mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-12 17:25:49 +00:00
AArch64: implement copies to/from NZCV as a last ditch effort.
A test in test/Generic creates a DAG where the NZCV output of an ADCS is used by multiple nodes. This makes LLVM want to save a copy of NZCV for later, which it couldn't do before. This should be the last fix required for the aarch64 buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1507,7 +1507,25 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(0 && "unimplemented reg-to-reg copy");
|
if (DestReg == AArch64::NZCV) {
|
||||||
|
assert(AArch64::GPR64RegClass.contains(SrcReg) && "Invalid NZCV copy");
|
||||||
|
BuildMI(MBB, I, DL, get(AArch64::MSR))
|
||||||
|
.addImm(AArch64SysReg::NZCV)
|
||||||
|
.addReg(SrcReg, getKillRegState(KillSrc))
|
||||||
|
.addReg(AArch64::NZCV, RegState::Implicit | RegState::Define);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SrcReg == AArch64::NZCV) {
|
||||||
|
assert(AArch64::GPR64RegClass.contains(DestReg) && "Invalid NZCV copy");
|
||||||
|
BuildMI(MBB, I, DL, get(AArch64::MRS))
|
||||||
|
.addReg(DestReg)
|
||||||
|
.addImm(AArch64SysReg::NZCV)
|
||||||
|
.addReg(AArch64::NZCV, RegState::Implicit | getKillRegState(KillSrc));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
llvm_unreachable("unimplemented reg-to-reg copy");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstrInfo::storeRegToStackSlot(
|
void AArch64InstrInfo::storeRegToStackSlot(
|
||||||
|
@@ -138,7 +138,7 @@ AArch64RegisterInfo::getPointerRegClass(const MachineFunction &MF,
|
|||||||
const TargetRegisterClass *
|
const TargetRegisterClass *
|
||||||
AArch64RegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
|
AArch64RegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
|
||||||
if (RC == &AArch64::CCRRegClass)
|
if (RC == &AArch64::CCRRegClass)
|
||||||
return nullptr; // Can't copy NZCV.
|
return &AArch64::GPR64RegClass; // Only MSR & MRS copy NZCV.
|
||||||
return RC;
|
return RC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user