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: movb {{[0-9]+}}(%esp), %al
123 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
124 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
125 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
126 ; X32-NEXT: movsbl %ah, %ebx
127 ; X32-NEXT: movb %al, (%edx)
128 ; X32-NEXT: movb %bl, (%ecx)
129 ; X32-NEXT: popl %ebx
134 ; X64-NEXT: movl %edi, %eax
135 ; X64-NEXT: # kill: def $al killed $al killed $eax
137 ; X64-NEXT: idivb %sil
138 ; X64-NEXT: movsbl %ah, %esi
139 ; X64-NEXT: movb %al, (%rdx)
140 ; X64-NEXT: movb %sil, (%rcx)
149 define void @ui64(i64 %x, i64 %y, i64* %p, i64* %q) nounwind {
152 ; X32-NEXT: pushl %ebp
153 ; X32-NEXT: pushl %ebx
154 ; X32-NEXT: pushl %edi
155 ; X32-NEXT: pushl %esi
156 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
157 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebp
158 ; X32-NEXT: pushl %ebp
159 ; X32-NEXT: pushl %ebx
160 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
161 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
162 ; X32-NEXT: calll __udivdi3
163 ; X32-NEXT: addl $16, %esp
164 ; X32-NEXT: movl %eax, %esi
165 ; X32-NEXT: movl %edx, %edi
166 ; X32-NEXT: pushl %ebp
167 ; X32-NEXT: pushl %ebx
168 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
169 ; X32-NEXT: pushl {{[0-9]+}}(%esp)
170 ; X32-NEXT: calll __umoddi3
171 ; X32-NEXT: addl $16, %esp
172 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
173 ; X32-NEXT: movl %edi, 4(%ecx)
174 ; X32-NEXT: movl %esi, (%ecx)
175 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
176 ; X32-NEXT: movl %edx, 4(%ecx)
177 ; X32-NEXT: movl %eax, (%ecx)
178 ; X32-NEXT: popl %esi
179 ; X32-NEXT: popl %edi
180 ; X32-NEXT: popl %ebx
181 ; X32-NEXT: popl %ebp
186 ; X64-NEXT: movq %rdx, %r8
187 ; X64-NEXT: movq %rdi, %rax
188 ; X64-NEXT: xorl %edx, %edx
189 ; X64-NEXT: divq %rsi
190 ; X64-NEXT: movq %rax, (%r8)
191 ; X64-NEXT: movq %rdx, (%rcx)
195 store i64 %r, i64* %p
196 store i64 %t, i64* %q
200 define void @ui32(i32 %x, i32 %y, i32* %p, i32* %q) nounwind {
203 ; X32-NEXT: pushl %esi
204 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
205 ; X32-NEXT: xorl %edx, %edx
206 ; X32-NEXT: divl {{[0-9]+}}(%esp)
207 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
208 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
209 ; X32-NEXT: movl %eax, (%esi)
210 ; X32-NEXT: movl %edx, (%ecx)
211 ; X32-NEXT: popl %esi
216 ; X64-NEXT: movq %rdx, %r8
217 ; X64-NEXT: movl %edi, %eax
218 ; X64-NEXT: xorl %edx, %edx
219 ; X64-NEXT: divl %esi
220 ; X64-NEXT: movl %eax, (%r8)
221 ; X64-NEXT: movl %edx, (%rcx)
225 store i32 %r, i32* %p
226 store i32 %t, i32* %q
230 define void @ui16(i16 %x, i16 %y, i16* %p, i16* %q) nounwind {
233 ; X32-NEXT: pushl %esi
234 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
235 ; X32-NEXT: xorl %edx, %edx
236 ; X32-NEXT: divw {{[0-9]+}}(%esp)
237 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
238 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
239 ; X32-NEXT: movw %ax, (%esi)
240 ; X32-NEXT: movw %dx, (%ecx)
241 ; X32-NEXT: popl %esi
246 ; X64-NEXT: movq %rdx, %r8
247 ; X64-NEXT: movl %edi, %eax
248 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
249 ; X64-NEXT: xorl %edx, %edx
251 ; X64-NEXT: movw %ax, (%r8)
252 ; X64-NEXT: movw %dx, (%rcx)
256 store i16 %r, i16* %p
257 store i16 %t, i16* %q
261 define void @ui8(i8 %x, i8 %y, i8* %p, i8* %q) nounwind {
264 ; X32-NEXT: pushl %ebx
265 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
266 ; X32-NEXT: # kill: def $eax killed $eax def $ax
267 ; X32-NEXT: divb {{[0-9]+}}(%esp)
268 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
269 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
270 ; X32-NEXT: movzbl %ah, %ebx
271 ; X32-NEXT: movb %al, (%edx)
272 ; X32-NEXT: movb %bl, (%ecx)
273 ; X32-NEXT: popl %ebx
278 ; X64-NEXT: movzbl %dil, %eax
279 ; X64-NEXT: # kill: def $eax killed $eax def $ax
280 ; X64-NEXT: divb %sil
281 ; X64-NEXT: movzbl %ah, %esi
282 ; X64-NEXT: movb %al, (%rdx)
283 ; X64-NEXT: movb %sil, (%rcx)