1 /* Verify that overloaded built-ins for vec_extract() with long long
2    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 P8LE and P8BE, six tests total.
9 // P8 (LE) constants: mfvsrd
10 // P8 (LE) variables: xori, rldic, mtvsrd, xxpermdi, vslo, mfvsrd
11 // P8 (BE) constants: xxpermdi, mfvsrd
12 // P8 (BE) Variables:       rldic, mtvsrd, xxpermdi, vslo, mfvsrd
13 
14 /* results. */
15 /* { dg-final { scan-assembler-times {\mxori\M} 3 { target le } } } */
16 /* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 3 } } */
17 /* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvw4x\M} 4 { target ilp32 } } } */
18 /* { dg-final { scan-assembler-times {\madd\M} 3 { target ilp32 } } } */
19 /* { dg-final { scan-assembler-times {\mlwz\M} 11 { target ilp32 } } } */
20 /* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 { target lp64 } } } */
21 /* { dg-final { scan-assembler-times {\mmtvsrd\M} 3 { target lp64 } } } */
22 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 3 { target le } } } */
23 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 6 { target { be && lp64 } } } } */
24 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 2 { target { be && ilp32 } } } } */
25 /* { dg-final { scan-assembler-times {\mvslo\M} 3 { target lp64 } } } */
26 
27 #include <altivec.h>
28 
29 unsigned long long
testbl_var(vector bool long long vbl2,signed int si)30 testbl_var (vector bool long long vbl2, signed int si)
31 {
32   return vec_extract (vbl2, si);
33 }
34 
35 signed long long
testsl_var(vector signed long long vsl2,signed int si)36 testsl_var (vector signed long long vsl2, signed int si)
37 {
38   return vec_extract (vsl2, si);
39 }
40 
41 unsigned long long
testul_var(vector unsigned long long vul2,signed int si)42 testul_var (vector unsigned long long vul2, signed int si)
43 {
44   return vec_extract (vul2, si);
45 }
46 
47 unsigned long long
testbl_cst(vector bool long long vbl2)48 testbl_cst (vector bool long long vbl2)
49 {
50   return vec_extract (vbl2, 1);
51 }
52 
53 signed long long
testsl_cst(vector signed long long vsl2)54 testsl_cst (vector signed long long vsl2)
55 {
56   return vec_extract (vsl2, 1);
57 }
58 
59 unsigned long long
testul_cst(vector unsigned long vul2)60 testul_cst (vector unsigned long vul2)
61 {
62   return vec_extract (vul2, 1);
63 }
64 
65