1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=GNU
3 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefix=CHECK --check-prefix=WIN
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefix=CHECK --check-prefix=MAC
6 ; PR35672 - https://bugs.llvm.org/show_bug.cgi?id=35672
7 ; FIXME: We would not need the function-level attributes if FMF were propagated to DAG nodes for this case.
9 define float @exp_f32(float %x) #0 {
12 ; GNU-NEXT: jmp __expf_finite # TAILCALL
16 ; WIN-NEXT: jmp expf # TAILCALL
20 ; MAC-NEXT: jmp _expf ## TAILCALL
21 %r = tail call nnan ninf float @llvm.exp.f32(float %x)
25 define double @exp_f64(double %x) #0 {
28 ; GNU-NEXT: jmp __exp_finite # TAILCALL
32 ; WIN-NEXT: jmp exp # TAILCALL
36 ; MAC-NEXT: jmp _exp ## TAILCALL
37 %r = tail call nnan ninf double @llvm.exp.f64(double %x)
41 define x86_fp80 @exp_f80(x86_fp80 %x) #0 {
44 ; GNU-NEXT: subq $24, %rsp
45 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
46 ; GNU-NEXT: fstpt (%rsp)
47 ; GNU-NEXT: callq __expl_finite
48 ; GNU-NEXT: addq $24, %rsp
53 ; WIN-NEXT: pushq %rsi
54 ; WIN-NEXT: subq $64, %rsp
55 ; WIN-NEXT: movq %rcx, %rsi
56 ; WIN-NEXT: fldt (%rdx)
57 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
58 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
59 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
60 ; WIN-NEXT: callq expl
61 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
62 ; WIN-NEXT: fstpt (%rsi)
63 ; WIN-NEXT: movq %rsi, %rax
64 ; WIN-NEXT: addq $64, %rsp
70 ; MAC-NEXT: subq $24, %rsp
71 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
72 ; MAC-NEXT: fstpt (%rsp)
73 ; MAC-NEXT: callq _expl
74 ; MAC-NEXT: addq $24, %rsp
76 %r = tail call nnan ninf x86_fp80 @llvm.exp.f80(x86_fp80 %x)
80 define float @exp2_f32(float %x) #0 {
81 ; GNU-LABEL: exp2_f32:
83 ; GNU-NEXT: jmp __exp2f_finite # TAILCALL
85 ; WIN-LABEL: exp2_f32:
87 ; WIN-NEXT: jmp exp2f # TAILCALL
89 ; MAC-LABEL: exp2_f32:
91 ; MAC-NEXT: jmp _exp2f ## TAILCALL
92 %r = tail call nnan ninf float @llvm.exp2.f32(float %x)
96 define double @exp2_f64(double %x) #0 {
97 ; GNU-LABEL: exp2_f64:
99 ; GNU-NEXT: jmp __exp2_finite # TAILCALL
101 ; WIN-LABEL: exp2_f64:
103 ; WIN-NEXT: jmp exp2 # TAILCALL
105 ; MAC-LABEL: exp2_f64:
107 ; MAC-NEXT: jmp _exp2 ## TAILCALL
108 %r = tail call nnan ninf double @llvm.exp2.f64(double %x)
112 define x86_fp80 @exp2_f80(x86_fp80 %x) #0 {
113 ; GNU-LABEL: exp2_f80:
115 ; GNU-NEXT: subq $24, %rsp
116 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
117 ; GNU-NEXT: fstpt (%rsp)
118 ; GNU-NEXT: callq __exp2l_finite
119 ; GNU-NEXT: addq $24, %rsp
122 ; WIN-LABEL: exp2_f80:
124 ; WIN-NEXT: pushq %rsi
125 ; WIN-NEXT: subq $64, %rsp
126 ; WIN-NEXT: movq %rcx, %rsi
127 ; WIN-NEXT: fldt (%rdx)
128 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
129 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
130 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
131 ; WIN-NEXT: callq exp2l
132 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
133 ; WIN-NEXT: fstpt (%rsi)
134 ; WIN-NEXT: movq %rsi, %rax
135 ; WIN-NEXT: addq $64, %rsp
136 ; WIN-NEXT: popq %rsi
139 ; MAC-LABEL: exp2_f80:
141 ; MAC-NEXT: subq $24, %rsp
142 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
143 ; MAC-NEXT: fstpt (%rsp)
144 ; MAC-NEXT: callq _exp2l
145 ; MAC-NEXT: addq $24, %rsp
147 %r = tail call nnan ninf x86_fp80 @llvm.exp2.f80(x86_fp80 %x)
151 define float @log_f32(float %x) #0 {
152 ; GNU-LABEL: log_f32:
154 ; GNU-NEXT: jmp __logf_finite # TAILCALL
156 ; WIN-LABEL: log_f32:
158 ; WIN-NEXT: jmp logf # TAILCALL
160 ; MAC-LABEL: log_f32:
162 ; MAC-NEXT: jmp _logf ## TAILCALL
163 %r = tail call nnan ninf float @llvm.log.f32(float %x)
167 define double @log_f64(double %x) #0 {
168 ; GNU-LABEL: log_f64:
170 ; GNU-NEXT: jmp __log_finite # TAILCALL
172 ; WIN-LABEL: log_f64:
174 ; WIN-NEXT: jmp log # TAILCALL
176 ; MAC-LABEL: log_f64:
178 ; MAC-NEXT: jmp _log ## TAILCALL
179 %r = tail call nnan ninf double @llvm.log.f64(double %x)
183 define x86_fp80 @log_f80(x86_fp80 %x) #0 {
184 ; GNU-LABEL: log_f80:
186 ; GNU-NEXT: subq $24, %rsp
187 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
188 ; GNU-NEXT: fstpt (%rsp)
189 ; GNU-NEXT: callq __logl_finite
190 ; GNU-NEXT: addq $24, %rsp
193 ; WIN-LABEL: log_f80:
195 ; WIN-NEXT: pushq %rsi
196 ; WIN-NEXT: subq $64, %rsp
197 ; WIN-NEXT: movq %rcx, %rsi
198 ; WIN-NEXT: fldt (%rdx)
199 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
200 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
201 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
202 ; WIN-NEXT: callq logl
203 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
204 ; WIN-NEXT: fstpt (%rsi)
205 ; WIN-NEXT: movq %rsi, %rax
206 ; WIN-NEXT: addq $64, %rsp
207 ; WIN-NEXT: popq %rsi
210 ; MAC-LABEL: log_f80:
212 ; MAC-NEXT: subq $24, %rsp
213 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
214 ; MAC-NEXT: fstpt (%rsp)
215 ; MAC-NEXT: callq _logl
216 ; MAC-NEXT: addq $24, %rsp
218 %r = tail call nnan ninf x86_fp80 @llvm.log.f80(x86_fp80 %x)
222 define float @log2_f32(float %x) #0 {
223 ; GNU-LABEL: log2_f32:
225 ; GNU-NEXT: jmp __log2f_finite # TAILCALL
227 ; WIN-LABEL: log2_f32:
229 ; WIN-NEXT: jmp log2f # TAILCALL
231 ; MAC-LABEL: log2_f32:
233 ; MAC-NEXT: jmp _log2f ## TAILCALL
234 %r = tail call nnan ninf float @llvm.log2.f32(float %x)
238 define double @log2_f64(double %x) #0 {
239 ; GNU-LABEL: log2_f64:
241 ; GNU-NEXT: jmp __log2_finite # TAILCALL
243 ; WIN-LABEL: log2_f64:
245 ; WIN-NEXT: jmp log2 # TAILCALL
247 ; MAC-LABEL: log2_f64:
249 ; MAC-NEXT: jmp _log2 ## TAILCALL
250 %r = tail call nnan ninf double @llvm.log2.f64(double %x)
254 define x86_fp80 @log2_f80(x86_fp80 %x) #0 {
255 ; GNU-LABEL: log2_f80:
257 ; GNU-NEXT: subq $24, %rsp
258 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
259 ; GNU-NEXT: fstpt (%rsp)
260 ; GNU-NEXT: callq __log2l_finite
261 ; GNU-NEXT: addq $24, %rsp
264 ; WIN-LABEL: log2_f80:
266 ; WIN-NEXT: pushq %rsi
267 ; WIN-NEXT: subq $64, %rsp
268 ; WIN-NEXT: movq %rcx, %rsi
269 ; WIN-NEXT: fldt (%rdx)
270 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
271 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
272 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
273 ; WIN-NEXT: callq log2l
274 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
275 ; WIN-NEXT: fstpt (%rsi)
276 ; WIN-NEXT: movq %rsi, %rax
277 ; WIN-NEXT: addq $64, %rsp
278 ; WIN-NEXT: popq %rsi
281 ; MAC-LABEL: log2_f80:
283 ; MAC-NEXT: subq $24, %rsp
284 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
285 ; MAC-NEXT: fstpt (%rsp)
286 ; MAC-NEXT: callq _log2l
287 ; MAC-NEXT: addq $24, %rsp
289 %r = tail call nnan ninf x86_fp80 @llvm.log2.f80(x86_fp80 %x)
293 define float @log10_f32(float %x) #0 {
294 ; GNU-LABEL: log10_f32:
296 ; GNU-NEXT: jmp __log10f_finite # TAILCALL
298 ; WIN-LABEL: log10_f32:
300 ; WIN-NEXT: jmp log10f # TAILCALL
302 ; MAC-LABEL: log10_f32:
304 ; MAC-NEXT: jmp _log10f ## TAILCALL
305 %r = tail call nnan ninf float @llvm.log10.f32(float %x)
309 define double @log10_f64(double %x) #0 {
310 ; GNU-LABEL: log10_f64:
312 ; GNU-NEXT: jmp __log10_finite # TAILCALL
314 ; WIN-LABEL: log10_f64:
316 ; WIN-NEXT: jmp log10 # TAILCALL
318 ; MAC-LABEL: log10_f64:
320 ; MAC-NEXT: jmp _log10 ## TAILCALL
321 %r = tail call nnan ninf double @llvm.log10.f64(double %x)
325 define x86_fp80 @log10_f80(x86_fp80 %x) #0 {
326 ; GNU-LABEL: log10_f80:
328 ; GNU-NEXT: subq $24, %rsp
329 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
330 ; GNU-NEXT: fstpt (%rsp)
331 ; GNU-NEXT: callq __log10l_finite
332 ; GNU-NEXT: addq $24, %rsp
335 ; WIN-LABEL: log10_f80:
337 ; WIN-NEXT: pushq %rsi
338 ; WIN-NEXT: subq $64, %rsp
339 ; WIN-NEXT: movq %rcx, %rsi
340 ; WIN-NEXT: fldt (%rdx)
341 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
342 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
343 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
344 ; WIN-NEXT: callq log10l
345 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
346 ; WIN-NEXT: fstpt (%rsi)
347 ; WIN-NEXT: movq %rsi, %rax
348 ; WIN-NEXT: addq $64, %rsp
349 ; WIN-NEXT: popq %rsi
352 ; MAC-LABEL: log10_f80:
354 ; MAC-NEXT: subq $24, %rsp
355 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
356 ; MAC-NEXT: fstpt (%rsp)
357 ; MAC-NEXT: callq _log10l
358 ; MAC-NEXT: addq $24, %rsp
360 %r = tail call nnan ninf x86_fp80 @llvm.log10.f80(x86_fp80 %x)
364 define float @pow_f32(float %x) #0 {
365 ; GNU-LABEL: pow_f32:
367 ; GNU-NEXT: movaps %xmm0, %xmm1
368 ; GNU-NEXT: jmp __powf_finite # TAILCALL
370 ; WIN-LABEL: pow_f32:
372 ; WIN-NEXT: movaps %xmm0, %xmm1
373 ; WIN-NEXT: jmp powf # TAILCALL
375 ; MAC-LABEL: pow_f32:
377 ; MAC-NEXT: movaps %xmm0, %xmm1
378 ; MAC-NEXT: jmp _powf ## TAILCALL
379 %r = tail call nnan ninf float @llvm.pow.f32(float %x, float %x)
383 define double @pow_f64(double %x) #0 {
384 ; GNU-LABEL: pow_f64:
386 ; GNU-NEXT: movaps %xmm0, %xmm1
387 ; GNU-NEXT: jmp __pow_finite # TAILCALL
389 ; WIN-LABEL: pow_f64:
391 ; WIN-NEXT: movaps %xmm0, %xmm1
392 ; WIN-NEXT: jmp pow # TAILCALL
394 ; MAC-LABEL: pow_f64:
396 ; MAC-NEXT: movaps %xmm0, %xmm1
397 ; MAC-NEXT: jmp _pow ## TAILCALL
398 %r = tail call nnan ninf double @llvm.pow.f64(double %x, double %x)
402 define x86_fp80 @pow_f80(x86_fp80 %x) #0 {
403 ; GNU-LABEL: pow_f80:
405 ; GNU-NEXT: subq $40, %rsp
406 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp)
407 ; GNU-NEXT: fld %st(0)
408 ; GNU-NEXT: fstpt {{[0-9]+}}(%rsp)
409 ; GNU-NEXT: fstpt (%rsp)
410 ; GNU-NEXT: callq __powl_finite
411 ; GNU-NEXT: addq $40, %rsp
414 ; WIN-LABEL: pow_f80:
416 ; WIN-NEXT: pushq %rsi
417 ; WIN-NEXT: subq $80, %rsp
418 ; WIN-NEXT: movq %rcx, %rsi
419 ; WIN-NEXT: fldt (%rdx)
420 ; WIN-NEXT: fld %st(0)
421 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
422 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp)
423 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
424 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
425 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
426 ; WIN-NEXT: callq powl
427 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp)
428 ; WIN-NEXT: fstpt (%rsi)
429 ; WIN-NEXT: movq %rsi, %rax
430 ; WIN-NEXT: addq $80, %rsp
431 ; WIN-NEXT: popq %rsi
434 ; MAC-LABEL: pow_f80:
436 ; MAC-NEXT: subq $40, %rsp
437 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp)
438 ; MAC-NEXT: fld %st(0)
439 ; MAC-NEXT: fstpt {{[0-9]+}}(%rsp)
440 ; MAC-NEXT: fstpt (%rsp)
441 ; MAC-NEXT: callq _powl
442 ; MAC-NEXT: addq $40, %rsp
444 %r = tail call nnan ninf x86_fp80 @llvm.pow.f80(x86_fp80 %x, x86_fp80 %x)
448 declare float @llvm.exp.f32(float) #1
449 declare double @llvm.exp.f64(double) #1
450 declare x86_fp80 @llvm.exp.f80(x86_fp80) #1
452 declare float @llvm.exp2.f32(float) #1
453 declare double @llvm.exp2.f64(double) #1
454 declare x86_fp80 @llvm.exp2.f80(x86_fp80) #1
456 declare float @llvm.log.f32(float) #1
457 declare double @llvm.log.f64(double) #1
458 declare x86_fp80 @llvm.log.f80(x86_fp80) #1
460 declare float @llvm.log2.f32(float) #1
461 declare double @llvm.log2.f64(double) #1
462 declare x86_fp80 @llvm.log2.f80(x86_fp80) #1
464 declare float @llvm.log10.f32(float) #1
465 declare double @llvm.log10.f64(double) #1
466 declare x86_fp80 @llvm.log10.f80(x86_fp80) #1
468 declare float @llvm.pow.f32(float, float) #1
469 declare double @llvm.pow.f64(double, double) #1
470 declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) #1
472 attributes #0 = { nounwind "no-infs-fp-math"="true" "no-nans-fp-math"="true" }
473 attributes #1 = { nounwind readnone speculatable }