1 ; RUN: opt < %s -libcalls-shrinkwrap -S | FileCheck %s
3 ; RUN: opt < %s -passes=libcalls-shrinkwrap -S | FileCheck %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 define void @test_range_error(x86_fp80 %value) {
10 %call_0 = call x86_fp80 @coshl(x86_fp80 %value)
11 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKC00CB174000000000000
12 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK400CB174000000000000
13 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
14 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT:[0-9]+]]
15 ; CHECK: [[CALL_LABEL]]:
16 ; CHECK-NEXT: %call_0 = call x86_fp80 @coshl(x86_fp80 %value)
17 ; CHECK-NEXT: br label %[[END_LABEL]]
18 ; CHECK: [[END_LABEL]]:
20 %call_1 = call x86_fp80 @expl(x86_fp80 %value)
21 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKC00CB21C000000000000
22 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK400CB170000000000000
23 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
24 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
25 ; CHECK: [[CALL_LABEL]]:
26 ; CHECK-NEXT: %call_1 = call x86_fp80 @expl(x86_fp80 %value)
27 ; CHECK-NEXT: br label %[[END_LABEL]]
28 ; CHECK: [[END_LABEL]]:
30 %call_3 = call x86_fp80 @exp2l(x86_fp80 %value)
31 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKC00D807A000000000000
32 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK400CB1DC000000000000
33 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
34 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
35 ; CHECK: [[CALL_LABEL]]:
36 ; CHECK-NEXT: %call_3 = call x86_fp80 @exp2l(x86_fp80 %value)
37 ; CHECK-NEXT: br label %[[END_LABEL]]
38 ; CHECK: [[END_LABEL]]:
40 %call_4 = call x86_fp80 @sinhl(x86_fp80 %value)
41 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKC00CB174000000000000
42 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK400CB174000000000000
43 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
44 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
45 ; CHECK: [[CALL_LABEL]]:
46 ; CHECK-NEXT: %call_4 = call x86_fp80 @sinhl(x86_fp80 %value)
47 ; CHECK-NEXT: br label %[[END_LABEL]]
48 ; CHECK: [[END_LABEL]]:
50 %call_5 = call x86_fp80 @expm1l(x86_fp80 %value)
51 ; CHECK: [[COND:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK400CB170000000000000
52 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
53 ; CHECK: [[CALL_LABEL]]:
54 ; CHECK-NEXT: %call_5 = call x86_fp80 @expm1l(x86_fp80 %value)
55 ; CHECK-NEXT: br label %[[END_LABEL]]
56 ; CHECK: [[END_LABEL]]:
61 declare x86_fp80 @coshl(x86_fp80)
62 declare x86_fp80 @expl(x86_fp80)
63 declare x86_fp80 @exp10l(x86_fp80)
64 declare x86_fp80 @exp2l(x86_fp80)
65 declare x86_fp80 @sinhl(x86_fp80)
66 declare x86_fp80 @expm1l(x86_fp80)
68 define void @test_domain_error(x86_fp80 %value) {
70 %call_00 = call x86_fp80 @acosl(x86_fp80 %value)
71 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK3FFF8000000000000000
72 ; CHECK: [[COND2:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKBFFF8000000000000000
73 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
74 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
75 ; CHECK: [[CALL_LABEL]]:
76 ; CHECK-NEXT: %call_00 = call x86_fp80 @acosl(x86_fp80 %value)
77 ; CHECK-NEXT: br label %[[END_LABEL]]
78 ; CHECK: [[END_LABEL]]:
80 %call_01 = call x86_fp80 @asinl(x86_fp80 %value)
81 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt x86_fp80 %value, 0xK3FFF8000000000000000
82 ; CHECK: [[COND2:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xKBFFF8000000000000000
83 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
84 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
85 ; CHECK: [[CALL_LABEL]]:
86 ; CHECK-NEXT: %call_01 = call x86_fp80 @asinl(x86_fp80 %value)
87 ; CHECK-NEXT: br label %[[END_LABEL]]
88 ; CHECK: [[END_LABEL]]:
90 %call_02 = call x86_fp80 @cosl(x86_fp80 %value)
91 ; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xKFFFF8000000000000000
92 ; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xK7FFF8000000000000000
93 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
94 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
95 ; CHECK: [[CALL_LABEL]]:
96 ; CHECK-NEXT: %call_02 = call x86_fp80 @cosl(x86_fp80 %value)
97 ; CHECK-NEXT: br label %[[END_LABEL]]
98 ; CHECK: [[END_LABEL]]:
100 %call_03 = call x86_fp80 @sinl(x86_fp80 %value)
101 ; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xKFFFF8000000000000000
102 ; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xK7FFF8000000000000000
103 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
104 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
105 ; CHECK: [[CALL_LABEL]]:
106 ; CHECK-NEXT: %call_03 = call x86_fp80 @sinl(x86_fp80 %value)
107 ; CHECK-NEXT: br label %[[END_LABEL]]
108 ; CHECK: [[END_LABEL]]:
110 %call_04 = call x86_fp80 @acoshl(x86_fp80 %value)
111 ; CHECK: [[COND:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xK3FFF8000000000000000
112 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
113 ; CHECK: [[CALL_LABEL]]:
114 ; CHECK-NEXT: %call_04 = call x86_fp80 @acoshl(x86_fp80 %value)
115 ; CHECK-NEXT: br label %[[END_LABEL]]
116 ; CHECK: [[END_LABEL]]:
118 %call_05 = call x86_fp80 @sqrtl(x86_fp80 %value)
119 ; CHECK: [[COND:%[0-9]+]] = fcmp olt x86_fp80 %value, 0xK00000000000000000000
120 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
121 ; CHECK: [[CALL_LABEL]]:
122 ; CHECK-NEXT: %call_05 = call x86_fp80 @sqrtl(x86_fp80 %value)
123 ; CHECK-NEXT: br label %[[END_LABEL]]
124 ; CHECK: [[END_LABEL]]:
126 %call_06 = call x86_fp80 @atanhl(x86_fp80 %value)
127 ; CHECK: [[COND1:%[0-9]+]] = fcmp oge x86_fp80 %value, 0xK3FFF8000000000000000
128 ; CHECK: [[COND2:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xKBFFF8000000000000000
129 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
130 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
131 ; CHECK: [[CALL_LABEL]]:
132 ; CHECK-NEXT: %call_06 = call x86_fp80 @atanhl(x86_fp80 %value)
133 ; CHECK-NEXT: br label %[[END_LABEL]]
134 ; CHECK: [[END_LABEL]]:
136 %call_07 = call x86_fp80 @logl(x86_fp80 %value)
137 ; CHECK: [[COND:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xK00000000000000000000
138 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
139 ; CHECK: [[CALL_LABEL]]:
140 ; CHECK-NEXT: %call_07 = call x86_fp80 @logl(x86_fp80 %value)
141 ; CHECK-NEXT: br label %[[END_LABEL]]
142 ; CHECK: [[END_LABEL]]:
144 %call_08 = call x86_fp80 @log10l(x86_fp80 %value)
145 ; CHECK: [[COND:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xK00000000000000000000
146 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
147 ; CHECK: [[CALL_LABEL]]:
148 ; CHECK-NEXT: %call_08 = call x86_fp80 @log10l(x86_fp80 %value)
149 ; CHECK-NEXT: br label %[[END_LABEL]]
150 ; CHECK: [[END_LABEL]]:
152 %call_09 = call x86_fp80 @log2l(x86_fp80 %value)
153 ; CHECK: [[COND:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xK00000000000000000000
154 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
155 ; CHECK: [[CALL_LABEL]]:
156 ; CHECK-NEXT: %call_09 = call x86_fp80 @log2l(x86_fp80 %value)
157 ; CHECK-NEXT: br label %[[END_LABEL]]
158 ; CHECK: [[END_LABEL]]:
160 %call_10 = call x86_fp80 @logbl(x86_fp80 %value)
161 ; CHECK: [[COND:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xK00000000000000000000
162 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
163 ; CHECK: [[CALL_LABEL]]:
164 ; CHECK-NEXT: %call_10 = call x86_fp80 @logbl(x86_fp80 %value)
165 ; CHECK-NEXT: br label %[[END_LABEL]]
166 ; CHECK: [[END_LABEL]]:
168 %call_11 = call x86_fp80 @log1pl(x86_fp80 %value)
169 ; CHECK: [[COND:%[0-9]+]] = fcmp ole x86_fp80 %value, 0xKBFFF8000000000000000
170 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
171 ; CHECK: [[CALL_LABEL]]:
172 ; CHECK-NEXT: %call_11 = call x86_fp80 @log1pl(x86_fp80 %value)
173 ; CHECK-NEXT: br label %[[END_LABEL]]
174 ; CHECK: [[END_LABEL]]:
179 declare x86_fp80 @acosl(x86_fp80)
180 declare x86_fp80 @asinl(x86_fp80)
181 declare x86_fp80 @cosl(x86_fp80)
182 declare x86_fp80 @sinl(x86_fp80)
183 declare x86_fp80 @acoshl(x86_fp80)
184 declare x86_fp80 @sqrtl(x86_fp80)
185 declare x86_fp80 @atanhl(x86_fp80)
186 declare x86_fp80 @logl(x86_fp80)
187 declare x86_fp80 @log10l(x86_fp80)
188 declare x86_fp80 @log2l(x86_fp80)
189 declare x86_fp80 @logbl(x86_fp80)
190 declare x86_fp80 @log1pl(x86_fp80)
192 ; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}