[flang-commits] [flang] 0838e33 - [Flang][OpenMP] NFC: Move PFT tests to a separate subdirectory
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Fri Sep 22 04:08:52 PDT 2023
Author: Kiran Chandramohan
Date: 2023-09-22T11:08:26Z
New Revision: 0838e33483971e58424802d793e787ed8a3df36b
URL: https://github.com/llvm/llvm-project/commit/0838e33483971e58424802d793e787ed8a3df36b
DIFF: https://github.com/llvm/llvm-project/commit/0838e33483971e58424802d793e787ed8a3df36b.diff
LOG: [Flang][OpenMP] NFC: Move PFT tests to a separate subdirectory
Added:
flang/test/Lower/OpenMP/PFT/pre-fir-tree-loop.f90
flang/test/Lower/OpenMP/PFT/pre-fir-tree01.f90
flang/test/Lower/OpenMP/PFT/sections-pft.f90
Modified:
Removed:
################################################################################
diff --git a/flang/test/Lower/OpenMP/PFT/pre-fir-tree-loop.f90 b/flang/test/Lower/OpenMP/PFT/pre-fir-tree-loop.f90
new file mode 100644
index 000000000000000..eca8fb30498635e
--- /dev/null
+++ b/flang/test/Lower/OpenMP/PFT/pre-fir-tree-loop.f90
@@ -0,0 +1,70 @@
+! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s
+
+! Loop constructs always have an `end do` which can be the target of
+! a branch. So OpenMP loop constructs do not need an artificial
+! continue inserted for a target.
+
+!CHECK-LABEL: sb0
+!CHECK-NOT: continue
+subroutine sb0(cond)
+ implicit none
+ logical :: cond
+ integer :: i
+ !$omp parallel do
+ do i = 1, 20
+ if( cond) then
+ cycle
+ end if
+ end do
+ return
+end subroutine
+
+!CHECK-LABEL: sb1
+!CHECK-NOT: continue
+subroutine sb1(cond)
+ implicit none
+ logical :: cond
+ integer :: i
+ !$omp parallel do
+ do i = 1, 20
+ if( cond) then
+ cycle
+ end if
+ end do
+ !$omp end parallel do
+ return
+end subroutine
+
+!CHECK-LABEL: sb2
+!CHECK-NOT: continue
+subroutine sb2
+ integer :: i, n
+ integer :: tmp
+
+ !$omp parallel do
+ do ifld=1,n
+ do isum=1,n
+ if (tmp > n) then
+ exit
+ endif
+ enddo
+ tmp = n
+ enddo
+end subroutine
+
+!CHECK-LABEL: sb3
+!CHECK-NOT: continue
+subroutine sb3
+ integer :: i, n
+ integer :: tmp
+
+ !$omp parallel do
+ do ifld=1,n
+ do isum=1,n
+ if (tmp > n) then
+ exit
+ endif
+ enddo
+ enddo
+end subroutine
diff --git a/flang/test/Lower/OpenMP/PFT/pre-fir-tree01.f90 b/flang/test/Lower/OpenMP/PFT/pre-fir-tree01.f90
new file mode 100644
index 000000000000000..fc817942513e2b3
--- /dev/null
+++ b/flang/test/Lower/OpenMP/PFT/pre-fir-tree01.f90
@@ -0,0 +1,19 @@
+! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s
+
+! Test structure of the Pre-FIR tree with OpenMP
+
+subroutine sub1(a, b, n)
+ real :: a(:), b(:)
+ integer :: n, i
+ !$omp parallel do
+ do i = 1, n
+ b(i) = exp(a(i))
+ end do
+ !$omp end parallel do
+end subroutine
+
+! CHECK-LABEL: Subroutine sub1
+! CHECK: <<OpenMPConstruct>>
+! CHECK: <<DoConstruct>>
+! CHECK: <<End OpenMPConstruct>>
diff --git a/flang/test/Lower/OpenMP/PFT/sections-pft.f90 b/flang/test/Lower/OpenMP/PFT/sections-pft.f90
new file mode 100644
index 000000000000000..7b20a87022c909d
--- /dev/null
+++ b/flang/test/Lower/OpenMP/PFT/sections-pft.f90
@@ -0,0 +1,91 @@
+! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
+
+subroutine openmp_sections(x, y)
+
+ integer, intent(inout)::x, y
+
+!==============================================================================
+! empty construct
+!==============================================================================
+!$omp sections
+!$omp end sections
+
+!CHECK: OpenMPConstruct
+!CHECK: End OpenMPConstruct
+
+!==============================================================================
+! single section, without `!$omp section`
+!==============================================================================
+!$omp sections
+ call F1()
+!$omp end sections
+
+!CHECK: OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: End OpenMPConstruct
+
+!==============================================================================
+! single section with `!$omp section`
+!==============================================================================
+!$omp sections
+ !$omp section
+ call F1
+!$omp end sections
+
+!CHECK: OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: End OpenMPConstruct
+
+!==============================================================================
+! multiple sections
+!==============================================================================
+!$omp sections
+ !$omp section
+ call F1
+ !$omp section
+ call F2
+ !$omp section
+ call F3
+!$omp end sections
+
+!CHECK: OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: End OpenMPConstruct
+
+!==============================================================================
+! multiple sections with clauses
+!==============================================================================
+!$omp sections PRIVATE(x) FIRSTPRIVATE(y)
+ !$omp section
+ call F1
+ !$omp section
+ call F2
+ !$omp section
+ call F3
+!$omp end sections NOWAIT
+
+!CHECK: OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: OpenMPConstruct
+!CHECK: CallStmt
+!CHECK: End OpenMPConstruct
+!CHECK: End OpenMPConstruct
+
+end subroutine openmp_sections
More information about the flang-commits
mailing list