; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86 ; Incremental updates of the instruction depths should be enough for this test ; case. ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=haswell -machine-combiner-inc-threshold=0| FileCheck %s --check-prefix=X64-HSW ; Function Attrs: norecurse nounwind readnone uwtable define i32 @mult(i32, i32) local_unnamed_addr #0 { ; X86-LABEL: mult: ; X86: # %bb.0: ; X86-NEXT: pushl %esi ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: .cfi_offset %esi, -8 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx ; X86-NEXT: cmpl $1, %edx ; X86-NEXT: movl $1, %eax ; X86-NEXT: movl $1, %esi ; X86-NEXT: jg .LBB0_2 ; X86-NEXT: # %bb.1: ; X86-NEXT: movl %edx, %esi ; X86-NEXT: .LBB0_2: ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx ; X86-NEXT: testl %edx, %edx ; X86-NEXT: je .LBB0_4 ; X86-NEXT: # %bb.3: ; X86-NEXT: movl %esi, %eax ; X86-NEXT: .LBB0_4: ; X86-NEXT: decl %ecx ; X86-NEXT: cmpl $31, %ecx ; X86-NEXT: ja .LBB0_7 ; X86-NEXT: # %bb.5: ; X86-NEXT: jmpl *.LJTI0_0(,%ecx,4) ; X86-NEXT: .LBB0_6: ; X86-NEXT: addl %eax, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_7: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: xorl %eax, %eax ; X86-NEXT: .LBB0_8: ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_10: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: shll $2, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_12: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: addl %eax, %eax ; X86-NEXT: jmp .LBB0_9 ; X86-NEXT: .LBB0_13: ; X86-NEXT: leal (,%eax,8), %ecx ; X86-NEXT: jmp .LBB0_41 ; X86-NEXT: .LBB0_14: ; X86-NEXT: shll $3, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_16: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: addl %eax, %eax ; X86-NEXT: jmp .LBB0_11 ; X86-NEXT: .LBB0_17: ; X86-NEXT: leal (%eax,%eax,4), %ecx ; X86-NEXT: jmp .LBB0_18 ; X86-NEXT: .LBB0_19: ; X86-NEXT: shll $2, %eax ; X86-NEXT: jmp .LBB0_9 ; X86-NEXT: .LBB0_20: ; X86-NEXT: leal (%eax,%eax,2), %ecx ; X86-NEXT: jmp .LBB0_21 ; X86-NEXT: .LBB0_22: ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shll $4, %ecx ; X86-NEXT: subl %eax, %ecx ; X86-NEXT: jmp .LBB0_41 ; X86-NEXT: .LBB0_23: ; X86-NEXT: leal (%eax,%eax,4), %eax ; X86-NEXT: jmp .LBB0_9 ; X86-NEXT: .LBB0_24: ; X86-NEXT: shll $4, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_25: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shll $4, %ecx ; X86-NEXT: jmp .LBB0_26 ; X86-NEXT: .LBB0_27: ; X86-NEXT: addl %eax, %eax ; X86-NEXT: .LBB0_15: ; X86-NEXT: leal (%eax,%eax,8), %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_28: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: leal (%eax,%eax,8), %ecx ; X86-NEXT: .LBB0_18: ; X86-NEXT: leal (%eax,%ecx,2), %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_29: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: shll $2, %eax ; X86-NEXT: jmp .LBB0_11 ; X86-NEXT: .LBB0_30: ; X86-NEXT: leal (%eax,%eax,4), %ecx ; X86-NEXT: .LBB0_21: ; X86-NEXT: leal (%eax,%ecx,4), %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_31: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: leal (%eax,%eax,4), %ecx ; X86-NEXT: leal (%eax,%ecx,4), %ecx ; X86-NEXT: jmp .LBB0_26 ; X86-NEXT: .LBB0_32: ; X86-NEXT: leal (%eax,%eax,2), %ecx ; X86-NEXT: shll $3, %ecx ; X86-NEXT: jmp .LBB0_41 ; X86-NEXT: .LBB0_33: ; X86-NEXT: shll $3, %eax ; X86-NEXT: jmp .LBB0_9 ; X86-NEXT: .LBB0_34: ; X86-NEXT: leal (%eax,%eax,4), %eax ; X86-NEXT: .LBB0_11: ; X86-NEXT: leal (%eax,%eax,4), %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_35: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: leal (%eax,%eax,4), %ecx ; X86-NEXT: leal (%ecx,%ecx,4), %ecx ; X86-NEXT: jmp .LBB0_26 ; X86-NEXT: .LBB0_36: ; X86-NEXT: leal (%eax,%eax,8), %eax ; X86-NEXT: .LBB0_9: ; X86-NEXT: leal (%eax,%eax,2), %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_37: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: leal (%eax,%eax,8), %ecx ; X86-NEXT: leal (%ecx,%ecx,2), %ecx ; X86-NEXT: jmp .LBB0_26 ; X86-NEXT: .LBB0_38: ; X86-NEXT: leal (%eax,%eax,8), %ecx ; X86-NEXT: leal (%ecx,%ecx,2), %ecx ; X86-NEXT: addl %eax, %ecx ; X86-NEXT: .LBB0_26: ; X86-NEXT: addl %ecx, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_39: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shll $5, %ecx ; X86-NEXT: subl %eax, %ecx ; X86-NEXT: jmp .LBB0_41 ; X86-NEXT: .LBB0_40: ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shll $5, %ecx ; X86-NEXT: .LBB0_41: ; X86-NEXT: subl %eax, %ecx ; X86-NEXT: movl %ecx, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; X86-NEXT: .LBB0_42: ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: shll $5, %eax ; X86-NEXT: popl %esi ; X86-NEXT: .cfi_def_cfa_offset 4 ; X86-NEXT: retl ; ; X64-HSW-LABEL: mult: ; X64-HSW: # %bb.0: ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi ; X64-HSW-NEXT: cmpl $1, %esi ; X64-HSW-NEXT: movl $1, %ecx ; X64-HSW-NEXT: movl %esi, %eax ; X64-HSW-NEXT: cmovgl %ecx, %eax ; X64-HSW-NEXT: testl %esi, %esi ; X64-HSW-NEXT: cmovel %ecx, %eax ; X64-HSW-NEXT: decl %edi ; X64-HSW-NEXT: cmpl $31, %edi ; X64-HSW-NEXT: ja .LBB0_3 ; X64-HSW-NEXT: # %bb.1: ; X64-HSW-NEXT: jmpq *.LJTI0_0(,%rdi,8) ; X64-HSW-NEXT: .LBB0_2: ; X64-HSW-NEXT: addl %eax, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_3: ; X64-HSW-NEXT: xorl %eax, %eax ; X64-HSW-NEXT: .LBB0_4: ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_6: ; X64-HSW-NEXT: shll $2, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_8: ; X64-HSW-NEXT: addl %eax, %eax ; X64-HSW-NEXT: .LBB0_5: ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_9: ; X64-HSW-NEXT: leal (,%rax,8), %ecx ; X64-HSW-NEXT: jmp .LBB0_37 ; X64-HSW-NEXT: .LBB0_10: ; X64-HSW-NEXT: shll $3, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_12: ; X64-HSW-NEXT: addl %eax, %eax ; X64-HSW-NEXT: .LBB0_7: ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_13: ; X64-HSW-NEXT: leal (%rax,%rax,4), %ecx ; X64-HSW-NEXT: leal (%rax,%rcx,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_15: ; X64-HSW-NEXT: shll $2, %eax ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_16: ; X64-HSW-NEXT: leal (%rax,%rax,2), %ecx ; X64-HSW-NEXT: leal (%rax,%rcx,4), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_18: ; X64-HSW-NEXT: movl %eax, %ecx ; X64-HSW-NEXT: shll $4, %ecx ; X64-HSW-NEXT: subl %eax, %ecx ; X64-HSW-NEXT: jmp .LBB0_37 ; X64-HSW-NEXT: .LBB0_19: ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_20: ; X64-HSW-NEXT: shll $4, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_21: ; X64-HSW-NEXT: movl %eax, %ecx ; X64-HSW-NEXT: shll $4, %ecx ; X64-HSW-NEXT: jmp .LBB0_34 ; X64-HSW-NEXT: .LBB0_22: ; X64-HSW-NEXT: addl %eax, %eax ; X64-HSW-NEXT: .LBB0_11: ; X64-HSW-NEXT: leal (%rax,%rax,8), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_23: ; X64-HSW-NEXT: leal (%rax,%rax,8), %ecx ; X64-HSW-NEXT: leal (%rax,%rcx,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_24: ; X64-HSW-NEXT: shll $2, %eax ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_25: ; X64-HSW-NEXT: leal (%rax,%rax,4), %ecx ; X64-HSW-NEXT: leal (%rax,%rcx,4), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_26: ; X64-HSW-NEXT: leal (%rax,%rax,4), %ecx ; X64-HSW-NEXT: leal (%rax,%rcx,4), %ecx ; X64-HSW-NEXT: jmp .LBB0_34 ; X64-HSW-NEXT: .LBB0_27: ; X64-HSW-NEXT: leal (%rax,%rax,2), %ecx ; X64-HSW-NEXT: shll $3, %ecx ; X64-HSW-NEXT: jmp .LBB0_37 ; X64-HSW-NEXT: .LBB0_28: ; X64-HSW-NEXT: shll $3, %eax ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_29: ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_30: ; X64-HSW-NEXT: leal (%rax,%rax,4), %ecx ; X64-HSW-NEXT: leal (%rcx,%rcx,4), %ecx ; X64-HSW-NEXT: jmp .LBB0_34 ; X64-HSW-NEXT: .LBB0_31: ; X64-HSW-NEXT: leal (%rax,%rax,8), %eax ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_32: ; X64-HSW-NEXT: leal (%rax,%rax,8), %ecx ; X64-HSW-NEXT: leal (%rcx,%rcx,2), %ecx ; X64-HSW-NEXT: jmp .LBB0_34 ; X64-HSW-NEXT: .LBB0_33: ; X64-HSW-NEXT: leal (%rax,%rax,8), %ecx ; X64-HSW-NEXT: leal (%rcx,%rcx,2), %ecx ; X64-HSW-NEXT: addl %eax, %ecx ; X64-HSW-NEXT: .LBB0_34: ; X64-HSW-NEXT: addl %eax, %ecx ; X64-HSW-NEXT: movl %ecx, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_35: ; X64-HSW-NEXT: movl %eax, %ecx ; X64-HSW-NEXT: shll $5, %ecx ; X64-HSW-NEXT: subl %eax, %ecx ; X64-HSW-NEXT: jmp .LBB0_37 ; X64-HSW-NEXT: .LBB0_36: ; X64-HSW-NEXT: movl %eax, %ecx ; X64-HSW-NEXT: shll $5, %ecx ; X64-HSW-NEXT: .LBB0_37: ; X64-HSW-NEXT: subl %eax, %ecx ; X64-HSW-NEXT: movl %ecx, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq ; X64-HSW-NEXT: .LBB0_39: ; X64-HSW-NEXT: shll $5, %eax ; X64-HSW-NEXT: # kill: def $eax killed $eax killed $rax ; X64-HSW-NEXT: retq %3 = icmp eq i32 %1, 0 %4 = icmp sgt i32 %1, 1 %5 = or i1 %3, %4 %6 = select i1 %5, i32 1, i32 %1 switch i32 %0, label %69 [ i32 1, label %70 i32 2, label %7 i32 3, label %9 i32 4, label %11 i32 5, label %13 i32 6, label %15 i32 7, label %17 i32 8, label %19 i32 9, label %21 i32 10, label %23 i32 11, label %25 i32 12, label %27 i32 13, label %29 i32 14, label %31 i32 15, label %33 i32 16, label %35 i32 17, label %37 i32 18, label %39 i32 19, label %41 i32 20, label %43 i32 21, label %45 i32 22, label %47 i32 23, label %49 i32 24, label %51 i32 25, label %53 i32 26, label %55 i32 27, label %57 i32 28, label %59 i32 29, label %61 i32 30, label %63 i32 31, label %65 i32 32, label %67 ] ;