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 { target { powerpc*-*-linux* } } } */
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 } } */
14 /* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstvx\M|\mstxv\M} 6 } } */
15 /* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 3 } } */
16 /* { dg-final { scan-assembler-times {\mlwz\M|\mlwa\M|\mlwzx\M|\mlwax\M} 6 } } */
17 
18 #include <altivec.h>
19 
20 unsigned int
testbi_var(vector bool int vbi2,signed int si)21 testbi_var (vector bool int vbi2, signed int si)
22 {
23   return vec_extract (vbi2, si);
24 }
25 
26 signed int
testsi_var(vector signed int vsi2,signed int si)27 testsi_var (vector signed int vsi2, signed int si)
28 {
29   return vec_extract (vsi2, si);
30 }
31 
32 unsigned int
testui_var(vector unsigned int vui2,signed int si)33 testui_var (vector unsigned int vui2, signed int si)
34 {
35   return vec_extract (vui2, si);
36 }
37 
38 unsigned int
testbi_cst(vector bool int vbi2)39 testbi_cst (vector bool int vbi2)
40 {
41   return vec_extract (vbi2, 12);
42 }
43 
44 signed int
testsi_cst(vector signed int vsi2)45 testsi_cst (vector signed int vsi2)
46 {
47   return vec_extract (vsi2, 12);
48 }
49 
50 unsigned int
testui_cst(vector unsigned int vui2)51 testui_cst (vector unsigned int vui2)
52 {
53   return vec_extract (vui2, 12);
54 }
55 
56