| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-fdump-tree-original" } |
| 3 |
|
| 4 |
int x; |
| 5 |
|
| 6 |
template<int C, int D> |
| 7 |
void foo() |
| 8 |
{ |
| 9 |
int arr1[40]; |
| 10 |
#pragma omp target map(arr1[x ? C : D]) |
| 11 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] \[len: [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 12 |
{ } |
| 13 |
#pragma omp target map(arr1[x ? C : D : D]) |
| 14 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] \[len: [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 15 |
{ } |
| 16 |
#pragma omp target map(arr1[1 : x ? C : D]) |
| 17 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[1\] \[len: x != 0 \? [0-9]+ : [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: [0-9]+\]\)} "original" } } |
| 18 |
{ } |
| 19 |
} |
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
int arr1[40]; |
| 24 |
#pragma omp target map(arr1[x ? 3 : 5]) |
| 25 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] \[len: [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 26 |
{ } |
| 27 |
#pragma omp target map(arr1[x ? 3 : 5 : 5]) |
| 28 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] \[len: [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x != 0 \? 3 : 5>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 29 |
{ } |
| 30 |
#pragma omp target map(arr1[1 : x ? 3 : 5]) |
| 31 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[1\] [len: x != 0 ? [0-9]+ : [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: [0-9]+\]\)} "original" } } |
| 32 |
{ } |
| 33 |
|
| 34 |
foo<3, 5> (); |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|