1; XFAIL: * 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 6 7define i8 @test_zext_i1toi8(i32 %a) { 8; X64-LABEL: test_zext_i1toi8: 9; X64: # %bb.0: 10; X64-NEXT: movl %edi, %eax 11; X64-NEXT: andb $1, %al 12; X64-NEXT: # kill: def $al killed $al killed $eax 13; X64-NEXT: retq 14; 15; X32-LABEL: test_zext_i1toi8: 16; X32: # %bb.0: 17; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 18; X32-NEXT: andb $1, %al 19; X32-NEXT: # kill: def $al killed $al killed $eax 20; X32-NEXT: retl 21 %val = trunc i32 %a to i1 22 %r = zext i1 %val to i8 23 ret i8 %r 24} 25 26define i16 @test_zext_i1toi16(i32 %a) { 27; X64-LABEL: test_zext_i1toi16: 28; X64: # %bb.0: 29; X64-NEXT: movl %edi, %eax 30; X64-NEXT: andw $1, %ax 31; X64-NEXT: # kill: def $ax killed $ax killed $eax 32; X64-NEXT: retq 33; 34; X32-LABEL: test_zext_i1toi16: 35; X32: # %bb.0: 36; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 37; X32-NEXT: andw $1, %ax 38; X32-NEXT: # kill: def $ax killed $ax killed $eax 39; X32-NEXT: retl 40 %val = trunc i32 %a to i1 41 %r = zext i1 %val to i16 42 ret i16 %r 43} 44 45define i32 @test_zext_i1(i32 %a) { 46; X64-LABEL: test_zext_i1: 47; X64: # %bb.0: 48; X64-NEXT: movl %edi, %eax 49; X64-NEXT: andl $1, %eax 50; X64-NEXT: retq 51; 52; X32-LABEL: test_zext_i1: 53; X32: # %bb.0: 54; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 55; X32-NEXT: andl $1, %eax 56; X32-NEXT: retl 57 %val = trunc i32 %a to i1 58 %r = zext i1 %val to i32 59 ret i32 %r 60} 61 62define i32 @test_zext_i8(i8 %val) { 63; X64-LABEL: test_zext_i8: 64; X64: # %bb.0: 65; X64-NEXT: movzbl %dil, %eax 66; X64-NEXT: retq 67; 68; X32-LABEL: test_zext_i8: 69; X32: # %bb.0: 70; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax 71; X32-NEXT: retl 72 %r = zext i8 %val to i32 73 ret i32 %r 74} 75 76define i32 @test_zext_i16(i16 %val) { 77; X64-LABEL: test_zext_i16: 78; X64: # %bb.0: 79; X64-NEXT: movzwl %di, %eax 80; X64-NEXT: retq 81; 82; X32-LABEL: test_zext_i16: 83; X32: # %bb.0: 84; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 85; X32-NEXT: retl 86 %r = zext i16 %val to i32 87 ret i32 %r 88} 89 90define i32 @test_sext_i8(i8 %val) { 91; X64-LABEL: test_sext_i8: 92; X64: # %bb.0: 93; X64-NEXT: movl %edi, %eax 94; X64-NEXT: shll $24, %eax 95; X64-NEXT: sarl $24, %eax 96; X64-NEXT: retq 97; 98; X32-LABEL: test_sext_i8: 99; X32: # %bb.0: 100; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax 101; X32-NEXT: retl 102 %r = sext i8 %val to i32 103 ret i32 %r 104} 105 106define i32 @test_sext_i16(i16 %val) { 107; X64-LABEL: test_sext_i16: 108; X64: # %bb.0: 109; X64-NEXT: movl %edi, %eax 110; X64-NEXT: shll $16, %eax 111; X64-NEXT: sarl $16, %eax 112; X64-NEXT: retq 113; 114; X32-LABEL: test_sext_i16: 115; X32: # %bb.0: 116; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax 117; X32-NEXT: retl 118 %r = sext i16 %val to i32 119 ret i32 %r 120} 121 122define i16 @test_zext_i8_to_i16(i8 %x, i8 %y) { 123; X64-LABEL: test_zext_i8_to_i16: 124; X64: # %bb.0: 125; X64-NEXT: addb %dil, %sil 126; X64-NEXT: movzbl %sil, %eax 127; X64-NEXT: # kill: def $ax killed $ax killed $eax 128; X64-NEXT: retq 129; 130; X32-LABEL: test_zext_i8_to_i16: 131; X32: # %bb.0: 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 136; X32-NEXT: retl 137 %a = add i8 %x, %y 138 %b = zext i8 %a to i16 139 ret i16 %b 140} 141