forked from OSchip/llvm-project
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. llvm-svn: 209651
This commit is contained in:
parent
4f1909f1da
commit
1bed9afd30
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue