2 ; FIXME: This test is broken due to https://bugs.llvm.org/show_bug.cgi?id=50035
3 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
4 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
5 ; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X32
7 define i8 @test_zext_i1toi8(i32 %a) {
8 ; X64-LABEL: test_zext_i1toi8:
10 ; X64-NEXT: movl %edi, %eax
11 ; X64-NEXT: andb $1, %al
12 ; X64-NEXT: # kill: def $al killed $al killed $eax
15 ; X32-LABEL: test_zext_i1toi8:
17 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
18 ; X32-NEXT: andb $1, %al
19 ; X32-NEXT: # kill: def $al killed $al killed $eax
21 %val = trunc i32 %a to i1
22 %r = zext i1 %val to i8
26 define i16 @test_zext_i1toi16(i32 %a) {
27 ; X64-LABEL: test_zext_i1toi16:
29 ; X64-NEXT: movl %edi, %eax
30 ; X64-NEXT: andw $1, %ax
31 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
34 ; X32-LABEL: test_zext_i1toi16:
36 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
37 ; X32-NEXT: andw $1, %ax
38 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
40 %val = trunc i32 %a to i1
41 %r = zext i1 %val to i16
45 define i32 @test_zext_i1(i32 %a) {
46 ; X64-LABEL: test_zext_i1:
48 ; X64-NEXT: movl %edi, %eax
49 ; X64-NEXT: andl $1, %eax
52 ; X32-LABEL: test_zext_i1:
54 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
55 ; X32-NEXT: andl $1, %eax
57 %val = trunc i32 %a to i1
58 %r = zext i1 %val to i32
62 define i32 @test_zext_i8(i8 %val) {
63 ; X64-LABEL: test_zext_i8:
65 ; X64-NEXT: movzbl %dil, %eax
68 ; X32-LABEL: test_zext_i8:
70 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
72 %r = zext i8 %val to i32
76 define i32 @test_zext_i16(i16 %val) {
77 ; X64-LABEL: test_zext_i16:
79 ; X64-NEXT: movzwl %di, %eax
82 ; X32-LABEL: test_zext_i16:
84 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
86 %r = zext i16 %val to i32
90 define i32 @test_sext_i8(i8 %val) {
91 ; X64-LABEL: test_sext_i8:
93 ; X64-NEXT: movl %edi, %eax
94 ; X64-NEXT: shll $24, %eax
95 ; X64-NEXT: sarl $24, %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: shll $16, %eax
111 ; X64-NEXT: sarl $16, %eax
114 ; X32-LABEL: test_sext_i16:
116 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
118 %r = sext i16 %val to i32
122 define i16 @test_zext_i8_to_i16(i8 %x, i8 %y) {
123 ; X64-LABEL: test_zext_i8_to_i16:
125 ; X64-NEXT: addb %dil, %sil
126 ; X64-NEXT: movzbl %sil, %eax
127 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
130 ; X32-LABEL: test_zext_i8_to_i16:
132 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
133 ; X32-NEXT: addb {{[0-9]+}}(%esp), %al
134 ; X32-NEXT: movzbl %al, %eax
135 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
138 %b = zext i8 %a to i16