1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
// RUN: %clang_cc1 %s -fopenacc -verify
struct CompositeOfScalars {
int I;
float F;
short J;
char C;
double D;
_Complex float CF;
_Complex double CD;
};
struct CompositeHasComposite {
int I;
float F;
short J;
char C;
double D;
_Complex float CF;
_Complex double CD;
struct CompositeOfScalars COS; // #COS_FIELD
};
// All of the type checking is done for compute and loop constructs, so only check the basics + the parts that are combined specific.
void uses(unsigned Parm) {
struct CompositeOfScalars CoS;
struct CompositeHasComposite ChC;
int I;
float F;
int Array[5];
// legal on all 3 kinds of combined constructs
#pragma acc parallel loop reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc serial loop reduction(&: CoS, I, F)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop reduction(min: CoS, Array[I], Array[0:I])
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
// expected-note@#COS_FIELD{{invalid field is here}}
#pragma acc parallel loop reduction(&: ChC)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop reduction(+:Parm) num_gangs(I)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'num_gangs' clause with more than 1 argument may not appear on a 'parallel loop' construct with a 'reduction' clause}}
// expected-note@+1{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(+:Parm) num_gangs(I, I)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop num_gangs(I) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'reduction' clause may not appear on a 'parallel loop' construct with a 'num_gangs' clause with more than 1 argument}}
// expected-note@+1{{previous 'num_gangs' clause is here}}
#pragma acc parallel loop num_gangs(I, I) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
// Reduction cannot appear on a loop with a 'gang' of dim>1.
#pragma acc parallel loop gang(dim:1) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'reduction' clause cannot appear on the same 'parallel loop' construct as a 'gang' clause with a 'dim' value greater than 1}}
// expected-note@+1{{previous 'gang' clause is here}}
#pragma acc parallel loop gang(dim:2) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop reduction(+:Parm) gang(dim:1)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'gang' clause with a 'dim' value greater than 1 cannot appear on the same 'parallel loop' construct as a 'reduction' clause}}
// expected-note@+1{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(+:Parm) gang(dim:2)
for(int i = 0; i < 5; ++i);
// Reduction cannot appear on a loop with a gang and a num_gangs with >1
// explicit argument.
#pragma acc kernels loop num_gangs(I) reduction(+:Parm) gang
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop num_gangs(I) gang reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop reduction(+:Parm) num_gangs(I) gang
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop reduction(+:Parm) gang num_gangs(I)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop gang num_gangs(I) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc kernels loop gang reduction(+:Parm) num_gangs(I)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'reduction' clause may not appear on a 'parallel loop' construct with a 'num_gangs' clause with more than 1 argument}}
// expected-note@+1{{previous 'num_gangs' clause is here}}
#pragma acc parallel loop num_gangs(I, I) reduction(+:Parm) gang
for(int i = 0; i < 5; ++i);
// expected-error@+3{{OpenACC 'reduction' clause cannot appear on the same 'parallel loop' construct as a 'gang' clause and a 'num_gangs' clause with more than one argument}}
// expected-note@+2{{previous 'num_gangs' clause is here}}
// expected-note@+1{{previous 'gang' clause is here}}
#pragma acc parallel loop num_gangs(I, I) gang reduction(+:Parm)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{OpenACC 'num_gangs' clause with more than 1 argument may not appear on a 'parallel loop' construct with a 'reduction' clause}}
// expected-note@+1{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(+:Parm) num_gangs(I, I) gang
for(int i = 0; i < 5; ++i);
// expected-error@+3{{OpenACC 'reduction' clause cannot appear on the same 'parallel loop' construct as a 'gang' clause and a 'num_gangs' clause with more than one argument}}
// expected-note@+2{{previous 'reduction' clause is here}}
// expected-note@+1{{previous 'gang' clause is here}}
#pragma acc parallel loop reduction(+:Parm) gang num_gangs(I, I)
for(int i = 0; i < 5; ++i);
// expected-error@+3{{OpenACC 'reduction' clause cannot appear on the same 'parallel loop' construct as a 'gang' clause and a 'num_gangs' clause with more than one argument}}
// expected-note@+2{{previous 'gang' clause is here}}
// expected-note@+1{{previous 'num_gangs' clause is here}}
#pragma acc parallel loop gang num_gangs(I, I) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
// expected-error@+3{{OpenACC 'reduction' clause cannot appear on the same 'parallel loop' construct as a 'gang' clause and a 'num_gangs' clause with more than one argument}}
// expected-note@+2{{previous 'reduction' clause is here}}
// expected-note@+1{{previous 'gang' clause is here}}
#pragma acc parallel loop gang reduction(+:Parm) num_gangs(I, I)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop num_gangs(I) reduction(+:Parm) gang
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop num_gangs(I) gang reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop reduction(+:Parm) num_gangs(I) gang
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop reduction(+:Parm) gang num_gangs(I)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop gang num_gangs(I) reduction(+:Parm)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop gang reduction(+:Parm) num_gangs(I)
for(int i = 0; i < 5; ++i);
#pragma acc parallel loop reduction(+:I)
for(int i = 0; i < 5; ++i) {
// expected-error@+2{{OpenACC 'reduction' variable must have the same operator in all nested constructs (& vs +)}}
// expected-note@-3{{previous 'reduction' clause is here}}
#pragma acc loop reduction(&:I)
for(int i = 0; i < 5; ++i);
}
#pragma acc parallel loop reduction(+:I)
for(int i = 0; i < 5; ++i) {
// expected-error@+2{{OpenACC 'reduction' variable must have the same operator in all nested constructs (& vs +)}}
// expected-note@-3{{previous 'reduction' clause is here}}
#pragma acc parallel reduction(&:I)
for(int i = 0; i < 5; ++i);
}
#pragma acc parallel loop reduction(+:I)
for(int i = 0; i < 5; ++i) {
// expected-error@+2{{OpenACC 'reduction' variable must have the same operator in all nested constructs (& vs +)}}
// expected-note@-3{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(&:I)
for(int i = 0; i < 5; ++i);
}
#pragma acc loop reduction(+:I)
for(int i = 0; i < 5; ++i) {
// expected-error@+2{{OpenACC 'reduction' variable must have the same operator in all nested constructs (& vs +)}}
// expected-note@-3{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(&:I)
for(int i = 0; i < 5; ++i);
}
#pragma acc parallel reduction(+:I)
for(int i = 0; i < 5; ++i) {
// expected-error@+2{{OpenACC 'reduction' variable must have the same operator in all nested constructs (& vs +)}}
// expected-note@-3{{previous 'reduction' clause is here}}
#pragma acc parallel loop reduction(&:I)
for(int i = 0; i < 5; ++i);
}
}
|