blob: 92344a5c1a30a450e8681ee8cb86d8321aa24639 [file] [log] [blame]
Craig Topper619b7592017-09-02 18:53:46 +00001; 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:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +00007; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +00008; X32-NEXT: movb {{[0-9]+}}(%esp), %al
9; X32-NEXT: andb $1, %al
10; X32-NEXT: negb %al
11; X32-NEXT: retl
12; X32-NEXT: ## -- End function
13;
14; X64-LABEL: test1:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000015; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000016; X64-NEXT: andb $1, %dil
17; X64-NEXT: negb %dil
18; X64-NEXT: movl %edi, %eax
19; X64-NEXT: retq
20; X64-NEXT: ## -- End function
21 %z = trunc i8 %x to i1
22 %u = sext i1 %z to i8
23 ret i8 %u
24}
25
26define i16 @test2(i16 %x) nounwind {
27; X32-LABEL: test2:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000028; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000029; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
30; X32-NEXT: andb $1, %al
31; X32-NEXT: negb %al
32; X32-NEXT: movsbl %al, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +000033; X32-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +000034; X32-NEXT: retl
35; X32-NEXT: ## -- End function
36;
37; X64-LABEL: test2:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000038; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000039; X64-NEXT: andb $1, %dil
40; X64-NEXT: negb %dil
41; X64-NEXT: movsbl %dil, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +000042; X64-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +000043; X64-NEXT: retq
44; X64-NEXT: ## -- End function
45 %z = trunc i16 %x to i1
46 %u = sext i1 %z to i16
47 ret i16 %u
48}
49
50define i32 @test3(i32 %x) nounwind {
51; X32-LABEL: test3:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000052; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000053; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
54; X32-NEXT: andb $1, %al
55; X32-NEXT: negb %al
56; X32-NEXT: movsbl %al, %eax
57; X32-NEXT: retl
58; X32-NEXT: ## -- End function
59;
60; X64-LABEL: test3:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000061; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000062; X64-NEXT: andb $1, %dil
63; X64-NEXT: negb %dil
64; X64-NEXT: movsbl %dil, %eax
65; X64-NEXT: retq
66; X64-NEXT: ## -- End function
67 %z = trunc i32 %x to i1
68 %u = sext i1 %z to i32
69 ret i32 %u
70}
71
72define i32 @test4(i32 %x) nounwind {
73; X32-LABEL: test4:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000074; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000075; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
76; X32-NEXT: andb $1, %al
77; X32-NEXT: negb %al
78; X32-NEXT: movsbl %al, %eax
79; X32-NEXT: retl
80; X32-NEXT: ## -- End function
81;
82; X64-LABEL: test4:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000083; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000084; X64-NEXT: andb $1, %dil
85; X64-NEXT: negb %dil
86; X64-NEXT: movsbl %dil, %eax
87; X64-NEXT: retq
88; X64-NEXT: ## -- End function
89 %z = trunc i32 %x to i1
90 %u = sext i1 %z to i32
91 ret i32 %u
92}
93
94define i8 @test5(i8 %x) nounwind {
95; X32-LABEL: test5:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000096; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +000097; X32-NEXT: movb {{[0-9]+}}(%esp), %al
98; X32-NEXT: andb $1, %al
99; X32-NEXT: retl
100; X32-NEXT: ## -- End function
101;
102; X64-LABEL: test5:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000103; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000104; X64-NEXT: andb $1, %dil
105; X64-NEXT: movl %edi, %eax
106; X64-NEXT: retq
107; X64-NEXT: ## -- End function
108 %z = trunc i8 %x to i1
109 %u = zext i1 %z to i8
110 ret i8 %u
111}
112
113define i16 @test6(i16 %x) nounwind {
114; X32-LABEL: test6:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000115; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000116; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
117; X32-NEXT: andb $1, %al
118; X32-NEXT: movzbl %al, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000119; X32-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000120; X32-NEXT: retl
121; X32-NEXT: ## -- End function
122;
123; X64-LABEL: test6:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000124; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000125; X64-NEXT: andb $1, %dil
126; X64-NEXT: movzbl %dil, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000127; X64-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000128; X64-NEXT: retq
129; X64-NEXT: ## -- End function
130 %z = trunc i16 %x to i1
131 %u = zext i1 %z to i16
132 ret i16 %u
133}
134
135define i32 @test7(i32 %x) nounwind {
136; X32-LABEL: test7:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000137; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000138; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
139; X32-NEXT: andb $1, %al
140; X32-NEXT: movzbl %al, %eax
141; X32-NEXT: retl
142; X32-NEXT: ## -- End function
143;
144; X64-LABEL: test7:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000145; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000146; X64-NEXT: andb $1, %dil
147; X64-NEXT: movzbl %dil, %eax
148; X64-NEXT: retq
149; X64-NEXT: ## -- End function
150 %z = trunc i32 %x to i1
151 %u = zext i1 %z to i32
152 ret i32 %u
153}
154
155define i32 @test8(i32 %x) nounwind {
156; X32-LABEL: test8:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000157; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000158; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
159; X32-NEXT: andb $1, %al
160; X32-NEXT: movzbl %al, %eax
161; X32-NEXT: retl
162; X32-NEXT: ## -- End function
163;
164; X64-LABEL: test8:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000165; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000166; X64-NEXT: andb $1, %dil
167; X64-NEXT: movzbl %dil, %eax
168; X64-NEXT: retq
169; X64-NEXT: ## -- End function
170 %z = trunc i32 %x to i1
171 %u = zext i1 %z to i32
172 ret i32 %u
173}
174
175define i16 @test9(i8 %x) nounwind {
176; X32-LABEL: test9:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000177; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000178; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000179; X32-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000180; X32-NEXT: retl
181; X32-NEXT: ## -- End function
182;
183; X64-LABEL: test9:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000184; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000185; X64-NEXT: movsbl %dil, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000186; X64-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000187; X64-NEXT: retq
188; X64-NEXT: ## -- End function
189 %u = sext i8 %x to i16
190 ret i16 %u
191}
192
193define i32 @test10(i8 %x) nounwind {
194; X32-LABEL: test10:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000195; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000196; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
197; X32-NEXT: retl
198; X32-NEXT: ## -- End function
199;
200; X64-LABEL: test10:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000201; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000202; X64-NEXT: movsbl %dil, %eax
203; X64-NEXT: retq
204; X64-NEXT: ## -- End function
205 %u = sext i8 %x to i32
206 ret i32 %u
207}
208
209define i64 @test11(i8 %x) nounwind {
210; X32-LABEL: test11:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000211; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000212; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
213; X32-NEXT: movl %eax, %edx
214; X32-NEXT: sarl $31, %edx
215; X32-NEXT: retl
216; X32-NEXT: ## -- End function
217;
218; X64-LABEL: test11:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000219; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000220; X64-NEXT: movsbq %dil, %rax
221; X64-NEXT: retq
222; X64-NEXT: ## -- End function
223 %u = sext i8 %x to i64
224 ret i64 %u
225}
226
227define i16 @test12(i8 %x) nounwind {
228; X32-LABEL: test12:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000229; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000230; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000231; X32-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000232; X32-NEXT: retl
233; X32-NEXT: ## -- End function
234;
235; X64-LABEL: test12:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000236; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000237; X64-NEXT: movzbl %dil, %eax
Francis Visoiu Mistriha8a83d12017-12-07 10:40:31 +0000238; X64-NEXT: ## kill: def %ax killed %ax killed %eax
Craig Topper619b7592017-09-02 18:53:46 +0000239; X64-NEXT: retq
240; X64-NEXT: ## -- End function
241 %u = zext i8 %x to i16
242 ret i16 %u
243}
244
245define i32 @test13(i8 %x) nounwind {
246; X32-LABEL: test13:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000247; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000248; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
249; X32-NEXT: retl
250; X32-NEXT: ## -- End function
251;
252; X64-LABEL: test13:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000253; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000254; X64-NEXT: movzbl %dil, %eax
255; X64-NEXT: retq
256; X64-NEXT: ## -- End function
257 %u = zext i8 %x to i32
258 ret i32 %u
259}
260
261define i64 @test14(i8 %x) nounwind {
262; X32-LABEL: test14:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000263; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000264; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
265; X32-NEXT: xorl %edx, %edx
266; X32-NEXT: retl
267; X32-NEXT: ## -- End function
268;
269; X64-LABEL: test14:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000270; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000271; X64-NEXT: movzbl %dil, %eax
272; X64-NEXT: retq
273; X64-NEXT: ## -- End function
274 %u = zext i8 %x to i64
275 ret i64 %u
276}
277
278define i32 @test15(i16 %x) nounwind {
279; X32-LABEL: test15:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000280; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000281; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
282; X32-NEXT: retl
283; X32-NEXT: ## -- End function
284;
285; X64-LABEL: test15:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000286; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000287; X64-NEXT: movswl %di, %eax
288; X64-NEXT: retq
289; X64-NEXT: ## -- End function
290 %u = sext i16 %x to i32
291 ret i32 %u
292}
293
294define i64 @test16(i16 %x) nounwind {
295; X32-LABEL: test16:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000296; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000297; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
298; X32-NEXT: movl %eax, %edx
299; X32-NEXT: sarl $31, %edx
300; X32-NEXT: retl
301; X32-NEXT: ## -- End function
302;
303; X64-LABEL: test16:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000304; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000305; X64-NEXT: movswq %di, %rax
306; X64-NEXT: retq
307; X64-NEXT: ## -- End function
308 %u = sext i16 %x to i64
309 ret i64 %u
310}
311
312define i32 @test17(i16 %x) nounwind {
313; X32-LABEL: test17:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000314; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000315; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
316; X32-NEXT: retl
317; X32-NEXT: ## -- End function
318;
319; X64-LABEL: test17:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000320; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000321; X64-NEXT: movzwl %di, %eax
322; X64-NEXT: retq
323; X64-NEXT: ## -- End function
324 %u = zext i16 %x to i32
325 ret i32 %u
326}
327
328define i64 @test18(i16 %x) nounwind {
329; X32-LABEL: test18:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000330; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000331; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
332; X32-NEXT: xorl %edx, %edx
333; X32-NEXT: retl
334; X32-NEXT: ## -- End function
335;
336; X64-LABEL: test18:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000337; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000338; X64-NEXT: movzwl %di, %eax
339; X64-NEXT: retq
340; X64-NEXT: ## -- End function
341 %u = zext i16 %x to i64
342 ret i64 %u
343}
344
345define i64 @test19(i32 %x) nounwind {
346; X32-LABEL: test19:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000347; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000348; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
349; X32-NEXT: movl %eax, %edx
350; X32-NEXT: sarl $31, %edx
351; X32-NEXT: retl
352; X32-NEXT: ## -- End function
353;
354; X64-LABEL: test19:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000355; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000356; X64-NEXT: movslq %edi, %rax
357; X64-NEXT: retq
358; X64-NEXT: ## -- End function
359 %u = sext i32 %x to i64
360 ret i64 %u
361}
362
363define i64 @test20(i32 %x) nounwind {
364; X32-LABEL: test20:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000365; X32: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000366; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
367; X32-NEXT: xorl %edx, %edx
368; X32-NEXT: retl
369; X32-NEXT: ## -- End function
370;
371; X64-LABEL: test20:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +0000372; X64: ## %bb.0:
Craig Topper619b7592017-09-02 18:53:46 +0000373; X64-NEXT: movl %edi, %eax
374; X64-NEXT: retq
375; X64-NEXT: ## -- End function
376 %u = zext i32 %x to i64
377 ret i64 %u
378}