Author: Nemanja Ivanovic Date: 2021-04-22T05:31:38-05:00 New Revision: 3bcd0ece43bd117b9931d2b010b50884aa74870a
URL: https://github.com/llvm/llvm-project/commit/3bcd0ece43bd117b9931d2b010b50884aa74870a DIFF: https://github.com/llvm/llvm-project/commit/3bcd0ece43bd117b9931d2b010b50884aa74870a.diff LOG: [PowerPC] Add vec_roundc as alias for vec_rint in altivec.h For compatibility with XLC, add these overloads. Added: Modified: clang/lib/Headers/altivec.h clang/test/CodeGen/builtins-ppc-vsx.c Removed: ################################################################################ diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 81e4cb686d8d..878fe666dad5 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -8150,6 +8150,16 @@ static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { return __builtin_vsx_xvrdpic(__a); } +/* vec_roundc */ + +static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { + return __builtin_vsx_xvrspic(__a); +} + +static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { + return __builtin_vsx_xvrdpic(__a); +} + /* vec_nearbyint */ static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { diff --git a/clang/test/CodeGen/builtins-ppc-vsx.c b/clang/test/CodeGen/builtins-ppc-vsx.c index f6157cf46778..5389979722d8 100644 --- a/clang/test/CodeGen/builtins-ppc-vsx.c +++ b/clang/test/CodeGen/builtins-ppc-vsx.c @@ -996,6 +996,14 @@ void test1() { // CHECK: call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %{{[0-9]+}}) // CHECK-LE: call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %{{[0-9]+}}) + res_vf = vec_roundc(vf); +// CHECK: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_roundc(vd); +// CHECK: call <2 x double> @llvm.rint.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.rint.v2f64(<2 x double> %{{[0-9]+}}) + res_vd = vec_rsqrte(vd); // CHECK: call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %{{[0-9]+}}) // CHECK-LE: call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %{{[0-9]+}}) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits