xref: /llvm-project/flang/test/Semantics/OpenACC/acc-routine.f90 (revision 238b5790ba2027a88706a320fe61bd21601b788b)
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc
2
3subroutine sub1(a)
4 real, dimension(10) :: a
5end subroutine
6
7subroutine sub2(a)
8  !$acc routine(sub1) gang(dim:1)
9  real, dimension(10) :: a
10  call sub1(a)
11end subroutine
12
13subroutine sub3()
14  !$acc routine bind(sub1)
15end subroutine
16
17subroutine sub4()
18  !ERROR: Only the dim argument is allowed on the GANG clause on the ROUTINE directive
19  !$acc routine gang(num: 1)
20end subroutine
21
22subroutine sub5()
23  !ERROR: Only the dim argument is allowed on the GANG clause on the ROUTINE directive
24  !$acc routine gang(static: 1)
25end subroutine
26
27subroutine sub6()
28  !ERROR: Clause GANG is not allowed if clause GANG appears on the ROUTINE directive
29  !$acc routine gang gang
30
31  !ERROR: Clause GANG is not allowed if clause WORKER appears on the ROUTINE directive
32  !$acc routine worker gang
33
34  !ERROR: Clause GANG is not allowed if clause VECTOR appears on the ROUTINE directive
35  !$acc routine vector gang
36
37  !ERROR: Clause GANG is not allowed if clause SEQ appears on the ROUTINE directive
38  !$acc routine seq gang
39
40  !ERROR: Clause WORKER is not allowed if clause WORKER appears on the ROUTINE directive
41  !$acc routine worker worker
42
43  !ERROR: Clause WORKER is not allowed if clause GANG appears on the ROUTINE directive
44  !$acc routine gang worker
45
46  !ERROR: Clause WORKER is not allowed if clause VECTOR appears on the ROUTINE directive
47  !$acc routine vector worker
48
49  !ERROR: Clause WORKER is not allowed if clause SEQ appears on the ROUTINE directive
50  !$acc routine seq worker
51
52  !ERROR: Clause VECTOR is not allowed if clause VECTOR appears on the ROUTINE directive
53  !$acc routine vector vector
54
55  !ERROR: Clause VECTOR is not allowed if clause GANG appears on the ROUTINE directive
56  !$acc routine gang vector
57
58  !ERROR: Clause VECTOR is not allowed if clause WORKER appears on the ROUTINE directive
59  !$acc routine worker vector
60
61  !ERROR: Clause VECTOR is not allowed if clause SEQ appears on the ROUTINE directive
62  !$acc routine seq vector
63
64  !ERROR: Clause SEQ is not allowed if clause SEQ appears on the ROUTINE directive
65  !$acc routine seq seq
66
67  !ERROR: Clause SEQ is not allowed if clause GANG appears on the ROUTINE directive
68  !$acc routine gang seq
69
70  !ERROR: Clause SEQ is not allowed if clause WORKER appears on the ROUTINE directive
71  !$acc routine worker seq
72
73  !ERROR: Clause SEQ is not allowed if clause VECTOR appears on the ROUTINE directive
74  !$acc routine vector seq
75
76end subroutine
77
78subroutine sub7()
79  !$acc routine device_type(*) gang device_type(host) worker
80
81  !ERROR: Clause SEQ is not allowed if clause GANG appears on the ROUTINE directive
82  !$acc routine device_type(*) gang seq
83
84  !ERROR: Clause WORKER is not allowed if clause GANG appears on the ROUTINE directive
85  !$acc routine device_type(*) gang worker
86
87  !ERROR: Clause GANG is not allowed if clause GANG appears on the ROUTINE directive
88  !$acc routine gang device_type(*) gang
89
90  !ERROR: Clause WORKER is not allowed if clause GANG appears on the ROUTINE directive
91  !$acc routine gang device_type(*) worker
92
93  !ERROR: Clause VECTOR is not allowed if clause GANG appears on the ROUTINE directive
94  !$acc routine gang device_type(*) vector
95
96  !ERROR: Clause SEQ is not allowed if clause GANG appears on the ROUTINE directive
97  !$acc routine gang device_type(*) seq
98
99  !ERROR: Clause WORKER is not allowed if clause WORKER appears on the ROUTINE directive
100  !$acc routine worker device_type(*) worker
101
102  !ERROR: Clause GANG is not allowed if clause WORKER appears on the ROUTINE directive
103  !$acc routine worker device_type(*) gang
104
105  !ERROR: Clause VECTOR is not allowed if clause WORKER appears on the ROUTINE directive
106  !$acc routine worker device_type(*) vector
107
108  !ERROR: Clause SEQ is not allowed if clause WORKER appears on the ROUTINE directive
109  !$acc routine worker device_type(*) seq
110
111  !ERROR: Clause VECTOR is not allowed if clause VECTOR appears on the ROUTINE directive
112  !$acc routine vector device_type(*) vector
113
114  !ERROR: Clause GANG is not allowed if clause VECTOR appears on the ROUTINE directive
115  !$acc routine vector device_type(*) gang
116
117  !ERROR: Clause VECTOR is not allowed if clause VECTOR appears on the ROUTINE directive
118  !$acc routine vector device_type(*) vector
119
120  !ERROR: Clause SEQ is not allowed if clause VECTOR appears on the ROUTINE directive
121  !$acc routine vector device_type(*) seq
122
123  !ERROR: Clause SEQ is not allowed if clause SEQ appears on the ROUTINE directive
124  !$acc routine seq device_type(*) seq
125
126  !ERROR: Clause GANG is not allowed if clause SEQ appears on the ROUTINE directive
127  !$acc routine seq device_type(*) gang
128
129  !ERROR: Clause VECTOR is not allowed if clause SEQ appears on the ROUTINE directive
130  !$acc routine seq device_type(*) vector
131
132  !ERROR: Clause WORKER is not allowed if clause SEQ appears on the ROUTINE directive
133  !$acc routine seq device_type(*) worker
134
135  !$acc routine device_type(host) seq device_type(nvidia) gang device_type(multicore) vector device_type(*) worker
136end subroutine
137