public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1226] OpenMP: Handle bind clause in tree-nested.c [PR100905]
Date: Fri,  4 Jun 2021 18:55:23 +0000 (GMT)	[thread overview]
Message-ID: <20210604185523.20EAC39A181A@sourceware.org> (raw)

https://gcc.gnu.org/g:c7070b31e12c18905ed0a60aaedd7a071aab5c60

commit r12-1226-gc7070b31e12c18905ed0a60aaedd7a071aab5c60
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Fri Jun 4 20:52:33 2021 +0200

    OpenMP: Handle bind clause in tree-nested.c [PR100905]
    
            PR middle-end/100905
    
    gcc/ChangeLog:
    
            * tree-nested.c (convert_nonlocal_omp_clauses,
            convert_local_omp_clauses): Handle OMP_CLAUSE_BIND.
    
    gcc/testsuite/ChangeLog:
    
            * gfortran.dg/gomp/loop-3.f90: New test.

Diff:
---
 gcc/testsuite/gfortran.dg/gomp/loop-3.f90 | 55 +++++++++++++++++++++++++++++++
 gcc/tree-nested.c                         |  2 ++
 2 files changed, 57 insertions(+)

diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-3.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-3.f90
new file mode 100644
index 00000000000..6d25b19735d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/loop-3.f90
@@ -0,0 +1,55 @@
+! PR middle-end/100905
+!
+PROGRAM test_loop_order_concurrent
+  implicit none
+  integer :: a, cc(64), dd(64)
+
+  dd = 54
+  cc = 99
+
+  call test_loop()
+  call test_affinity(a)
+  if (a /= 5) stop 3
+  call test_scan(cc, dd)
+  if (any (cc /= 99)) stop 4
+  if (dd(1) /= 5  .or. dd(2) /= 104) stop 5
+
+CONTAINS
+
+  SUBROUTINE test_loop()
+    INTEGER,DIMENSION(1024):: a, b, c
+    INTEGER:: i
+
+    DO i = 1, 1024
+       a(i) = 1
+       b(i) = i + 1
+       c(i) = 2*(i + 1)
+    END DO
+
+   !$omp loop order(concurrent) bind(thread)
+    DO i = 1, 1024
+       a(i) = a(i) + b(i)*c(i)
+    END DO
+
+    DO i = 1, 1024
+       if (a(i) /= 1 + (b(i)*c(i))) stop 1
+    END DO
+  END SUBROUTINE test_loop
+
+  SUBROUTINE test_affinity(aa)
+    integer :: aa
+    !$omp task affinity(aa)
+      a = 5
+    !$omp end task
+  end 
+
+  subroutine test_scan(c, d)
+    integer i, c(*), d(*)
+    !$omp simd reduction (inscan, +: a)
+    do i = 1, 64
+      d(i) = a
+      !$omp scan exclusive (a)
+      a = a + c(i)
+    end do
+  end
+END PROGRAM test_loop_order_concurrent
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index cea917a4d58..41cbca9e3b8 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1484,6 +1484,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE_AUTO:
 	case OMP_CLAUSE_IF_PRESENT:
 	case OMP_CLAUSE_FINALIZE:
+	case OMP_CLAUSE_BIND:
 	case OMP_CLAUSE__CONDTEMP_:
 	case OMP_CLAUSE__SCANTEMP_:
 	  break;
@@ -2264,6 +2265,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE_AUTO:
 	case OMP_CLAUSE_IF_PRESENT:
 	case OMP_CLAUSE_FINALIZE:
+	case OMP_CLAUSE_BIND:
 	case OMP_CLAUSE__CONDTEMP_:
 	case OMP_CLAUSE__SCANTEMP_:
 	  break;


                 reply	other threads:[~2021-06-04 18:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210604185523.20EAC39A181A@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).