GCC Vector Extensions

Christian Schoenebeck cuse@users.sourceforge.net
Fri Apr 7 19:03:00 GMT 2006


I just read the GCC Vector Extensions doc [1] and have a few questions.

a) The last code block in that doc [1] uses "builtin" functions? Why should
somebody use those builtin functions when the normal C operations on the new
vector extension types do the same?

b) We wondered [2] what the currently best way is to access single elements of
one vector. Currently the only solution we saw is to use a union trick like:

typedef struct {
        float _1;
        float _2;
        float _3;
        float _4;
} quad_samples;

typedef float v4sf __attribute__ ((vector_size (16)));

typedef union {
        quad_samples s;
        v4sf v;
} quad_sample_t;

Is there a better way to access single elements of a vector?

c) What I'm missing a lot (especially for digital signal processing) are (bit)
shifting operations on the new vector types. Are those planned or already in

[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Vector-Extensions.html#Vector-Extensions
[2] https://bugs.linuxsampler.org/cgi-bin/show_bug.cgi?id=25


More information about the Gcc-help mailing list