| 1 |
// Test parsing of #pragma omp declare variant |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-additional-options "-fdump-tree-gimple" } |
| 4 |
|
| 5 |
void f01 (); |
| 6 |
#pragma omp declare variant (f01) match (user={condition(1)},device={arch(x86_64)}) |
| 7 |
template <int N> |
| 8 |
void f02 (); |
| 9 |
void f03 (); |
| 10 |
#pragma omp declare variant (f03) match (user={condition(score(N+2):N)}) |
| 11 |
template <int N> |
| 12 |
void f04 (); |
| 13 |
template <int N> |
| 14 |
void f05 (); |
| 15 |
#pragma omp declare variant (f05<N>) match (user={condition((T)N)},implementation={vendor("gnu")}) |
| 16 |
template <int N, typename T> |
| 17 |
void f06 (); |
| 18 |
void f07 (); |
| 19 |
#pragma omp declare variant (f07) match (user={condition(score(N+2):N)}) |
| 20 |
template <int N> |
| 21 |
void f08 (); |
| 22 |
template <int N> |
| 23 |
void f09 (); |
| 24 |
#pragma omp declare variant (f09<N>) match (user={condition((T) N)}) |
| 25 |
template <int N, typename T> |
| 26 |
void f10 (); |
| 27 |
template <int N> |
| 28 |
struct S |
| 29 |
{ |
| 30 |
template <typename T> |
| 31 |
void f11 (T) {} |
| 32 |
#pragma omp declare variant (f11<T>) match (user={condition(score(N):N)}) |
| 33 |
template <typename T> |
| 34 |
void f12 (T) {} |
| 35 |
template <typename T> |
| 36 |
void f13 (T); |
| 37 |
#pragma omp declare variant (f13<T>) match (user={condition(score(N):N)}) |
| 38 |
template <typename T> |
| 39 |
void f14 (T); |
| 40 |
int s; |
| 41 |
}; |
| 42 |
template <int N> |
| 43 |
struct T |
| 44 |
{ |
| 45 |
template <typename T> |
| 46 |
void f15 (T) {} |
| 47 |
#pragma omp declare variant (f15<T>) match (user={condition(score(N):N)}) |
| 48 |
template <typename T> |
| 49 |
void f16 (T) {} |
| 50 |
template <typename T> |
| 51 |
void f17 (T); |
| 52 |
#pragma omp declare variant (f17<T>) match (user={condition(score(N):N)}) |
| 53 |
template <typename T> |
| 54 |
void f18 (T); |
| 55 |
int t; |
| 56 |
}; |
| 57 |
|
| 58 |
void |
| 59 |
test () |
| 60 |
{ |
| 61 |
f02<1> (); // { dg-final { scan-tree-dump-times "f01 \\\(\\\);" 1 "gimple" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } |
| 62 |
// { dg-final { scan-tree-dump-times "f02<1> \\\(\\\);" 1 "gimple" { target { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } |
| 63 |
// { dg-final { scan-tree-dump-times "f02<1> \\\(\\\);" 1 "gimple" { target { ! { i?86-*-* x86_64-*-* } } } } } |
| 64 |
f04<1> (); // { dg-final { scan-tree-dump-times "f03 \\\(\\\);" 1 "gimple" } } |
| 65 |
f06<1, long> (); // { dg-final { scan-tree-dump-times "f05<1> \\\(\\\);" 1 "gimple" } } |
| 66 |
f08<0> (); // { dg-final { scan-tree-dump-times "f08<0> \\\(\\\);" 1 "gimple" } } |
| 67 |
f10<0, short int> (); // { dg-final { scan-tree-dump-times "f10<0, short int> \\\(\\\);" 1 "gimple" } } |
| 68 |
S<1> s; |
| 69 |
s.f12 (0); // { dg-final { scan-tree-dump-times "S<1>::f11<int> \\\(&s, 0\\\);" 1 "gimple" } } |
| 70 |
s.f12 (0.0); // { dg-final { scan-tree-dump-times "S<1>::f11<double> \\\(&s, 0.0\\\);" 1 "gimple" } } |
| 71 |
s.f14 (0LL); // { dg-final { scan-tree-dump-times "S<1>::f13<long long int> \\\(&s, 0\\\);" 1 "gimple" } } |
| 72 |
T<0> t; |
| 73 |
t.f16 (s); // { dg-final { scan-tree-dump-times "T<0>::f16<S<1> > \\\(&t, s\\\);" 1 "gimple" } } |
| 74 |
t.f18 (s); // { dg-final { scan-tree-dump-times "T<0>::f18<S<1> > \\\(&t, s\\\);" 1 "gimple" } } |
| 75 |
} |