Skip to content

Commit 0838e33

Browse files
[Flang][OpenMP] NFC: Move PFT tests to a separate subdirectory
1 parent a657deb commit 0838e33

File tree

3 files changed

+180
-0
lines changed

3 files changed

+180
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s
2+
! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s
3+
4+
! Loop constructs always have an `end do` which can be the target of
5+
! a branch. So OpenMP loop constructs do not need an artificial
6+
! continue inserted for a target.
7+
8+
!CHECK-LABEL: sb0
9+
!CHECK-NOT: continue
10+
subroutine sb0(cond)
11+
implicit none
12+
logical :: cond
13+
integer :: i
14+
!$omp parallel do
15+
do i = 1, 20
16+
if( cond) then
17+
cycle
18+
end if
19+
end do
20+
return
21+
end subroutine
22+
23+
!CHECK-LABEL: sb1
24+
!CHECK-NOT: continue
25+
subroutine sb1(cond)
26+
implicit none
27+
logical :: cond
28+
integer :: i
29+
!$omp parallel do
30+
do i = 1, 20
31+
if( cond) then
32+
cycle
33+
end if
34+
end do
35+
!$omp end parallel do
36+
return
37+
end subroutine
38+
39+
!CHECK-LABEL: sb2
40+
!CHECK-NOT: continue
41+
subroutine sb2
42+
integer :: i, n
43+
integer :: tmp
44+
45+
!$omp parallel do
46+
do ifld=1,n
47+
do isum=1,n
48+
if (tmp > n) then
49+
exit
50+
endif
51+
enddo
52+
tmp = n
53+
enddo
54+
end subroutine
55+
56+
!CHECK-LABEL: sb3
57+
!CHECK-NOT: continue
58+
subroutine sb3
59+
integer :: i, n
60+
integer :: tmp
61+
62+
!$omp parallel do
63+
do ifld=1,n
64+
do isum=1,n
65+
if (tmp > n) then
66+
exit
67+
endif
68+
enddo
69+
enddo
70+
end subroutine
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
! RUN: bbc -fopenmp -pft-test -o %t %s | FileCheck %s
2+
! RUN: %flang_fc1 -fopenmp -fdebug-dump-pft -o %t %s | FileCheck %s
3+
4+
! Test structure of the Pre-FIR tree with OpenMP
5+
6+
subroutine sub1(a, b, n)
7+
real :: a(:), b(:)
8+
integer :: n, i
9+
!$omp parallel do
10+
do i = 1, n
11+
b(i) = exp(a(i))
12+
end do
13+
!$omp end parallel do
14+
end subroutine
15+
16+
! CHECK-LABEL: Subroutine sub1
17+
! CHECK: <<OpenMPConstruct>>
18+
! CHECK: <<DoConstruct>>
19+
! CHECK: <<End OpenMPConstruct>>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
2+
3+
subroutine openmp_sections(x, y)
4+
5+
integer, intent(inout)::x, y
6+
7+
!==============================================================================
8+
! empty construct
9+
!==============================================================================
10+
!$omp sections
11+
!$omp end sections
12+
13+
!CHECK: OpenMPConstruct
14+
!CHECK: End OpenMPConstruct
15+
16+
!==============================================================================
17+
! single section, without `!$omp section`
18+
!==============================================================================
19+
!$omp sections
20+
call F1()
21+
!$omp end sections
22+
23+
!CHECK: OpenMPConstruct
24+
!CHECK: OpenMPConstruct
25+
!CHECK: CallStmt
26+
!CHECK: End OpenMPConstruct
27+
!CHECK: End OpenMPConstruct
28+
29+
!==============================================================================
30+
! single section with `!$omp section`
31+
!==============================================================================
32+
!$omp sections
33+
!$omp section
34+
call F1
35+
!$omp end sections
36+
37+
!CHECK: OpenMPConstruct
38+
!CHECK: OpenMPConstruct
39+
!CHECK: CallStmt
40+
!CHECK: End OpenMPConstruct
41+
!CHECK: End OpenMPConstruct
42+
43+
!==============================================================================
44+
! multiple sections
45+
!==============================================================================
46+
!$omp sections
47+
!$omp section
48+
call F1
49+
!$omp section
50+
call F2
51+
!$omp section
52+
call F3
53+
!$omp end sections
54+
55+
!CHECK: OpenMPConstruct
56+
!CHECK: OpenMPConstruct
57+
!CHECK: CallStmt
58+
!CHECK: End OpenMPConstruct
59+
!CHECK: OpenMPConstruct
60+
!CHECK: CallStmt
61+
!CHECK: End OpenMPConstruct
62+
!CHECK: OpenMPConstruct
63+
!CHECK: CallStmt
64+
!CHECK: End OpenMPConstruct
65+
!CHECK: End OpenMPConstruct
66+
67+
!==============================================================================
68+
! multiple sections with clauses
69+
!==============================================================================
70+
!$omp sections PRIVATE(x) FIRSTPRIVATE(y)
71+
!$omp section
72+
call F1
73+
!$omp section
74+
call F2
75+
!$omp section
76+
call F3
77+
!$omp end sections NOWAIT
78+
79+
!CHECK: OpenMPConstruct
80+
!CHECK: OpenMPConstruct
81+
!CHECK: CallStmt
82+
!CHECK: End OpenMPConstruct
83+
!CHECK: OpenMPConstruct
84+
!CHECK: CallStmt
85+
!CHECK: End OpenMPConstruct
86+
!CHECK: OpenMPConstruct
87+
!CHECK: CallStmt
88+
!CHECK: End OpenMPConstruct
89+
!CHECK: End OpenMPConstruct
90+
91+
end subroutine openmp_sections

0 commit comments

Comments
 (0)