1 /* Verify that overloaded built-ins for vec_extract() with long long
2 inputs produce the right code for a P9 (LE) target. */
3
4 /* { dg-do compile { target { powerpc*-*-linux* && le } } } */
5 /* { dg-require-effective-target powerpc_p9vector_ok } */
6 /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
7
8 // targeting P9 (LE), six tests.
9 // p9 constants: mfvsrd
10 // p9 vars: xori, rldic, mtvsrdd, vslo, mfvsrd
11
12 /* results. */
13 /* { dg-final { scan-assembler-times {\mxori\M} 3 } } */
14 /* { dg-final { scan-assembler-times {\mrldic\M} 3 } } */
15 /* { dg-final { scan-assembler-times {\mmtvsrdd\M} 3 } } */
16 /* { dg-final { scan-assembler-times {\mvslo\M} 3 } } */
17 /* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 } } */
18
19 #include <altivec.h>
20
21 unsigned long long
testbl_var(vector bool long long vbl2,signed int si)22 testbl_var (vector bool long long vbl2, signed int si)
23 {
24 return vec_extract (vbl2, si);
25 }
26
27 signed long long
testsl_var(vector signed long long vsl2,signed int si)28 testsl_var (vector signed long long vsl2, signed int si)
29 {
30 return vec_extract (vsl2, si);
31 }
32
33 unsigned long long
testul_var(vector unsigned long long vul2,signed int si)34 testul_var (vector unsigned long long vul2, signed int si)
35 {
36 return vec_extract (vul2, si);
37 }
38
39 unsigned long long
testbl_cst(vector bool long long vbl2)40 testbl_cst (vector bool long long vbl2)
41 {
42 return vec_extract (vbl2, 1);
43 }
44
45 signed long long
testsl_cst(vector signed long long vsl2)46 testsl_cst (vector signed long long vsl2)
47 {
48 return vec_extract (vsl2, 1);
49 }
50
51 unsigned long long
testul_cst(vector unsigned long vul2)52 testul_cst (vector unsigned long vul2)
53 {
54 return vec_extract (vul2, 1);
55 }
56
57