]> granicus.if.org Git - clang/commitdiff
[PowerPC] Add VSX builtins for vec_div
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 14 Nov 2014 12:10:51 +0000 (12:10 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 14 Nov 2014 12:10:51 +0000 (12:10 +0000)
This patch adds builtin support for xvdivdp and xvdivsp, along with a
new test case.  The builtins are accessed using vec_div in altivec.h.
Builtins are listed (mostly) alphabetically there, so inserting these
changed the line numbers for deprecation warnings tested in
test/Headers/altivec-intrin.c.

There is a companion patch for LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221984 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/BuiltinsPPC.def
lib/Headers/altivec.h
test/CodeGen/builtins-ppc-vsx.c
test/Headers/altivec-intrin.c

index 12bf58f74e55f750da262562a126299239a72b62..e42af4244160b455d4778ff1bdbcc5e33f6aeb14 100644 (file)
@@ -220,6 +220,9 @@ BUILTIN(__builtin_vsx_xvmindp, "V2dV2dV2d", "")
 BUILTIN(__builtin_vsx_xvminsp, "V4fV4fV4f", "")
 BUILTIN(__builtin_vsx_xsmindp, "ddd", "")
 
+BUILTIN(__builtin_vsx_xvdivdp, "V2dV2dV2d", "")
+BUILTIN(__builtin_vsx_xvdivsp, "V4fV4fV4f", "")
+
 // FIXME: Obviously incomplete.
 
 #undef BUILTIN
index 6e33091db2f7f4997773b6ab55af59f9ef623679..5e27a8327b472e5cdbf92c0b1f6c099df14899a9 100644 (file)
@@ -1623,6 +1623,21 @@ vec_vctuxs(vector float __a, int __b)
   return __builtin_altivec_vctuxs(__a, __b);
 }
 
+/* vec_div */
+#ifdef __VSX__
+static vector float __ATTRS_o_ai
+vec_div(vector float __a, vector float __b)
+{
+  return __builtin_vsx_xvdivsp(__a, __b);
+}
+
+static vector double __ATTRS_o_ai
+vec_div(vector double __a, vector double __b)
+{
+  return __builtin_vsx_xvdivdp(__a, __b);
+}
+#endif
+
 /* vec_dss */
 
 static void __attribute__((__always_inline__))
index 9bd0a5df6f20f3eb75852f7073d25de8e313dc78..a5e3e4f441cdf1383cfe6bface039517db0ab66f 100644 (file)
@@ -20,6 +20,13 @@ double res_d;
 void test1() {
 // CHECK-LABEL: define void @test1
 
+  /* vec_div */
+  res_vf = vec_div(vf, vf);
+// CHECK: @llvm.ppc.vsx.xvdivsp
+
+  res_vd = vec_div(vd, vd);
+// CHECK: @llvm.ppc.vsx.xvdivdp
+
   /* vec_max */
   res_vf = vec_max(vf, vf);
 // CHECK: @llvm.ppc.vsx.xvmaxsp
index 5ec4e9d3e76a844737d64b88c7f53329a75bf892..a4de7e75966bcf0fa5657bf4bcb9533c6485d4fe 100644 (file)
@@ -14,5 +14,5 @@ int main()
 }
 // FIXME: As noted in ms-intrin.cpp, it would be nice if we didn't have to
 // hard-code the line number from altivec.h here.
-// expected-note@altivec.h:2374 {{deprecated here}}
-// expected-note@altivec.h:2509 {{deprecated here}}
+// expected-note@altivec.h:2389 {{deprecated here}}
+// expected-note@altivec.h:2524 {{deprecated here}}