[InstCombine] fold unsigned predicates on srem result (#122520)
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-parallel-loop-validity.f90
blob7f33f9e145110c491abd0a0bb4455cce2119d5c4
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.11 Parallel Loop
6 program openacc_parallel_loop_validity
8 implicit none
10 integer :: i, j, b
11 integer, parameter :: N = 256
12 integer, dimension(N) :: c
13 logical, dimension(N) :: d, e
14 real :: reduction_r
15 logical :: reduction_l
16 logical :: ifCondition = .TRUE.
17 real(8), dimension(N) :: a, f, g, h
18 real(8), dimension(N, N) :: aa, bb, cc
20 !$acc parallel loop
21 do i = 1, N
22 a(i) = 3.14
23 end do
25 !$acc parallel loop
26 do i = 1, N
27 a(i) = 3.14
28 end do
29 !$acc end parallel loop
31 !$acc parallel loop
32 do i = 1, N
33 a(i) = 3.14
34 end do
35 !$acc end parallel
37 !$acc parallel loop tile(2)
38 do i = 1, N
39 a(i) = 3.14
40 end do
42 !$acc parallel loop self
43 do i = 1, N
44 a(i) = 3.14
45 end do
47 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
48 !$acc parallel loop self(bb, cc(:,:))
49 do i = 1, N
50 a(i) = 3.14
51 end do
53 !$acc parallel loop self(.true.)
54 do i = 1, N
55 a(i) = 3.14
56 end do
58 !$acc parallel loop self(ifCondition)
59 do i = 1, N
60 a(i) = 3.14
61 end do
63 !$acc parallel loop tile(2, 2)
64 do i = 1, N
65 do j = 1, N
66 aa(i, j) = 3.14
67 end do
68 end do
70 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
71 !$acc parallel loop device_type(*) if(.TRUE.)
72 do i = 1, N
73 a(i) = 3.14
74 end do
75 !$acc end parallel loop
77 !$acc kernels loop
78 do i = 1, N
79 a(i) = 3.14
80 end do
81 !ERROR: Unmatched END PARALLEL LOOP directive
82 !$acc end parallel loop
84 !$acc parallel loop reduction(+: reduction_r)
85 do i = 1, N
86 reduction_r = a(i) + i
87 end do
89 !$acc parallel loop reduction(*: reduction_r)
90 do i = 1, N
91 reduction_r = reduction_r * (a(i) + i)
92 end do
94 !$acc parallel loop reduction(min: reduction_r)
95 do i = 1, N
96 reduction_r = min(reduction_r, a(i) * i)
97 end do
99 !$acc parallel loop reduction(max: reduction_r)
100 do i = 1, N
101 reduction_r = max(reduction_r, a(i) * i)
102 end do
104 !$acc parallel loop reduction(iand: b)
105 do i = 1, N
106 b = iand(b, c(i))
107 end do
109 !$acc parallel loop reduction(ior: b)
110 do i = 1, N
111 b = ior(b, c(i))
112 end do
114 !$acc parallel loop reduction(ieor: b)
115 do i = 1, N
116 b = ieor(b, c(i))
117 end do
119 !$acc parallel loop reduction(.and.: reduction_l)
120 do i = 1, N
121 reduction_l = d(i) .and. e(i)
122 end do
124 !$acc parallel loop reduction(.or.: reduction_l)
125 do i = 1, N
126 reduction_l = d(i) .or. e(i)
127 end do
129 !$acc parallel loop reduction(.eqv.: reduction_l)
130 do i = 1, N
131 reduction_l = d(i) .eqv. e(i)
132 end do
134 !$acc parallel loop reduction(.neqv.: reduction_l)
135 do i = 1, N
136 reduction_l = d(i) .neqv. e(i)
137 end do
139 !$acc parallel loop
140 do i = 1, N
141 if(i == 10) cycle
142 end do
144 end program openacc_parallel_loop_validity