diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-05-07 12:11:51 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-05-07 12:11:51 +0200 |
commit | 33b647956caa977d1ae489f9baed9cef70b4f382 (patch) | |
tree | 465ce5bcdc9f33dff40257c7cad8db3dc0b62bc6 /gcc/omp-low.c | |
parent | a4613d9ada54c334650d93edbb4c08069550099e (diff) | |
download | gcc-33b647956caa977d1ae489f9baed9cef70b4f382.zip gcc-33b647956caa977d1ae489f9baed9cef70b4f382.tar.gz gcc-33b647956caa977d1ae489f9baed9cef70b4f382.tar.bz2 |
OpenMP: Fix SIMT for complex/float reduction with && and ||
2021-05-07 Tobias Burnus <tobias@codesourcery.com>
Tom de Vries <tdevries@suse.de>
gcc/ChangeLog:
* omp-low.c (lower_rec_simd_input_clauses): Set max_vf = 1 if
a truth_value_p reduction variable is nonintegral.
libgomp/ChangeLog:
* testsuite/libgomp.c-c++-common/reduction-5.c: New test, testing
complex/floating-point || + && reduction with 'omp target'.
* testsuite/libgomp.c-c++-common/reduction-6.c: Likewise.
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 26ceaf7..2325cfc 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4389,14 +4389,28 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, { for (tree c = gimple_omp_for_clauses (ctx->stmt); c; c = OMP_CLAUSE_CHAIN (c)) - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION - && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) - { - /* UDR reductions are not supported yet for SIMT, disable - SIMT. */ - sctx->max_vf = 1; - break; + { + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION) + continue; + + if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) + { + /* UDR reductions are not supported yet for SIMT, disable + SIMT. */ + sctx->max_vf = 1; + break; + } + + if (truth_value_p (OMP_CLAUSE_REDUCTION_CODE (c)) + && !INTEGRAL_TYPE_P (TREE_TYPE (new_var))) + { + /* Doing boolean operations on non-integral types is + for conformance only, it's not worth supporting this + for SIMT. */ + sctx->max_vf = 1; + break; } + } } if (maybe_gt (sctx->max_vf, 1U)) { |