xref: /llvm-project/flang/test/Semantics/loop-directives.f90 (revision e811cb00e533e9737db689e35ee6cb0d5af536cc)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
2! RUN: %python %S/test_errors.py %s %flang_fc1 -fopenacc -Werror
3
4subroutine empty
5  ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
6  !dir$ vector always
7  ! WARNING: A DO loop must follow the UNROLL directive
8  !dir$ unroll
9end subroutine empty
10
11subroutine non_do
12  ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
13  !dir$ vector always
14  ! WARNING: A DO loop must follow the UNROLL directive
15  !dir$ unroll
16  a = 1
17end subroutine non_do
18
19subroutine execution_part
20  do i=1,10
21  ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
22  !dir$ vector always
23  ! WARNING: A DO loop must follow the UNROLL directive
24  !dir$ unroll
25  end do
26end subroutine execution_part
27
28! OK
29subroutine test_vector_always_before_acc(a, b, c)
30  real, dimension(10) :: a,b,c
31  !dir$ vector always
32  !$acc loop
33  do i=1,N
34    a(i) = b(i) + c(i)
35  enddo
36end subroutine
37
38! OK
39subroutine test_unroll_before_acc(a, b, c)
40  real, dimension(10) :: a,b,c
41  !dir$ unroll
42  !$acc loop
43  do i=1,N
44    a(i) = b(i) + c(i)
45  enddo
46end subroutine
47