[clang] 3a46667 - [PowerPC] Add vec_roundm as alias for vec_floor in altivec.h
Nemanja Ivanovic via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 22 08:31:23 PDT 2021
Author: Nemanja Ivanovic
Date: 2021-04-22T10:30:59-05:00
New Revision: 3a466670595a9d4d41b1e221ac0f76183c5d096b
URL: https://github.com/llvm/llvm-project/commit/3a466670595a9d4d41b1e221ac0f76183c5d096b
DIFF: https://github.com/llvm/llvm-project/commit/3a466670595a9d4d41b1e221ac0f76183c5d096b.diff
LOG: [PowerPC] Add vec_roundm as alias for vec_floor in altivec.h
Add the overloads for compatibility with XLC.
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 878fe666dad5..8486f97d2fa2 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 5389979722d8..94924237ce2c 100644
--- a/clang/test/CodeGen/builtins-ppc-vsx.c
+++ b/clang/test/CodeGen/builtins-ppc-vsx.c
@@ -773,6 +773,14 @@ void test1() {
res_vd = vec_floor(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_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);
More information about the cfe-commits
mailing list