3 ms·
> Autovectorised SIMD code would probably need something like an "AUTOVEC" annotation If you only need SIMD for stream processing, autovectorisation is OK. On
by Const-me 9y ago
> Autovectorised SIMD code would probably need something like an "AUTOVEC" annotation
If you only need SIMD for stream processing, autovectorisation is OK.
Only there’re multiple autovectorizers in C. The default one is indeed very fragile. But the one in OpenMP 4 is better: http://www.hpctoday.com/hpc-labs/explicit-vector-programming-with-openmp-4-0-simd-extensions/ http://www.hpctoday.com/hpc-labs/explicit-vector-programming...
But even that OMP 4 is very limited.
One reason is many SSE operations don’t map to C: approximate math (rcpps, rsqrtps), composite operations (FMA, AES), and saturated math (there’re dozens instruction for manipulating 8 and 16 bit numbers with saturation, i.e. on over/underflow the numbers don’t wrap around by stripping highest byte[s] but stay at the min/max 8/16 bit value).
Another reason is some SSE instructions operate horizontally (phminposuw, pmaddubsw, psadbw, dpps), or are advanced swizzle instructions (shufps, pshufb, pshuflw, pshufhw, pslldq), both are very hard to autogenerate from these #pragma omp simd loops.