3 ms·
I agree that it's unacceptable that SIMD Vector extensions [0] are not standardized yet. However, they already work acceptably in GCC and Clang. There are only
by exDM69 8y ago
I agree that it's unacceptable that SIMD Vector extensions [0] are not standardized yet.
However, they already work acceptably in GCC and Clang. There are only minor differences (e.g. __builtin_shufflevector) but it's usable with very minimal #ifdeffing.
Example:
typedef float vec4f __attribute__((vector_size(16)));
// initializer
vec4f a = { 1.0, 2.0, 3.0, 4.0 };
// literal expression
vec4f b = a + (vec4f){ 5.0, 6.0, 7.0, 8.0 };
// standard infix operators
vec4f c = -b * (a+b); // with --ffast-math, this will be a mad()
It's not perfect but it's quite usable and I've been using vector extensions in C for years.
[0] https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html