diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 25c1b1de998df6..dadf6b5cf75bb8 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -12520,6 +12520,13 @@ vec_vrfiz(vector float __a) { /* The vector unpack instructions all have a big-endian bias, so for little endian we must reverse the meanings of "high" and "low." */ +#ifdef __LITTLE_ENDIAN__ +#define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) +#define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) +#else +#define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) +#define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) +#endif static __inline__ vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) { diff --git a/clang/test/CodeGen/builtins-ppc-altivec.c b/clang/test/CodeGen/builtins-ppc-altivec.c index e7593ca9021cf5..8edef9806af22f 100644 --- a/clang/test/CodeGen/builtins-ppc-altivec.c +++ b/clang/test/CodeGen/builtins-ppc-altivec.c @@ -5788,6 +5788,10 @@ void test6() { res_vui = vec_unpackh(vp); // CHECK: @llvm.ppc.altivec.vupkhpx +// CHECK-LE: @llvm.ppc.altivec.vupklpx + + res_vui = vec_vupkhpx(vp); +// CHECK: @llvm.ppc.altivec.vupkhpx // CHECK-LE: @llvm.ppc.altivec.vupklpx res_vs = vec_vupkhsb(vsc); @@ -5829,6 +5833,10 @@ void test6() { res_vui = vec_unpackl(vp); // CHECK: @llvm.ppc.altivec.vupklpx +// CHECK-LE: @llvm.ppc.altivec.vupkhpx + + res_vui = vec_vupklpx(vp); +// CHECK: @llvm.ppc.altivec.vupklpx // CHECK-LE: @llvm.ppc.altivec.vupkhpx res_vs = vec_vupklsb(vsc);