• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4
5define i8 @test1(i8 %x) nounwind {
6; X32-LABEL: test1:
7; X32:       ## %bb.0:
8; X32-NEXT:    movb {{[0-9]+}}(%esp), %al
9; X32-NEXT:    andb $1, %al
10; X32-NEXT:    negb %al
11; X32-NEXT:    retl
12;
13; X64-LABEL: test1:
14; X64:       ## %bb.0:
15; X64-NEXT:    andb $1, %dil
16; X64-NEXT:    negb %dil
17; X64-NEXT:    movl %edi, %eax
18; X64-NEXT:    retq
19  %z = trunc i8 %x to i1
20  %u = sext i1 %z to i8
21  ret i8 %u
22}
23
24define i16 @test2(i16 %x) nounwind {
25; X32-LABEL: test2:
26; X32:       ## %bb.0:
27; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
28; X32-NEXT:    andb $1, %al
29; X32-NEXT:    negb %al
30; X32-NEXT:    movsbl %al, %eax
31; X32-NEXT:    ## kill: def $ax killed $ax killed $eax
32; X32-NEXT:    retl
33;
34; X64-LABEL: test2:
35; X64:       ## %bb.0:
36; X64-NEXT:    andb $1, %dil
37; X64-NEXT:    negb %dil
38; X64-NEXT:    movsbl %dil, %eax
39; X64-NEXT:    ## kill: def $ax killed $ax killed $eax
40; X64-NEXT:    retq
41  %z = trunc i16 %x to i1
42  %u = sext i1 %z to i16
43  ret i16 %u
44}
45
46define i32 @test3(i32 %x) nounwind {
47; X32-LABEL: test3:
48; X32:       ## %bb.0:
49; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
50; X32-NEXT:    andb $1, %al
51; X32-NEXT:    negb %al
52; X32-NEXT:    movsbl %al, %eax
53; X32-NEXT:    retl
54;
55; X64-LABEL: test3:
56; X64:       ## %bb.0:
57; X64-NEXT:    andb $1, %dil
58; X64-NEXT:    negb %dil
59; X64-NEXT:    movsbl %dil, %eax
60; X64-NEXT:    retq
61  %z = trunc i32 %x to i1
62  %u = sext i1 %z to i32
63  ret i32 %u
64}
65
66define i32 @test4(i32 %x) nounwind {
67; X32-LABEL: test4:
68; X32:       ## %bb.0:
69; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
70; X32-NEXT:    andb $1, %al
71; X32-NEXT:    negb %al
72; X32-NEXT:    movsbl %al, %eax
73; X32-NEXT:    retl
74;
75; X64-LABEL: test4:
76; X64:       ## %bb.0:
77; X64-NEXT:    andb $1, %dil
78; X64-NEXT:    negb %dil
79; X64-NEXT:    movsbl %dil, %eax
80; X64-NEXT:    retq
81  %z = trunc i32 %x to i1
82  %u = sext i1 %z to i32
83  ret i32 %u
84}
85
86define i8 @test5(i8 %x) nounwind {
87; X32-LABEL: test5:
88; X32:       ## %bb.0:
89; X32-NEXT:    movb {{[0-9]+}}(%esp), %al
90; X32-NEXT:    andb $1, %al
91; X32-NEXT:    retl
92;
93; X64-LABEL: test5:
94; X64:       ## %bb.0:
95; X64-NEXT:    andb $1, %dil
96; X64-NEXT:    movl %edi, %eax
97; X64-NEXT:    retq
98  %z = trunc i8 %x to i1
99  %u = zext i1 %z to i8
100  ret i8 %u
101}
102
103define i16 @test6(i16 %x) nounwind {
104; X32-LABEL: test6:
105; X32:       ## %bb.0:
106; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
107; X32-NEXT:    andb $1, %al
108; X32-NEXT:    movzbl %al, %eax
109; X32-NEXT:    ## kill: def $ax killed $ax killed $eax
110; X32-NEXT:    retl
111;
112; X64-LABEL: test6:
113; X64:       ## %bb.0:
114; X64-NEXT:    andb $1, %dil
115; X64-NEXT:    movzbl %dil, %eax
116; X64-NEXT:    ## kill: def $ax killed $ax killed $eax
117; X64-NEXT:    retq
118  %z = trunc i16 %x to i1
119  %u = zext i1 %z to i16
120  ret i16 %u
121}
122
123define i32 @test7(i32 %x) nounwind {
124; X32-LABEL: test7:
125; X32:       ## %bb.0:
126; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
127; X32-NEXT:    andb $1, %al
128; X32-NEXT:    movzbl %al, %eax
129; X32-NEXT:    retl
130;
131; X64-LABEL: test7:
132; X64:       ## %bb.0:
133; X64-NEXT:    andb $1, %dil
134; X64-NEXT:    movzbl %dil, %eax
135; X64-NEXT:    retq
136  %z = trunc i32 %x to i1
137  %u = zext i1 %z to i32
138  ret i32 %u
139}
140
141define i32 @test8(i32 %x) nounwind {
142; X32-LABEL: test8:
143; X32:       ## %bb.0:
144; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
145; X32-NEXT:    andb $1, %al
146; X32-NEXT:    movzbl %al, %eax
147; X32-NEXT:    retl
148;
149; X64-LABEL: test8:
150; X64:       ## %bb.0:
151; X64-NEXT:    andb $1, %dil
152; X64-NEXT:    movzbl %dil, %eax
153; X64-NEXT:    retq
154  %z = trunc i32 %x to i1
155  %u = zext i1 %z to i32
156  ret i32 %u
157}
158
159define i16 @test9(i8 %x) nounwind {
160; X32-LABEL: test9:
161; X32:       ## %bb.0:
162; X32-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
163; X32-NEXT:    ## kill: def $ax killed $ax killed $eax
164; X32-NEXT:    retl
165;
166; X64-LABEL: test9:
167; X64:       ## %bb.0:
168; X64-NEXT:    movsbl %dil, %eax
169; X64-NEXT:    ## kill: def $ax killed $ax killed $eax
170; X64-NEXT:    retq
171  %u = sext i8 %x to i16
172  ret i16 %u
173}
174
175define i32 @test10(i8 %x) nounwind {
176; X32-LABEL: test10:
177; X32:       ## %bb.0:
178; X32-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
179; X32-NEXT:    retl
180;
181; X64-LABEL: test10:
182; X64:       ## %bb.0:
183; X64-NEXT:    movsbl %dil, %eax
184; X64-NEXT:    retq
185  %u = sext i8 %x to i32
186  ret i32 %u
187}
188
189define i64 @test11(i8 %x) nounwind {
190; X32-LABEL: test11:
191; X32:       ## %bb.0:
192; X32-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
193; X32-NEXT:    movl %eax, %edx
194; X32-NEXT:    sarl $31, %edx
195; X32-NEXT:    retl
196;
197; X64-LABEL: test11:
198; X64:       ## %bb.0:
199; X64-NEXT:    movsbq %dil, %rax
200; X64-NEXT:    retq
201  %u = sext i8 %x to i64
202  ret i64 %u
203}
204
205define i16 @test12(i8 %x) nounwind {
206; X32-LABEL: test12:
207; X32:       ## %bb.0:
208; X32-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
209; X32-NEXT:    ## kill: def $ax killed $ax killed $eax
210; X32-NEXT:    retl
211;
212; X64-LABEL: test12:
213; X64:       ## %bb.0:
214; X64-NEXT:    movzbl %dil, %eax
215; X64-NEXT:    ## kill: def $ax killed $ax killed $eax
216; X64-NEXT:    retq
217  %u = zext i8 %x to i16
218  ret i16 %u
219}
220
221define i32 @test13(i8 %x) nounwind {
222; X32-LABEL: test13:
223; X32:       ## %bb.0:
224; X32-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
225; X32-NEXT:    retl
226;
227; X64-LABEL: test13:
228; X64:       ## %bb.0:
229; X64-NEXT:    movzbl %dil, %eax
230; X64-NEXT:    retq
231  %u = zext i8 %x to i32
232  ret i32 %u
233}
234
235define i64 @test14(i8 %x) nounwind {
236; X32-LABEL: test14:
237; X32:       ## %bb.0:
238; X32-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
239; X32-NEXT:    xorl %edx, %edx
240; X32-NEXT:    retl
241;
242; X64-LABEL: test14:
243; X64:       ## %bb.0:
244; X64-NEXT:    movzbl %dil, %eax
245; X64-NEXT:    retq
246  %u = zext i8 %x to i64
247  ret i64 %u
248}
249
250define i32 @test15(i16 %x) nounwind {
251; X32-LABEL: test15:
252; X32:       ## %bb.0:
253; X32-NEXT:    movswl {{[0-9]+}}(%esp), %eax
254; X32-NEXT:    retl
255;
256; X64-LABEL: test15:
257; X64:       ## %bb.0:
258; X64-NEXT:    movswl %di, %eax
259; X64-NEXT:    retq
260  %u = sext i16 %x to i32
261  ret i32 %u
262}
263
264define i64 @test16(i16 %x) nounwind {
265; X32-LABEL: test16:
266; X32:       ## %bb.0:
267; X32-NEXT:    movswl {{[0-9]+}}(%esp), %eax
268; X32-NEXT:    movl %eax, %edx
269; X32-NEXT:    sarl $31, %edx
270; X32-NEXT:    retl
271;
272; X64-LABEL: test16:
273; X64:       ## %bb.0:
274; X64-NEXT:    movswq %di, %rax
275; X64-NEXT:    retq
276  %u = sext i16 %x to i64
277  ret i64 %u
278}
279
280define i32 @test17(i16 %x) nounwind {
281; X32-LABEL: test17:
282; X32:       ## %bb.0:
283; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
284; X32-NEXT:    retl
285;
286; X64-LABEL: test17:
287; X64:       ## %bb.0:
288; X64-NEXT:    movzwl %di, %eax
289; X64-NEXT:    retq
290  %u = zext i16 %x to i32
291  ret i32 %u
292}
293
294define i64 @test18(i16 %x) nounwind {
295; X32-LABEL: test18:
296; X32:       ## %bb.0:
297; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
298; X32-NEXT:    xorl %edx, %edx
299; X32-NEXT:    retl
300;
301; X64-LABEL: test18:
302; X64:       ## %bb.0:
303; X64-NEXT:    movzwl %di, %eax
304; X64-NEXT:    retq
305  %u = zext i16 %x to i64
306  ret i64 %u
307}
308
309define i64 @test19(i32 %x) nounwind {
310; X32-LABEL: test19:
311; X32:       ## %bb.0:
312; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
313; X32-NEXT:    movl %eax, %edx
314; X32-NEXT:    sarl $31, %edx
315; X32-NEXT:    retl
316;
317; X64-LABEL: test19:
318; X64:       ## %bb.0:
319; X64-NEXT:    movslq %edi, %rax
320; X64-NEXT:    retq
321  %u = sext i32 %x to i64
322  ret i64 %u
323}
324
325define i64 @test20(i32 %x) nounwind {
326; X32-LABEL: test20:
327; X32:       ## %bb.0:
328; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
329; X32-NEXT:    xorl %edx, %edx
330; X32-NEXT:    retl
331;
332; X64-LABEL: test20:
333; X64:       ## %bb.0:
334; X64-NEXT:    movl %edi, %eax
335; X64-NEXT:    retq
336  %u = zext i32 %x to i64
337  ret i64 %u
338}
339