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 { target { powerpc*-*-linux* } } } */
5 /* { dg-require-effective-target powerpc_p8vector_ok } */
6 /* { dg-options "-mdejagnu-cpu=power8 -O2" } */
7 
8 // targeting P8, both LE and BE. six tests.
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 {\maddi\M} 6 { target ilp32 } } } */
21 /* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 { target lp64 } } } */
22 /* { dg-final { scan-assembler-times {\mmtvsrd\M} 3 { target lp64 } } } */
23 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 3 { target le } } } */
24 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 6 { target { be && lp64 } } } } */
25 /* { dg-final { scan-assembler-times {\mxxpermdi\M} 2 { target { be && ilp32 } } } } */
26 /* { dg-final { scan-assembler-times {\mvslo\M} 3 { target lp64 } } } */
27 
28 #include <altivec.h>
29 
30 unsigned long long
testbl_var(vector bool long long vbl2,signed int si)31 testbl_var (vector bool long long vbl2, signed int si)
32 {
33   return vec_extract (vbl2, si);
34 }
35 
36 signed long long
testsl_var(vector signed long long vsl2,signed int si)37 testsl_var (vector signed long long vsl2, signed int si)
38 {
39   return vec_extract (vsl2, si);
40 }
41 
42 unsigned long long
testul_var(vector unsigned long long vul2,signed int si)43 testul_var (vector unsigned long long vul2, signed int si)
44 {
45   return vec_extract (vul2, si);
46 }
47 
48 unsigned long long
testbl_cst(vector bool long long vbl2)49 testbl_cst (vector bool long long vbl2)
50 {
51   return vec_extract (vbl2, 1);
52 }
53 
54 signed long long
testsl_cst(vector signed long long vsl2)55 testsl_cst (vector signed long long vsl2)
56 {
57   return vec_extract (vsl2, 1);
58 }
59 
60 unsigned long long
testul_cst(vector unsigned long vul2)61 testul_cst (vector unsigned long vul2)
62 {
63   return vec_extract (vul2, 1);
64 }
65 
66