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 zeroext i8 @test_udivrem_zext_ah(i8 %x, i8 %y) {
6 ; X86-LABEL: test_udivrem_zext_ah:
8 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
9 ; X86-NEXT: divb {{[0-9]+}}(%esp)
10 ; X86-NEXT: movzbl %ah, %ecx
11 ; X86-NEXT: movb %al, z
12 ; X86-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, z(%rip)
21 ; X64-NEXT: movl %ecx, %eax
29 define zeroext i8 @test_urem_zext_ah(i8 %x, i8 %y) {
30 ; X86-LABEL: test_urem_zext_ah:
32 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
33 ; X86-NEXT: divb {{[0-9]+}}(%esp)
34 ; X86-NEXT: movzbl %ah, %eax
35 ; X86-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 ; X86-LABEL: test_urem_noext_ah:
52 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
53 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
55 ; X86-NEXT: movzbl %ah, %eax
56 ; X86-NEXT: addb %cl, %al
57 ; X86-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 ; X86-LABEL: test_urem_zext64_ah:
76 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
77 ; X86-NEXT: divb {{[0-9]+}}(%esp)
78 ; X86-NEXT: movzbl %ah, %eax
79 ; X86-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 ; X86-LABEL: test_sdivrem_sext_ah:
96 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
97 ; X86-NEXT: idivb {{[0-9]+}}(%esp)
98 ; X86-NEXT: movsbl %ah, %ecx
99 ; X86-NEXT: movb %al, z
100 ; X86-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, z(%rip)
109 ; X64-NEXT: movl %ecx, %eax
111 %div = sdiv i8 %x, %y
112 store i8 %div, ptr @z
117 define signext i8 @test_srem_sext_ah(i8 %x, i8 %y) {
118 ; X86-LABEL: test_srem_sext_ah:
120 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
121 ; X86-NEXT: idivb {{[0-9]+}}(%esp)
122 ; X86-NEXT: movsbl %ah, %eax
123 ; X86-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 ; X86-LABEL: test_srem_noext_ah:
140 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
141 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
142 ; X86-NEXT: idivb %cl
143 ; X86-NEXT: movsbl %ah, %eax
144 ; X86-NEXT: addb %cl, %al
145 ; X86-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 ; X86-LABEL: test_srem_sext64_ah:
164 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
165 ; X86-NEXT: idivb {{[0-9]+}}(%esp)
166 ; X86-NEXT: movsbl %ah, %eax
167 ; X86-NEXT: movl %eax, %edx
168 ; X86-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 ; X86-LABEL: pr25754:
186 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
187 ; X86-NEXT: divb {{[0-9]+}}(%esp)
188 ; X86-NEXT: movzbl %ah, %ecx
189 ; X86-NEXT: movzbl %al, %eax
190 ; X86-NEXT: addl %ecx, %eax
191 ; X86-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 dso_local global i8