Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / distribute_parallel_for_simd_simdlen_messages.cpp
blobe035f16b60b4598fdf350c18aaa0bb9c0627138d
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2 // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
8 // expected-note@* 0+{{declared here}}
10 void foo() {
13 bool foobool(int argc) {
14 return argc;
17 struct S1;
19 template <class T, typename S, int N, int ST>
20 T tmain(T argc, S **argv) {
21 #pragma omp target
22 #pragma omp teams
23 #pragma omp distribute parallel for simd simdlen // expected-error {{expected '(' after 'simdlen'}}
24 for (int i = ST; i < N; i++)
25 argv[0][i] = argv[0][i] - argv[0][i-ST];
27 #pragma omp target
28 #pragma omp teams
29 #pragma omp distribute parallel for simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
30 for (int i = ST; i < N; i++)
31 argv[0][i] = argv[0][i] - argv[0][i-ST];
33 #pragma omp target
34 #pragma omp teams
35 #pragma omp distribute parallel for simd simdlen () // expected-error {{expected expression}}
36 for (int i = ST; i < N; i++)
37 argv[0][i] = argv[0][i] - argv[0][i-ST];
39 // expected-error@+4 {{expected ')'}} expected-note@+4 {{to match this '('}}
40 // expected-error@+3 2 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
41 #pragma omp target
42 #pragma omp teams
43 #pragma omp distribute parallel for simd simdlen (argc
44 for (int i = ST; i < N; i++)
45 argv[0][i] = argv[0][i] - argv[0][i-ST];
47 // expected-error@+3 {{argument to 'simdlen' clause must be a strictly positive integer value}}
48 #pragma omp target
49 #pragma omp teams
50 #pragma omp distribute parallel for simd simdlen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
51 for (int i = ST; i < N; i++)
52 argv[0][i] = argv[0][i] - argv[0][i-ST];
54 #pragma omp target
55 #pragma omp teams
56 #pragma omp distribute parallel for simd simdlen (1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
57 for (int i = ST; i < N; i++)
58 argv[0][i] = argv[0][i] - argv[0][i-ST];
60 #pragma omp target
61 #pragma omp teams
62 #pragma omp distribute parallel for simd simdlen ((ST > 0) ? 1 + ST : 2)
63 for (int i = ST; i < N; i++)
64 argv[0][i] = argv[0][i] - argv[0][i-ST];
66 #pragma omp target
67 #pragma omp teams
68 // expected-error@+3 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}}
69 // expected-error@+2 {{argument to 'simdlen' clause must be a strictly positive integer value}}
70 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
71 #pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
72 for (int i = ST; i < N; i++)
73 argv[0][i] = argv[0][i] - argv[0][i-ST];
75 #pragma omp target
76 #pragma omp teams
77 #pragma omp distribute parallel for simd simdlen (S) // expected-error {{'S' does not refer to a value}}
78 for (int i = ST; i < N; i++)
79 argv[0][i] = argv[0][i] - argv[0][i-ST];
81 #if __cplusplus <= 199711L
82 // expected-error@+6 2 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
83 #else
84 // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
85 #endif
86 #pragma omp target
87 #pragma omp teams
88 #pragma omp distribute parallel for simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
89 for (int i = ST; i < N; i++)
90 argv[0][i] = argv[0][i] - argv[0][i-ST];
92 #pragma omp target
93 #pragma omp teams
94 #pragma omp distribute parallel for simd simdlen (4)
95 for (int i = ST; i < N; i++)
96 argv[0][i] = argv[0][i] - argv[0][i-ST];
98 #pragma omp target
99 #pragma omp teams
100 #pragma omp distribute parallel for simd simdlen (N) // expected-error {{argument to 'simdlen' clause must be a strictly positive integer value}}
101 for (T i = ST; i < N; i++)
102 argv[0][i] = argv[0][i] - argv[0][i-ST];
104 return argc;
107 int main(int argc, char **argv) {
108 #pragma omp target
109 #pragma omp teams
110 #pragma omp distribute parallel for simd simdlen // expected-error {{expected '(' after 'simdlen'}}
111 for (int i = 4; i < 12; i++)
112 argv[0][i] = argv[0][i] - argv[0][i-4];
114 #pragma omp target
115 #pragma omp teams
116 #pragma omp distribute parallel for simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
117 for (int i = 4; i < 12; i++)
118 argv[0][i] = argv[0][i] - argv[0][i-4];
120 #pragma omp target
121 #pragma omp teams
122 #pragma omp distribute parallel for simd simdlen () // expected-error {{expected expression}}
123 for (int i = 4; i < 12; i++)
124 argv[0][i] = argv[0][i] - argv[0][i-4];
126 #pragma omp target
127 #pragma omp teams
128 #pragma omp distribute parallel for simd simdlen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
129 for (int i = 4; i < 12; i++)
130 argv[0][i] = argv[0][i] - argv[0][i-4];
132 #pragma omp target
133 #pragma omp teams
134 #pragma omp distribute parallel for simd simdlen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
135 for (int i = 4; i < 12; i++)
136 argv[0][i] = argv[0][i] - argv[0][i-4];
138 #pragma omp target
139 #pragma omp teams
140 #pragma omp distribute parallel for simd simdlen (foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
141 for (int i = 4; i < 12; i++)
142 argv[0][i] = argv[0][i] - argv[0][i-4];
144 #pragma omp target
145 #pragma omp teams
146 // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
147 // expected-error@+2 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}}
148 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
149 #pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
150 for (int i = 4; i < 12; i++)
151 argv[0][i] = argv[0][i] - argv[0][i-4];
153 #pragma omp target
154 #pragma omp teams
155 #pragma omp distribute parallel for simd simdlen (S1) // expected-error {{'S1' does not refer to a value}}
156 for (int i = 4; i < 12; i++)
157 argv[0][i] = argv[0][i] - argv[0][i-4];
159 #if __cplusplus <= 199711L
160 // expected-error@+6 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
161 #else
162 // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
163 #endif
164 #pragma omp target
165 #pragma omp teams
166 #pragma omp distribute parallel for simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
167 for (int i = 4; i < 12; i++)
168 argv[0][i] = argv[0][i] - argv[0][i-4];
170 #pragma omp target
171 #pragma omp teams
172 #pragma omp distribute parallel for simd simdlen(simdlen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
173 foo(); // expected-error {{statement after '#pragma omp distribute parallel for simd' must be a for loop}}
175 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
176 return tmain<int, char, 12, 4>(argc, argv);