From 2098bf010ac1d68a9378edc1a04fda31812158d9 Mon Sep 17 00:00:00 2001 From: Stefan Pintilie Date: Mon, 9 Jul 2018 20:09:52 +0000 Subject: [PATCH] [Power9] [CLANG] Add __float128 support for trunc to double round to odd Add support for this builtin: double builtin_truncf128_round_to_odd(float128) Differential Revision: https://reviews.llvm.org/D48482 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336596 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/BuiltinsPPC.def | 1 + test/CodeGen/builtins-ppc-p9-f128.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index e3d71385eb..8cd8a2be20 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -430,6 +430,7 @@ BUILTIN(__builtin_subf128_round_to_odd, "LLdLLdLLd", "") 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", "") // HTM builtins BUILTIN(__builtin_tbegin, "UiUIi", "") diff --git a/test/CodeGen/builtins-ppc-p9-f128.c b/test/CodeGen/builtins-ppc-p9-f128.c index c0e8f6485c..c43915ad24 100644 --- a/test/CodeGen/builtins-ppc-p9-f128.c +++ b/test/CodeGen/builtins-ppc-p9-f128.c @@ -42,4 +42,9 @@ __float128 testDivOdd() { // 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 +} -- 2.40.0