[AArch64] Set COPY ZR isAsCheapAsAMove when needed.

If a subtarget has both ZCZeroing and CustomCheapAsMoveHandling features (now
only Kryo has both), set COPY (W|X)ZR isAsCheapAsAMove.

Differential Revision: http://reviews.llvm.org/D22360

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Haicheng Wu 2016-07-15 00:27:01 +00:00
parent c61d5f4b2c
commit f7f8380105

View File

@ -624,11 +624,15 @@ bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr &MI) const {
case AArch64::MOVi64imm:
return canBeExpandedToORR(MI, 64);
// It is cheap to move #0 to float registers if the subtarget has
// ZeroCycleZeroing feature.
// It is cheap to zero out registers if the subtarget has ZeroCycleZeroing
// feature.
case AArch64::FMOVS0:
case AArch64::FMOVD0:
return Subtarget.hasZeroCycleZeroing();
case TargetOpcode::COPY:
return (Subtarget.hasZeroCycleZeroing() &&
(MI.getOperand(1).getReg() == AArch64::WZR ||
MI.getOperand(1).getReg() == AArch64::XZR));
}
llvm_unreachable("Unknown opcode to check as cheap as a move!");