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: divb {{[0-9]+}}(%esp)
10 ; X32-NEXT: movzbl %ah, %ecx
11 ; X32-NEXT: movb %al, z
12 ; X32-NEXT: movl %ecx, %eax
15 ; X64-LABEL: test_udivrem_zext_ah:
17 ; X64-NEXT: movzbl %dil, %eax
19 ; X64-NEXT: movzbl %ah, %ecx
20 ; X64-NEXT: movb %al, {{.*}}(%rip)
21 ; X64-NEXT: movl %ecx, %eax
29 define zeroext i8 @test_urem_zext_ah(i8 %x, i8 %y) {
30 ; X32-LABEL: test_urem_zext_ah:
32 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
33 ; X32-NEXT: divb {{[0-9]+}}(%esp)
34 ; X32-NEXT: movzbl %ah, %eax
35 ; X32-NEXT: # kill: def $al killed $al killed $eax
38 ; X64-LABEL: test_urem_zext_ah:
40 ; X64-NEXT: movzbl %dil, %eax
42 ; X64-NEXT: movzbl %ah, %eax
43 ; X64-NEXT: # kill: def $al killed $al killed $eax
49 define i8 @test_urem_noext_ah(i8 %x, i8 %y) {
50 ; X32-LABEL: test_urem_noext_ah:
52 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
53 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
55 ; X32-NEXT: movzbl %ah, %eax
56 ; X32-NEXT: addb %cl, %al
57 ; X32-NEXT: # kill: def $al killed $al killed $eax
60 ; X64-LABEL: test_urem_noext_ah:
62 ; X64-NEXT: movzbl %dil, %eax
64 ; X64-NEXT: movzbl %ah, %eax
65 ; X64-NEXT: addb %sil, %al
66 ; X64-NEXT: # kill: def $al killed $al killed $eax
73 define i64 @test_urem_zext64_ah(i8 %x, i8 %y) {
74 ; X32-LABEL: test_urem_zext64_ah:
76 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
77 ; X32-NEXT: divb {{[0-9]+}}(%esp)
78 ; X32-NEXT: movzbl %ah, %eax
79 ; X32-NEXT: xorl %edx, %edx
82 ; X64-LABEL: test_urem_zext64_ah:
84 ; X64-NEXT: movzbl %dil, %eax
86 ; X64-NEXT: movzbl %ah, %eax
89 %2 = zext i8 %1 to i64
93 define signext i8 @test_sdivrem_sext_ah(i8 %x, i8 %y) {
94 ; X32-LABEL: test_sdivrem_sext_ah:
96 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
97 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
98 ; X32-NEXT: movsbl %ah, %ecx
99 ; X32-NEXT: movb %al, z
100 ; X32-NEXT: movl %ecx, %eax
103 ; X64-LABEL: test_sdivrem_sext_ah:
105 ; X64-NEXT: movsbl %dil, %eax
106 ; X64-NEXT: idivb %sil
107 ; X64-NEXT: movsbl %ah, %ecx
108 ; X64-NEXT: movb %al, {{.*}}(%rip)
109 ; X64-NEXT: movl %ecx, %eax
111 %div = sdiv i8 %x, %y
112 store i8 %div, i8* @z
117 define signext i8 @test_srem_sext_ah(i8 %x, i8 %y) {
118 ; X32-LABEL: test_srem_sext_ah:
120 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
121 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
122 ; X32-NEXT: movsbl %ah, %eax
123 ; X32-NEXT: # kill: def $al killed $al killed $eax
126 ; X64-LABEL: test_srem_sext_ah:
128 ; X64-NEXT: movsbl %dil, %eax
129 ; X64-NEXT: idivb %sil
130 ; X64-NEXT: movsbl %ah, %eax
131 ; X64-NEXT: # kill: def $al killed $al killed $eax
137 define i8 @test_srem_noext_ah(i8 %x, i8 %y) {
138 ; X32-LABEL: test_srem_noext_ah:
140 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
141 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
142 ; X32-NEXT: idivb %cl
143 ; X32-NEXT: movsbl %ah, %eax
144 ; X32-NEXT: addb %cl, %al
145 ; X32-NEXT: # kill: def $al killed $al killed $eax
148 ; X64-LABEL: test_srem_noext_ah:
150 ; X64-NEXT: movsbl %dil, %eax
151 ; X64-NEXT: idivb %sil
152 ; X64-NEXT: movsbl %ah, %eax
153 ; X64-NEXT: addb %sil, %al
154 ; X64-NEXT: # kill: def $al killed $al killed $eax
161 define i64 @test_srem_sext64_ah(i8 %x, i8 %y) {
162 ; X32-LABEL: test_srem_sext64_ah:
164 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
165 ; X32-NEXT: idivb {{[0-9]+}}(%esp)
166 ; X32-NEXT: movsbl %ah, %eax
167 ; X32-NEXT: movl %eax, %edx
168 ; X32-NEXT: sarl $31, %edx
171 ; X64-LABEL: test_srem_sext64_ah:
173 ; X64-NEXT: movsbl %dil, %eax
174 ; X64-NEXT: idivb %sil
175 ; X64-NEXT: movsbl %ah, %eax
179 %2 = sext i8 %1 to i64
183 define i64 @pr25754(i8 %a, i8 %c) {
184 ; X32-LABEL: pr25754:
186 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
187 ; X32-NEXT: divb {{[0-9]+}}(%esp)
188 ; X32-NEXT: movzbl %ah, %ecx
189 ; X32-NEXT: movzbl %al, %eax
190 ; X32-NEXT: addl %ecx, %eax
191 ; X32-NEXT: xorl %edx, %edx
194 ; X64-LABEL: pr25754:
196 ; X64-NEXT: movzbl %dil, %eax
197 ; X64-NEXT: divb %sil
198 ; X64-NEXT: movzbl %ah, %ecx
199 ; X64-NEXT: movzbl %al, %eax
200 ; X64-NEXT: addq %rcx, %rax
204 %r2 = zext i8 %r1 to i64
205 %d2 = zext i8 %d1 to i64
206 %ret = add i64 %r2, %d2
210 @z = external global i8