Support for gcc vector attributes, SIMD builtins

Mike Farnsworth mike.farnsworth at gmail.com
Tue Feb 1 10:18:14 PST 2011


Daniel Gibson Wrote:
> I'm not sure if that'll help at all, but you may try something like
> alias float[4] vec4; // or whatever type you're using
> /Maybe/ SSE optimizations work better on arrays than on structs.
> Of course, such a type isn't as handy because it'll be vec4[0] instead 
> of vec4.x, but it may be worth a try..
> If it helps (i.e. SSE is used better) you could go on trying to put that 
> vector in a struct, have x, y, z, w as properties[1] that get/set the 
> corresponding fields in the array and overload operators so they work 
> directly on the array.

I actually tried making the actual data a float[4] vs float x, y, z, w, and while it generates different code, neither one boiled down to the simpler SSE instructions I had hoped for (and generally get out of gcc with my c++ classes, especially if I use the SSE intrinsics in the *mmintrin.h headers).  I poked with various bits of syntax to see if I could convince it, with no luck.

-Mike



More information about the D.gnu mailing list