]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: Support complex/float in && and || reduction
authorTobias Burnus <tobias@codesourcery.com>
Tue, 4 May 2021 11:38:03 +0000 (13:38 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sun, 18 Jul 2021 11:01:24 +0000 (13:01 +0200)
commitd2904de2cfac76c9fdc47842abfccc95eaccafdb
tree39ddc00c46c2982cae443d7eb288d9470ca57df6
parent2f49122aec76fdd40a7157f66df9c058d635efe6
OpenMP: Support complex/float in && and || reduction

C/C++ permit logical AND and logical OR also with floating-point or complex
arguments by doing an unequal zero comparison; the result is an 'int' with
value one or zero.  Hence, those are also permitted as reduction variable,
even though it is not the most sensible thing to do.

gcc/c/ChangeLog:

* c-typeck.c (c_finish_omp_clauses): Accept float + complex
for || and && reductions.

gcc/cp/ChangeLog:

* semantics.c (finish_omp_reduction_clause): Accept float + complex
for || and && reductions.

gcc/ChangeLog:

* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses): Handle
&& and || with floating-point and complex arguments.

gcc/testsuite/ChangeLog:

* gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/reduction-1.c: New test.
* testsuite/libgomp.c-c++-common/reduction-2.c: New test.
* testsuite/libgomp.c-c++-common/reduction-3.c: New test.

(cherry picked from commit 1580fc764423bf89e9b853aaa8c65999e37ccb8b)
gcc/c/c-typeck.c
gcc/cp/semantics.c
gcc/omp-low.c
gcc/testsuite/gcc.dg/gomp/clause-1.c
libgomp/testsuite/libgomp.c-c++-common/reduction-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-3.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-4.c [new file with mode: 0644]