Skip to content

Commit

Permalink
[AArch64] Add pipeline model for Exynos M3
Browse files Browse the repository at this point in the history
Add the scheduling and cost model for Exynos M3.

Differential revision: https://reviews.llvm.org/D42387

llvm-svn: 323773
  • Loading branch information
Evandro Menezes committed Jan 30, 2018
1 parent 4256fd0 commit 9f9daa1
Show file tree
Hide file tree
Showing 10 changed files with 908 additions and 10 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Target/AArch64/AArch64.td
Expand Up @@ -200,6 +200,7 @@ include "AArch64SchedCyclone.td"
include "AArch64SchedFalkor.td"
include "AArch64SchedKryo.td"
include "AArch64SchedExynosM1.td"
include "AArch64SchedExynosM3.td"
include "AArch64SchedThunderX.td"
include "AArch64SchedThunderX2T99.td"

Expand Down Expand Up @@ -334,19 +335,19 @@ def ProcExynosM2 : SubtargetFeature<"exynosm2", "ARMProcFamily", "ExynosM1",
FeatureSlowMisaligned128Store,
FeatureZCZeroing]>;

def ProcExynosM3 : SubtargetFeature<"exynosm3", "ARMProcFamily", "ExynosM1",
def ProcExynosM3 : SubtargetFeature<"exynosm3", "ARMProcFamily", "ExynosM3",
"Samsung Exynos-M3 processors",
[FeatureCRC,
FeatureCrypto,
FeatureCustomCheapAsMoveHandling,
FeatureFPARMv8,
FeatureFuseAES,
FeatureFuseLiterals,
FeatureLSLFast,
FeatureNEON,
FeaturePerfMon,
FeaturePostRAScheduler,
FeatureSlowMisaligned128Store,
FeatureSlowPaired128,
FeaturePredictableSelectIsExpensive,
FeatureZCZeroing]>;

def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
Expand Down Expand Up @@ -470,7 +471,7 @@ def : ProcessorModel<"cortex-a75", CortexA57Model, [ProcA75]>;
def : ProcessorModel<"cyclone", CycloneModel, [ProcCyclone]>;
def : ProcessorModel<"exynos-m1", ExynosM1Model, [ProcExynosM1]>;
def : ProcessorModel<"exynos-m2", ExynosM1Model, [ProcExynosM2]>;
def : ProcessorModel<"exynos-m3", ExynosM1Model, [ProcExynosM3]>;
def : ProcessorModel<"exynos-m3", ExynosM3Model, [ProcExynosM3]>;
def : ProcessorModel<"falkor", FalkorModel, [ProcFalkor]>;
def : ProcessorModel<"saphira", FalkorModel, [ProcSaphira]>;
def : ProcessorModel<"kryo", KryoModel, [ProcKryo]>;
Expand Down
40 changes: 37 additions & 3 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Expand Up @@ -675,9 +675,14 @@ static bool canBeExpandedToORR(const MachineInstr &MI, unsigned BitSize) {
bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr &MI) const {
if (!Subtarget.hasCustomCheapAsMoveHandling())
return MI.isAsCheapAsAMove();
if (Subtarget.getProcFamily() == AArch64Subtarget::ExynosM1 &&
isExynosShiftLeftFast(MI))
return true;

if (Subtarget.getProcFamily() == AArch64Subtarget::ExynosM1 ||
Subtarget.getProcFamily() == AArch64Subtarget::ExynosM3) {
if (isExynosResetFast(MI) || isExynosShiftLeftFast(MI))
return true;
else
return MI.isAsCheapAsAMove();
}

switch (MI.getOpcode()) {
default:
Expand Down Expand Up @@ -736,6 +741,35 @@ bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr &MI) const {
llvm_unreachable("Unknown opcode to check as cheap as a move!");
}

bool AArch64InstrInfo::isExynosResetFast(const MachineInstr &MI) const {
switch (MI.getOpcode()) {
default:
return false;

case AArch64::ADR:
case AArch64::ADRP:

case AArch64::MOVNWi:
case AArch64::MOVNXi:
case AArch64::MOVZWi:
case AArch64::MOVZXi:
return true;

case AArch64::MOVID:
case AArch64::MOVIv2d_ns:
case AArch64::MOVIv8b_ns:
case AArch64::MOVIv16b_ns:
return (MI.getOperand(1).getImm() == 0);

case AArch64::MOVIv2i32:
case AArch64::MOVIv4i32:
case AArch64::MOVIv4i16:
case AArch64::MOVIv8i16:
return (MI.getOperand(1).getImm() == 0 &&
MI.getOperand(2).getImm() == 0);
}
}

bool AArch64InstrInfo::isExynosShiftLeftFast(const MachineInstr &MI) const {
unsigned Imm, Shift;
AArch64_AM::ShiftExtendType Ext;
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.h
Expand Up @@ -369,6 +369,9 @@ class AArch64InstrInfo final : public AArch64GenInstrInfo {
insertOutlinedCall(Module &M, MachineBasicBlock &MBB,
MachineBasicBlock::iterator &It, MachineFunction &MF,
const MachineOutlinerInfo &MInfo) const override;
/// Returns true if the instruction sets to an immediate value that can be
/// executed more efficiently.
bool isExynosResetFast(const MachineInstr &MI) const;
/// Returns true if the instruction has a shift left that can be executed
/// more efficiently.
bool isExynosShiftLeftFast(const MachineInstr &MI) const;
Expand Down

0 comments on commit 9f9daa1

Please sign in to comment.