29444c4cb97bc22d95d18a4cd0b429d689ec4807
[gcc.git] / gcc / testsuite / gcc.target / powerpc / swaps-p8-24.c
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 V4SFmode reduction. */
8
9 extern double optvalue;
10 extern void obfuscate (float, unsigned int);
11
12 void
13 foo (float *x, float *y, unsigned int n, unsigned int m)
14 {
15 unsigned int i, j;
16 float sacc;
17 for (j = 0; j < m; ++j)
18 {
19 sacc = 0.0f;
20 for (i = 0; i < n; ++i)
21 sacc += x[i] * y[i];
22 obfuscate (sacc, n);
23 }
24 optvalue = n * 2.0f * m;
25 }