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 for (int i = 0; i < 4; ++i)
20 {
21 if (a[i] != (i + 1) * (i + 1))
22 __builtin_abort ();
23 asm volatile ("" ::: "memory");
24 }
25 return 0;
26 }
27
28 /* On older powerpc hardware (POWER7 and earlier), the default flag
29 -mno-allow-movmisalign prevents vectorization. On POWER8 and later,
30 when vect_hw_misalign is true, vectorization occurs. */
31
32 /* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target {{ ! powerpc*-*-* } || { powerpc*-*-* && vect_hw_misalign }} } } } */