| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-foffload=disable -fdump-tree-gimple" } */ |
| 3 |
/* { dg-additional-options "-mavx512bw -mavx512vl" { target { i?86-*-* x86_64-*-* } } } */ |
| 4 |
|
| 5 |
void f01 (void); |
| 6 |
void f02 (void); |
| 7 |
#pragma omp declare variant (f01) match (device={isa(avx512f,"avx512vl")}) |
| 8 |
#pragma omp declare variant (f02) match (device={isa(avx512bw,avx512vl,"avx512f")}) |
| 9 |
void f03 (void); |
| 10 |
void f04 (void); |
| 11 |
void f05 (void); |
| 12 |
#pragma omp declare variant (f04) match (device={isa(avx512f,avx512vl)}) |
| 13 |
#pragma omp declare variant (f05) match (device={isa(avx512bw,avx512vl,avx512f)}) |
| 14 |
void f06 (void); |
| 15 |
void f07 (void); |
| 16 |
void f08 (void); |
| 17 |
#pragma omp declare variant (f07) match (device={isa(sse4,"sse4.1","sse4.2",sse3,"avx")}) |
| 18 |
#pragma omp declare variant (f08) match (device={isa("avx",sse3)}) |
| 19 |
void f09 (void); |
| 20 |
void f10 (void); |
| 21 |
void f11 (void); |
| 22 |
void f12 (void); |
| 23 |
#pragma omp declare variant (f10) match (device={isa("avx512f")}) |
| 24 |
#pragma omp declare variant (f11) match (user={condition(1)},device={isa(avx512f)},implementation={vendor(gnu)}) |
| 25 |
#pragma omp declare variant (f12) match (user={condition(2 + 1)},device={isa(avx512f)}) |
| 26 |
void f13 (void); |
| 27 |
void f14 (void); |
| 28 |
void f15 (void); |
| 29 |
void f16 (void); |
| 30 |
void f17 (void); |
| 31 |
#pragma omp declare variant (f14) match (construct={teams,for}) |
| 32 |
#pragma omp declare variant (f15) match (construct={teams,parallel,for}) |
| 33 |
#pragma omp declare variant (f16) match (construct={for}) |
| 34 |
#pragma omp declare variant (f17) match (construct={parallel,for}) |
| 35 |
void f18 (void); |
| 36 |
void f19 (void); |
| 37 |
void f20 (void); |
| 38 |
void f21 (void); |
| 39 |
void f22 (void); |
| 40 |
#pragma omp declare variant (f19) match (construct={teams,for}) |
| 41 |
#pragma omp declare variant (f20) match (construct={teams,parallel,for}) |
| 42 |
#pragma omp declare variant (f21) match (construct={for}) |
| 43 |
#pragma omp declare variant (f22) match (construct={parallel,for}) |
| 44 |
void f23 (void); |
| 45 |
void f24 (void); |
| 46 |
void f25 (void); |
| 47 |
void f26 (void); |
| 48 |
#pragma omp declare variant (f24) match (device={kind(cpu)}) |
| 49 |
#pragma omp declare variant (f25) match (device={kind(cpu),isa(avx512f),arch(x86_64)}) |
| 50 |
#pragma omp declare variant (f26) match (device={arch(x86_64),kind(cpu)}) |
| 51 |
void f27 (void); |
| 52 |
|
| 53 |
void |
| 54 |
test1 (void) |
| 55 |
{ |
| 56 |
int i; |
| 57 |
f03 (); /* { dg-final { scan-tree-dump-times "f02 \\\(\\\);" 1 "gimple" { target i?86-*-* x86_64-*-* } } } */ |
| 58 |
/* { dg-final { scan-tree-dump-times "f03 \\\(\\\);" 1 "gimple" { target { ! { i?86-*-* x86_64-*-* } } } } } */ |
| 59 |
f09 (); /* { dg-final { scan-tree-dump-times "f07 \\\(\\\);" 1 "gimple" { target i?86-*-* x86_64-*-* } } } */ |
| 60 |
/* { dg-final { scan-tree-dump-times "f09 \\\(\\\);" 1 "gimple" { target { ! { i?86-*-* x86_64-*-* } } } } } */ |
| 61 |
f13 (); /* { dg-final { scan-tree-dump-times "f11 \\\(\\\);" 1 "gimple" { target i?86-*-* x86_64-*-* } } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "f13 \\\(\\\);" 1 "gimple" { target { ! { i?86-*-* x86_64-*-* } } } } } */ |
| 63 |
#pragma omp teams distribute parallel for |
| 64 |
for (i = 0; i < 1; i++) |
| 65 |
f18 (); /* { dg-final { scan-tree-dump-times "f15 \\\(\\\);" 1 "gimple" } } */ |
| 66 |
#pragma omp parallel for |
| 67 |
for (i = 0; i < 1; i++) |
| 68 |
f23 (); /* { dg-final { scan-tree-dump-times "f22 \\\(\\\);" 1 "gimple" } } */ |
| 69 |
f27 (); /* { dg-final { scan-tree-dump-times "f25 \\\(\\\);" 1 "gimple" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ |
| 70 |
/* { dg-final { scan-tree-dump-times "f24 \\\(\\\);" 1 "gimple" { target { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } */ |
| 71 |
/* { dg-final { scan-tree-dump-times "f24 \\\(\\\);" 1 "gimple" { target { ! { nvptx*-*-* amdgcn*-*-* i?86-*-* x86_64-*-* } } } } } */ |
| 72 |
/* { dg-final { scan-tree-dump-times "f27 \\\(\\\);" 1 "gimple" { target { nvptx*-*-* amdgcn*-*-* } } } } */ |
| 73 |
} |
| 74 |
|
| 75 |
#if defined(__i386__) || defined(__x86_64__) |
| 76 |
__attribute__((target ("no-avx512bw,avx512f,avx512vl"))) |
| 77 |
#endif |
| 78 |
void |
| 79 |
test2 (void) |
| 80 |
{ |
| 81 |
f06 (); /* { dg-final { scan-tree-dump-times "f04 \\\(\\\);" 1 "gimple" { target i?86-*-* x86_64-*-* } } } */ |
| 82 |
/* { dg-final { scan-tree-dump-times "f06 \\\(\\\);" 1 "gimple" { target { ! { i?86-*-* x86_64-*-* } } } } } */ |
| 83 |
} |