1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
6 program openacc_parallel_loop_validity
11 integer, parameter :: N
= 256
12 integer, dimension(N
) :: c
13 logical, dimension(N
) :: d
, e
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
29 !$acc end parallel loop
37 !$acc parallel loop tile(2)
42 !$acc parallel loop self
47 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
48 !$acc parallel loop self(bb, cc(:,:))
53 !$acc parallel loop self(.true.)
58 !$acc parallel loop self(ifCondition)
63 !$acc parallel loop tile(2, 2)
70 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
71 !$acc parallel loop device_type(*) if(.TRUE.)
75 !$acc end parallel loop
81 !ERROR: Unmatched END PARALLEL LOOP directive
82 !$acc end parallel loop
84 !$acc parallel loop reduction(+: reduction_r)
86 reduction_r
= a(i
) + i
89 !$acc parallel loop reduction(*: reduction_r)
91 reduction_r
= reduction_r
* (a(i
) + i
)
94 !$acc parallel loop reduction(min: reduction_r)
96 reduction_r
= min(reduction_r
, a(i
) * i
)
99 !$acc parallel loop reduction(max: reduction_r)
101 reduction_r
= max(reduction_r
, a(i
) * i
)
104 !$acc parallel loop reduction(iand: b)
109 !$acc parallel loop reduction(ior: b)
114 !$acc parallel loop reduction(ieor: b)
119 !$acc parallel loop reduction(.and.: reduction_l)
121 reduction_l
= d(i
) .and
. e(i
)
124 !$acc parallel loop reduction(.or.: reduction_l)
126 reduction_l
= d(i
) .or
. e(i
)
129 !$acc parallel loop reduction(.eqv.: reduction_l)
131 reduction_l
= d(i
) .eqv
. e(i
)
134 !$acc parallel loop reduction(.neqv.: reduction_l)
136 reduction_l
= d(i
) .neqv
. e(i
)
144 end program openacc_parallel_loop_validity