Post a Comment
The page points to
http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Vector-Extensions.html
Which isn't very helpful. (e.g. how to populate an v4si or how to extract the components of it for e.g. I/O)
Anyone knows of some more definitve guides to these extensions in gcc ?
Here's an example:
http://ds9a.nl/gcc-simd/example.html
It uses unions, very ugly. There must be a better way, surely?
What's wrong with unions ?
Nothing, it's the way they're used in that example that is wrong.
Basically, there's no guarantee that fields of the float[4] array in there actually correspond to the elements of the v4sf vector, because it's up to the compiler how it lays out things in memory.
So unless there's a proper specification for those vector types somewhere, this is dodgy code.
The universal binary pdf that was available the day the switch was mentioned had an entire appendix that mapped altivec instructions to their sse equivalents. In some cases (where sse lacked a direct correlation) they even provided full sample code to get the same results with sse.
I fail to see how this is "OS" news. It should be under the title "unobservant rehashed dribble."
>Here's an example:
>http://ds9a.nl/gcc-simd/example.html
Thank you.
It does depend a bit on size though, what if I need to load 128 bits floats for simd use, does a long double fit the layout.
I'd like to see this documented :-)



