Clang Project

clang_source_code/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_messages.cpp
1// RUN: %clang_cc1 -verify -fopenmp %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd %s
4
5void foo() {
6}
7
8bool foobool(int argc) {
9  return argc;
10}
11
12struct S1; // expected-note {{declared here}}
13
14template <class T, typename S, int N, int ST> // expected-note {{declared here}}
15T tmain(T argc, S **argv) {
16// expected-error@+1 {{expected '(' after 'schedule'}}
17#pragma omp target teams distribute parallel for simd schedule
18  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
19
20// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
21#pragma omp target teams distribute parallel for simd schedule (
22  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
23
24// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
25#pragma omp target teams distribute parallel for simd schedule ()
26  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
27
28// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
29#pragma omp target teams distribute parallel for simd schedule (auto
30  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
31
32// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
33#pragma omp target teams distribute parallel for simd schedule (auto_dynamic
34  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
35
36// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
37#pragma omp target teams distribute parallel for simd schedule (auto,
38  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
39
40// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
41#pragma omp target teams distribute parallel for simd schedule (runtime, 3)
42  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
43
44// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
45#pragma omp target teams distribute parallel for simd schedule (guided argc
46  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
47
48// expected-error@+1 2 {{argument to 'schedule' clause must be a strictly positive integer value}}
49#pragma omp target teams distribute parallel for simd schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
50  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
51
52// expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}}
53#pragma omp target teams distribute parallel for simd schedule (dynamic, 1))
54  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
55
56#pragma omp target teams distribute parallel for simd schedule (guided, (ST > 0) ? 1 + ST : 2)
57  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
58
59// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'schedule' clause}}
60// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
61#pragma omp target teams distribute parallel for simd schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)
62  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
63
64// expected-error@+1 {{'S' does not refer to a value}}
65#pragma omp target teams distribute parallel for simd schedule (static, S)
66  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
67
68// expected-error@+2 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
69// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
70#pragma omp target teams distribute parallel for simd schedule (guided, argv[1]=2)
71  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
72
73#pragma omp target teams distribute parallel for simd schedule (dynamic, 1)
74  for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
75
76// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
77#pragma omp target teams distribute parallel for simd schedule (static, N)
78  for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
79
80  return argc;
81}
82
83int main(int argc, char **argv) {
84// expected-error@+1 {{expected '(' after 'schedule'}}
85#pragma omp target teams distribute parallel for simd schedule
86  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
87
88// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
89#pragma omp target teams distribute parallel for simd schedule (
90  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
91
92// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
93#pragma omp target teams distribute parallel for simd schedule ()
94  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
95
96// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
97#pragma omp target teams distribute parallel for simd schedule (auto
98  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
99
100// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
101#pragma omp target teams distribute parallel for simd schedule (auto_dynamic
102  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
103
104// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
105#pragma omp target teams distribute parallel for simd schedule (auto,
106  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
107
108// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
109#pragma omp target teams distribute parallel for simd schedule (runtime, 3)
110  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
111
112// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
113#pragma omp target teams distribute parallel for simd schedule (guided, 4
114  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
115
116// expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}}
117#pragma omp target teams distribute parallel for simd schedule (static, 2+2))
118  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
119
120#pragma omp target teams distribute parallel for simd schedule (dynamic, foobool(1) > 0 ? 1 : 2)
121  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
122
123// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'schedule' clause}}
124// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
125#pragma omp target teams distribute parallel for simd schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)
126  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
127
128// expected-error@+1 {{'S1' does not refer to a value}}
129#pragma omp target teams distribute parallel for simd schedule (guided, S1)
130  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
131
132// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
133// expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}}
134#pragma omp target teams distribute parallel for simd schedule (static, argv[1]=2)
135  for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
136
137// expected-error@+3 {{statement after '#pragma omp target teams distribute parallel for simd' must be a for loop}}
138// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
139#pragma omp target teams distribute parallel for simd schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
140  foo();
141
142  // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
143  return tmain<int, char, 1, 0>(argc, argv);
144}
145
146