From: Stefan Pintilie Date: Mon, 24 Sep 2018 18:14:50 +0000 (+0000) Subject: [Power9] [CLANG] Add __float128 exponent GET and SET builtins X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=544685ca6d4fc1833fb22dd4de787eaa07df5f24;p=clang [Power9] [CLANG] Add __float128 exponent GET and SET builtins Added __builtin_vsx_scalar_extract_expq __builtin_vsx_scalar_insert_exp_qp Builtins should behave the same way as in GCC. Differential Revision: https://reviews.llvm.org/D48184 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342911 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index 6791e188bf..d31cb06f05 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -431,6 +431,8 @@ 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", "") // 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 c43915ad24..d0c89cea5b 100644 --- a/test/CodeGen/builtins-ppc-p9-f128.c +++ b/test/CodeGen/builtins-ppc-p9-f128.c @@ -48,3 +48,15 @@ double testTruncOdd() { // 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 +// 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 +} +