Does the OpenMP standard #pragma omp simd make it work, i.e. if compilation fails, if the compiler cannot vectorize the code?
#include <cstdint> void foo(uint32_t r[8], uint16_t* ptr) { const uint32_t C = 1000; #pragma omp simd for (int j = 0; j < 8; ++j) if (r[j] < C) r[j] = *(ptr++); }
gcc and clang cannot vectorize this, but don't complain at all (unless you use -fopt-info-vec-optimized-missed , etc.).
source share