1 /* Verify that overloaded built-ins for vec_extract() with
2 double inputs produce the right code with a P8 (LE or BE) target. */
3
4 /* { dg-do compile } */
5 /* { dg-require-effective-target powerpc_p8vector_ok } */
6 /* { dg-options "-mdejagnu-cpu=power8 -O2" } */
7
8 // targeting P8, BE and LE. 2 tests.
9 // P8 (LE) constants: xxlor
10 // P8 (LE) variables: xori, rldic, mtvsrd, xxpermdi, vslo, xxlor
11 // P8 (BE) constants: xxpermdi
12 // P8 (BE) variables: rldic, mtvsrd, xxpermdi, vslo, xxlor
13
14 /* { dg-final { scan-assembler-times {\mxxlor\M} 2 { target { le && lp64 } } } } */
15 /* { dg-final { scan-assembler-times {\mxxlor\M} 1 { target { be && lp64 } } } } */
16 /* { dg-final { scan-assembler-times {\mxori\M} 1 { target { le } } } } */
17 /* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 1 } } */
18 /* { dg-final { scan-assembler-times {\mmtvsrd\M} 1 { target lp64 } } } */
19 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 1 { target { le } } } } */
20 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 2 { target { lp64 && be } } } } */
21 /* { dg-final { scan-assembler-times {\mvslo\M} 1 { target lp64 } } } */
22
23 /* { dg-final { scan-assembler-times {\mstxvd2x\M} 1 { target ilp32 } } } */
24 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 1 { target ilp32 } } } */
25
26 #include <altivec.h>
27
28 double
29 testd_var (vector double vd2, signed int si)
30 {
31 return vec_extract (vd2, si);
32 }
33
34 double
35 testd_cst (vector double vd2)
36 {
37 return vec_extract (vd2, 1);
38 }
39