Skip to content

Commit 3dbde8a

Browse files
[Power9] Add __float128 builtins for Round To Odd
Add a number of builtins for __float128 Round To Odd. This is the Clang portion of the builtins work. Differential Revision: https://reviews.llvm.org/D47548 llvm-svn: 336579
1 parent 83a5fe1 commit 3dbde8a

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

clang/include/clang/Basic/BuiltinsPPC.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,14 @@ BUILTIN(__builtin_vsx_extractuword, "V2ULLiV16UcIi", "")
423423
BUILTIN(__builtin_vsx_xxpermdi, "v.", "t")
424424
BUILTIN(__builtin_vsx_xxsldwi, "v.", "t")
425425

426+
// Float 128 built-ins
427+
BUILTIN(__builtin_sqrtf128_round_to_odd, "LLdLLd", "")
428+
BUILTIN(__builtin_addf128_round_to_odd, "LLdLLdLLd", "")
429+
BUILTIN(__builtin_subf128_round_to_odd, "LLdLLdLLd", "")
430+
BUILTIN(__builtin_mulf128_round_to_odd, "LLdLLdLLd", "")
431+
BUILTIN(__builtin_divf128_round_to_odd, "LLdLLdLLd", "")
432+
BUILTIN(__builtin_fmaf128_round_to_odd, "LLdLLdLLdLLd", "")
433+
426434
// HTM builtins
427435
BUILTIN(__builtin_tbegin, "UiUIi", "")
428436
BUILTIN(__builtin_tend, "UiUIi", "")
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm \
2+
// RUN: -target-cpu pwr9 -target-feature +float128 -o - %s | FileCheck %s
3+
4+
__float128 A;
5+
__float128 B;
6+
__float128 C;
7+
8+
9+
__float128 testSqrtOdd() {
10+
return __builtin_sqrtf128_round_to_odd(A);
11+
// CHECK: @llvm.ppc.sqrtf128.round.to.odd(fp128
12+
// CHECK-NEXT: ret fp128
13+
}
14+
15+
__float128 testFMAOdd() {
16+
return __builtin_fmaf128_round_to_odd(A, B, C);
17+
// CHECK: @llvm.ppc.fmaf128.round.to.odd(fp128 %{{.+}}, fp128 %{{.+}}, fp128
18+
// CHECK-NEXT: ret fp128
19+
}
20+
21+
__float128 testAddOdd() {
22+
return __builtin_addf128_round_to_odd(A, B);
23+
// CHECK: @llvm.ppc.addf128.round.to.odd(fp128 %{{.+}}, fp128
24+
// CHECK-NEXT: ret fp128
25+
}
26+
27+
__float128 testSubOdd() {
28+
return __builtin_subf128_round_to_odd(A, B);
29+
// CHECK: @llvm.ppc.subf128.round.to.odd(fp128 %{{.+}}, fp128
30+
// CHECK-NEXT: ret fp128
31+
}
32+
33+
__float128 testMulOdd() {
34+
return __builtin_mulf128_round_to_odd(A, B);
35+
// CHECK: @llvm.ppc.mulf128.round.to.odd(fp128 %{{.+}}, fp128
36+
// CHECK-NEXT: ret fp128
37+
}
38+
39+
__float128 testDivOdd() {
40+
return __builtin_divf128_round_to_odd(A, B);
41+
// CHECK: @llvm.ppc.divf128.round.to.odd(fp128 %{{.+}}, fp128
42+
// CHECK-NEXT: ret fp128
43+
}
44+
45+

0 commit comments

Comments
 (0)