| 1 |
/* Test that omp parallel simd schedule uses the correct max_vf for the |
| 2 |
host system, when target directives are present. */ |
| 3 |
|
| 4 |
/* { dg-require-effective-target offload_target_any } */ |
| 5 |
|
| 6 |
/* { dg-do link } */ |
| 7 |
/* { dg-options "-fopenmp -O2 -fdump-tree-ompexp -foffload=-fdump-tree-optimized" } */ |
| 8 |
|
| 9 |
/* Fix a max_vf size so we can scan for it. |
| 10 |
{ dg-additional-options "-msse2 -mno-avx" { target { x86_64-*-* i?86-*-* } } } */ |
| 11 |
|
| 12 |
#define N 1024 |
| 13 |
int a[N], b[N], c[N]; |
| 14 |
|
| 15 |
/* Test both static schedules and inline target directives. */ |
| 16 |
void |
| 17 |
f2 (void) |
| 18 |
{ |
| 19 |
int i; |
| 20 |
#pragma omp target parallel for simd schedule (simd: static, 7) |
| 21 |
for (i = 0; i < N; i++) |
| 22 |
a[i] = b[i] + c[i]; |
| 23 |
} |
| 24 |
|
| 25 |
/* Test both dynamic schedules and declare target functions. */ |
| 26 |
#pragma omp declare target |
| 27 |
void |
| 28 |
f3 (int *a, int *b, int *c) |
| 29 |
{ |
| 30 |
int i; |
| 31 |
#pragma omp parallel for simd schedule (simd : dynamic, 7) |
| 32 |
for (i = 0; i < N; i++) |
| 33 |
a[i] = b[i] + c[i]; |
| 34 |
} |
| 35 |
#pragma omp end declare target |
| 36 |
|
| 37 |
/* Make sure that the max_vf is used as an IFN. |
| 38 |
{ dg-final { scan-tree-dump-times {GOMP_MAX_VF} 2 "ompexp" { target { x86_64-*-* i?86-*-* } } } } */ |
| 39 |
|
| 40 |
/* Make sure the max_vf is passed as a temporary variable. |
| 41 |
{ dg-final { scan-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, D\.[0-9]*, 0\);} 1 "ompexp" { target { x86_64-*-* i?86-*-* } } } } */ |
| 42 |
|
| 43 |
/* Test SIMD offload devices |
| 44 |
{ dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 64, 0\);} 1 "optimized" { target offload_target_amdgcn } } } |
| 45 |
{ dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 7, 0\);} 1 "optimized" { target offload_target_nvptx } } } */ |
| 46 |
|
| 47 |
int main() {} |