1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
4 ! Check OpenACC clause validity for the following construct and directive:
7 program openacc_parallel_loop_validity
12 integer, parameter :: N
= 256
13 integer, dimension(N
) :: c
14 logical, dimension(N
) :: d
, e
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)
26 !$acc parallel loop self
31 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
32 !$acc parallel loop self(bb, cc(:))
37 !$acc parallel loop self(.true.)
42 !$acc parallel loop self(ifCondition)
47 !$acc parallel loop tile(2, 2)
54 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
55 !$acc parallel loop device_type(*) if(.TRUE.)
59 !$acc end parallel loop
65 !ERROR: Unmatched END PARALLEL LOOP directive
66 !$acc end parallel loop
68 !$acc parallel loop reduction(+: reduction_r)
70 reduction_r
= a(i
) + i
73 !$acc parallel loop reduction(*: reduction_r)
75 reduction_r
= reduction_r
* (a(i
) + i
)
78 !$acc parallel loop reduction(min: reduction_r)
80 reduction_r
= min(reduction_r
, a(i
) * i
)
83 !$acc parallel loop reduction(max: reduction_r)
85 reduction_r
= max(reduction_r
, a(i
) * i
)
88 !$acc parallel loop reduction(iand: b)
93 !$acc parallel loop reduction(ior: b)
98 !$acc parallel loop reduction(ieor: b)
103 !$acc parallel loop reduction(.and.: reduction_l)
105 reduction_l
= d(i
) .and
. e(i
)
108 !$acc parallel loop reduction(.or.: reduction_l)
110 reduction_l
= d(i
) .or
. e(i
)
113 !$acc parallel loop reduction(.eqv.: reduction_l)
115 reduction_l
= d(i
) .eqv
. e(i
)
118 !$acc parallel loop reduction(.neqv.: reduction_l)
120 reduction_l
= d(i
) .neqv
. e(i
)
123 end program openacc_parallel_loop_validity