[llvm] r304209 - This patch closes PR28513: an optimization of multiplication by different constants.
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 12:26:34 PDT 2017
I've reverted this change for the moment to unblock our bots (r304231). Please let me know if you need any help reproducing the issue.
thanks,
vedant
> On May 30, 2017, at 12:22 PM, Vedant Kumar <vsk at apple.com> wrote:
>
> Hi Andrew,
>
> I think this change is responsible for a tablgen failure in stage2 builds:
>
> http://green.lab.llvm.org/green/job/clang-stage2-configure-Rthinlto_build/2171/ <http://green.lab.llvm.org/green/job/clang-stage2-configure-Rthinlto_build/2171/>
>
> I reproduced the failure locally (without ThinLTO), reverted your commit, rebuilt the stage1 clang, rebuilt the stage2 llvm-tblgen tool, and found that the crash disappears when your commit is reverted.
>
> Could you take a look?
>
> FAILED: lib/Target/ARM/ARMGenRegisterBank.inc.tmp
> cd /Volumes/Builds/pz-master-stage2-RA/lib/Target/ARM && /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes
> /Builds/pz-master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp
> 0 llvm-tblgen 0x0000000106fc9568 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
> 1 llvm-tblgen 0x0000000106fc9be6 SignalHandler(int) + 422
> 2 libsystem_platform.dylib 0x00000001076a7fba _sigtramp + 26
> 3 libsystem_platform.dylib 0x00007fff58deb468 _sigtramp + 1366570184
> 4 llvm-tblgen 0x0000000106e89cc7 llvm::CodeGenRegBank::getCompositeSubRegIndex(llvm::CodeGenSubRegIndex*, llvm::CodeGenSubRegIndex*) + 615
> 5 llvm-tblgen 0x0000000106e88be6 llvm::CodeGenRegister::computeSubRegs(llvm::CodeGenRegBank&) + 2182
> 6 llvm-tblgen 0x0000000106e8e9f0 llvm::CodeGenRegBank::CodeGenRegBank(llvm::RecordKeeper&) + 2192
> 7 llvm-tblgen 0x0000000106f384a1 llvm::EmitRegisterBank(llvm::RecordKeeper&, llvm::raw_ostream&) + 65
> 8 llvm-tblgen 0x0000000106f72c64 (anonymous namespace)::LLVMTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&) + 1172
> 9 llvm-tblgen 0x0000000106fcb15f llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) + 3599
> 10 llvm-tblgen 0x0000000106f727a6 main + 134
> 11 libdyld.dylib 0x000000010733c6a5 start + 1
> Stack dump:
> 0. Program arguments: /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes/Builds/pz-master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp
> /bin/sh: line 1: 41986 Segmentation fault: 11 /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes/Builds/pz
> -master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp
>
> thanks,
> vedant
>
>> On May 30, 2017, at 6:00 AM, Andrew V. Tischenko via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>>
>> Author: avt77
>> Date: Tue May 30 08:00:44 2017
>> New Revision: 304209
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=304209&view=rev <http://llvm.org/viewvc/llvm-project?rev=304209&view=rev>
>> Log:
>> This patch closes PR28513: an optimization of multiplication by different constants.
>> It's implemented on DAG combiner level.
>>
>> Modified:
>> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>> 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/lib/Target/X86/X86ISelLowering.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=304209&r1=304208&r2=304209&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=304209&r1=304208&r2=304209&view=diff>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
>> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue May 30 08:00:44 2017
>> @@ -80,6 +80,12 @@ static cl::opt<int> ExperimentalPrefLoop
>> " of the loop header PC will be 0)."),
>> cl::Hidden);
>>
>> +static cl::opt<bool> MulConstantOptimization(
>> + "mul-constant-optimization", cl::init(true),
>> + cl::desc("Replace 'mul x, Const' with more effective instructions like "
>> + "SHIFT, LEA, etc."),
>> + cl::Hidden);
>> +
>> /// Call this when the user attempts to do something unsupported, like
>> /// returning a double without SSE2 enabled on x86_64. This is not fatal, unlike
>> /// report_fatal_error, so calling code should attempt to recover without
>> @@ -30928,6 +30934,75 @@ static SDValue reduceVMULWidth(SDNode *N
>> }
>> }
>>
>> +static SDValue combineMulSpecial(uint64_t MulAmt, SDNode *N, SelectionDAG &DAG,
>> + EVT VT, SDLoc DL) {
>> +
>> + auto combineMulShlAddOrSub = [&](int Mult, int Shift, bool isAdd) {
>> + SDValue Result = DAG.getNode(X86ISD::MUL_IMM, DL, VT, N->getOperand(0),
>> + DAG.getConstant(Mult, DL, VT));
>> + Result = DAG.getNode(ISD::SHL, DL, VT, Result,
>> + DAG.getConstant(Shift, DL, MVT::i8));
>> + Result = DAG.getNode(isAdd ? ISD::ADD : ISD::SUB, DL, VT, N->getOperand(0),
>> + Result);
>> + return Result;
>> + };
>> +
>> + auto combineMulMulAddOrSub = [&](bool isAdd) {
>> + SDValue Result = DAG.getNode(X86ISD::MUL_IMM, DL, VT, N->getOperand(0),
>> + DAG.getConstant(9, DL, VT));
>> + Result = DAG.getNode(ISD::MUL, DL, VT, Result, DAG.getConstant(3, DL, VT));
>> + Result = DAG.getNode(isAdd ? ISD::ADD : ISD::SUB, DL, VT, N->getOperand(0),
>> + Result);
>> + return Result;
>> + };
>> +
>> + switch (MulAmt) {
>> + default:
>> + break;
>> + case 11:
>> + // mul x, 11 => add ((shl (mul x, 5), 1), x)
>> + return combineMulShlAddOrSub(5, 1, /*isAdd*/ true);
>> + case 21:
>> + // mul x, 21 => add ((shl (mul x, 5), 2), x)
>> + return combineMulShlAddOrSub(5, 2, /*isAdd*/ true);
>> + case 22:
>> + // mul x, 22 => add (add ((shl (mul x, 5), 2), x), x)
>> + return DAG.getNode(ISD::ADD, DL, VT, N->getOperand(0),
>> + combineMulShlAddOrSub(5, 2, /*isAdd*/ true));
>> + case 19:
>> + // mul x, 19 => sub ((shl (mul x, 5), 2), x)
>> + return combineMulShlAddOrSub(5, 2, /*isAdd*/ false);
>> + case 13:
>> + // mul x, 13 => add ((shl (mul x, 3), 2), x)
>> + return combineMulShlAddOrSub(3, 2, /*isAdd*/ true);
>> + case 23:
>> + // mul x, 13 => sub ((shl (mul x, 3), 3), x)
>> + return combineMulShlAddOrSub(3, 3, /*isAdd*/ false);
>> + case 14:
>> + // mul x, 14 => add (add ((shl (mul x, 3), 2), x), x)
>> + return DAG.getNode(ISD::ADD, DL, VT, N->getOperand(0),
>> + combineMulShlAddOrSub(3, 2, /*isAdd*/ true));
>> + case 26:
>> + // mul x, 26 => sub ((mul (mul x, 9), 3), x)
>> + return combineMulMulAddOrSub(/*isAdd*/ false);
>> + case 28:
>> + // mul x, 28 => add ((mul (mul x, 9), 3), x)
>> + return combineMulMulAddOrSub(/*isAdd*/ true);
>> + case 29:
>> + // mul x, 29 => add (add ((mul (mul x, 9), 3), x), x)
>> + return DAG.getNode(ISD::ADD, DL, VT, N->getOperand(0),
>> + combineMulMulAddOrSub(/*isAdd*/ true));
>> + case 30:
>> + // mul x, 30 => sub (sub ((shl x, 5), x), x)
>> + return DAG.getNode(
>> + ISD::SUB, DL, VT, N->getOperand(0),
>> + DAG.getNode(ISD::SUB, DL, VT, N->getOperand(0),
>> + DAG.getNode(ISD::SHL, DL, VT, N->getOperand(0),
>> + DAG.getConstant(5, DL, MVT::i8))));
>> + }
>> + return SDValue();
>> +}
>> +
>> /// Optimize a single multiply with constant into two operations in order to
>> /// implement it with two cheaper instructions, e.g. LEA + SHL, LEA + LEA.
>> static SDValue combineMul(SDNode *N, SelectionDAG &DAG,
>> @@ -30937,6 +31012,8 @@ static SDValue combineMul(SDNode *N, Sel
>> if (DCI.isBeforeLegalize() && VT.isVector())
>> return reduceVMULWidth(N, DAG, Subtarget);
>>
>> + if (!MulConstantOptimization)
>> + return SDValue();
>> // An imul is usually smaller than the alternative sequence.
>> if (DAG.getMachineFunction().getFunction()->optForMinSize())
>> return SDValue();
>> @@ -30992,7 +31069,8 @@ static SDValue combineMul(SDNode *N, Sel
>> else
>> NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, NewMul,
>> DAG.getConstant(MulAmt2, DL, VT));
>> - }
>> + } else if (!Subtarget.slowLEA())
>> + NewMul = combineMulSpecial(MulAmt, N, DAG, VT, DL);
>>
>> if (!NewMul) {
>> assert(MulAmt != 0 &&
>>
>> 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=304209&r1=304208&r2=304209&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll?rev=304209&r1=304208&r2=304209&view=diff>
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/mul-constant-i16.ll Tue May 30 08:00:44 2017
>> @@ -188,13 +188,16 @@ define i16 @test_mul_by_11(i16 %x) {
>> ; X86-LABEL: test_mul_by_11:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $11, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,2), %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_11:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $11, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> +; X64-NEXT: leal (%rdi,%rax,2), %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 11
>> @@ -225,13 +228,16 @@ define i16 @test_mul_by_13(i16 %x) {
>> ; X86-LABEL: test_mul_by_13:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $13, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_13:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $13, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> +; X64-NEXT: leal (%rdi,%rax,4), %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 13
>> @@ -241,14 +247,19 @@ define i16 @test_mul_by_13(i16 %x) {
>> define i16 @test_mul_by_14(i16 %x) {
>> ; X86-LABEL: test_mul_by_14:
>> ; X86: # BB#0:
>> -; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $14, %eax, %eax
>> +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %eax
>> +; X86-NEXT: leal (%ecx,%eax,4), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_14:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $14, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> +; X64-NEXT: leal (%rdi,%rax,4), %eax
>> +; X64-NEXT: addl %edi, %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 14
>> @@ -338,14 +349,19 @@ define i16 @test_mul_by_19(i16 %x) {
>> ; X86-LABEL: test_mul_by_19:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $19, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: shll $2, %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_19:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $19, %edi, %eax
>> -; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> +; X64-NEXT: shll $2, %eax
>> +; X64-NEXT: subl %eax, %edi
>> +; X64-NEXT: movl %edi, %eax
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 19
>> ret i16 %mul
>> @@ -375,13 +391,16 @@ define i16 @test_mul_by_21(i16 %x) {
>> ; X86-LABEL: test_mul_by_21:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $21, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_21:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $21, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> +; X64-NEXT: leal (%rdi,%rax,4), %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 21
>> @@ -391,14 +410,19 @@ define i16 @test_mul_by_21(i16 %x) {
>> define i16 @test_mul_by_22(i16 %x) {
>> ; X86-LABEL: test_mul_by_22:
>> ; X86: # BB#0:
>> -; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $22, %eax, %eax
>> +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,4), %eax
>> +; X86-NEXT: leal (%ecx,%eax,4), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_22:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $22, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> +; X64-NEXT: leal (%rdi,%rax,4), %eax
>> +; X64-NEXT: addl %edi, %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 22
>> @@ -409,14 +433,19 @@ define i16 @test_mul_by_23(i16 %x) {
>> ; X86-LABEL: test_mul_by_23:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $23, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: shll $3, %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_23:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $23, %edi, %eax
>> -; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> +; X64-NEXT: shll $3, %eax
>> +; X64-NEXT: subl %eax, %edi
>> +; X64-NEXT: movl %edi, %eax
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 23
>> ret i16 %mul
>> @@ -466,14 +495,19 @@ define i16 @test_mul_by_26(i16 %x) {
>> ; X86-LABEL: test_mul_by_26:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $26, %eax, %eax
>> +; X86-NEXT: leal (%eax,%eax,8), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_26:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $26, %edi, %eax
>> -; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> +; X64-NEXT: leal (%rax,%rax,2), %eax
>> +; X64-NEXT: subl %eax, %edi
>> +; X64-NEXT: movl %edi, %eax
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 26
>> ret i16 %mul
>> @@ -502,14 +536,19 @@ define i16 @test_mul_by_27(i16 %x) {
>> define i16 @test_mul_by_28(i16 %x) {
>> ; X86-LABEL: test_mul_by_28:
>> ; X86: # BB#0:
>> -; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $28, %eax, %eax
>> +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,8), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_28:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $28, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> +; X64-NEXT: leal (%rax,%rax,2), %eax
>> +; X64-NEXT: addl %edi, %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 28
>> @@ -519,14 +558,21 @@ define i16 @test_mul_by_28(i16 %x) {
>> define i16 @test_mul_by_29(i16 %x) {
>> ; X86-LABEL: test_mul_by_29:
>> ; X86: # BB#0:
>> -; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $29, %eax, %eax
>> +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,8), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_29:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $29, %edi, %eax
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> +; X64-NEXT: leal (%rax,%rax,2), %eax
>> +; X64-NEXT: addl %edi, %eax
>> +; X64-NEXT: addl %edi, %eax
>> ; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 29
>> @@ -537,14 +583,22 @@ define i16 @test_mul_by_30(i16 %x) {
>> ; X86-LABEL: test_mul_by_30:
>> ; X86: # BB#0:
>> ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: imull $30, %eax, %eax
>> +; X86-NEXT: movl %eax, %ecx
>> +; X86-NEXT: shll $5, %ecx
>> +; X86-NEXT: movl %eax, %edx
>> +; X86-NEXT: subl %ecx, %edx
>> +; X86-NEXT: subl %edx, %eax
>> ; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> ; X86-NEXT: retl
>> ;
>> ; X64-LABEL: test_mul_by_30:
>> ; X64: # BB#0:
>> -; X64-NEXT: imull $30, %edi, %eax
>> -; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; X64-NEXT: movl %edi, %eax
>> +; X64-NEXT: shll $5, %eax
>> +; X64-NEXT: movl %edi, %ecx
>> +; X64-NEXT: subl %eax, %ecx
>> +; X64-NEXT: subl %ecx, %edi
>> +; X64-NEXT: movl %edi, %eax
>> ; X64-NEXT: retq
>> %mul = mul nsw i16 %x, 30
>> ret i16 %mul
>> @@ -587,3 +641,30 @@ define i16 @test_mul_by_32(i16 %x) {
>> %mul = mul nsw i16 %x, 32
>> ret i16 %mul
>> }
>> +
>> +; (x*9+42)*(x*5+2)
>> +define i16 @test_mul_spec(i16 %x) nounwind {
>> +; X86-LABEL: test_mul_spec:
>> +; X86: # BB#0:
>> +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal 42(%eax,%eax,8), %ecx
>> +; X86-NEXT: leal 2(%eax,%eax,4), %eax
>> +; X86-NEXT: imull %ecx, %eax
>> +; X86-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; X86-NEXT: retl
>> +;
>> +; X64-LABEL: test_mul_spec:
>> +; X64: # BB#0:
>> +; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-NEXT: leal 42(%rdi,%rdi,8), %ecx
>> +; X64-NEXT: leal 2(%rdi,%rdi,4), %eax
>> +; X64-NEXT: imull %ecx, %eax
>> +; X64-NEXT: # kill: %AX<def> %AX<kill> %EAX<kill>
>> +; 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
>> +}
>>
>> 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=304209&r1=304208&r2=304209&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll?rev=304209&r1=304208&r2=304209&view=diff>
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/mul-constant-i32.ll Tue May 30 08:00:44 2017
>> @@ -1,6 +1,12 @@
>> ; 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
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=X64-HSW
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=X64-JAG
>> +; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefix=X86-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=HSW-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=JAG-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=X64-SLM
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=SLM-NOOPT
>>
>> define i32 @test_mul_by_1(i32 %x) {
>> ; X86-LABEL: test_mul_by_1:
>> @@ -8,10 +14,40 @@ define i32 @test_mul_by_1(i32 %x) {
>> ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_1:
>> -; X64: # BB#0:
>> -; X64-NEXT: movl %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_1:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_1:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_1:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_1:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_1:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_1:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_1:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 1
>> ret i32 %mul
>> }
>> @@ -23,11 +59,47 @@ define i32 @test_mul_by_2(i32 %x) {
>> ; X86-NEXT: addl %eax, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_2:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_2:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_2:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_2:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: addl %eax, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_2:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_2:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_2:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_2:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 2
>> ret i32 %mul
>> }
>> @@ -38,11 +110,46 @@ define i32 @test_mul_by_3(i32 %x) {
>> ; X86-NEXT: imull $3, {{[0-9]+}}(%esp), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_3:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_3:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_3:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_3:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_3:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_3:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_3:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_3:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 3
>> ret i32 %mul
>> }
>> @@ -54,11 +161,47 @@ define i32 @test_mul_by_4(i32 %x) {
>> ; X86-NEXT: shll $2, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_4:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (,%rdi,4), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_4:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_4:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_4:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: shll $2, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_4:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_4:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_4:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_4:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 4
>> ret i32 %mul
>> }
>> @@ -69,11 +212,46 @@ define i32 @test_mul_by_5(i32 %x) {
>> ; X86-NEXT: imull $5, {{[0-9]+}}(%esp), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_5:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_5:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_5:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_5:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_5:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_5:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_5:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_5:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 5
>> ret i32 %mul
>> }
>> @@ -86,12 +264,46 @@ define i32 @test_mul_by_6(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_6:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: addl %edi, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_6:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_6:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_6:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_6:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $6, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_6:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $6, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_6:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_6:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $6, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 6
>> ret i32 %mul
>> }
>> @@ -104,12 +316,46 @@ define i32 @test_mul_by_7(i32 %x) {
>> ; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_7:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (,%rdi,8), %eax
>> -; X64-NEXT: subl %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_7:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_7:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_7:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_7:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $7, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_7:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $7, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_7:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_7:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $7, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 7
>> ret i32 %mul
>> }
>> @@ -121,11 +367,47 @@ define i32 @test_mul_by_8(i32 %x) {
>> ; X86-NEXT: shll $3, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_8:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (,%rdi,8), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_8:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_8:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_8:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: shll $3, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_8:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_8:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_8:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_8:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 8
>> ret i32 %mul
>> }
>> @@ -136,11 +418,46 @@ define i32 @test_mul_by_9(i32 %x) {
>> ; X86-NEXT: imull $9, {{[0-9]+}}(%esp), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_9:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_9:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_9:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_9:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_9:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_9:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_9:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_9:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 9
>> ret i32 %mul
>> }
>> @@ -153,12 +470,46 @@ define i32 @test_mul_by_10(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,4), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_10:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: addl %edi, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_10:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_10:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_10:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_10:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $10, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_10:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $10, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_10:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_10:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $10, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 10
>> ret i32 %mul
>> }
>> @@ -166,13 +517,49 @@ define i32 @test_mul_by_10(i32 %x) {
>> define i32 @test_mul_by_11(i32 %x) {
>> ; X86-LABEL: test_mul_by_11:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $11, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_11:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $11, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_11:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_11:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_11:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_11:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $11, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_11:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $11, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_11:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $11, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_11:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $11, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 11
>> ret i32 %mul
>> }
>> @@ -185,12 +572,46 @@ define i32 @test_mul_by_12(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_12:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: shll $2, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_12:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: shll $2, %edi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_12:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: shll $2, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_12:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_12:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $12, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_12:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $12, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_12:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: shll $2, %edi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_12:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $12, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 12
>> ret i32 %mul
>> }
>> @@ -198,13 +619,49 @@ define i32 @test_mul_by_12(i32 %x) {
>> define i32 @test_mul_by_13(i32 %x) {
>> ; X86-LABEL: test_mul_by_13:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $13, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_13:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $13, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_13:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_13:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_13:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_13:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $13, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_13:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $13, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_13:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $13, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_13:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $13, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 13
>> ret i32 %mul
>> }
>> @@ -212,13 +669,52 @@ define i32 @test_mul_by_13(i32 %x) {
>> define i32 @test_mul_by_14(i32 %x) {
>> ; X86-LABEL: test_mul_by_14:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $14, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %eax
>> +; X86-NEXT: leal (%ecx,%eax,4), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_14:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $14, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_14:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_14:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_14:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_14:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $14, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_14:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $14, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_14:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $14, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_14:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $14, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 14
>> ret i32 %mul
>> }
>> @@ -231,12 +727,46 @@ define i32 @test_mul_by_15(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_15:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> -; X64-NEXT: leal (%rax,%rax,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_15:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_15:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_15:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_15:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $15, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_15:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $15, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_15:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rax,%rax,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_15:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $15, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 15
>> ret i32 %mul
>> }
>> @@ -248,11 +778,47 @@ define i32 @test_mul_by_16(i32 %x) {
>> ; X86-NEXT: shll $4, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_16:
>> -; X64: # BB#0:
>> -; X64-NEXT: shll $4, %edi
>> -; X64-NEXT: movl %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_16:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shll $4, %edi # sched: [1:0.50]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_16:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shll $4, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_16:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: shll $4, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_16:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: shll $4, %edi # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_16:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: shll $4, %edi # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_16:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shll $4, %edi # sched: [1:1.00]
>> +; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_16:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: shll $4, %edi # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 16
>> ret i32 %mul
>> }
>> @@ -266,13 +832,49 @@ define i32 @test_mul_by_17(i32 %x) {
>> ; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_17:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: movl %edi, %eax
>> -; X64-NEXT: shll $4, %eax
>> -; X64-NEXT: leal (%rax,%rdi), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_17:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shll $4, %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rdi), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_17:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: shll $4, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rdi), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_17:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_17:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $17, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_17:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $17, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_17:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: shll $4, %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rax,%rdi), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_17:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $17, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 17
>> ret i32 %mul
>> }
>> @@ -285,12 +887,46 @@ define i32 @test_mul_by_18(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,8), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_18:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: addl %edi, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_18:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_18:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_18:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_18:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $18, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_18:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $18, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_18:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_18:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $18, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 18
>> ret i32 %mul
>> }
>> @@ -298,13 +934,54 @@ define i32 @test_mul_by_18(i32 %x) {
>> define i32 @test_mul_by_19(i32 %x) {
>> ; X86-LABEL: test_mul_by_19:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $19, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: shll $2, %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_19:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $19, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_19:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: shll $2, %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subl %eax, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_19:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: shll $2, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %eax, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_19:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_19:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $19, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_19:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $19, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_19:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $19, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_19:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $19, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 19
>> ret i32 %mul
>> }
>> @@ -317,12 +994,46 @@ define i32 @test_mul_by_20(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,4), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_20:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: shll $2, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_20:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: shll $2, %edi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_20:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: shll $2, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_20:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_20:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $20, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_20:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $20, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_20:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: shll $2, %edi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_20:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $20, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 20
>> ret i32 %mul
>> }
>> @@ -330,13 +1041,49 @@ define i32 @test_mul_by_20(i32 %x) {
>> define i32 @test_mul_by_21(i32 %x) {
>> ; X86-LABEL: test_mul_by_21:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $21, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_21:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $21, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_21:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_21:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_21:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_21:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $21, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_21:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $21, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_21:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $21, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_21:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $21, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 21
>> ret i32 %mul
>> }
>> @@ -344,13 +1091,52 @@ define i32 @test_mul_by_21(i32 %x) {
>> define i32 @test_mul_by_22(i32 %x) {
>> ; X86-LABEL: test_mul_by_22:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $22, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,4), %eax
>> +; X86-NEXT: leal (%ecx,%eax,4), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_22:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $22, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_22:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_22:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_22:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_22:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $22, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_22:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $22, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_22:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $22, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_22:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $22, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 22
>> ret i32 %mul
>> }
>> @@ -358,13 +1144,54 @@ define i32 @test_mul_by_22(i32 %x) {
>> define i32 @test_mul_by_23(i32 %x) {
>> ; X86-LABEL: test_mul_by_23:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $23, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: shll $3, %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_23:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $23, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_23:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: shll $3, %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subl %eax, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_23:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: shll $3, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %eax, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_23:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_23:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $23, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_23:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $23, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_23:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $23, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_23:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $23, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 23
>> ret i32 %mul
>> }
>> @@ -377,12 +1204,46 @@ define i32 @test_mul_by_24(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_24:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: shll $3, %edi
>> -; X64-NEXT: leal (%rdi,%rdi,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_24:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: shll $3, %edi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_24:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: shll $3, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_24:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_24:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $24, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_24:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $24, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_24:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: shll $3, %edi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_24:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $24, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 24
>> ret i32 %mul
>> }
>> @@ -395,12 +1256,46 @@ define i32 @test_mul_by_25(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,4), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_25:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,4), %eax
>> -; X64-NEXT: leal (%rax,%rax,4), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_25:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_25:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_25:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_25:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $25, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_25:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $25, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_25:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rax,%rax,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_25:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $25, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 25
>> ret i32 %mul
>> }
>> @@ -408,13 +1303,54 @@ define i32 @test_mul_by_25(i32 %x) {
>> define i32 @test_mul_by_26(i32 %x) {
>> ; X86-LABEL: test_mul_by_26:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $26, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,8), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %ecx
>> +; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_26:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $26, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_26:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subl %eax, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_26:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %eax, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_26:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_26:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $26, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_26:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $26, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_26:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $26, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_26:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $26, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 26
>> ret i32 %mul
>> }
>> @@ -427,12 +1363,46 @@ define i32 @test_mul_by_27(i32 %x) {
>> ; X86-NEXT: leal (%eax,%eax,2), %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_27:
>> -; X64: # BB#0:
>> -; X64-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> -; X64-NEXT: leal (%rdi,%rdi,8), %eax
>> -; X64-NEXT: leal (%rax,%rax,2), %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_27:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_27:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_27:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_27:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $27, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_27:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $27, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_27:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal (%rax,%rax,2), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_27:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $27, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 27
>> ret i32 %mul
>> }
>> @@ -440,13 +1410,52 @@ define i32 @test_mul_by_27(i32 %x) {
>> define i32 @test_mul_by_28(i32 %x) {
>> ; X86-LABEL: test_mul_by_28:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $28, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,8), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_28:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $28, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_28:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_28:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_28:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_28:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $28, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_28:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $28, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_28:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $28, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_28:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $28, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 28
>> ret i32 %mul
>> }
>> @@ -454,13 +1463,55 @@ define i32 @test_mul_by_28(i32 %x) {
>> define i32 @test_mul_by_29(i32 %x) {
>> ; X86-LABEL: test_mul_by_29:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $29, {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,8), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %eax
>> +; X86-NEXT: addl %ecx, %eax
>> +; X86-NEXT: addl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_29:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $29, %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_29:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_29:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_29:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_29:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $29, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_29:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $29, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_29:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $29, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_29:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $29, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 29
>> ret i32 %mul
>> }
>> @@ -468,13 +1519,58 @@ define i32 @test_mul_by_29(i32 %x) {
>> define i32 @test_mul_by_30(i32 %x) {
>> ; X86-LABEL: test_mul_by_30:
>> ; X86: # BB#0:
>> -; X86-NEXT: imull $30, {{[0-9]+}}(%esp), %eax
>> -; X86-NEXT: retl
>> -;
>> -; X64-LABEL: test_mul_by_30:
>> -; X64: # BB#0:
>> -; X64-NEXT: imull $30, %edi, %eax
>> -; X64-NEXT: retq
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: movl %eax, %ecx
>> +; X86-NEXT: shll $5, %ecx
>> +; X86-NEXT: movl %eax, %edx
>> +; X86-NEXT: subl %ecx, %edx
>> +; X86-NEXT: subl %edx, %eax
>> +; X86-NEXT: retl
>> +;
>> +; X64-HSW-LABEL: test_mul_by_30:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shll $5, %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: movl %edi, %ecx # sched: [1:0.25]
>> +; X64-HSW-NEXT: subl %eax, %ecx # sched: [1:0.25]
>> +; X64-HSW-NEXT: subl %ecx, %edi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_30:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: movl %edi, %ecx # sched: [1:0.17]
>> +; X64-JAG-NEXT: shll $5, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %eax, %ecx # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %ecx, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_30:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_30:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $30, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_30:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $30, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_30:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imull $30, %edi, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_30:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $30, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 30
>> ret i32 %mul
>> }
>> @@ -488,12 +1584,46 @@ define i32 @test_mul_by_31(i32 %x) {
>> ; X86-NEXT: subl %ecx, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_31:
>> -; X64: # BB#0:
>> -; X64-NEXT: movl %edi, %eax
>> -; X64-NEXT: shll $5, %eax
>> -; X64-NEXT: subl %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_31:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shll $5, %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_31:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: shll $5, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_31:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_31:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imull $31, %edi, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_31:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imull $31, %edi, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_31:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: shll $5, %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_31:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imull $31, %edi, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 31
>> ret i32 %mul
>> }
>> @@ -505,11 +1635,124 @@ define i32 @test_mul_by_32(i32 %x) {
>> ; X86-NEXT: shll $5, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_32:
>> -; X64: # BB#0:
>> -; X64-NEXT: shll $5, %edi
>> -; X64-NEXT: movl %edi, %eax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_32:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shll $5, %edi # sched: [1:0.50]
>> +; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_32:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shll $5, %edi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_32:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: shll $5, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_32:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: shll $5, %edi # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_32:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: shll $5, %edi # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_32:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shll $5, %edi # sched: [1:1.00]
>> +; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_32:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: shll $5, %edi # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i32 %x, 32
>> ret i32 %mul
>> }
>> +
>> +; (x*9+42)*(x*5+2)
>> +define i32 @test_mul_spec(i32 %x) nounwind {
>> +; X86-LABEL: test_mul_spec:
>> +; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal 42(%eax,%eax,8), %ecx
>> +; X86-NEXT: leal 2(%eax,%eax,4), %eax
>> +; X86-NEXT: imull %ecx, %eax
>> +; X86-NEXT: retl
>> +;
>> +; X64-HSW-LABEL: test_mul_spec:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,8), %ecx # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl $42, %ecx # sched: [1:0.25]
>> +; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addl $2, %eax # sched: [1:0.25]
>> +; X64-HSW-NEXT: imull %ecx, %eax # sched: [4:1.00]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_spec:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-JAG-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:0.50]
>> +; X64-JAG-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; X64-JAG-NEXT: imull %ecx, %eax # sched: [3:1.00]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_spec:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: leal 42(%eax,%eax,8), %ecx
>> +; X86-NOOPT-NEXT: leal 2(%eax,%eax,4), %eax
>> +; X86-NOOPT-NEXT: imull %ecx, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_spec:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi,8), %ecx # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: addl $42, %ecx # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: addl $2, %eax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: imull %ecx, %eax # sched: [4:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_spec:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; JAG-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: imull %ecx, %eax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_spec:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; X64-SLM-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:1.00]
>> +; X64-SLM-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; X64-SLM-NEXT: imull %ecx, %eax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_spec:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: # kill: %EDI<def> %EDI<kill> %RDI<def>
>> +; SLM-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: imull %ecx, %eax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> + %mul = mul nsw i32 %x, 9
>> + %add = add nsw i32 %mul, 42
>> + %mul2 = mul nsw i32 %x, 5
>> + %add2 = add nsw i32 %mul2, 2
>> + %mul3 = mul nsw i32 %add, %add2
>> + ret i32 %mul3
>> +}
>>
>> 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=304209&r1=304208&r2=304209&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll?rev=304209&r1=304208&r2=304209&view=diff>
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/mul-constant-i64.ll Tue May 30 08:00:44 2017
>> @@ -1,18 +1,55 @@
>> ; 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
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=X64-HSW
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=X64-JAG
>> +; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefix=X86-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=HSW-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=JAG-NOOPT
>> +; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=X64-SLM
>> +; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=SLM-NOOPT
>>
>> -define i64 @test_mul_by_1(i64 %x) {
>> +define i64 @test_mul_by_1(i64 %x) nounwind {
>> ; X86-LABEL: test_mul_by_1:
>> ; X86: # BB#0:
>> ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_1:
>> -; X64: # BB#0:
>> -; X64-NEXT: movq %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_1:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_1:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_1:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_1:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_1:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_1:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_1:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 1
>> ret i64 %mul
>> }
>> @@ -26,10 +63,43 @@ define i64 @test_mul_by_2(i64 %x) {
>> ; X86-NEXT: addl %eax, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_2:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_2:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_2:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_2:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: shldl $1, %eax, %edx
>> +; X86-NOOPT-NEXT: addl %eax, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_2:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_2:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_2:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_2:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (%rdi,%rdi), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 2
>> ret i64 %mul
>> }
>> @@ -43,10 +113,43 @@ define i64 @test_mul_by_3(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_3:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_3:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_3:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_3:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $3, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_3:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_3:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_3:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_3:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 3
>> ret i64 %mul
>> }
>> @@ -60,10 +163,43 @@ define i64 @test_mul_by_4(i64 %x) {
>> ; X86-NEXT: shll $2, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_4:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (,%rdi,4), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_4:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_4:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_4:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: shldl $2, %eax, %edx
>> +; X86-NOOPT-NEXT: shll $2, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_4:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_4:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_4:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_4:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (,%rdi,4), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 4
>> ret i64 %mul
>> }
>> @@ -77,10 +213,43 @@ define i64 @test_mul_by_5(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_5:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,4), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_5:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_5:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_5:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $5, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_5:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_5:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_5:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_5:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 5
>> ret i64 %mul
>> }
>> @@ -95,11 +264,46 @@ define i64 @test_mul_by_6(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,2), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_6:
>> -; X64: # BB#0:
>> -; X64-NEXT: addq %rdi, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_6:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_6:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_6:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $6, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_6:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_6:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_6:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_6:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $6, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 6
>> ret i64 %mul
>> }
>> @@ -115,11 +319,46 @@ define i64 @test_mul_by_7(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_7:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (,%rdi,8), %rax
>> -; X64-NEXT: subq %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_7:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_7:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_7:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $7, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_7:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_7:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_7:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_7:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $7, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 7
>> ret i64 %mul
>> }
>> @@ -133,10 +372,43 @@ define i64 @test_mul_by_8(i64 %x) {
>> ; X86-NEXT: shll $3, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_8:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (,%rdi,8), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_8:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_8:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_8:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: shldl $3, %eax, %edx
>> +; X86-NOOPT-NEXT: shll $3, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_8:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_8:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_8:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_8:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (,%rdi,8), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 8
>> ret i64 %mul
>> }
>> @@ -150,10 +422,43 @@ define i64 @test_mul_by_9(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_9:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,8), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_9:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_9:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_9:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $9, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_9:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_9:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_9:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_9:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 9
>> ret i64 %mul
>> }
>> @@ -168,11 +473,46 @@ define i64 @test_mul_by_10(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,2), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_10:
>> -; X64: # BB#0:
>> -; X64-NEXT: addq %rdi, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,4), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_10:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_10:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_10:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $10, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_10:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_10:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_10:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_10:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $10, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 10
>> ret i64 %mul
>> }
>> @@ -180,16 +520,53 @@ define i64 @test_mul_by_10(i64 %x) {
>> define i64 @test_mul_by_11(i64 %x) {
>> ; X86-LABEL: test_mul_by_11:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,2), %ecx
>> ; X86-NEXT: movl $11, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $11, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_11:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $11, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_11:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_11:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_11:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $11, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_11:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_11:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_11:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_11:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $11, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 11
>> ret i64 %mul
>> }
>> @@ -204,11 +581,46 @@ define i64 @test_mul_by_12(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,4), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_12:
>> -; X64: # BB#0:
>> -; X64-NEXT: shlq $2, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_12:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shlq $2, %rdi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_12:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shlq $2, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_12:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $12, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_12:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_12:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_12:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shlq $2, %rdi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_12:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $12, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 12
>> ret i64 %mul
>> }
>> @@ -216,16 +628,53 @@ define i64 @test_mul_by_12(i64 %x) {
>> define i64 @test_mul_by_13(i64 %x) {
>> ; X86-LABEL: test_mul_by_13:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %ecx
>> ; X86-NEXT: movl $13, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $13, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_13:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $13, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_13:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_13:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_13:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $13, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_13:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_13:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_13:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_13:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $13, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 13
>> ret i64 %mul
>> }
>> @@ -233,16 +682,56 @@ define i64 @test_mul_by_13(i64 %x) {
>> define i64 @test_mul_by_14(i64 %x) {
>> ; X86-LABEL: test_mul_by_14:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %ecx
>> +; X86-NEXT: addl %eax, %ecx
>> ; X86-NEXT: movl $14, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $14, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_14:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $14, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_14:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_14:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_14:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $14, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_14:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_14:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_14:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_14:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $14, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 14
>> ret i64 %mul
>> }
>> @@ -258,11 +747,46 @@ define i64 @test_mul_by_15(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_15:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,4), %rax
>> -; X64-NEXT: leaq (%rax,%rax,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_15:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_15:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_15:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $15, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_15:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_15:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_15:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_15:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $15, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 15
>> ret i64 %mul
>> }
>> @@ -276,11 +800,49 @@ define i64 @test_mul_by_16(i64 %x) {
>> ; X86-NEXT: shll $4, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_16:
>> -; X64: # BB#0:
>> -; X64-NEXT: shlq $4, %rdi
>> -; X64-NEXT: movq %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_16:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shlq $4, %rdi # sched: [1:0.50]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_16:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shlq $4, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_16:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: shldl $4, %eax, %edx
>> +; X86-NOOPT-NEXT: shll $4, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_16:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: shlq $4, %rdi # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_16:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: shlq $4, %rdi # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_16:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shlq $4, %rdi # sched: [1:1.00]
>> +; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_16:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: shlq $4, %rdi # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 16
>> ret i64 %mul
>> }
>> @@ -297,12 +859,49 @@ define i64 @test_mul_by_17(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_17:
>> -; X64: # BB#0:
>> -; X64-NEXT: movq %rdi, %rax
>> -; X64-NEXT: shlq $4, %rax
>> -; X64-NEXT: leaq (%rax,%rdi), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_17:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shlq $4, %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_17:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: shlq $4, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rdi), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_17:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $17, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_17:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_17:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_17:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: shlq $4, %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_17:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $17, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 17
>> ret i64 %mul
>> }
>> @@ -317,11 +916,46 @@ define i64 @test_mul_by_18(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,2), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_18:
>> -; X64: # BB#0:
>> -; X64-NEXT: addq %rdi, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,8), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_18:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: addq %rdi, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_18:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_18:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $18, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_18:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_18:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_18:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: addq %rdi, %rdi # sched: [1:0.50]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_18:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $18, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 18
>> ret i64 %mul
>> }
>> @@ -329,16 +963,58 @@ define i64 @test_mul_by_18(i64 %x) {
>> define i64 @test_mul_by_19(i64 %x) {
>> ; X86-LABEL: test_mul_by_19:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,4), %eax
>> +; X86-NEXT: shll $2, %eax
>> +; X86-NEXT: subl %eax, %ecx
>> ; X86-NEXT: movl $19, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $19, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_19:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $19, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_19:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: shlq $2, %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subq %rax, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_19:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: shlq $2, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rax, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_19:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $19, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_19:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_19:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_19:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_19:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $19, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 19
>> ret i64 %mul
>> }
>> @@ -353,11 +1029,46 @@ define i64 @test_mul_by_20(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,4), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_20:
>> -; X64: # BB#0:
>> -; X64-NEXT: shlq $2, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,4), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_20:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shlq $2, %rdi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_20:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shlq $2, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_20:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $20, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_20:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_20:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_20:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shlq $2, %rdi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_20:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $20, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 20
>> ret i64 %mul
>> }
>> @@ -365,16 +1076,53 @@ define i64 @test_mul_by_20(i64 %x) {
>> define i64 @test_mul_by_21(i64 %x) {
>> ; X86-LABEL: test_mul_by_21:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %ecx
>> ; X86-NEXT: movl $21, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $21, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_21:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $21, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_21:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_21:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_21:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $21, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_21:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_21:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_21:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_21:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $21, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 21
>> ret i64 %mul
>> }
>> @@ -382,16 +1130,56 @@ define i64 @test_mul_by_21(i64 %x) {
>> define i64 @test_mul_by_22(i64 %x) {
>> ; X86-LABEL: test_mul_by_22:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,4), %ecx
>> +; X86-NEXT: leal (%eax,%ecx,4), %ecx
>> +; X86-NEXT: addl %eax, %ecx
>> ; X86-NEXT: movl $22, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $22, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_22:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $22, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_22:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_22:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rax,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_22:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $22, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_22:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_22:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_22:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_22:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $22, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 22
>> ret i64 %mul
>> }
>> @@ -399,16 +1187,58 @@ define i64 @test_mul_by_22(i64 %x) {
>> define i64 @test_mul_by_23(i64 %x) {
>> ; X86-LABEL: test_mul_by_23:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %eax
>> +; X86-NEXT: shll $3, %eax
>> +; X86-NEXT: subl %eax, %ecx
>> ; X86-NEXT: movl $23, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $23, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_23:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $23, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_23:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: shlq $3, %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subq %rax, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_23:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: shlq $3, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rax, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_23:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $23, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_23:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_23:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_23:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_23:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $23, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 23
>> ret i64 %mul
>> }
>> @@ -423,11 +1253,46 @@ define i64 @test_mul_by_24(i64 %x) {
>> ; X86-NEXT: leal (%edx,%ecx,8), %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_24:
>> -; X64: # BB#0:
>> -; X64-NEXT: shlq $3, %rdi
>> -; X64-NEXT: leaq (%rdi,%rdi,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_24:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shlq $3, %rdi # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_24:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shlq $3, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_24:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $24, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_24:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_24:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_24:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shlq $3, %rdi # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_24:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $24, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 24
>> ret i64 %mul
>> }
>> @@ -443,11 +1308,46 @@ define i64 @test_mul_by_25(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_25:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,4), %rax
>> -; X64-NEXT: leaq (%rax,%rax,4), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_25:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_25:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_25:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $25, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_25:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_25:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_25:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rax,%rax,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_25:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $25, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 25
>> ret i64 %mul
>> }
>> @@ -455,16 +1355,58 @@ define i64 @test_mul_by_25(i64 %x) {
>> define i64 @test_mul_by_26(i64 %x) {
>> ; X86-LABEL: test_mul_by_26:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,8), %eax
>> +; X86-NEXT: leal (%eax,%eax,2), %eax
>> +; X86-NEXT: subl %eax, %ecx
>> ; X86-NEXT: movl $26, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $26, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_26:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $26, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_26:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subq %rax, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_26:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rax, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_26:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $26, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_26:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_26:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_26:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_26:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $26, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 26
>> ret i64 %mul
>> }
>> @@ -480,11 +1422,46 @@ define i64 @test_mul_by_27(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_27:
>> -; X64: # BB#0:
>> -; X64-NEXT: leaq (%rdi,%rdi,8), %rax
>> -; X64-NEXT: leaq (%rax,%rax,2), %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_27:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_27:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_27:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $27, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_27:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_27:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_27:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_27:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $27, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 27
>> ret i64 %mul
>> }
>> @@ -492,16 +1469,56 @@ define i64 @test_mul_by_27(i64 %x) {
>> define i64 @test_mul_by_28(i64 %x) {
>> ; X86-LABEL: test_mul_by_28:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,8), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %ecx
>> +; X86-NEXT: addl %eax, %ecx
>> ; X86-NEXT: movl $28, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $28, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_28:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $28, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_28:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_28:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_28:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $28, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_28:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_28:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_28:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_28:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $28, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 28
>> ret i64 %mul
>> }
>> @@ -509,16 +1526,59 @@ define i64 @test_mul_by_28(i64 %x) {
>> define i64 @test_mul_by_29(i64 %x) {
>> ; X86-LABEL: test_mul_by_29:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NEXT: leal (%eax,%eax,8), %ecx
>> +; X86-NEXT: leal (%ecx,%ecx,2), %ecx
>> +; X86-NEXT: addl %eax, %ecx
>> +; X86-NEXT: addl %eax, %ecx
>> ; X86-NEXT: movl $29, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $29, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_29:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $29, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_29:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: addq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_29:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq (%rdi,%rdi,8), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq (%rax,%rax,2), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: addq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_29:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $29, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_29:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_29:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_29:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_29:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $29, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 29
>> ret i64 %mul
>> }
>> @@ -526,16 +1586,60 @@ define i64 @test_mul_by_29(i64 %x) {
>> define i64 @test_mul_by_30(i64 %x) {
>> ; X86-LABEL: test_mul_by_30:
>> ; X86: # BB#0:
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: shll $5, %ecx
>> ; X86-NEXT: movl $30, %eax
>> ; X86-NEXT: mull {{[0-9]+}}(%esp)
>> -; X86-NEXT: imull $30, {{[0-9]+}}(%esp), %ecx
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_30:
>> -; X64: # BB#0:
>> -; X64-NEXT: imulq $30, %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_30:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shlq $5, %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: movq %rdi, %rcx # sched: [1:0.25]
>> +; X64-HSW-NEXT: subq %rax, %rcx # sched: [1:0.25]
>> +; X64-HSW-NEXT: subq %rcx, %rdi # sched: [1:0.25]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_30:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: movq %rdi, %rcx # sched: [1:0.17]
>> +; X64-JAG-NEXT: shlq $5, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rax, %rcx # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rcx, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_30:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $30, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_30:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_30:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_30:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_30:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $30, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 30
>> ret i64 %mul
>> }
>> @@ -552,12 +1656,49 @@ define i64 @test_mul_by_31(i64 %x) {
>> ; X86-NEXT: addl %ecx, %edx
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_31:
>> -; X64: # BB#0:
>> -; X64-NEXT: movq %rdi, %rax
>> -; X64-NEXT: shlq $5, %rax
>> -; X64-NEXT: subq %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_31:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: shlq $5, %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: subq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_31:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: shlq $5, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: subq %rdi, %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_31:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl $31, %eax
>> +; X86-NOOPT-NEXT: mull {{[0-9]+}}(%esp)
>> +; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_31:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_31:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_31:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: shlq $5, %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: subq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_31:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: imulq $31, %rdi, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 31
>> ret i64 %mul
>> }
>> @@ -571,11 +1712,168 @@ define i64 @test_mul_by_32(i64 %x) {
>> ; X86-NEXT: shll $5, %eax
>> ; X86-NEXT: retl
>> ;
>> -; X64-LABEL: test_mul_by_32:
>> -; X64: # BB#0:
>> -; X64-NEXT: shlq $5, %rdi
>> -; X64-NEXT: movq %rdi, %rax
>> -; X64-NEXT: retq
>> +; X64-HSW-LABEL: test_mul_by_32:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: shlq $5, %rdi # sched: [1:0.50]
>> +; X64-HSW-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_by_32:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: shlq $5, %rdi # sched: [1:0.50]
>> +; X64-JAG-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_by_32:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edx
>> +; X86-NOOPT-NEXT: shldl $5, %eax, %edx
>> +; X86-NOOPT-NEXT: shll $5, %eax
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_by_32:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: shlq $5, %rdi # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_by_32:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: shlq $5, %rdi # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.17]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_by_32:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: shlq $5, %rdi # sched: [1:1.00]
>> +; X64-SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_by_32:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: shlq $5, %rdi # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: movq %rdi, %rax # sched: [1:0.50]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> %mul = mul nsw i64 %x, 32
>> ret i64 %mul
>> }
>> +
>> +; (x*9+42)*(x*5+2)
>> +define i64 @test_mul_spec(i64 %x) nounwind {
>> +; X86-LABEL: test_mul_spec:
>> +; X86: # BB#0:
>> +; X86-NEXT: pushl %ebx
>> +; X86-NEXT: pushl %edi
>> +; X86-NEXT: pushl %esi
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
>> +; X86-NEXT: movl $9, %edx
>> +; X86-NEXT: movl %ecx, %eax
>> +; X86-NEXT: mull %edx
>> +; X86-NEXT: movl %eax, %esi
>> +; X86-NEXT: leal (%edi,%edi,8), %ebx
>> +; X86-NEXT: addl $42, %esi
>> +; X86-NEXT: adcl %edx, %ebx
>> +; X86-NEXT: movl $5, %edx
>> +; X86-NEXT: movl %ecx, %eax
>> +; X86-NEXT: mull %edx
>> +; X86-NEXT: movl %eax, %ecx
>> +; X86-NEXT: leal (%edi,%edi,4), %edi
>> +; X86-NEXT: addl $2, %ecx
>> +; X86-NEXT: adcl %edx, %edi
>> +; X86-NEXT: movl %esi, %eax
>> +; X86-NEXT: mull %ecx
>> +; X86-NEXT: imull %esi, %edi
>> +; X86-NEXT: addl %edi, %edx
>> +; X86-NEXT: imull %ebx, %ecx
>> +; X86-NEXT: addl %ecx, %edx
>> +; X86-NEXT: popl %esi
>> +; X86-NEXT: popl %edi
>> +; X86-NEXT: popl %ebx
>> +; X86-NEXT: retl
>> +;
>> +; X64-HSW-LABEL: test_mul_spec:
>> +; X64-HSW: # BB#0:
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,8), %rcx # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq $42, %rcx # sched: [1:0.25]
>> +; X64-HSW-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-HSW-NEXT: addq $2, %rax # sched: [1:0.25]
>> +; X64-HSW-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; X64-HSW-NEXT: retq # sched: [1:1.00]
>> +;
>> +; X64-JAG-LABEL: test_mul_spec:
>> +; X64-JAG: # BB#0:
>> +; X64-JAG-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:0.50]
>> +; X64-JAG-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; X64-JAG-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; X64-JAG-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X86-NOOPT-LABEL: test_mul_spec:
>> +; X86-NOOPT: # BB#0:
>> +; X86-NOOPT-NEXT: pushl %ebx
>> +; X86-NOOPT-NEXT: pushl %edi
>> +; X86-NOOPT-NEXT: pushl %esi
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %ecx
>> +; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %edi
>> +; X86-NOOPT-NEXT: movl $9, %edx
>> +; X86-NOOPT-NEXT: movl %ecx, %eax
>> +; X86-NOOPT-NEXT: mull %edx
>> +; X86-NOOPT-NEXT: movl %eax, %esi
>> +; X86-NOOPT-NEXT: leal (%edi,%edi,8), %ebx
>> +; X86-NOOPT-NEXT: addl $42, %esi
>> +; X86-NOOPT-NEXT: adcl %edx, %ebx
>> +; X86-NOOPT-NEXT: movl $5, %edx
>> +; X86-NOOPT-NEXT: movl %ecx, %eax
>> +; X86-NOOPT-NEXT: mull %edx
>> +; X86-NOOPT-NEXT: movl %eax, %ecx
>> +; X86-NOOPT-NEXT: leal (%edi,%edi,4), %edi
>> +; X86-NOOPT-NEXT: addl $2, %ecx
>> +; X86-NOOPT-NEXT: adcl %edx, %edi
>> +; X86-NOOPT-NEXT: movl %esi, %eax
>> +; X86-NOOPT-NEXT: mull %ecx
>> +; X86-NOOPT-NEXT: imull %esi, %edi
>> +; X86-NOOPT-NEXT: addl %edi, %edx
>> +; X86-NOOPT-NEXT: imull %ebx, %ecx
>> +; X86-NOOPT-NEXT: addl %ecx, %edx
>> +; X86-NOOPT-NEXT: popl %esi
>> +; X86-NOOPT-NEXT: popl %edi
>> +; X86-NOOPT-NEXT: popl %ebx
>> +; X86-NOOPT-NEXT: retl
>> +;
>> +; HSW-NOOPT-LABEL: test_mul_spec:
>> +; HSW-NOOPT: # BB#0:
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,8), %rcx # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: addq $42, %rcx # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: leaq (%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; HSW-NOOPT-NEXT: addq $2, %rax # sched: [1:0.25]
>> +; HSW-NOOPT-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; HSW-NOOPT-NEXT: retq # sched: [1:1.00]
>> +;
>> +; JAG-NOOPT-LABEL: test_mul_spec:
>> +; JAG-NOOPT: # BB#0:
>> +; JAG-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:0.50]
>> +; JAG-NOOPT-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; JAG-NOOPT-NEXT: retq # sched: [4:1.00]
>> +;
>> +; X64-SLM-LABEL: test_mul_spec:
>> +; X64-SLM: # BB#0:
>> +; X64-SLM-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:1.00]
>> +; X64-SLM-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; X64-SLM-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; X64-SLM-NEXT: retq # sched: [4:1.00]
>> +;
>> +; SLM-NOOPT-LABEL: test_mul_spec:
>> +; SLM-NOOPT: # BB#0:
>> +; SLM-NOOPT-NEXT: leaq 42(%rdi,%rdi,8), %rcx # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: leaq 2(%rdi,%rdi,4), %rax # sched: [1:1.00]
>> +; SLM-NOOPT-NEXT: imulq %rcx, %rax # sched: [3:1.00]
>> +; SLM-NOOPT-NEXT: retq # sched: [4:1.00]
>> + %mul = mul nsw i64 %x, 9
>> + %add = add nsw i64 %mul, 42
>> + %mul2 = mul nsw i64 %x, 5
>> + %add2 = add nsw i64 %mul2, 2
>> + %mul3 = mul nsw i64 %add, %add2
>> + ret i64 %mul3
>> +}
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170530/39a8e153/attachment-0001.html>
More information about the llvm-commits
mailing list