diff options
Diffstat (limited to 'llvm/test/CodeGen/X86/mul-constant-i64.ll')
| -rw-r--r-- | llvm/test/CodeGen/X86/mul-constant-i64.ll | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/X86/mul-constant-i64.ll b/llvm/test/CodeGen/X86/mul-constant-i64.ll index e0793380ab9..332ad7f0129 100644 --- a/llvm/test/CodeGen/X86/mul-constant-i64.ll +++ b/llvm/test/CodeGen/X86/mul-constant-i64.ll @@ -1938,8 +1938,7 @@ define i64 @test_mul_by_66(i64 %x) { ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shll $6, %ecx -; X86-NEXT: addl %eax, %ecx -; X86-NEXT: addl %eax, %ecx +; X86-NEXT: leal (%ecx,%eax,2), %ecx ; X86-NEXT: movl $66, %eax ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: addl %ecx, %edx @@ -1949,16 +1948,14 @@ define i64 @test_mul_by_66(i64 %x) { ; X64-HSW: # %bb.0: ; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] ; X64-HSW-NEXT: shlq $6, %rax # sched: [1:0.50] -; X64-HSW-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50] -; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25] +; X64-HSW-NEXT: leaq (%rax,%rdi,2), %rax # sched: [1:0.50] ; X64-HSW-NEXT: retq # sched: [7:1.00] ; ; X64-JAG-LABEL: test_mul_by_66: ; X64-JAG: # %bb.0: ; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] ; X64-JAG-NEXT: shlq $6, %rax # sched: [1:0.50] -; X64-JAG-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50] -; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50] +; X64-JAG-NEXT: leaq (%rax,%rdi,2), %rax # sched: [2:1.00] ; X64-JAG-NEXT: retq # sched: [4:1.00] ; ; X86-NOOPT-LABEL: test_mul_by_66: @@ -2049,6 +2046,67 @@ define i64 @test_mul_by_73(i64 %x) { ret i64 %mul } +define i64 @test_mul_by_520(i64 %x) { +; X86-LABEL: test_mul_by_520: +; X86: # %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, %ecx +; X86-NEXT: shll $9, %ecx +; X86-NEXT: leal (%ecx,%eax,8), %ecx +; X86-NEXT: movl $520, %eax # imm = 0x208 +; X86-NEXT: mull {{[0-9]+}}(%esp) +; X86-NEXT: addl %ecx, %edx +; X86-NEXT: retl +; +; X64-HSW-LABEL: test_mul_by_520: +; X64-HSW: # %bb.0: +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25] +; X64-HSW-NEXT: shlq $9, %rax # sched: [1:0.50] +; X64-HSW-NEXT: leaq (%rax,%rdi,8), %rax # sched: [1:0.50] +; X64-HSW-NEXT: retq # sched: [7:1.00] +; +; X64-JAG-LABEL: test_mul_by_520: +; X64-JAG: # %bb.0: +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.50] +; X64-JAG-NEXT: shlq $9, %rax # sched: [1:0.50] +; X64-JAG-NEXT: leaq (%rax,%rdi,8), %rax # sched: [2:1.00] +; X64-JAG-NEXT: retq # sched: [4:1.00] +; +; X86-NOOPT-LABEL: test_mul_by_520: +; X86-NOOPT: # %bb.0: +; X86-NOOPT-NEXT: movl $520, %eax # imm = 0x208 +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp) +; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %ecx # imm = 0x208 +; X86-NOOPT-NEXT: addl %ecx, %edx +; X86-NOOPT-NEXT: retl +; +; HSW-NOOPT-LABEL: test_mul_by_520: +; HSW-NOOPT: # %bb.0: +; HSW-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 +; HSW-NOOPT-NEXT: # sched: [3:1.00] +; HSW-NOOPT-NEXT: retq # sched: [7:1.00] +; +; JAG-NOOPT-LABEL: test_mul_by_520: +; JAG-NOOPT: # %bb.0: +; JAG-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 +; JAG-NOOPT-NEXT: # sched: [6:4.00] +; JAG-NOOPT-NEXT: retq # sched: [4:1.00] +; +; X64-SLM-LABEL: test_mul_by_520: +; X64-SLM: # %bb.0: +; X64-SLM-NEXT: imulq $520, %rdi, %rax # imm = 0x208 +; X64-SLM-NEXT: # sched: [3:1.00] +; X64-SLM-NEXT: retq # sched: [4:1.00] +; +; SLM-NOOPT-LABEL: test_mul_by_520: +; SLM-NOOPT: # %bb.0: +; SLM-NOOPT-NEXT: imulq $520, %rdi, %rax # imm = 0x208 +; SLM-NOOPT-NEXT: # sched: [3:1.00] +; SLM-NOOPT-NEXT: retq # sched: [4:1.00] + %mul = mul nsw i64 %x, 520 + ret i64 %mul +} + ; (x*9+42)*(x*5+2) define i64 @test_mul_spec(i64 %x) nounwind { ; X86-LABEL: test_mul_spec: |

