1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
3 ; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X32
5 define i8 @test_zext_i1toi8(i32 %a) {
6 ; X64-LABEL: test_zext_i1toi8:
8 ; X64-NEXT: movl %edi, %eax
9 ; X64-NEXT: andb $1, %al
10 ; X64-NEXT: # kill: def $al killed $al killed $eax
13 ; X32-LABEL: test_zext_i1toi8:
15 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
16 ; X32-NEXT: andb $1, %al
17 ; X32-NEXT: # kill: def $al killed $al killed $eax
19 %val = trunc i32 %a to i1
20 %r = zext i1 %val to i8
24 define i16 @test_zext_i1toi16(i32 %a) {
25 ; X64-LABEL: test_zext_i1toi16:
27 ; X64-NEXT: movl %edi, %eax
28 ; X64-NEXT: andw $1, %ax
29 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
32 ; X32-LABEL: test_zext_i1toi16:
34 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
35 ; X32-NEXT: andw $1, %ax
36 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
38 %val = trunc i32 %a to i1
39 %r = zext i1 %val to i16
43 define i32 @test_zext_i1(i32 %a) {
44 ; X64-LABEL: test_zext_i1:
46 ; X64-NEXT: movl %edi, %eax
47 ; X64-NEXT: andl $1, %eax
50 ; X32-LABEL: test_zext_i1:
52 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
53 ; X32-NEXT: andl $1, %eax
55 %val = trunc i32 %a to i1
56 %r = zext i1 %val to i32
60 define i32 @test_zext_i8(i8 %val) {
61 ; X64-LABEL: test_zext_i8:
63 ; X64-NEXT: movzbl %dil, %eax
66 ; X32-LABEL: test_zext_i8:
68 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
70 %r = zext i8 %val to i32
74 define i32 @test_zext_i16(i16 %val) {
75 ; X64-LABEL: test_zext_i16:
77 ; X64-NEXT: movzwl %di, %eax
80 ; X32-LABEL: test_zext_i16:
82 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
84 %r = zext i16 %val to i32
88 define i32 @test_sext_i8(i8 %val) {
89 ; X64-LABEL: test_sext_i8:
91 ; X64-NEXT: movl %edi, %eax
92 ; X64-NEXT: movl $24, %ecx
93 ; X64-NEXT: shll %cl, %eax
94 ; X64-NEXT: movl $24, %ecx
95 ; X64-NEXT: sarl %cl, %eax
98 ; X32-LABEL: test_sext_i8:
100 ; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
102 %r = sext i8 %val to i32
106 define i32 @test_sext_i16(i16 %val) {
107 ; X64-LABEL: test_sext_i16:
109 ; X64-NEXT: movl %edi, %eax
110 ; X64-NEXT: movl $16, %ecx
111 ; X64-NEXT: shll %cl, %eax
112 ; X64-NEXT: movl $16, %ecx
113 ; X64-NEXT: sarl %cl, %eax
116 ; X32-LABEL: test_sext_i16:
118 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
120 %r = sext i16 %val to i32