[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-parallel-loop-validity.f90
blob3dee14733b66ee2371a6844ae28b5128ad964f3b
1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
2 ! REQUIRES: shell
4 ! Check OpenACC clause validity for the following construct and directive:
5 ! 2.11 Parallel Loop
7 program openacc_parallel_loop_validity
9 implicit none
11 integer :: i, j, b
12 integer, parameter :: N = 256
13 integer, dimension(N) :: c
14 logical, dimension(N) :: d, e
15 real :: reduction_r
16 logical :: reduction_l
17 logical :: ifCondition = .TRUE.
18 real(8), dimension(N) :: a, f, g, h
19 real(8), dimension(N, N) :: aa, bb, cc
21 !$acc parallel loop tile(2)
22 do i = 1, N
23 a(i) = 3.14
24 end do
26 !$acc parallel loop self
27 do i = 1, N
28 a(i) = 3.14
29 end do
31 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
32 !$acc parallel loop self(bb, cc(:))
33 do i = 1, N
34 a(i) = 3.14
35 end do
37 !$acc parallel loop self(.true.)
38 do i = 1, N
39 a(i) = 3.14
40 end do
42 !$acc parallel loop self(ifCondition)
43 do i = 1, N
44 a(i) = 3.14
45 end do
47 !$acc parallel loop tile(2, 2)
48 do i = 1, N
49 do j = 1, N
50 aa(i, j) = 3.14
51 end do
52 end do
54 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
55 !$acc parallel loop device_type(*) if(.TRUE.)
56 do i = 1, N
57 a(i) = 3.14
58 end do
59 !$acc end parallel loop
61 !$acc kernels loop
62 do i = 1, N
63 a(i) = 3.14
64 end do
65 !ERROR: Unmatched END PARALLEL LOOP directive
66 !$acc end parallel loop
68 !$acc parallel loop reduction(+: reduction_r)
69 do i = 1, N
70 reduction_r = a(i) + i
71 end do
73 !$acc parallel loop reduction(*: reduction_r)
74 do i = 1, N
75 reduction_r = reduction_r * (a(i) + i)
76 end do
78 !$acc parallel loop reduction(min: reduction_r)
79 do i = 1, N
80 reduction_r = min(reduction_r, a(i) * i)
81 end do
83 !$acc parallel loop reduction(max: reduction_r)
84 do i = 1, N
85 reduction_r = max(reduction_r, a(i) * i)
86 end do
88 !$acc parallel loop reduction(iand: b)
89 do i = 1, N
90 b = iand(b, c(i))
91 end do
93 !$acc parallel loop reduction(ior: b)
94 do i = 1, N
95 b = ior(b, c(i))
96 end do
98 !$acc parallel loop reduction(ieor: b)
99 do i = 1, N
100 b = ieor(b, c(i))
101 end do
103 !$acc parallel loop reduction(.and.: reduction_l)
104 do i = 1, N
105 reduction_l = d(i) .and. e(i)
106 end do
108 !$acc parallel loop reduction(.or.: reduction_l)
109 do i = 1, N
110 reduction_l = d(i) .or. e(i)
111 end do
113 !$acc parallel loop reduction(.eqv.: reduction_l)
114 do i = 1, N
115 reduction_l = d(i) .eqv. e(i)
116 end do
118 !$acc parallel loop reduction(.neqv.: reduction_l)
119 do i = 1, N
120 reduction_l = d(i) .neqv. e(i)
121 end do
123 end program openacc_parallel_loop_validity