| 1 |
/* { dg-options "-fopenmp -O2" } */ |
| 2 |
/* { dg-additional-options "-fopenmp-target-simd-clone=any -fdump-ipa-simdclone-details" } */ |
| 3 |
|
| 4 |
/* Test that simd clones are not generated for functions with |
| 5 |
"declare target" but that call possibly side-effecting functions |
| 6 |
in the body. */ |
| 7 |
|
| 8 |
extern int f (int); |
| 9 |
|
| 10 |
#pragma omp declare target |
| 11 |
__attribute__ ((__noinline__)) int addit(int a, int b) |
| 12 |
{ |
| 13 |
return f(a) + b; |
| 14 |
} |
| 15 |
#pragma omp end declare target |
| 16 |
|
| 17 |
void callit (int *a, int *b, int *c) |
| 18 |
{ |
| 19 |
int i; |
| 20 |
#pragma omp for simd |
| 21 |
for (i = 0; i < 16; i++) |
| 22 |
c[i] = addit (a[i], b[i]); |
| 23 |
} |
| 24 |
|
| 25 |
/* { dg-final { scan-ipa-dump "body contains unsafe function call" "simdclone" { target x86_64-*-* } } } */ |
| 26 |
/* { dg-final { scan-ipa-dump-not "Generated .* clone" "simdclone" { target x86_64-*-* } } } */ |
| 27 |
|