| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target vect_float } */ |
| 3 |
/* { dg-require-effective-target vect_shift } */ |
| 4 |
/* { dg-require-effective-target vect_floatint_cvt } */ |
| 5 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ |
| 6 |
|
| 7 |
static inline float |
| 8 |
i2f(int x) |
| 9 |
{ |
| 10 |
union { float f; int i; } tmp; |
| 11 |
tmp.i=x; |
| 12 |
return tmp.f; |
| 13 |
} |
| 14 |
static inline float |
| 15 |
vect_ldexpf(float x, int n) |
| 16 |
{ |
| 17 |
n = (n+0x7f)<<23; |
| 18 |
return x * i2f(n); |
| 19 |
} |
| 20 |
|
| 21 |
float __attribute__ ((aligned(16))) a[1024]; |
| 22 |
float __attribute__ ((aligned(16))) b[1024]; |
| 23 |
float __attribute__ ((aligned(16))) c[1024]; |
| 24 |
|
| 25 |
void |
| 26 |
tV() |
| 27 |
{ |
| 28 |
int i; |
| 29 |
for (i=0; i!=1024; ++i) |
| 30 |
{ |
| 31 |
float z = a[i]; |
| 32 |
int n = b[i]; |
| 33 |
c[i] = vect_ldexpf(z,n); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 38 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |