1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
5 define void @si64(i64 %x, i64 %y, ptr %p, ptr %q) nounwind {
10 ; X86-NEXT: pushl %edi
11 ; X86-NEXT: pushl %esi
12 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
13 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
14 ; X86-NEXT: pushl %ebp
15 ; X86-NEXT: pushl %ebx
16 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
17 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
18 ; X86-NEXT: calll __divdi3
19 ; X86-NEXT: addl $16, %esp
20 ; X86-NEXT: movl %eax, %esi
21 ; X86-NEXT: movl %edx, %edi
22 ; X86-NEXT: pushl %ebp
23 ; X86-NEXT: pushl %ebx
24 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
25 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
26 ; X86-NEXT: calll __moddi3
27 ; X86-NEXT: addl $16, %esp
28 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
29 ; X86-NEXT: movl %edi, 4(%ecx)
30 ; X86-NEXT: movl %esi, (%ecx)
31 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
32 ; X86-NEXT: movl %edx, 4(%ecx)
33 ; X86-NEXT: movl %eax, (%ecx)
42 ; X64-NEXT: movq %rdx, %r8
43 ; X64-NEXT: movq %rdi, %rax
45 ; X64-NEXT: idivq %rsi
46 ; X64-NEXT: movq %rax, (%r8)
47 ; X64-NEXT: movq %rdx, (%rcx)
56 define void @si32(i32 %x, i32 %y, ptr %p, ptr %q) nounwind {
59 ; X86-NEXT: pushl %esi
60 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
62 ; X86-NEXT: idivl {{[0-9]+}}(%esp)
63 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
64 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
65 ; X86-NEXT: movl %eax, (%esi)
66 ; X86-NEXT: movl %edx, (%ecx)
72 ; X64-NEXT: movq %rdx, %r8
73 ; X64-NEXT: movl %edi, %eax
75 ; X64-NEXT: idivl %esi
76 ; X64-NEXT: movl %eax, (%r8)
77 ; X64-NEXT: movl %edx, (%rcx)
86 define void @si16(i16 %x, i16 %y, ptr %p, ptr %q) nounwind {
89 ; X86-NEXT: pushl %esi
90 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
92 ; X86-NEXT: idivw {{[0-9]+}}(%esp)
93 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
94 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
95 ; X86-NEXT: movw %ax, (%esi)
96 ; X86-NEXT: movw %dx, (%ecx)
102 ; X64-NEXT: movq %rdx, %r8
103 ; X64-NEXT: movl %edi, %eax
104 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
106 ; X64-NEXT: idivw %si
107 ; X64-NEXT: movw %ax, (%r8)
108 ; X64-NEXT: movw %dx, (%rcx)
117 define void @si8(i8 %x, i8 %y, ptr %p, ptr %q) nounwind {
120 ; X86-NEXT: pushl %ebx
121 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
122 ; X86-NEXT: idivb {{[0-9]+}}(%esp)
123 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
124 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
125 ; X86-NEXT: movsbl %ah, %ebx
126 ; X86-NEXT: movb %al, (%edx)
127 ; X86-NEXT: movb %bl, (%ecx)
128 ; X86-NEXT: popl %ebx
133 ; X64-NEXT: movsbl %dil, %eax
134 ; X64-NEXT: idivb %sil
135 ; X64-NEXT: movsbl %ah, %esi
136 ; X64-NEXT: movb %al, (%rdx)
137 ; X64-NEXT: movb %sil, (%rcx)
146 define void @ui64(i64 %x, i64 %y, ptr %p, ptr %q) nounwind {
149 ; X86-NEXT: pushl %ebp
150 ; X86-NEXT: pushl %ebx
151 ; X86-NEXT: pushl %edi
152 ; X86-NEXT: pushl %esi
153 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
154 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
155 ; X86-NEXT: pushl %ebp
156 ; X86-NEXT: pushl %ebx
157 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
158 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
159 ; X86-NEXT: calll __udivdi3
160 ; X86-NEXT: addl $16, %esp
161 ; X86-NEXT: movl %eax, %esi
162 ; X86-NEXT: movl %edx, %edi
163 ; X86-NEXT: pushl %ebp
164 ; X86-NEXT: pushl %ebx
165 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
166 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
167 ; X86-NEXT: calll __umoddi3
168 ; X86-NEXT: addl $16, %esp
169 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
170 ; X86-NEXT: movl %edi, 4(%ecx)
171 ; X86-NEXT: movl %esi, (%ecx)
172 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
173 ; X86-NEXT: movl %edx, 4(%ecx)
174 ; X86-NEXT: movl %eax, (%ecx)
175 ; X86-NEXT: popl %esi
176 ; X86-NEXT: popl %edi
177 ; X86-NEXT: popl %ebx
178 ; X86-NEXT: popl %ebp
183 ; X64-NEXT: movq %rdx, %r8
184 ; X64-NEXT: movq %rdi, %rax
185 ; X64-NEXT: xorl %edx, %edx
186 ; X64-NEXT: divq %rsi
187 ; X64-NEXT: movq %rax, (%r8)
188 ; X64-NEXT: movq %rdx, (%rcx)
197 define void @ui32(i32 %x, i32 %y, ptr %p, ptr %q) nounwind {
200 ; X86-NEXT: pushl %esi
201 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
202 ; X86-NEXT: xorl %edx, %edx
203 ; X86-NEXT: divl {{[0-9]+}}(%esp)
204 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
205 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
206 ; X86-NEXT: movl %eax, (%esi)
207 ; X86-NEXT: movl %edx, (%ecx)
208 ; X86-NEXT: popl %esi
213 ; X64-NEXT: movq %rdx, %r8
214 ; X64-NEXT: movl %edi, %eax
215 ; X64-NEXT: xorl %edx, %edx
216 ; X64-NEXT: divl %esi
217 ; X64-NEXT: movl %eax, (%r8)
218 ; X64-NEXT: movl %edx, (%rcx)
227 define void @ui16(i16 %x, i16 %y, ptr %p, ptr %q) nounwind {
230 ; X86-NEXT: pushl %esi
231 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
232 ; X86-NEXT: xorl %edx, %edx
233 ; X86-NEXT: divw {{[0-9]+}}(%esp)
234 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
235 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
236 ; X86-NEXT: movw %ax, (%esi)
237 ; X86-NEXT: movw %dx, (%ecx)
238 ; X86-NEXT: popl %esi
243 ; X64-NEXT: movq %rdx, %r8
244 ; X64-NEXT: movl %edi, %eax
245 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
246 ; X64-NEXT: xorl %edx, %edx
248 ; X64-NEXT: movw %ax, (%r8)
249 ; X64-NEXT: movw %dx, (%rcx)
258 define void @ui8(i8 %x, i8 %y, ptr %p, ptr %q) nounwind {
261 ; X86-NEXT: pushl %ebx
262 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
263 ; X86-NEXT: divb {{[0-9]+}}(%esp)
264 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
265 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
266 ; X86-NEXT: movzbl %ah, %ebx
267 ; X86-NEXT: movb %al, (%edx)
268 ; X86-NEXT: movb %bl, (%ecx)
269 ; X86-NEXT: popl %ebx
274 ; X64-NEXT: movzbl %dil, %eax
275 ; X64-NEXT: divb %sil
276 ; X64-NEXT: movzbl %ah, %esi
277 ; X64-NEXT: movb %al, (%rdx)
278 ; X64-NEXT: movb %sil, (%rcx)