1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
5 define void @si64(i64 %x, i64 %y, i64* %p, i64* %q) nounwind {
10 ; X32-NEXT: pushl %edi
11 ; X32-NEXT: pushl %esi
12 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
13 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebp
14 ; X32-NEXT: pushl %ebp
15 ; X32-NEXT: pushl %ebx
16 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
17 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
18 ; X32-NEXT: calll __divdi3
19 ; X32-NEXT: addl $16, %esp
20 ; X32-NEXT: movl %eax, %esi
21 ; X32-NEXT: movl %edx, %edi
22 ; X32-NEXT: pushl %ebp
23 ; X32-NEXT: pushl %ebx
24 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
25 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
26 ; X32-NEXT: calll __moddi3
27 ; X32-NEXT: addl $16, %esp
28 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
29 ; X32-NEXT: movl %edi, 4(%ecx)
30 ; X32-NEXT: movl %esi, (%ecx)
31 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
32 ; X32-NEXT: movl %edx, 4(%ecx)
33 ; X32-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, i32* %p, i32* %q) nounwind {
59 ; X32-NEXT: pushl %esi
60 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
62 ; X32-NEXT: idivl {{[0-9]+}}(%esp)
63 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
64 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
65 ; X32-NEXT: movl %eax, (%esi)
66 ; X32-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, i16* %p, i16* %q) nounwind {
89 ; X32-NEXT: pushl %esi
90 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
92 ; X32-NEXT: idivw {{[0-9]+}}(%esp)
93 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
94 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
95 ; X32-NEXT: movw %ax, (%esi)
96 ; X32-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)
112 store i16 %r, i16* %p
113 store i16 %t, i16* %q
117 define void @si8(i8 %x, i8 %y, i8* %p, i8* %q) nounwind {
120 ; X32-NEXT: pushl %ebx
121 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
122 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
123 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
124 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
125 ; X32-NEXT: movsbl %ah, %ebx
126 ; X32-NEXT: movb %al, (%edx)
127 ; X32-NEXT: movb %bl, (%ecx)
128 ; X32-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, i64* %p, i64* %q) nounwind {
149 ; X32-NEXT: pushl %ebp
150 ; X32-NEXT: pushl %ebx
151 ; X32-NEXT: pushl %edi
152 ; X32-NEXT: pushl %esi
153 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
154 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebp
155 ; X32-NEXT: pushl %ebp
156 ; X32-NEXT: pushl %ebx
157 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
158 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
159 ; X32-NEXT: calll __udivdi3
160 ; X32-NEXT: addl $16, %esp
161 ; X32-NEXT: movl %eax, %esi
162 ; X32-NEXT: movl %edx, %edi
163 ; X32-NEXT: pushl %ebp
164 ; X32-NEXT: pushl %ebx
165 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
166 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
167 ; X32-NEXT: calll __umoddi3
168 ; X32-NEXT: addl $16, %esp
169 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
170 ; X32-NEXT: movl %edi, 4(%ecx)
171 ; X32-NEXT: movl %esi, (%ecx)
172 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
173 ; X32-NEXT: movl %edx, 4(%ecx)
174 ; X32-NEXT: movl %eax, (%ecx)
175 ; X32-NEXT: popl %esi
176 ; X32-NEXT: popl %edi
177 ; X32-NEXT: popl %ebx
178 ; X32-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)
192 store i64 %r, i64* %p
193 store i64 %t, i64* %q
197 define void @ui32(i32 %x, i32 %y, i32* %p, i32* %q) nounwind {
200 ; X32-NEXT: pushl %esi
201 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
202 ; X32-NEXT: xorl %edx, %edx
203 ; X32-NEXT: divl {{[0-9]+}}(%esp)
204 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
205 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
206 ; X32-NEXT: movl %eax, (%esi)
207 ; X32-NEXT: movl %edx, (%ecx)
208 ; X32-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)
222 store i32 %r, i32* %p
223 store i32 %t, i32* %q
227 define void @ui16(i16 %x, i16 %y, i16* %p, i16* %q) nounwind {
230 ; X32-NEXT: pushl %esi
231 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
232 ; X32-NEXT: xorl %edx, %edx
233 ; X32-NEXT: divw {{[0-9]+}}(%esp)
234 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
235 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
236 ; X32-NEXT: movw %ax, (%esi)
237 ; X32-NEXT: movw %dx, (%ecx)
238 ; X32-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)
253 store i16 %r, i16* %p
254 store i16 %t, i16* %q
258 define void @ui8(i8 %x, i8 %y, i8* %p, i8* %q) nounwind {
261 ; X32-NEXT: pushl %ebx
262 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
263 ; X32-NEXT: divb {{[0-9]+}}(%esp)
264 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
265 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
266 ; X32-NEXT: movzbl %ah, %ebx
267 ; X32-NEXT: movb %al, (%edx)
268 ; X32-NEXT: movb %bl, (%ecx)
269 ; X32-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)