[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / combined-construct-create-clause.c
blobc17e6921a7da206b1175bc3bbfe5fb488ae76cd0
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 typedef struct IsComplete {
4 struct S { int A; } CompositeMember;
5 int ScalarMember;
6 float ArrayMember[5];
7 void *PointerMember;
8 } Complete;
9 void uses(int IntParam, short *PointerParam, float ArrayParam[5], Complete CompositeParam) {
10 int LocalInt;
11 short *LocalPointer;
12 float LocalArray[5];
13 Complete LocalComposite;
14 // Check Appertainment:
15 #pragma acc parallel loop create(LocalInt)
16 for(int i = 0; i < 5; ++i);
17 #pragma acc serial loop create(LocalInt)
18 for(int i = 0; i < 5; ++i);
19 #pragma acc kernels loop create(LocalInt)
20 for(int i = 0; i < 5; ++i);
22 // expected-warning@+1{{OpenACC clause name 'pcreate' is a deprecated clause name and is now an alias for 'create'}}
23 #pragma acc parallel loop pcreate(LocalInt)
24 for(int i = 0; i < 5; ++i);
26 // expected-warning@+1{{OpenACC clause name 'present_or_create' is a deprecated clause name and is now an alias for 'create'}}
27 #pragma acc parallel loop present_or_create(LocalInt)
28 for(int i = 0; i < 5; ++i);
30 // Valid cases:
31 #pragma acc parallel loop create(LocalInt, LocalPointer, LocalArray)
32 for(int i = 0; i < 5; ++i);
33 #pragma acc parallel loop create(LocalArray[2:1])
34 for(int i = 0; i < 5; ++i);
35 #pragma acc parallel loop create(zero:LocalArray[2:1])
36 for(int i = 0; i < 5; ++i);
38 #pragma acc parallel loop create(LocalComposite.ScalarMember, LocalComposite.ScalarMember)
39 for(int i = 0; i < 5; ++i);
41 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
42 #pragma acc parallel loop create(1 + IntParam)
43 for(int i = 0; i < 5; ++i);
45 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
46 #pragma acc parallel loop create(+IntParam)
47 for(int i = 0; i < 5; ++i);
49 // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}
50 #pragma acc parallel loop create(PointerParam[2:])
51 for(int i = 0; i < 5; ++i);
53 // expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
54 #pragma acc parallel loop create(ArrayParam[2:5])
55 for(int i = 0; i < 5; ++i);
57 // expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
58 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
59 #pragma acc parallel loop create((float*)ArrayParam[2:5])
60 for(int i = 0; i < 5; ++i);
61 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
62 #pragma acc parallel loop create((float)ArrayParam[2])
63 for(int i = 0; i < 5; ++i);
64 // expected-error@+2{{invalid tag 'invalid' on 'create' clause}}
65 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
66 #pragma acc parallel loop create(invalid:(float)ArrayParam[2])
67 for(int i = 0; i < 5; ++i);
69 // expected-error@+1{{OpenACC 'create' clause is not valid on 'loop' directive}}
70 #pragma acc loop create(LocalInt)
71 for(int i = 5; i < 10;++i);
72 // expected-error@+1{{OpenACC 'pcreate' clause is not valid on 'loop' directive}}
73 #pragma acc loop pcreate(LocalInt)
74 for(int i = 5; i < 10;++i);
75 // expected-error@+1{{OpenACC 'present_or_create' clause is not valid on 'loop' directive}}
76 #pragma acc loop present_or_create(LocalInt)
77 for(int i = 5; i < 10;++i);