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=i686-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X86 4 5define i8 @test_mul_i8(i8 %arg1, i8 %arg2) nounwind { 6; X64-LABEL: test_mul_i8: 7; X64: # %bb.0: 8; X64-NEXT: movsbl %dil, %eax 9; X64-NEXT: imulb %sil 10; X64-NEXT: retq 11; 12; X86-LABEL: test_mul_i8: 13; X86: # %bb.0: 14; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 15; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 16; X86-NEXT: cbtw 17; X86-NEXT: imulb %cl 18; X86-NEXT: retl 19 %ret = mul i8 %arg1, %arg2 20 ret i8 %ret 21} 22 23define i16 @test_mul_i16(i16 %arg1, i16 %arg2) nounwind { 24; X64-LABEL: test_mul_i16: 25; X64: # %bb.0: 26; X64-NEXT: movl %esi, %eax 27; X64-NEXT: imulw %di, %ax 28; X64-NEXT: # kill: def $ax killed $ax killed $eax 29; X64-NEXT: retq 30; 31; X86-LABEL: test_mul_i16: 32; X86: # %bb.0: 33; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 34; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 35; X86-NEXT: imulw %cx, %ax 36; X86-NEXT: # kill: def $ax killed $ax killed $eax 37; X86-NEXT: retl 38 %ret = mul i16 %arg1, %arg2 39 ret i16 %ret 40} 41 42define i32 @test_mul_i32(i32 %arg1, i32 %arg2) nounwind { 43; X64-LABEL: test_mul_i32: 44; X64: # %bb.0: 45; X64-NEXT: movl %esi, %eax 46; X64-NEXT: imull %edi, %eax 47; X64-NEXT: retq 48; 49; X86-LABEL: test_mul_i32: 50; X86: # %bb.0: 51; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 52; X86-NEXT: imull {{[0-9]+}}(%esp), %eax 53; X86-NEXT: retl 54 %ret = mul i32 %arg1, %arg2 55 ret i32 %ret 56} 57 58define i64 @test_mul_i64(i64 %arg1, i64 %arg2) nounwind { 59; X64-LABEL: test_mul_i64: 60; X64: # %bb.0: 61; X64-NEXT: movq %rsi, %rax 62; X64-NEXT: imulq %rdi, %rax 63; X64-NEXT: retq 64; 65; X86-LABEL: test_mul_i64: 66; X86: # %bb.0: 67; X86-NEXT: pushl %edi 68; X86-NEXT: pushl %esi 69; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 70; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 71; X86-NEXT: movl {{[0-9]+}}(%esp), %esi 72; X86-NEXT: imull %eax, %esi 73; X86-NEXT: movl %eax, %ecx 74; X86-NEXT: imull %edx, %ecx 75; X86-NEXT: movl {{[0-9]+}}(%esp), %edi 76; X86-NEXT: imull %edx, %edi 77; X86-NEXT: addl %edi, %esi 78; X86-NEXT: mull %edx 79; X86-NEXT: addl %esi, %edx 80; X86-NEXT: movl %ecx, %eax 81; X86-NEXT: popl %esi 82; X86-NEXT: popl %edi 83; X86-NEXT: retl 84 %ret = mul i64 %arg1, %arg2 85 ret i64 %ret 86} 87 88;TODO: instruction selection not supported yet 89;define i128 @test_mul_i128(i128 %arg1, i128 %arg2) nounwind { 90; %ret = mul i128 %arg1, %arg2 91; ret i128 %ret 92;} 93