2017-03-22 20:03:56 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
|
|
|
|
|
|
|
|
define i16 @test_mul_by_1(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 1
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_2(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: addl %eax, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 2
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_3(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-26 01:35:03 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 3
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_4(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $2, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (,%rdi,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 4
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_5(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-26 01:35:03 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 5
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_6(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: addl %eax, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: addl %edi, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 6
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_7(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_7:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: leal (,%ecx,8), %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_7:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (,%rdi,8), %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 7
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_8(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $3, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (,%rdi,8), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 8
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_9(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_9:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-26 01:35:03 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_9:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 9
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_10(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_10:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: addl %eax, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_10:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: addl %edi, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 10
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_11(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_11:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_11:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 11
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_12(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_12:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $2, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_12:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: shll $2, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 12
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_13(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_13:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_13:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 13
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_14(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_14:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2018-07-25 05:15:41 +08:00
|
|
|
; X86-NEXT: movl %ecx, %eax
|
|
|
|
; X86-NEXT: shll $4, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_14:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-07-25 05:15:41 +08:00
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $4, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 14
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_15(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_15:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_15:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 15
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_16(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $4, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: shll $4, %edi
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 16
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_17(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_17:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: movl %ecx, %eax
|
|
|
|
; X86-NEXT: shll $4, %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_17:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $4, %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rdi), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 17
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_18(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_18:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: addl %eax, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_18:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: addl %edi, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 18
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_19(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_19:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-07-25 04:31:48 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_19:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2018-07-25 04:31:48 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 19
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_20(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_20:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $2, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_20:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: shll $2, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 20
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_21(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_21:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_21:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 21
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_22(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_22:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%ecx,%ecx,4), %eax
|
|
|
|
; X86-NEXT: leal (%ecx,%eax,4), %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_22:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,4), %eax
|
|
|
|
; X64-NEXT: addl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 22
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_23(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_23:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%ecx,%ecx,2), %eax
|
|
|
|
; X86-NEXT: shll $3, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_23:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
|
|
|
; X64-NEXT: shll $3, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 23
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_24(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_24:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $3, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_24:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: shll $3, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 24
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_25(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_25:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_25:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,4), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 25
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_26(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_26:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2018-07-25 07:44:12 +08:00
|
|
|
; X86-NEXT: leal (%ecx,%ecx,4), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_26:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2018-07-25 07:44:12 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,4), %eax
|
|
|
|
; X64-NEXT: addl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 26
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_27(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_27:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_27:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,2), %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 27
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_28(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_28:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal (%ecx,%ecx,8), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_28:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,2), %eax
|
|
|
|
; X64-NEXT: addl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 28
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_29(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_29:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-12-02 06:20:26 +08:00
|
|
|
; X86-NEXT: leal (%ecx,%ecx,8), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,2), %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
|
|
|
; X86-NEXT: addl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_29:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rax,2), %eax
|
2017-12-02 06:20:26 +08:00
|
|
|
; X64-NEXT: addl %edi, %eax
|
|
|
|
; X64-NEXT: addl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 29
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_30(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_30:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: movl %ecx, %eax
|
|
|
|
; X86-NEXT: shll $5, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_30:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $5, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 30
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_31(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_31:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: movl %ecx, %eax
|
|
|
|
; X86-NEXT: shll $5, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_31:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $5, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 31
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_32(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: shll $5, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-03-22 20:03:56 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-03-22 20:03:56 +08:00
|
|
|
; X64-NEXT: shll $5, %edi
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 32
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
2017-06-08 18:20:13 +08:00
|
|
|
|
2018-07-25 07:44:15 +08:00
|
|
|
define i16 @test_mul_by_37(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_37:
|
|
|
|
; X86: # %bb.0:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,4), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_37:
|
|
|
|
; X64: # %bb.0:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,4), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; 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:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,8), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_41:
|
|
|
|
; X64: # %bb.0:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,8), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 41
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2018-07-25 05:15:41 +08:00
|
|
|
define i16 @test_mul_by_62(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_62:
|
|
|
|
; X86: # %bb.0:
|
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X86-NEXT: movl %ecx, %eax
|
|
|
|
; X86-NEXT: shll $6, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
|
|
|
; X86-NEXT: subl %ecx, %eax
|
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_62:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $6, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
|
|
|
; X64-NEXT: subl %edi, %eax
|
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 62
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2018-07-25 09:15:35 +08:00
|
|
|
define i16 @test_mul_by_66(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_66:
|
|
|
|
; X86: # %bb.0:
|
2018-07-25 09:15:38 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: movl %eax, %ecx
|
|
|
|
; X86-NEXT: shll $6, %ecx
|
|
|
|
; X86-NEXT: leal (%ecx,%eax,2), %eax
|
2018-07-25 09:15:35 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_66:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $6, %eax
|
2018-07-25 09:15:38 +08:00
|
|
|
; X64-NEXT: leal (%rax,%rdi,2), %eax
|
2018-07-25 09:15:35 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 66
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2018-07-25 07:44:15 +08:00
|
|
|
define i16 @test_mul_by_73(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_73:
|
|
|
|
; X86: # %bb.0:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %ecx
|
|
|
|
; X86-NEXT: leal (%eax,%ecx,8), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_73:
|
|
|
|
; X64: # %bb.0:
|
2018-07-25 07:44:17 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: leal (%rdi,%rax,8), %eax
|
2018-07-25 07:44:15 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 73
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2018-07-25 09:15:38 +08:00
|
|
|
define i16 @test_mul_by_520(i16 %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), %eax
|
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_520:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: shll $9, %eax
|
|
|
|
; X64-NEXT: leal (%rax,%rdi,8), %eax
|
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 520
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2018-07-28 07:04:59 +08:00
|
|
|
define i16 @test_mul_by_neg10(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_neg10:
|
|
|
|
; X86: # %bb.0:
|
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: addl %eax, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,4), %eax
|
|
|
|
; X86-NEXT: negl %eax
|
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_neg10:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: addl %edi, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: negl %eax
|
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, -10
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_mul_by_neg36(i16 %x) {
|
|
|
|
; X86-LABEL: test_mul_by_neg36:
|
|
|
|
; X86: # %bb.0:
|
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X86-NEXT: shll $2, %eax
|
|
|
|
; X86-NEXT: leal (%eax,%eax,8), %eax
|
|
|
|
; X86-NEXT: negl %eax
|
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_by_neg36:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
|
|
|
; X64-NEXT: shll $2, %edi
|
|
|
|
; X64-NEXT: leal (%rdi,%rdi,8), %eax
|
|
|
|
; X64-NEXT: negl %eax
|
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, -36
|
|
|
|
ret i16 %mul
|
|
|
|
}
|
|
|
|
|
2017-06-08 18:20:13 +08:00
|
|
|
; (x*9+42)*(x*5+2)
|
|
|
|
define i16 @test_mul_spec(i16 %x) nounwind {
|
|
|
|
; X86-LABEL: test_mul_spec:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X86: # %bb.0:
|
2018-04-25 06:35:27 +08:00
|
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: leal 42(%eax,%eax,8), %ecx
|
|
|
|
; X86-NEXT: leal 2(%eax,%eax,4), %eax
|
|
|
|
; X86-NEXT: imull %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X86-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test_mul_spec:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $edi killed $edi def $rdi
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: leal 42(%rdi,%rdi,8), %ecx
|
|
|
|
; X64-NEXT: leal 2(%rdi,%rdi,4), %eax
|
|
|
|
; X64-NEXT: imull %ecx, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-06-08 18:20:13 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
%mul = mul nsw i16 %x, 9
|
|
|
|
%add = add nsw i16 %mul, 42
|
|
|
|
%mul2 = mul nsw i16 %x, 5
|
|
|
|
%add2 = add nsw i16 %mul2, 2
|
|
|
|
%mul3 = mul nsw i16 %add, %add2
|
|
|
|
ret i16 %mul3
|
|
|
|
}
|