how to detect that the vector extension is available

Vincent Torri vtorri@univ-evry.fr
Wed Sep 28 13:49:00 GMT 2011


Hi

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 :

1) from which version of gcc is the addition with a scalar possible (just 
for my curiosity)

2) is checking the size sufficient to be sure that the extension is 
available ?

3) is there better code for such check ?

thank you

Vincent Torri

[1] http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html




More information about the Gcc-help mailing list