diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 935eac3c8672..55f04d0efbd6 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -15347,25 +15347,57 @@ static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, /* vec_all_nle */ -static __inline__ int __attribute__((__always_inline__)) +static __inline__ int __ATTRS_o_ai vec_all_nle(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); +#else return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); +#endif } +#ifdef __VSX__ +static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, + vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); +} +#endif + /* vec_all_nlt */ -static __inline__ int __attribute__((__always_inline__)) +static __inline__ int __ATTRS_o_ai vec_all_nlt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); +#endif } +#ifdef __VSX__ +static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, + vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); +} +#endif + /* vec_all_numeric */ -static __inline__ int __attribute__((__always_inline__)) +static __inline__ int __ATTRS_o_ai vec_all_numeric(vector float __a) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); +#endif } +#ifdef __VSX__ +static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); +} +#endif + /* vec_any_eq */ static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, diff --git a/clang/test/CodeGen/builtins-ppc-vsx.c b/clang/test/CodeGen/builtins-ppc-vsx.c index 53370cb3949e..398a5023eaf3 100644 --- a/clang/test/CodeGen/builtins-ppc-vsx.c +++ b/clang/test/CodeGen/builtins-ppc-vsx.c @@ -93,6 +93,34 @@ void test1() { // CHECK: fadd <2 x double> // CHECK-LE: fadd <2 x double> + res_i = vec_all_nle(vf, vf); +// CHECK: @llvm.ppc.vsx.xvcmpgesp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpgesp.p + + res_i = vec_all_nle(vd, vd); +// CHECK: @llvm.ppc.vsx.xvcmpgedp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpgedp.p + + res_i = vec_all_nlt(vf, vf); +// CHECK: @llvm.ppc.vsx.xvcmpgtsp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpgtsp.p + + res_i = vec_all_nlt(vd, vd); +// CHECK: @llvm.ppc.vsx.xvcmpgtdp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpgtdp.p + + res_i = vec_all_numeric(vf); +// CHECK: @llvm.ppc.vsx.xvcmpeqsp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpeqsp.p + + res_i = vec_all_numeric(vd); +// CHECK: @llvm.ppc.vsx.xvcmpeqdp.p +// CHECK-LE: @llvm.ppc.vsx.xvcmpeqdp.p + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + res_vd = vec_and(vbll, vd); // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double>