[Bug c/80502] Provide macro to indicate OpenMP SIMD support

evan@coeus-group.com gcc-bugzilla@gcc.gnu.org
Tue Feb 20 22:36:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80502

--- Comment #3 from Evan Nemerson <evan@coeus-group.com> ---
(In reply to Jakub Jelinek from comment #2)
> _OPENMP_SIMD is a bad idea, that namespace is reserved for OpenMP, so unless
> it shows up in the OpenMP standard, it shouldn't be added.

Fair enough, I'll propose it to the OpenMP people:
http://forum.openmp.org/forum/viewtopic.php?f=23&t=2031

> Why do you need a macro?  Just use #pragma omp simd etc. unconditionally,
> compilers that don't have support for such pragmas will just ignore those.

Not necessarily; often they'll emit warnings (for GCC, -Wall even includes
-Wunknown-pragmas). I'd much rather use the preprocessor in my code than teach
people to disable warnings.

I need to support alternatives in my code. For example, for SIMDe
(<https://github.com/nemequ/simde>), I try to support OpenMP SIMD and Cilk
Plus, as well as compiler-specific pragmas for GCC (GCC ivdep), ICC (simd), and
clang (clang loop ...), and I'd be happy to add more as necessary. I'd rather
not end up with something like

  #pragma omp simd
  #pragma simd
  #pragma GCC ivdep
  #pragma clang loop vectorize(enable)
  for (...) { ... }

I'd much rather just have a few macros which will expand to the right pragma
based on preprocessor macros. Right now I'm stuck using the much less
expressive ivdep syntax for GCC unless *full* OpenMP support is enabled (or
someone defines a macro manually to indicate OpenMP SIMD support).


More information about the Gcc-bugs mailing list