1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model=dynamic" } */
9 typedef vector
long long vll_sign
;
10 typedef vector
unsigned long long vll_uns
;
11 typedef vector
bool long long vll_bool
;
13 typedef vector
int vi_sign
;
14 typedef vector
unsigned int vi_uns
;
15 typedef vector
bool int vi_bool
;
17 typedef vector
short vs_sign
;
18 typedef vector
unsigned short vs_uns
;
19 typedef vector
bool short vs_bool
;
21 typedef vector
signed char vc_sign
;
22 typedef vector
unsigned char vc_uns
;
23 typedef vector
bool char vc_bool
;
26 vi_sign
vi_pack_1 (vll_sign a
, vll_sign b
)
28 return __builtin_altivec_vpkudum (a
, b
);
31 vi_sign
vi_pack_2 (vll_sign a
, vll_sign b
)
33 return vec_pack (a
, b
);
36 vi_sign
vi_pack_3 (vll_sign a
, vll_sign b
)
38 return vec_vpkudum (a
, b
);
41 vs_sign
vs_pack_1 (vi_sign a
, vi_sign b
)
43 return __builtin_altivec_vpkuwum (a
, b
);
46 vs_sign
vs_pack_2 (vi_sign a
, vi_sign b
)
48 return vec_pack (a
, b
);
51 vs_sign
vs_pack_3 (vi_sign a
, vi_sign b
)
53 return vec_vpkuwum (a
, b
);
56 vc_sign
vc_pack_1 (vs_sign a
, vs_sign b
)
58 return __builtin_altivec_vpkuhum (a
, b
);
61 vc_sign
vc_pack_2 (vs_sign a
, vs_sign b
)
63 return vec_pack (a
, b
);
66 vc_sign
vc_pack_3 (vs_sign a
, vs_sign b
)
68 return vec_vpkuhum (a
, b
);
71 vll_sign
vll_unpack_hi_1 (vi_sign a
)
73 return __builtin_altivec_vupkhsw (a
);
76 vll_sign
vll_unpack_hi_2 (vi_sign a
)
78 return vec_unpackh (a
);
81 vll_sign
vll_unpack_hi_3 (vi_sign a
)
83 return __builtin_vec_vupkhsw (a
);
86 vll_sign
vll_unpack_lo_1 (vi_sign a
)
88 return vec_vupklsw (a
);
91 vll_sign
vll_unpack_lo_2 (vi_sign a
)
93 return vec_unpackl (a
);
96 vll_sign
vll_unpack_lo_3 (vi_sign a
)
98 return vec_vupklsw (a
);
101 /* { dg-final { scan-assembler-times "vpkudum" 3 } } */
102 /* { dg-final { scan-assembler-times "vpkuwum" 3 } } */
103 /* { dg-final { scan-assembler-times "vpkuhum" 3 } } */
104 /* { dg-final { scan-assembler-times "vupklsw" 3 } } */
105 /* { dg-final { scan-assembler-times "vupkhsw" 3 } } */