Skip to content

Commit

Permalink
[Power9] [CLANG] Add __float128 exponent GET and SET builtins
Browse files Browse the repository at this point in the history
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

llvm-svn: 342911
  • Loading branch information
stefanp-ibm committed Sep 24, 2018
1 parent b530577 commit 9177cf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/BuiltinsPPC.def
Expand Up @@ -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", "")
Expand Down
12 changes: 12 additions & 0 deletions clang/test/CodeGen/builtins-ppc-p9-f128.c
Expand Up @@ -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
}

0 comments on commit 9177cf4

Please sign in to comment.