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

            Bug ID: 80502
           Summary: Provide macro to indicate OpenMP SIMD support
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: e...@coeus-group.com
  Target Milestone: ---

Created attachment 41250
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41250&action=edit
define _OPENMP_SIMD when -fopenmp-simd or -fopenmp is passed

_OPENMP is (correctly) only defined for full OpenMP; when only -fopenmp-simd is
used there doesn't seem to be any way to detect in the preprocessor that the
compiler supports OpenMP SIMD pragmas.

It would be nice if there were a macro to determine whether they are supported
so we could do something like

  #if (defined(_OPENMP) && (_OPENMP >= 201307L)) || \
    (defined(_OPENMP_SIMD) && (_OPENMP_SIMD >= 201307L))
  #pragma omp simd
  #endif

AFAIK ICC is the only compiler with a feature like -fopenmp-simd (they call it
-openmp-simd), and they don't define anything either.  I've reported the issue
to them, but in the meantime it seems GCC can choose whatever it wants without
creating any compatibility issues.  Defining _OPENMP_SIMD to the version of
OpenMP supported (just like _OPENMP does) seems logicial to me.  I've attached
a fairly trivial patch.

Reply via email to