From: Nemanja Ivanovic Date: Thu, 22 Apr 2021 10:38:11 +0000 (-0500) Subject: [PowerPC] Add vec_roundm as alias for vec_floor in altivec.h X-Git-Tag: llvmorg-14-init~8773 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a466670595a9d4d41b1e221ac0f76183c5d096b;p=platform%2Fupstream%2Fllvm.git [PowerPC] Add vec_roundm as alias for vec_floor in altivec.h Add the overloads for compatibility with XLC. --- diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 878fe66..8486f97 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -3729,6 +3729,15 @@ static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { } #endif +/* vec_roundm */ +static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { + return vec_floor(__a); +} + +static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { + return vec_floor(__a); +} + /* vec_vrfim */ static __inline__ vector float __attribute__((__always_inline__)) diff --git a/clang/test/CodeGen/builtins-ppc-vsx.c b/clang/test/CodeGen/builtins-ppc-vsx.c index 5389979..9492423 100644 --- a/clang/test/CodeGen/builtins-ppc-vsx.c +++ b/clang/test/CodeGen/builtins-ppc-vsx.c @@ -775,6 +775,14 @@ void test1() { // CHECK: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) // CHECK-LE: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) + res_vf = vec_roundm(vf); +// CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_roundm(vd); +// CHECK: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) + res_vf = vec_madd(vf, vf, vf); // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}) // CHECK-LE: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}})