| 1 |
/* { dg-additional-options "-fno-math-errno -fdisable-tree-sincos" } */ |
| 2 |
/* { dg-require-effective-target vect_float } */ |
| 3 |
|
| 4 |
void __attribute__ ((noipa)) |
| 5 |
f (float *a) |
| 6 |
{ |
| 7 |
a[0] = a[0] * a[0]; |
| 8 |
a[1] = __builtin_powf (a[1], 2); |
| 9 |
a[2] = a[2] * a[2]; |
| 10 |
a[3] = __builtin_powf (a[3], 2); |
| 11 |
} |
| 12 |
|
| 13 |
float a[4] = { 1, 2, 3, 4 }; |
| 14 |
|
| 15 |
int |
| 16 |
main (void) |
| 17 |
{ |
| 18 |
f (a); |
| 19 |
#pragma GCC novector |
| 20 |
for (int i = 0; i < 4; ++i) |
| 21 |
{ |
| 22 |
if (a[i] != (i + 1) * (i + 1)) |
| 23 |
__builtin_abort (); |
| 24 |
asm volatile ("" ::: "memory"); |
| 25 |
} |
| 26 |
return 0; |
| 27 |
} |
| 28 |
|
| 29 |
/* On older powerpc hardware (POWER7 and earlier), the default flag |
| 30 |
-mno-allow-movmisalign prevents vectorization. On POWER8 and later, |
| 31 |
when vect_hw_misalign is true, vectorization occurs. */ |
| 32 |
|
| 33 |
/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target {{ ! powerpc*-*-* } || { powerpc*-*-* && vect_hw_misalign }} } } } */ |