[RFC,6/X] omp: Allow creation of simd clones from omp declare variant with -fopenmp-simd flag
Commit Message
Hi,
This RFC is to propose relaxing the flag needed to allow the creation of
simd clones from omp declare variants, such that we can use
-fopenmp-simd rather than -fopenmp.
This should only change the behaviour of omp simd clones and should not
enable any other openmp functionality, though I need to test this
furter, for the time being I just played around a bit with some of the
existing declare-variant tests.
Any objections to this in general? And/or ideas to properly test the
effect of this on other omp codegen? My current plan is to have a look
at the declare-variant tests we had before this patch series, locally
modify them to pass -fopenmp-simd and make sure they fail the same way
before and after this patch.
@@ -23564,6 +23564,13 @@ c_parser_omp_declare (c_parser *parser, enum pragma_context context)
c_parser_omp_declare_reduction (parser, context);
return false;
}
+ if (strcmp (p, "variant") == 0)
+ {
+ /* c_parser_consume_token (parser); done in
+ c_parser_omp_declare_simd. */
+ c_parser_omp_declare_simd (parser, context);
+ return true;
+ }
if (!flag_openmp) /* flag_openmp_simd */
{
c_parser_skip_to_pragma_eol (parser, false);
@@ -23575,13 +23582,6 @@ c_parser_omp_declare (c_parser *parser, enum pragma_context context)
c_parser_omp_declare_target (parser);
return false;
}
- if (strcmp (p, "variant") == 0)
- {
- /* c_parser_consume_token (parser); done in
- c_parser_omp_declare_simd. */
- c_parser_omp_declare_simd (parser, context);
- return true;
- }
}
c_parser_error (parser, "expected %<simd%>, %<reduction%>, "
@@ -8428,7 +8428,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
suppress_warning (decl, OPT_Winit_self);
}
- if (flag_openmp
+ if (flag_openmp_simd
&& TREE_CODE (decl) == FUNCTION_DECL
/* #pragma omp declare variant on methods handled in finish_struct
instead. */
@@ -47884,7 +47884,7 @@ cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
context, false);
return true;
}
- if (flag_openmp && strcmp (p, "variant") == 0)
+ if (strcmp (p, "variant") == 0)
{
cp_lexer_consume_token (parser->lexer);
cp_parser_omp_declare_simd (parser, pragma_tok,
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fopenmp" } */
+/* { dg-options "-O3 -fopenmp-simd" } */
#include "declare-variant-1.x"
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fopenmp" } */
+/* { dg-options "-O3 -fopenmp-simd" } */
#include "../declare-variant-1.x"
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fopenmp -msve-vector-bits=128" } */
+/* { dg-options "-O3 -fopenmp-simd -msve-vector-bits=128" } */
#include "../declare-variant-1.x"
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fopenmp -msve-vector-bits=256" } */
+/* { dg-options "-O3 -fopenmp-simd -msve-vector-bits=256" } */
#include "../declare-variant-1.x"