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