forked from OSchip/llvm-project
Support fp64 immediate zero, this fixes only part of PR5445
because the testcase is triggering one more bug. llvm-svn: 88674
This commit is contained in:
parent
9f2ee2bb26
commit
a03b5b44fc
|
@ -314,6 +314,16 @@ SDNode* MipsDAGToDAGISel::Select(SDValue N) {
|
|||
case ISD::GLOBAL_OFFSET_TABLE:
|
||||
return getGlobalBaseReg();
|
||||
|
||||
case ISD::ConstantFP: {
|
||||
ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(N);
|
||||
if (N.getValueType() == MVT::f64 && CN->isExactlyValue(+0.0)) {
|
||||
SDValue Zero = CurDAG->getRegister(Mips::ZERO, MVT::i32);
|
||||
ReplaceUses(N, Zero);
|
||||
return Zero.getNode();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/// Handle direct and indirect calls when using PIC. On PIC, when
|
||||
/// GOT is smaller than about 64k (small code) the GA target is
|
||||
/// loaded with only one instruction. Otherwise GA's target must
|
||||
|
|
|
@ -134,6 +134,9 @@ copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
|||
const TargetRegisterClass *DestRC,
|
||||
const TargetRegisterClass *SrcRC) const {
|
||||
DebugLoc DL = DebugLoc::getUnknownLoc();
|
||||
const MachineFunction *MF = MBB.getParent();
|
||||
const TargetRegisterInfo *TRI = MF->getTarget().getRegisterInfo();
|
||||
|
||||
if (I != MBB.end()) DL = I->getDebugLoc();
|
||||
|
||||
if (DestRC != SrcRC) {
|
||||
|
@ -153,6 +156,13 @@ copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
|||
else if ((DestRC == Mips::FGR32RegisterClass) &&
|
||||
(SrcRC == Mips::CPURegsRegisterClass))
|
||||
BuildMI(MBB, I, DL, get(Mips::MTC1), DestReg).addReg(SrcReg);
|
||||
else if ((DestRC == Mips::AFGR64RegisterClass) &&
|
||||
(SrcRC == Mips::CPURegsRegisterClass) &&
|
||||
(SrcReg == Mips::ZERO)) {
|
||||
const unsigned *AliasSet = TRI->getAliasSet(DestReg);
|
||||
BuildMI(MBB, I, DL, get(Mips::MTC1), AliasSet[0]).addReg(SrcReg);
|
||||
BuildMI(MBB, I, DL, get(Mips::MTC1), AliasSet[1]).addReg(SrcReg);
|
||||
}
|
||||
|
||||
// Move from/to Hi/Lo registers
|
||||
else if ((DestRC == Mips::HILORegisterClass) &&
|
||||
|
@ -163,9 +173,8 @@ copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
|||
(DestRC == Mips::CPURegsRegisterClass)) {
|
||||
unsigned Opc = (SrcReg == Mips::HI) ? Mips::MFHI : Mips::MFLO;
|
||||
BuildMI(MBB, I, DL, get(Opc), DestReg);
|
||||
|
||||
// Can't copy this register
|
||||
} else
|
||||
} else
|
||||
// Can't copy this register
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue