1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=X64
5 define i8 @test1(i8 %x) nounwind {
8 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
9 ; X32-NEXT: andb $1, %al
15 ; X64-NEXT: movl %edi, %eax
16 ; X64-NEXT: andb $1, %al
18 ; X64-NEXT: ## kill: def $al killed $al killed $eax
20 %z = trunc i8 %x to i1
25 define i16 @test2(i16 %x) nounwind {
28 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
29 ; X32-NEXT: andb $1, %al
31 ; X32-NEXT: movsbl %al, %eax
32 ; X32-NEXT: ## kill: def $ax killed $ax killed $eax
37 ; X64-NEXT: andb $1, %dil
39 ; X64-NEXT: movsbl %dil, %eax
40 ; X64-NEXT: ## kill: def $ax killed $ax killed $eax
42 %z = trunc i16 %x to i1
43 %u = sext i1 %z to i16
47 define i32 @test3(i32 %x) nounwind {
50 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
51 ; X32-NEXT: andb $1, %al
53 ; X32-NEXT: movsbl %al, %eax
58 ; X64-NEXT: andb $1, %dil
60 ; X64-NEXT: movsbl %dil, %eax
62 %z = trunc i32 %x to i1
63 %u = sext i1 %z to i32
67 define i32 @test4(i32 %x) nounwind {
70 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
71 ; X32-NEXT: andb $1, %al
73 ; X32-NEXT: movsbl %al, %eax
78 ; X64-NEXT: andb $1, %dil
80 ; X64-NEXT: movsbl %dil, %eax
82 %z = trunc i32 %x to i1
83 %u = sext i1 %z to i32
87 define i8 @test5(i8 %x) nounwind {
90 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
91 ; X32-NEXT: andb $1, %al
96 ; X64-NEXT: movl %edi, %eax
97 ; X64-NEXT: andb $1, %al
98 ; X64-NEXT: ## kill: def $al killed $al killed $eax
100 %z = trunc i8 %x to i1
101 %u = zext i1 %z to i8
105 define i16 @test6(i16 %x) nounwind {
108 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
109 ; X32-NEXT: andb $1, %al
110 ; X32-NEXT: movzbl %al, %eax
111 ; X32-NEXT: ## kill: def $ax killed $ax killed $eax
116 ; X64-NEXT: andb $1, %dil
117 ; X64-NEXT: movzbl %dil, %eax
118 ; X64-NEXT: ## kill: def $ax killed $ax killed $eax
120 %z = trunc i16 %x to i1
121 %u = zext i1 %z to i16
125 define i32 @test7(i32 %x) nounwind {
128 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
129 ; X32-NEXT: andb $1, %al
130 ; X32-NEXT: movzbl %al, %eax
135 ; X64-NEXT: andb $1, %dil
136 ; X64-NEXT: movzbl %dil, %eax
138 %z = trunc i32 %x to i1
139 %u = zext i1 %z to i32
143 define i32 @test8(i32 %x) nounwind {
146 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
147 ; X32-NEXT: andb $1, %al
148 ; X32-NEXT: movzbl %al, %eax
153 ; X64-NEXT: andb $1, %dil
154 ; X64-NEXT: movzbl %dil, %eax
156 %z = trunc i32 %x to i1
157 %u = zext i1 %z to i32
161 define i16 @test9(i8 %x) nounwind {
164 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
165 ; X32-NEXT: ## kill: def $ax killed $ax killed $eax
170 ; X64-NEXT: movsbl %dil, %eax
171 ; X64-NEXT: ## kill: def $ax killed $ax killed $eax
173 %u = sext i8 %x to i16
177 define i32 @test10(i8 %x) nounwind {
180 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
185 ; X64-NEXT: movsbl %dil, %eax
187 %u = sext i8 %x to i32
191 define i64 @test11(i8 %x) nounwind {
194 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
195 ; X32-NEXT: movl %eax, %edx
196 ; X32-NEXT: sarl $31, %edx
201 ; X64-NEXT: movsbq %dil, %rax
203 %u = sext i8 %x to i64
207 define i16 @test12(i8 %x) nounwind {
210 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
211 ; X32-NEXT: ## kill: def $ax killed $ax killed $eax
216 ; X64-NEXT: movzbl %dil, %eax
217 ; X64-NEXT: ## kill: def $ax killed $ax killed $eax
219 %u = zext i8 %x to i16
223 define i32 @test13(i8 %x) nounwind {
226 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
231 ; X64-NEXT: movzbl %dil, %eax
233 %u = zext i8 %x to i32
237 define i64 @test14(i8 %x) nounwind {
240 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
241 ; X32-NEXT: xorl %edx, %edx
246 ; X64-NEXT: movzbl %dil, %eax
248 %u = zext i8 %x to i64
252 define i32 @test15(i16 %x) nounwind {
255 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
260 ; X64-NEXT: movswl %di, %eax
262 %u = sext i16 %x to i32
266 define i64 @test16(i16 %x) nounwind {
269 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
270 ; X32-NEXT: movl %eax, %edx
271 ; X32-NEXT: sarl $31, %edx
276 ; X64-NEXT: movswq %di, %rax
278 %u = sext i16 %x to i64
282 define i32 @test17(i16 %x) nounwind {
285 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
290 ; X64-NEXT: movzwl %di, %eax
292 %u = zext i16 %x to i32
296 define i64 @test18(i16 %x) nounwind {
299 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
300 ; X32-NEXT: xorl %edx, %edx
305 ; X64-NEXT: movzwl %di, %eax
307 %u = zext i16 %x to i64
311 define i64 @test19(i32 %x) nounwind {
314 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
315 ; X32-NEXT: movl %eax, %edx
316 ; X32-NEXT: sarl $31, %edx
321 ; X64-NEXT: movslq %edi, %rax
323 %u = sext i32 %x to i64
327 define i64 @test20(i32 %x) nounwind {
330 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
331 ; X32-NEXT: xorl %edx, %edx
336 ; X64-NEXT: movl %edi, %eax
338 %u = zext i32 %x to i64