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 zeroext i8 @test_udivrem_zext_ah(i8 %x, i8 %y) {
6 ; X32-LABEL: test_udivrem_zext_ah:
8 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
9 ; X32-NEXT: # kill: def $eax killed $eax def $ax
10 ; X32-NEXT: divb {{[0-9]+}}(%esp)
11 ; X32-NEXT: movzbl %ah, %ecx
12 ; X32-NEXT: movb %al, z
13 ; X32-NEXT: movl %ecx, %eax
16 ; X64-LABEL: test_udivrem_zext_ah:
18 ; X64-NEXT: movzbl %dil, %eax
19 ; X64-NEXT: # kill: def $eax killed $eax def $ax
21 ; X64-NEXT: movzbl %ah, %ecx
22 ; X64-NEXT: movb %al, {{.*}}(%rip)
23 ; X64-NEXT: movl %ecx, %eax
31 define zeroext i8 @test_urem_zext_ah(i8 %x, i8 %y) {
32 ; X32-LABEL: test_urem_zext_ah:
34 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
35 ; X32-NEXT: # kill: def $eax killed $eax def $ax
36 ; X32-NEXT: divb {{[0-9]+}}(%esp)
37 ; X32-NEXT: movzbl %ah, %eax
38 ; X32-NEXT: # kill: def $al killed $al killed $eax
41 ; X64-LABEL: test_urem_zext_ah:
43 ; X64-NEXT: movzbl %dil, %eax
44 ; X64-NEXT: # kill: def $eax killed $eax def $ax
46 ; X64-NEXT: movzbl %ah, %eax
47 ; X64-NEXT: # kill: def $al killed $al killed $eax
53 define i8 @test_urem_noext_ah(i8 %x, i8 %y) {
54 ; X32-LABEL: test_urem_noext_ah:
56 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
57 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
58 ; X32-NEXT: # kill: def $eax killed $eax def $ax
60 ; X32-NEXT: movzbl %ah, %eax
61 ; X32-NEXT: addb %cl, %al
62 ; X32-NEXT: # kill: def $al killed $al killed $eax
65 ; X64-LABEL: test_urem_noext_ah:
67 ; X64-NEXT: movzbl %dil, %eax
68 ; X64-NEXT: # kill: def $eax killed $eax def $ax
70 ; X64-NEXT: movzbl %ah, %eax
71 ; X64-NEXT: addb %sil, %al
72 ; X64-NEXT: # kill: def $al killed $al killed $eax
79 define i64 @test_urem_zext64_ah(i8 %x, i8 %y) {
80 ; X32-LABEL: test_urem_zext64_ah:
82 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
83 ; X32-NEXT: # kill: def $eax killed $eax def $ax
84 ; X32-NEXT: divb {{[0-9]+}}(%esp)
85 ; X32-NEXT: movzbl %ah, %eax
86 ; X32-NEXT: xorl %edx, %edx
89 ; X64-LABEL: test_urem_zext64_ah:
91 ; X64-NEXT: movzbl %dil, %eax
92 ; X64-NEXT: # kill: def $eax killed $eax def $ax
94 ; X64-NEXT: movzbl %ah, %eax
97 %2 = zext i8 %1 to i64
101 define signext i8 @test_sdivrem_sext_ah(i8 %x, i8 %y) {
102 ; X32-LABEL: test_sdivrem_sext_ah:
104 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
106 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
107 ; X32-NEXT: movsbl %ah, %ecx
108 ; X32-NEXT: movb %al, z
109 ; X32-NEXT: movl %ecx, %eax
112 ; X64-LABEL: test_sdivrem_sext_ah:
114 ; X64-NEXT: movl %edi, %eax
115 ; X64-NEXT: # kill: def $al killed $al killed $eax
117 ; X64-NEXT: idivb %sil
118 ; X64-NEXT: movsbl %ah, %ecx
119 ; X64-NEXT: movb %al, {{.*}}(%rip)
120 ; X64-NEXT: movl %ecx, %eax
122 %div = sdiv i8 %x, %y
123 store i8 %div, i8* @z
128 define signext i8 @test_srem_sext_ah(i8 %x, i8 %y) {
129 ; X32-LABEL: test_srem_sext_ah:
131 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
133 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
134 ; X32-NEXT: movsbl %ah, %eax
135 ; X32-NEXT: # kill: def $al killed $al killed $eax
138 ; X64-LABEL: test_srem_sext_ah:
140 ; X64-NEXT: movl %edi, %eax
141 ; X64-NEXT: # kill: def $al killed $al killed $eax
143 ; X64-NEXT: idivb %sil
144 ; X64-NEXT: movsbl %ah, %eax
145 ; X64-NEXT: # kill: def $al killed $al killed $eax
151 define i8 @test_srem_noext_ah(i8 %x, i8 %y) {
152 ; X32-LABEL: test_srem_noext_ah:
154 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
156 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
157 ; X32-NEXT: idivb %cl
158 ; X32-NEXT: movsbl %ah, %eax
159 ; X32-NEXT: addb %cl, %al
160 ; X32-NEXT: # kill: def $al killed $al killed $eax
163 ; X64-LABEL: test_srem_noext_ah:
165 ; X64-NEXT: movl %edi, %eax
166 ; X64-NEXT: # kill: def $al killed $al killed $eax
168 ; X64-NEXT: idivb %sil
169 ; X64-NEXT: movsbl %ah, %eax
170 ; X64-NEXT: addb %sil, %al
171 ; X64-NEXT: # kill: def $al killed $al killed $eax
178 define i64 @test_srem_sext64_ah(i8 %x, i8 %y) {
179 ; X32-LABEL: test_srem_sext64_ah:
181 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
183 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
184 ; X32-NEXT: movsbl %ah, %eax
185 ; X32-NEXT: movl %eax, %edx
186 ; X32-NEXT: sarl $31, %edx
189 ; X64-LABEL: test_srem_sext64_ah:
191 ; X64-NEXT: movl %edi, %eax
192 ; X64-NEXT: # kill: def $al killed $al killed $eax
194 ; X64-NEXT: idivb %sil
195 ; X64-NEXT: movsbl %ah, %eax
199 %2 = sext i8 %1 to i64
203 define i64 @pr25754(i8 %a, i8 %c) {
204 ; X32-LABEL: pr25754:
206 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
207 ; X32-NEXT: # kill: def $eax killed $eax def $ax
208 ; X32-NEXT: divb {{[0-9]+}}(%esp)
209 ; X32-NEXT: movzbl %ah, %ecx
210 ; X32-NEXT: movzbl %al, %eax
211 ; X32-NEXT: addl %ecx, %eax
212 ; X32-NEXT: xorl %edx, %edx
215 ; X64-LABEL: pr25754:
217 ; X64-NEXT: movzbl %dil, %eax
218 ; X64-NEXT: # kill: def $eax killed $eax def $ax
219 ; X64-NEXT: divb %sil
220 ; X64-NEXT: movzbl %ah, %ecx
221 ; X64-NEXT: movzbl %al, %eax
222 ; X64-NEXT: addq %rcx, %rax
226 %r2 = zext i8 %r1 to i64
227 %d2 = zext i8 %d1 to i64
228 %ret = add i64 %r2, %d2
232 @z = external global i8