testsuite: enable and fix swaps-p8 testcases
[gcc.git] / gcc / testsuite / gcc.target / powerpc / swaps-p8-16.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O3" } */
4 /* { dg-final { scan-assembler "lxvd2x" } } */
5 /* { dg-final { scan-assembler "stxvd2x" } } */
6 /* { dg-final { scan-assembler "vspltw" } } */
7 /* { dg-final { scan-assembler-not "xxpermdi" } } */
8
9 #include <altivec.h>
10 void abort();
11
12 typedef struct xx {vector double l; vector double h;} xx;
13
14 #define N 4096
15 #define M 10000000
16 vector float ca[N][4] = {0};
17 vector float cb[N][4] = {0};
18 vector float cc[N][4] = {0};
19
20 __attribute__((noinline)) void foo ()
21 {
22 int i;
23 vector float brow;
24
25 for (i = 0; i < N; i++) {
26
27 brow = cb[i][0];
28 cc[i][0] = vec_mul(vec_splats(brow[0]), ca[i][0]);
29 cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]);
30 cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]);
31 cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]);
32
33 brow = cb[i][1];
34 cc[i][1] = vec_mul(vec_splats(brow[0]), ca[i][0]);
35 cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]);
36 cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]);
37 cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]);
38
39 brow = cb[i][2];
40 cc[i][2] = vec_mul(vec_splats(brow[0]), ca[i][0]);
41 cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]);
42 cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]);
43 cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]);
44
45 brow = cb[i][3];
46 cc[i][3] = vec_mul(vec_splats(brow[0]), ca[i][0]);
47 cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]);
48 cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]);
49 cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]);
50 }
51 }
52
53 int main ()
54 {
55 foo ();
56 return 0;
57 }