Re: how to detect that the vector extension is available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :
>
> 1) from which version of gcc is the addition with a scalar possible
> (just for my curiosity)

It's new in the upcoming gcc 4.7.


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

The vector extension, yes.


> 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.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux