[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #11 from CVS Commits --- The master branch has been updated by Tom de Vries : https://gcc.gnu.org/g:093cdadbce30ce2d36846a05d979b8afc2eff618 commit r12-7702-g093cdadbce30ce2d36846a05d979b8afc2eff618 Author: Tom de Vries Date:

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-18 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 Tom de Vries changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|---

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #10 from Jakub Jelinek --- Comment on attachment 52647 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52647 Tentative patch with test-cases, rationale and changelog Please change arr[5] = 1; to arr[5] = 42; or so also to test

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #9 from Tom de Vries --- Created attachment 52647 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52647=edit Tentative patch with test-cases, rationale and changelog I'll put this through testing, and submit if no problems

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #8 from Tom de Vries --- (In reply to Jakub Jelinek from comment #6) > And yes, #c1 is valid. Thanks for confirming. > But would be nice to have similar test with && and > initial result = 2; and arr[] say { 1, 2, 3, 4, 5, 6, 7,

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #7 from Tom de Vries --- Alternative fix that doesn't require fiddling with the 'code' var: ... diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index d932d74cb03..d0ddd4a6142 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -6734,7

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #6 from Jakub Jelinek --- And yes, #c1 is valid. But would be nice to have similar test with && and initial result = 2; and arr[] say { 1, 2, 3, 4, 5, 6, 7, ..., 32 } and test result is 1 at the end to make sure we don't actually

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #5 from Jakub Jelinek --- Note, I guess this is related to PR94366 and r12-438-g1580fc764423bf89e9b which was fixing it for non-SIMT and quite possibly left out the SIMT stuff out. Using the TRUTH_{AND,OR}_EXPR instead of

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #4 from Tom de Vries --- This fixes it: ... diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index d932d74cb03..f2ac8f98e32 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -6734,7 +6734,21 @@ lower_rec_input_clauses (tree clauses,

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #3 from Tom de Vries --- Hmm, that seems to be actually due to: ... if (sctx.is_simt) { if (!simt_lane) simt_lane = create_tmp_var

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 --- Comment #2 from Tom de Vries --- I think the problem can be seen already at omp-lower, in the body of the butterfly loop. Let's first look at what we have if we use reduction op '|': ... D.2173 = .GOMP_SIMT_VF ();

[Bug target/104952] [nvptx][OpenMP] wrong code with OR / AND reduction ('reduction(||:' and '&&') with SIMT

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104952 Tom de Vries changed: What|Removed |Added Keywords||openmp --- Comment #1 from Tom de Vries