[clang] d8e574c - [PowerPC] Add more missing overloads to altivec.h
Nemanja Ivanovic via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 22 20:08:55 PDT 2021
Author: Nemanja Ivanovic
Date: 2021-03-22T22:08:43-05:00
New Revision: d8e574c8e690841ea3f8a607b383c314043b70a0
URL: https://github.com/llvm/llvm-project/commit/d8e574c8e690841ea3f8a607b383c314043b70a0
DIFF: https://github.com/llvm/llvm-project/commit/d8e574c8e690841ea3f8a607b383c314043b70a0.diff
LOG: [PowerPC] Add more missing overloads to altivec.h
Add vec_cvf as a synonym for vec_doublee/vec_floate.
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 0d8961ef8b8c..55b84f93422e 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -3421,6 +3421,15 @@ vec_doubleo(vector float __a) {
return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
#endif
}
+
+/* vec_cvf */
+static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) {
+ return vec_doublee(__a);
+}
+
+static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) {
+ return vec_floate(__a);
+}
#endif
/* vec_div */
diff --git a/clang/test/CodeGen/builtins-ppc-vsx.c b/clang/test/CodeGen/builtins-ppc-vsx.c
index d133b5e3f517..7bfecb13a47e 100644
--- a/clang/test/CodeGen/builtins-ppc-vsx.c
+++ b/clang/test/CodeGen/builtins-ppc-vsx.c
@@ -1519,6 +1519,15 @@ void test1() {
// CHECK-LE: sub nsw i32 17
// CHECK-LE: sub nsw i32 18
// CHECK-LE: sub nsw i32 31
+// CHECK-LE: @llvm.ppc.altivec.vperm
+
+ res_vf = vec_cvf(vd);
+// CHECK: @llvm.ppc.vsx.xvcvdpsp
+// CHECK-LE: @llvm.ppc.vsx.xvcvdpsp
+// CHECK-LE: sub nsw i32 16
+// CHECK-LE: sub nsw i32 17
+// CHECK-LE: sub nsw i32 18
+// CHECK-LE: sub nsw i32 31
// CHECK-LE: @llvm.ppc.altivec.vperm
res_vf = vec_floato(vsll);
@@ -1581,6 +1590,15 @@ void test1() {
// CHECK-LE: sub nsw i32 18
// CHECK-LE: sub nsw i32 31
// CHECK-LE: @llvm.ppc.altivec.vperm
+// CHECK-LE: @llvm.ppc.vsx.xvcvspdp(<4 x float
+
+ res_vd = vec_cvf(vf);
+// CHECK: @llvm.ppc.vsx.xvcvspdp(<4 x float
+// CHECK-LE: sub nsw i32 16
+// CHECK-LE: sub nsw i32 17
+// CHECK-LE: sub nsw i32 18
+// CHECK-LE: sub nsw i32 31
+// CHECK-LE: @llvm.ppc.altivec.vperm
// CHECK-LE: @llvm.ppc.vsx.xvcvspdp(<4 x float
res_vd = vec_doubleh(vsi);
More information about the cfe-commits
mailing list