[PATCH] D48482: [Power9] [CLANG] Add __float128 support for trunc to double round to odd

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 06:47:31 PDT 2018


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

Add support for this builtin:
double __builtin_truncf128_round_to_odd(__float128)


https://reviews.llvm.org/D48482

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,6 +42,12 @@
 // CHECK-NEXT: ret fp128
 }
 
+double testTruncOdd() {
+  return __builtin_truncf128_round_to_odd(A);
+// CHECK: @llvm.ppc.truncf128.round.to.odd(fp128
+// CHECK-NEXT: ret double
+}
+
 __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
Index: include/clang/Basic/BuiltinsPPC.def
===================================================================
--- include/clang/Basic/BuiltinsPPC.def
+++ include/clang/Basic/BuiltinsPPC.def
@@ -430,6 +430,7 @@
 BUILTIN(__builtin_mulf128_round_to_odd, "LLdLLdLLd", "")
 BUILTIN(__builtin_divf128_round_to_odd, "LLdLLdLLd", "")
 BUILTIN(__builtin_fmaf128_round_to_odd, "LLdLLdLLdLLd", "")
+BUILTIN(__builtin_truncf128_round_to_odd, "dLLd", "")
 
 BUILTIN(__builtin_vsx_scalar_extract_expq, "ULLiLLd", "")
 BUILTIN(__builtin_vsx_scalar_insert_exp_qp, "LLdLLdULLi", "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48482.152466.patch
Type: text/x-patch
Size: 1131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180622/e54cf44f/attachment.bin>


More information about the llvm-commits mailing list