[clang] 1550c47 - [PowerPC] Add vec_roundp as alias for vec_ceil
Nemanja Ivanovic via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 22 08:31:27 PDT 2021
Author: Nemanja Ivanovic
Date: 2021-04-22T10:30:59-05:00
New Revision: 1550c47c18f05800b20af071da50881ffd996254
URL: https://github.com/llvm/llvm-project/commit/1550c47c18f05800b20af071da50881ffd996254
DIFF: https://github.com/llvm/llvm-project/commit/1550c47c18f05800b20af071da50881ffd996254.diff
LOG: [PowerPC] Add vec_roundp as alias for vec_ceil
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 b806aa9a55ce..a47d5f90dbe2 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -1627,6 +1627,17 @@ static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
}
#endif
+/* vec_roundp */
+static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) {
+ return vec_ceil(__a);
+}
+
+#ifdef __VSX__
+static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) {
+ return vec_ceil(__a);
+}
+#endif
+
/* vec_vrfip */
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 94924237ce2c..87cd776e2694 100644
--- a/clang/test/CodeGen/builtins-ppc-vsx.c
+++ b/clang/test/CodeGen/builtins-ppc-vsx.c
@@ -278,6 +278,14 @@ void test1() {
res_vf = vec_ceil(vf);
// CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}})
+// CHECK-LE: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}})
+
+ res_vd = vec_roundp(vd);
+// CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{[0-9]*}})
+// CHECK-LE: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{[0-9]*}})
+
+ res_vf = vec_roundp(vf);
+// CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}})
// CHECK-LE: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}})
res_vbll = vec_cmpeq(vd, vd);
More information about the cfe-commits
mailing list