brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 5e50eb6 Raw
103 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 copy(LocalInt)16  while(1);17#pragma acc serial copy(LocalInt)18  while(1);19#pragma acc kernels copy(LocalInt)20  while(1);21 22  // expected-warning@+1{{OpenACC clause name 'pcopy' is a deprecated clause name and is now an alias for 'copy'}}23#pragma acc parallel pcopy(LocalInt)24  while(1);25 26  // expected-warning@+1{{OpenACC clause name 'present_or_copy' is a deprecated clause name and is now an alias for 'copy'}}27#pragma acc parallel present_or_copy(LocalInt)28  while(1);29 30  // Valid cases:31#pragma acc parallel copy(LocalInt, LocalPointer, LocalArray)32  while(1);33#pragma acc parallel copy(LocalArray[2:1])34  while(1);35 36#pragma acc parallel copy(LocalComposite.ScalarMember, LocalComposite.ScalarMember)37  while(1);38 39  // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}40#pragma acc parallel copy(1 + IntParam)41  while(1);42 43  // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}44#pragma acc parallel copy(+IntParam)45  while(1);46 47  // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}48#pragma acc parallel copy(PointerParam[2:])49  while(1);50 51  // expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}52#pragma acc parallel copy(ArrayParam[2:5])53  while(1);54 55  // expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}56  // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}57#pragma acc parallel copy((float*)ArrayParam[2:5])58  while(1);59  // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}60#pragma acc parallel copy((float)ArrayParam[2])61  while(1);62 63  // expected-error@+1{{OpenACC 'copy' clause is not valid on 'loop' directive}}64#pragma acc loop copy(LocalInt)65  for(int i = 5; i < 10;++i);66  // expected-error@+1{{OpenACC 'pcopy' clause is not valid on 'loop' directive}}67#pragma acc loop pcopy(LocalInt)68  for(int i = 5; i < 10;++i);69  // expected-error@+1{{OpenACC 'present_or_copy' clause is not valid on 'loop' directive}}70#pragma acc loop present_or_copy(LocalInt)71  for(int i = 5; i < 10;++i);72 73  short *ArrayOfPtrs[5];74#pragma acc parallel copy(ArrayOfPtrs[1:1])75  ;76  // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}77#pragma acc parallel copy(ArrayOfPtrs[1:1][1])78  ;79  // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}80#pragma acc parallel copy(ArrayOfPtrs[1:1][1:])81  ;82#pragma acc parallel copy(ArrayOfPtrs[1:1][1:2])83  ;84 85}86void ModList() {87  int V1;88  // expected-error@+2{{OpenACC 'readonly' modifier not valid on 'copy' clause}}89  // expected-error@+1{{OpenACC 'zero' modifier not valid on 'copy' clause}}90#pragma acc parallel copy(always, alwaysin, alwaysout, zero, readonly: V1)91  for(int i = 5; i < 10;++i);92  // expected-error@+1{{OpenACC 'readonly' modifier not valid on 'copy' clause}}93#pragma acc serial copy(readonly: V1)94  for(int i = 5; i < 10;++i);95  // expected-error@+1{{OpenACC 'zero' modifier not valid on 'copy' clause}}96#pragma acc kernels copy(zero: V1)97  for(int i = 5; i < 10;++i);98#pragma acc parallel copy(capture:V1)99  for(int i = 5; i < 10;++i);100#pragma acc parallel copy(always, alwaysin, alwaysout, capture: V1)101  for(int i = 5; i < 10;++i);102}103