[PowerPC] Add vec_roundm as alias for vec_floor in altivec.h
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 22 Apr 2021 10:38:11 +0000 (05:38 -0500)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 22 Apr 2021 15:30:59 +0000 (10:30 -0500)
Add the overloads for compatibility with XLC.

clang/lib/Headers/altivec.h
clang/test/CodeGen/builtins-ppc-vsx.c

index 878fe66..8486f97 100644 (file)
@@ -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__))
index 5389979..9492423 100644 (file)
@@ -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]+}})