On Wed, 28 Sep 2011, Ian Lance Taylor wrote:
Vincent Torri <vtorri@xxxxxxxxxxxx> writes:
I want to write an autoconf test to see if the vector extension is
available or not.
if I have
typedef int v4si __attribute__ ((vector_size (16)));
I can check the size of v4si.
I'm wondering if it's sufficient. Indeed, with my gcc 4.4.5, the size
of v4si is 16 bytes, but the code in the doc [1]:
v4si a, b;
a=b+1;
fails with error "can't convert between vector values of different
size". With gcc 4.7, it works.
So :
3) is there better code for such check ?
I guess it depends on exactly what you want to check. With current gcc
vector_size will work even if the target does not actually support
vectors in hardware. So if you want to check whether you can use
vectors in your code this test will suffice. If you want to check
whether you will actually get any hardware speedup, you will need a
different check.
That would indeed interest us to know if the vectors are hardware
accelerated. Do you have an idea of such check ?
thanks
Vincent Torri