[PATCH] D48184: [Power9] [CLANG] Add __float128 exponent GET and SET builtins

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 11:56:32 PDT 2018


stefanp created this revision.
stefanp added reviewers: nemanjai, kbarton, hfinkel, syzaara, sfertile, lei.

Added

  __builtin_vsx_scalar_extract_expq
  __builtin_vsx_scalar_insert_exp_qp

Builtins should behave the same way as in GCC.


https://reviews.llvm.org/D48184

Files:
  include/clang/Basic/BuiltinsPPC.def
  test/CodeGen/builtins-ppc-p9-f128.c


Index: test/CodeGen/builtins-ppc-p9-f128.c
===================================================================
--- test/CodeGen/builtins-ppc-p9-f128.c
+++ test/CodeGen/builtins-ppc-p9-f128.c
@@ -42,4 +42,16 @@
 // CHECK-NEXT: ret fp128
 }
 
+__float128 insert_exp_qp(unsigned long long int b) {
+    return __builtin_vsx_scalar_insert_exp_qp(A, b);
+// CHECK: @llvm.ppc.scalar.insert.exp.qp(fp128 %{{.+}}, i64
+// CHECK-NEXT: ret fp128
+}
+
+unsigned long long int extract_exp() {
+    return __builtin_vsx_scalar_extract_expq(A);
+// CHECK: @llvm.ppc.scalar.extract.expq(fp128
+// CHECK-NEXT: ret i64
+}
+
 
Index: include/clang/Basic/BuiltinsPPC.def
===================================================================
--- include/clang/Basic/BuiltinsPPC.def
+++ include/clang/Basic/BuiltinsPPC.def
@@ -431,6 +431,9 @@
 BUILTIN(__builtin_divf128_round_to_odd, "LLdLLdLLd", "")
 BUILTIN(__builtin_fmaf128_round_to_odd, "LLdLLdLLdLLd", "")
 
+BUILTIN(__builtin_vsx_scalar_extract_expq, "ULLiLLd", "")
+BUILTIN(__builtin_vsx_scalar_insert_exp_qp, "LLdLLdULLi", "")
+
 // HTM builtins
 BUILTIN(__builtin_tbegin, "UiUIi", "")
 BUILTIN(__builtin_tend, "UiUIi", "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48184.151392.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180614/857ba0ba/attachment.bin>


More information about the llvm-commits mailing list