[llvm] r337870 - [X86] Add test cases for multiply by 37, 41, and 73.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 24 16:44:15 PDT 2018
Author: ctopper
Date: Tue Jul 24 16:44:15 2018
New Revision: 337870
URL: http://llvm.org/viewvc/llvm-project?rev=337870&view=rev
Log:
[X86] Add test cases for multiply by 37, 41, and 73.
These can all be handled with 2 LEAs similar to what we do for 11, 19, 21.
Modified:
llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll
llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll
llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll
Modified: llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll?rev=337870&r1=337869&r2=337870&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll (original)
+++ llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll Tue Jul 24 16:44:15 2018
@@ -639,6 +639,38 @@ define i16 @test_mul_by_32(i16 %x) {
ret i16 %mul
}
+define i16 @test_mul_by_37(i16 %x) {
+; X86-LABEL: test_mul_by_37:
+; X86: # %bb.0:
+; X86-NEXT: imull $37, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: # kill: def $ax killed $ax killed $eax
+; X86-NEXT: retl
+;
+; X64-LABEL: test_mul_by_37:
+; X64: # %bb.0:
+; X64-NEXT: imull $37, %edi, %eax
+; X64-NEXT: # kill: def $ax killed $ax killed $eax
+; X64-NEXT: retq
+ %mul = mul nsw i16 %x, 37
+ ret i16 %mul
+}
+
+define i16 @test_mul_by_41(i16 %x) {
+; X86-LABEL: test_mul_by_41:
+; X86: # %bb.0:
+; X86-NEXT: imull $41, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: # kill: def $ax killed $ax killed $eax
+; X86-NEXT: retl
+;
+; X64-LABEL: test_mul_by_41:
+; X64: # %bb.0:
+; X64-NEXT: imull $41, %edi, %eax
+; X64-NEXT: # kill: def $ax killed $ax killed $eax
+; X64-NEXT: retq
+ %mul = mul nsw i16 %x, 41
+ ret i16 %mul
+}
+
define i16 @test_mul_by_62(i16 %x) {
; X86-LABEL: test_mul_by_62:
; X86: # %bb.0:
@@ -662,6 +694,22 @@ define i16 @test_mul_by_62(i16 %x) {
ret i16 %mul
}
+define i16 @test_mul_by_73(i16 %x) {
+; X86-LABEL: test_mul_by_73:
+; X86: # %bb.0:
+; X86-NEXT: imull $73, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: # kill: def $ax killed $ax killed $eax
+; X86-NEXT: retl
+;
+; X64-LABEL: test_mul_by_73:
+; X64: # %bb.0:
+; X64-NEXT: imull $73, %edi, %eax
+; X64-NEXT: # kill: def $ax killed $ax killed $eax
+; X64-NEXT: retq
+ %mul = mul nsw i16 %x, 73
+ ret i16 %mul
+}
+
; (x*9+42)*(x*5+2)
define i16 @test_mul_spec(i16 %x) nounwind {
; X86-LABEL: test_mul_spec:
Modified: llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll?rev=337870&r1=337869&r2=337870&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll (original)
+++ llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll Tue Jul 24 16:44:15 2018
@@ -1676,6 +1676,94 @@ define i32 @test_mul_by_32(i32 %x) {
ret i32 %mul
}
+define i32 @test_mul_by_37(i32 %x) {
+; X86-LABEL: test_mul_by_37:
+; X86: # %bb.0:
+; X86-NEXT: imull $37, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_37:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_37:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_37:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %eax
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_37:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_37:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_37:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_37:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i32 %x, 37
+ ret i32 %mul
+}
+
+define i32 @test_mul_by_41(i32 %x) {
+; X86-LABEL: test_mul_by_41:
+; X86: # %bb.0:
+; X86-NEXT: imull $41, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_41:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_41:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_41:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %eax
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_41:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_41:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_41:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_41:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i32 %x, 41
+ ret i32 %mul
+}
+
define i32 @test_mul_by_62(i32 %x) {
; X86-LABEL: test_mul_by_62:
; X86: # %bb.0:
@@ -1733,6 +1821,50 @@ define i32 @test_mul_by_62(i32 %x) {
ret i32 %mul
}
+define i32 @test_mul_by_73(i32 %x) {
+; X86-LABEL: test_mul_by_73:
+; X86: # %bb.0:
+; X86-NEXT: imull $73, {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_73:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_73:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_73:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %eax
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_73:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_73:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_73:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_73:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i32 %x, 73
+ ret i32 %mul
+}
+
; (x*9+42)*(x*5+2)
define i32 @test_mul_spec(i32 %x) nounwind {
; X86-LABEL: test_mul_spec:
Modified: llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll?rev=337870&r1=337869&r2=337870&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll Tue Jul 24 16:44:15 2018
@@ -1761,6 +1761,106 @@ define i64 @test_mul_by_32(i64 %x) {
ret i64 %mul
}
+define i64 @test_mul_by_37(i64 %x) {
+; X86-LABEL: test_mul_by_37:
+; X86: # %bb.0:
+; X86-NEXT: movl $37, %eax
+; X86-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NEXT: imull $37, {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: addl %ecx, %edx
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_37:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_37:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imulq $37, %rdi, %rax # sched: [6:4.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_37:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: movl $37, %eax
+; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %ecx
+; X86-NOOPT-NEXT: addl %ecx, %edx
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_37:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_37:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [6:4.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_37:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_37:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imulq $37, %rdi, %rax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i64 %x, 37
+ ret i64 %mul
+}
+
+define i64 @test_mul_by_41(i64 %x) {
+; X86-LABEL: test_mul_by_41:
+; X86: # %bb.0:
+; X86-NEXT: movl $41, %eax
+; X86-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NEXT: imull $41, {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: addl %ecx, %edx
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_41:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_41:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imulq $41, %rdi, %rax # sched: [6:4.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_41:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: movl $41, %eax
+; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %ecx
+; X86-NOOPT-NEXT: addl %ecx, %edx
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_41:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_41:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [6:4.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_41:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_41:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imulq $41, %rdi, %rax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i64 %x, 41
+ ret i64 %mul
+}
+
define i64 @test_mul_by_62(i64 %x) {
; X86-LABEL: test_mul_by_62:
; X86: # %bb.0:
@@ -1824,6 +1924,56 @@ define i64 @test_mul_by_62(i64 %x) {
ret i64 %mul
}
+define i64 @test_mul_by_73(i64 %x) {
+; X86-LABEL: test_mul_by_73:
+; X86: # %bb.0:
+; X86-NEXT: movl $73, %eax
+; X86-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NEXT: imull $73, {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: addl %ecx, %edx
+; X86-NEXT: retl
+;
+; X64-HSW-LABEL: test_mul_by_73:
+; X64-HSW: # %bb.0:
+; X64-HSW-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00]
+; X64-HSW-NEXT: retq # sched: [7:1.00]
+;
+; X64-JAG-LABEL: test_mul_by_73:
+; X64-JAG: # %bb.0:
+; X64-JAG-NEXT: imulq $73, %rdi, %rax # sched: [6:4.00]
+; X64-JAG-NEXT: retq # sched: [4:1.00]
+;
+; X86-NOOPT-LABEL: test_mul_by_73:
+; X86-NOOPT: # %bb.0:
+; X86-NOOPT-NEXT: movl $73, %eax
+; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %ecx
+; X86-NOOPT-NEXT: addl %ecx, %edx
+; X86-NOOPT-NEXT: retl
+;
+; HSW-NOOPT-LABEL: test_mul_by_73:
+; HSW-NOOPT: # %bb.0:
+; HSW-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00]
+; HSW-NOOPT-NEXT: retq # sched: [7:1.00]
+;
+; JAG-NOOPT-LABEL: test_mul_by_73:
+; JAG-NOOPT: # %bb.0:
+; JAG-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [6:4.00]
+; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
+;
+; X64-SLM-LABEL: test_mul_by_73:
+; X64-SLM: # %bb.0:
+; X64-SLM-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00]
+; X64-SLM-NEXT: retq # sched: [4:1.00]
+;
+; SLM-NOOPT-LABEL: test_mul_by_73:
+; SLM-NOOPT: # %bb.0:
+; SLM-NOOPT-NEXT: imulq $73, %rdi, %rax # sched: [3:1.00]
+; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
+ %mul = mul nsw i64 %x, 73
+ ret i64 %mul
+}
+
; (x*9+42)*(x*5+2)
define i64 @test_mul_spec(i64 %x) nounwind {
; X86-LABEL: test_mul_spec:
More information about the llvm-commits
mailing list