brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · a1774e0 Raw
97 lines · c
1// RUN: %clang_cc1 %s -fopenacc -verify2 3typedef struct IsComplete {4  struct S { int A; } CompositeMember;5  int ScalarMember;6  float ArrayMember[5];7  void *PointerMember;8} Complete;9void 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 copyout(LocalInt)16  for(int i = 0; i < 5; ++i);17#pragma acc serial loop copyout(LocalInt)18  for(int i = 0; i < 5; ++i);19#pragma acc kernels loop copyout(LocalInt)20  for(int i = 0; i < 5; ++i);21 22  // expected-warning@+1{{OpenACC clause name 'pcopyout' is a deprecated clause name and is now an alias for 'copyout'}}23#pragma acc parallel loop pcopyout(LocalInt)24  for(int i = 0; i < 5; ++i);25 26  // expected-warning@+1{{OpenACC clause name 'present_or_copyout' is a deprecated clause name and is now an alias for 'copyout'}}27#pragma acc parallel loop present_or_copyout(LocalInt)28  for(int i = 0; i < 5; ++i);29 30  // Valid cases:31#pragma acc parallel loop copyout(LocalInt, LocalPointer, LocalArray)32  for(int i = 0; i < 5; ++i);33#pragma acc parallel loop copyout(LocalArray[2:1])34  for(int i = 0; i < 5; ++i);35#pragma acc parallel loop copyout(zero:LocalArray[2:1])36  for(int i = 0; i < 5; ++i);37 38#pragma acc parallel loop copyout(LocalComposite.ScalarMember, LocalComposite.ScalarMember)39  for(int i = 0; i < 5; ++i);40 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 copyout(1 + IntParam)43  for(int i = 0; i < 5; ++i);44 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 copyout(+IntParam)47  for(int i = 0; i < 5; ++i);48 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 copyout(PointerParam[2:])51  for(int i = 0; i < 5; ++i);52 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 copyout(ArrayParam[2:5])55  for(int i = 0; i < 5; ++i);56 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 copyout((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 copyout((float)ArrayParam[2])63  for(int i = 0; i < 5; ++i);64  // expected-error@+2{{unknown modifier 'invalid' in OpenACC modifier-list on 'copyout' 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 copyout(invalid:(float)ArrayParam[2])67  for(int i = 0; i < 5; ++i);68 69  // expected-error@+1{{OpenACC 'copyout' clause is not valid on 'loop' directive}}70#pragma acc loop copyout(LocalInt)71  for(int i = 0; i < 6;++i);72  // expected-error@+1{{OpenACC 'pcopyout' clause is not valid on 'loop' directive}}73#pragma acc loop pcopyout(LocalInt)74  for(int i = 0; i < 6;++i);75  // expected-error@+1{{OpenACC 'present_or_copyout' clause is not valid on 'loop' directive}}76#pragma acc loop present_or_copyout(LocalInt)77  for(int i = 0; i < 6;++i);78}79void ModList() {80  int V1;81  // expected-error@+2{{OpenACC 'alwaysin' modifier not valid on 'copyout' clause}}82  // expected-error@+1{{OpenACC 'readonly' modifier not valid on 'copyout' clause}}83#pragma acc parallel loop copyout(always, alwaysin, alwaysout, zero, readonly: V1)84  for(int i = 0; i < 6;++i);85  // expected-error@+1{{OpenACC 'alwaysin' modifier not valid on 'copyout' clause}}86#pragma acc serial loop copyout(alwaysin: V1)87  for(int i = 0; i < 6;++i);88  // expected-error@+1{{OpenACC 'readonly' modifier not valid on 'copyout' clause}}89#pragma acc kernels loop copyout(readonly: V1)90  for(int i = 0; i < 6;++i);91#pragma acc parallel loop copyout(capture:V1)92  for(int i = 5; i < 10;++i);93#pragma acc parallel loop copyout(always, alwaysout, zero, capture: V1)94  for(int i = 5; i < 10;++i);95}96 97