1 /* Verify that overloaded built-ins for vec_extract() with int
2    inputs produce the right code with a P7 (BE) target.  */
3 
4 /* { dg-do compile } */
5 /* { dg-require-effective-target powerpc_vsx_ok } */
6 /* { dg-options "-mdejagnu-cpu=power7 -O2 " } */
7 
8 // Targeting P7 (BE).  6 tests total.
9 // P7 constant:   li, addi, stxvw4x, rldic, addi, lwzx/lwax
10 // P7 variables:  li, addi, stxvw4x, lwa/lwz
11 
12 /* { dg-final { scan-assembler-times {\mli\M} 6 } } */
13 /* { dg-final { scan-assembler-times {\maddi\M|\madd\M} 9 { target lp64 } } } */
14 /* { dg-final { scan-assembler-times {\maddi\M|\madd\M} 12 { target ilp32 } } } */
15 /* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstvx\M|\mstxv\M} 6 } } */
16 /* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 3 } } */
17 /* { dg-final { scan-assembler-times {\mlwz\M|\mlwa\M|\mlwzx\M|\mlwax\M} 6 } } */
18 
19 #include <altivec.h>
20 
21 unsigned int
testbi_var(vector bool int vbi2,signed int si)22 testbi_var (vector bool int vbi2, signed int si)
23 {
24   return vec_extract (vbi2, si);
25 }
26 
27 signed int
testsi_var(vector signed int vsi2,signed int si)28 testsi_var (vector signed int vsi2, signed int si)
29 {
30   return vec_extract (vsi2, si);
31 }
32 
33 unsigned int
testui_var(vector unsigned int vui2,signed int si)34 testui_var (vector unsigned int vui2, signed int si)
35 {
36   return vec_extract (vui2, si);
37 }
38 
39 unsigned int
testbi_cst(vector bool int vbi2)40 testbi_cst (vector bool int vbi2)
41 {
42   return vec_extract (vbi2, 12);
43 }
44 
45 signed int
testsi_cst(vector signed int vsi2)46 testsi_cst (vector signed int vsi2)
47 {
48   return vec_extract (vsi2, 12);
49 }
50 
51 unsigned int
testui_cst(vector unsigned int vui2)52 testui_cst (vector unsigned int vui2)
53 {
54   return vec_extract (vui2, 12);
55 }
56 
57