1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O3 -ffast-math" } */
4 /* { dg-final { scan-assembler "lxvd2x" } } */
5 /* { dg-final { scan-assembler-not "xxpermdi" } } */
6 
7 /* Verify that swap optimization works correctly in the presence of
8    a V4SFmode reduction.  */
9 
10 extern double optvalue;
11 extern void obfuscate (float, unsigned int);
12 
13 void
foo(float * x,float * y,unsigned int n,unsigned int m)14 foo (float *x, float *y, unsigned int n, unsigned int m)
15 {
16   unsigned int i, j;
17   float sacc;
18   for (j = 0; j < m; ++j)
19     {
20       sacc = 0.0f;
21       for (i = 0; i < n; ++i)
22 	sacc += x[i] * y[i];
23       obfuscate (sacc, n);
24     }
25   optvalue = n * 2.0f * m;
26 }
27