1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=CHECK,X86,X86-X87
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X86,X86-SSE
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X64
6 ; Ideally this would compile to 5 multiplies.
8 define double @pow_wrapper(double %a) nounwind readonly ssp noredzone {
9 ; X86-X87-LABEL: pow_wrapper:
11 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
12 ; X86-X87-NEXT: fld %st(0)
13 ; X86-X87-NEXT: fmul %st(1), %st
14 ; X86-X87-NEXT: fmul %st, %st(1)
15 ; X86-X87-NEXT: fmul %st, %st(0)
16 ; X86-X87-NEXT: fmul %st, %st(1)
17 ; X86-X87-NEXT: fmul %st, %st(0)
18 ; X86-X87-NEXT: fmulp %st, %st(1)
21 ; X86-SSE-LABEL: pow_wrapper:
23 ; X86-SSE-NEXT: pushl %ebp
24 ; X86-SSE-NEXT: movl %esp, %ebp
25 ; X86-SSE-NEXT: andl $-8, %esp
26 ; X86-SSE-NEXT: subl $8, %esp
27 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
28 ; X86-SSE-NEXT: movapd %xmm0, %xmm1
29 ; X86-SSE-NEXT: mulsd %xmm0, %xmm1
30 ; X86-SSE-NEXT: mulsd %xmm1, %xmm0
31 ; X86-SSE-NEXT: mulsd %xmm1, %xmm1
32 ; X86-SSE-NEXT: mulsd %xmm1, %xmm0
33 ; X86-SSE-NEXT: mulsd %xmm1, %xmm1
34 ; X86-SSE-NEXT: mulsd %xmm0, %xmm1
35 ; X86-SSE-NEXT: movsd %xmm1, (%esp)
36 ; X86-SSE-NEXT: fldl (%esp)
37 ; X86-SSE-NEXT: movl %ebp, %esp
38 ; X86-SSE-NEXT: popl %ebp
41 ; X64-LABEL: pow_wrapper:
43 ; X64-NEXT: movapd %xmm0, %xmm1
44 ; X64-NEXT: mulsd %xmm0, %xmm1
45 ; X64-NEXT: mulsd %xmm1, %xmm0
46 ; X64-NEXT: mulsd %xmm1, %xmm1
47 ; X64-NEXT: mulsd %xmm1, %xmm0
48 ; X64-NEXT: mulsd %xmm1, %xmm1
49 ; X64-NEXT: mulsd %xmm0, %xmm1
50 ; X64-NEXT: movapd %xmm1, %xmm0
52 %ret = tail call double @llvm.powi.f64(double %a, i32 15) nounwind ; <double> [#uses=1]
56 define double @pow_wrapper_optsize(double %a) optsize {
57 ; X86-X87-LABEL: pow_wrapper_optsize:
59 ; X86-X87-NEXT: subl $12, %esp
60 ; X86-X87-NEXT: .cfi_def_cfa_offset 16
61 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
62 ; X86-X87-NEXT: fstpl (%esp)
63 ; X86-X87-NEXT: movl $15, {{[0-9]+}}(%esp)
64 ; X86-X87-NEXT: calll __powidf2
65 ; X86-X87-NEXT: addl $12, %esp
66 ; X86-X87-NEXT: .cfi_def_cfa_offset 4
69 ; X86-SSE-LABEL: pow_wrapper_optsize:
71 ; X86-SSE-NEXT: subl $12, %esp
72 ; X86-SSE-NEXT: .cfi_def_cfa_offset 16
73 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
74 ; X86-SSE-NEXT: movsd %xmm0, (%esp)
75 ; X86-SSE-NEXT: movl $15, {{[0-9]+}}(%esp)
76 ; X86-SSE-NEXT: calll __powidf2
77 ; X86-SSE-NEXT: addl $12, %esp
78 ; X86-SSE-NEXT: .cfi_def_cfa_offset 4
81 ; X64-LABEL: pow_wrapper_optsize:
83 ; X64-NEXT: movl $15, %edi
84 ; X64-NEXT: jmp __powidf2 # TAILCALL
85 %ret = tail call double @llvm.powi.f64(double %a, i32 15) nounwind ; <double> [#uses=1]
89 define double @pow_wrapper_minsize(double %a) minsize {
90 ; X86-X87-LABEL: pow_wrapper_minsize:
92 ; X86-X87-NEXT: subl $12, %esp
93 ; X86-X87-NEXT: .cfi_def_cfa_offset 16
94 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
95 ; X86-X87-NEXT: fstpl (%esp)
96 ; X86-X87-NEXT: movl $15, {{[0-9]+}}(%esp)
97 ; X86-X87-NEXT: calll __powidf2
98 ; X86-X87-NEXT: addl $12, %esp
99 ; X86-X87-NEXT: .cfi_def_cfa_offset 4
102 ; X86-SSE-LABEL: pow_wrapper_minsize:
104 ; X86-SSE-NEXT: subl $12, %esp
105 ; X86-SSE-NEXT: .cfi_def_cfa_offset 16
106 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
107 ; X86-SSE-NEXT: movsd %xmm0, (%esp)
108 ; X86-SSE-NEXT: movl $15, {{[0-9]+}}(%esp)
109 ; X86-SSE-NEXT: calll __powidf2
110 ; X86-SSE-NEXT: addl $12, %esp
111 ; X86-SSE-NEXT: .cfi_def_cfa_offset 4
114 ; X64-LABEL: pow_wrapper_minsize:
116 ; X64-NEXT: pushq $15
117 ; X64-NEXT: .cfi_adjust_cfa_offset 8
118 ; X64-NEXT: popq %rdi
119 ; X64-NEXT: .cfi_adjust_cfa_offset -8
120 ; X64-NEXT: jmp __powidf2 # TAILCALL
121 %ret = tail call double @llvm.powi.f64(double %a, i32 15) nounwind ; <double> [#uses=1]
125 declare double @llvm.powi.f64(double, i32) nounwind readonly