[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-num_gangs-clause.c
blob40b3b652d21da1a892cd53b97f314cd548bc06e0
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 short getS();
4 void Test() {
5 #pragma acc kernels num_gangs(1)
6 while(1);
8 // expected-error@+1{{OpenACC 'num_gangs' clause is not valid on 'serial' directive}}
9 #pragma acc serial num_gangs(1)
10 while(1);
12 #pragma acc parallel num_gangs(1)
13 while(1);
15 // expected-error@+2{{OpenACC 'num_gangs' clause cannot appear more than once on a 'kernels' directive}}
16 // expected-note@+1{{previous clause is here}}
17 #pragma acc kernels num_gangs(1) num_gangs(2)
18 while(1);
20 // expected-error@+2{{OpenACC 'num_gangs' clause cannot appear more than once on a 'parallel' directive}}
21 // expected-note@+1{{previous clause is here}}
22 #pragma acc parallel num_gangs(1) num_gangs(2)
23 while(1);
25 // expected-error@+1{{too many integer expression arguments provided to OpenACC 'num_gangs' clause: 'kernels' directive expects maximum of 1, 2 were provided}}
26 #pragma acc kernels num_gangs(1, getS())
27 while(1);
29 // expected-error@+1{{OpenACC 'num_gangs' clause is not valid on 'serial' directive}}
30 #pragma acc serial num_gangs(1, getS())
31 while(1);
32 #pragma acc parallel num_gangs(1, getS())
33 while(1);
35 struct NotConvertible{} NC;
36 // expected-error@+1{{OpenACC clause 'num_gangs' requires expression of integer type ('struct NotConvertible' invalid)}}
37 #pragma acc parallel num_gangs(NC)
38 while(1);
40 // expected-error@+1{{OpenACC clause 'num_gangs' requires expression of integer type ('struct NotConvertible' invalid)}}
41 #pragma acc parallel num_gangs(1, NC)
42 while(1);
44 // expected-error@+1{{OpenACC clause 'num_gangs' requires expression of integer type ('struct NotConvertible' invalid)}}
45 #pragma acc parallel num_gangs(NC, 1)
46 while(1);
48 #pragma acc parallel num_gangs(getS(), 1, getS())
49 while(1);
51 // expected-error@+1{{too many integer expression arguments provided to OpenACC 'num_gangs' clause: 'parallel' directive expects maximum of 3, 4 were provided}}
52 #pragma acc parallel num_gangs(getS(), 1, getS(), 1)
53 while(1);
55 // expected-error@+1{{OpenACC 'num_gangs' clause is not valid on 'loop' directive}}
56 #pragma acc loop num_gangs(1)
57 for(int i = 5; i < 10;++i);