brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · d8778e5 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 copyin(LocalInt)16  for(int i = 0; i < 5; ++i);17#pragma acc serial loop copyin(LocalInt)18  for(int i = 0; i < 5; ++i);19#pragma acc kernels loop copyin(LocalInt)20  for(int i = 0; i < 5; ++i);21 22  // expected-warning@+1{{OpenACC clause name 'pcopyin' is a deprecated clause name and is now an alias for 'copyin'}}23#pragma acc parallel loop pcopyin(LocalInt)24  for(int i = 0; i < 5; ++i);25 26  // expected-warning@+1{{OpenACC clause name 'present_or_copyin' is a deprecated clause name and is now an alias for 'copyin'}}27#pragma acc parallel loop present_or_copyin(LocalInt)28  for(int i = 0; i < 5; ++i);29 30  // Valid cases:31#pragma acc parallel loop copyin(LocalInt, LocalPointer, LocalArray)32  for(int i = 0; i < 5; ++i);33#pragma acc parallel loop copyin(LocalArray[2:1])34  for(int i = 0; i < 5; ++i);35#pragma acc parallel loop copyin(readonly:LocalArray[2:1])36  for(int i = 0; i < 5; ++i);37 38#pragma acc parallel loop copyin(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 copyin(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 copyin(+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 copyin(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 copyin(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 copyin((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 copyin((float)ArrayParam[2])63  for(int i = 0; i < 5; ++i);64  // expected-error@+2{{unknown modifier 'invalid' in OpenACC modifier-list on 'copyin' 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 copyin(invalid:(float)ArrayParam[2])67  for(int i = 0; i < 5; ++i);68 69  // expected-error@+1{{OpenACC 'copyin' clause is not valid on 'loop' directive}}70#pragma acc loop copyin(LocalInt)71  for(int i = 5; i < 10;++i);72  // expected-error@+1{{OpenACC 'pcopyin' clause is not valid on 'loop' directive}}73#pragma acc loop pcopyin(LocalInt)74  for(int i = 5; i < 10;++i);75  // expected-error@+1{{OpenACC 'present_or_copyin' clause is not valid on 'loop' directive}}76#pragma acc loop present_or_copyin(LocalInt)77  for(int i = 5; i < 10;++i);78}79 80void ModList() {81  int V1;82  // expected-error@+2{{OpenACC 'alwaysout' modifier not valid on 'copyin' clause}}83  // expected-error@+1{{OpenACC 'zero' modifier not valid on 'copyin' clause}}84#pragma acc parallel loop copyin(always, alwaysin, alwaysout, zero, readonly: V1)85  for(int i = 5; i < 10;++i);86  // expected-error@+1{{OpenACC 'alwaysout' modifier not valid on 'copyin' clause}}87#pragma acc serial loop copyin(alwaysout: V1)88  for(int i = 5; i < 10;++i);89  // expected-error@+1{{OpenACC 'zero' modifier not valid on 'copyin' clause}}90#pragma acc kernels loop copyin(zero: V1)91  for(int i = 5; i < 10;++i);92#pragma acc parallel loop copyin(capture:V1)93  for(int i = 5; i < 10;++i);94#pragma acc parallel loop copyin(always, alwaysin, readonly, capture: V1)95  for(int i = 5; i < 10;++i);96}97