1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O3" } */
3 /* { dg-require-effective-target powerpc_vsx } */
4 /* { dg-final { scan-assembler "lxvd2x" } } */
5 /* { dg-final { scan-assembler "stxvd2x" } } */
6 /* { dg-final { scan-assembler "stxsdx" } } */
7 /* { dg-final { scan-assembler-times "xxpermdi" 1 } } */
9 /* The only xxpermdi expected is for the vec_splats. */
15 long long ca
[N
] __attribute__((aligned(16)));
16 long long cb
[N
] __attribute__((aligned(16)));
17 long long cc
[N
] __attribute__((aligned(16)));
18 long long cd
[N
] __attribute__((aligned(16)));
21 __attribute__((noinline
)) void foo ()
24 vector
long long va
, vb
, vc
, vd
, tmp
;
25 volatile unsigned long long three
= 3;
26 vector
unsigned long long threes
= vec_splats (three
);
27 for (i
= 0; i
< N
; i
+=2) {
28 vb
= vec_vsx_ld (0, (vector
long long *)&cb
[i
]);
29 vc
= vec_vsx_ld (0, (vector
long long *)&cc
[i
]);
30 vd
= vec_vsx_ld (0, (vector
long long *)&cd
[i
]);
31 tmp
= vec_add (vb
, vc
);
32 tmp
= vec_sub (tmp
, vd
);
33 tmp
= vec_sra (tmp
, threes
);
34 x
= vec_extract (tmp
, 0);
35 vec_vsx_st (tmp
, 0, (vector
long long *)&ca
[i
]);