Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 00ed93a

Browse files
author
Evandro Menezes
committed
[AArch64] Add cheap as move instructions for Exynos M1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268549 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 18c0216 commit 00ed93a

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,11 @@ static bool canBeExpandedToORR(const MachineInstr *MI, unsigned BitSize) {
545545
// micro-architecture target hook should be introduced here in future.
546546
bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr *MI) const {
547547
if (!Subtarget.isCortexA57() && !Subtarget.isCortexA53() &&
548-
!Subtarget.isKryo())
548+
!Subtarget.isExynosM1() && !Subtarget.isKryo())
549549
return MI->isAsCheapAsAMove();
550550

551+
unsigned Imm;
552+
551553
switch (MI->getOpcode()) {
552554
default:
553555
return false;
@@ -557,7 +559,17 @@ bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr *MI) const {
557559
case AArch64::ADDXri:
558560
case AArch64::SUBWri:
559561
case AArch64::SUBXri:
560-
return (MI->getOperand(3).getImm() == 0);
562+
return (Subtarget.isExynosM1() ||
563+
MI->getOperand(3).getImm() == 0);
564+
565+
// add/sub on register with shift
566+
case AArch64::ADDWrs:
567+
case AArch64::ADDXrs:
568+
case AArch64::SUBWrs:
569+
case AArch64::SUBXrs:
570+
Imm = MI->getOperand(3).getImm();
571+
return (Subtarget.isExynosM1() &&
572+
AArch64_AM::getArithShiftValue(Imm) < 4);
561573

562574
// logical ops on immediate
563575
case AArch64::ANDWri:
@@ -582,6 +594,25 @@ bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr *MI) const {
582594
case AArch64::ORRWrr:
583595
case AArch64::ORRXrr:
584596
return true;
597+
598+
// logical ops on register with shift
599+
case AArch64::ANDWrs:
600+
case AArch64::ANDXrs:
601+
case AArch64::BICWrs:
602+
case AArch64::BICXrs:
603+
case AArch64::EONWrs:
604+
case AArch64::EONXrs:
605+
case AArch64::EORWrs:
606+
case AArch64::EORXrs:
607+
case AArch64::ORNWrs:
608+
case AArch64::ORNXrs:
609+
case AArch64::ORRWrs:
610+
case AArch64::ORRXrs:
611+
Imm = MI->getOperand(3).getImm();
612+
return (Subtarget.isExynosM1() &&
613+
AArch64_AM::getShiftValue(Imm) < 4 &&
614+
AArch64_AM::getShiftType(Imm) == AArch64_AM::LSL);
615+
585616
// If MOVi32imm or MOVi64imm can be expanded into ORRWri or
586617
// ORRXri, it is as cheap as MOV
587618
case AArch64::MOVi32imm:

0 commit comments

Comments
 (0)