I'm planning on adding OpenMP SIMD pragmas to a project of mine, but I don't really need the full OpenMP; the -openmp-simd option is perfect for me.
The problem is that _OPENMP is (correctly) only defined for full OpenMP; when only -openmp-simd is used there doesn't seem to be any way to detect that the compiler supports it. It would be nice if there were a macro (_OPENMP_SIMD seems logical) to tell if omp simd pragmas are supported. I'd love to be able to do something like
#if (defined(_OPENMP) && (_OPENMP >= 201307L)) || (defined(_OPENMP_SIMD) && (_OPENMP_SIMD >= 201307L)) #pragma omp simd ... #endif
I'd probably wrap it up in a macro, but that's beside the point. As it stands the best I can do is pass something like -DOPENMP_SIMD from the build system, which isn't terrible, but it would be nice to have something a bit more standard so the code is easier to copy around across projects.
FWIW, gcc doesn't have anything for -fopenmp-simd either, but I figured I'd start with ICC since that's where the idea for -fopenmp-simd originated.
Yes, I'm doing that. in addition to checking _OPENMP_SIMD (and living in hope), I'm checking _OPENMP, and allowing people to define a project-specific macro (SIMDE_ENABLE_OPENMP) to force the issue. Now that GCC 7 is out I'll try find someone to poke about that patch…