mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 13:10:34 +00:00
Lower SETCC nodes during legalization. Previously, it was lowered in DAG combine pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152450 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9ab3dbe617
commit
0a40c2353c
@ -142,6 +142,8 @@ MipsTargetLowering(MipsTargetMachine &TM)
|
||||
setOperationAction(ISD::SELECT, MVT::f32, Custom);
|
||||
setOperationAction(ISD::SELECT, MVT::f64, Custom);
|
||||
setOperationAction(ISD::SELECT, MVT::i32, Custom);
|
||||
setOperationAction(ISD::SETCC, MVT::f32, Custom);
|
||||
setOperationAction(ISD::SETCC, MVT::f64, Custom);
|
||||
setOperationAction(ISD::BRCOND, MVT::Other, Custom);
|
||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
|
||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom);
|
||||
@ -246,7 +248,6 @@ MipsTargetLowering(MipsTargetMachine &TM)
|
||||
setTargetDAGCombine(ISD::SUBE);
|
||||
setTargetDAGCombine(ISD::SDIVREM);
|
||||
setTargetDAGCombine(ISD::UDIVREM);
|
||||
setTargetDAGCombine(ISD::SETCC);
|
||||
setTargetDAGCombine(ISD::SELECT);
|
||||
setTargetDAGCombine(ISD::AND);
|
||||
setTargetDAGCombine(ISD::OR);
|
||||
@ -560,23 +561,6 @@ static SDValue CreateCMovFP(SelectionDAG& DAG, SDValue Cond, SDValue True,
|
||||
True.getValueType(), True, False, Cond);
|
||||
}
|
||||
|
||||
static SDValue PerformSETCCCombine(SDNode *N, SelectionDAG& DAG,
|
||||
TargetLowering::DAGCombinerInfo &DCI,
|
||||
const MipsSubtarget* Subtarget) {
|
||||
if (DCI.isBeforeLegalizeOps())
|
||||
return SDValue();
|
||||
|
||||
SDValue Cond = CreateFPCmp(DAG, SDValue(N, 0));
|
||||
|
||||
if (Cond.getOpcode() != MipsISD::FPCmp)
|
||||
return SDValue();
|
||||
|
||||
SDValue True = DAG.getConstant(1, MVT::i32);
|
||||
SDValue False = DAG.getConstant(0, MVT::i32);
|
||||
|
||||
return CreateCMovFP(DAG, Cond, True, False, N->getDebugLoc());
|
||||
}
|
||||
|
||||
static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG& DAG,
|
||||
TargetLowering::DAGCombinerInfo &DCI,
|
||||
const MipsSubtarget* Subtarget) {
|
||||
@ -718,8 +702,6 @@ SDValue MipsTargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI)
|
||||
case ISD::SDIVREM:
|
||||
case ISD::UDIVREM:
|
||||
return PerformDivRemCombine(N, DAG, DCI, Subtarget);
|
||||
case ISD::SETCC:
|
||||
return PerformSETCCCombine(N, DAG, DCI, Subtarget);
|
||||
case ISD::SELECT:
|
||||
return PerformSELECTCombine(N, DAG, DCI, Subtarget);
|
||||
case ISD::AND:
|
||||
@ -744,6 +726,7 @@ LowerOperation(SDValue Op, SelectionDAG &DAG) const
|
||||
case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
|
||||
case ISD::JumpTable: return LowerJumpTable(Op, DAG);
|
||||
case ISD::SELECT: return LowerSELECT(Op, DAG);
|
||||
case ISD::SETCC: return LowerSETCC(Op, DAG);
|
||||
case ISD::VASTART: return LowerVASTART(Op, DAG);
|
||||
case ISD::FCOPYSIGN: return LowerFCOPYSIGN(Op, DAG);
|
||||
case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG);
|
||||
@ -1511,6 +1494,18 @@ LowerSELECT(SDValue Op, SelectionDAG &DAG) const
|
||||
Op.getDebugLoc());
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
|
||||
SDValue Cond = CreateFPCmp(DAG, Op);
|
||||
|
||||
assert(Cond.getOpcode() == MipsISD::FPCmp &&
|
||||
"Floating point operand expected.");
|
||||
|
||||
SDValue True = DAG.getConstant(1, MVT::i32);
|
||||
SDValue False = DAG.getConstant(0, MVT::i32);
|
||||
|
||||
return CreateCMovFP(DAG, Cond, True, False, Op.getDebugLoc());
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
// FIXME there isn't actually debug info here
|
||||
|
@ -128,6 +128,7 @@ namespace llvm {
|
||||
SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
|
||||
|
Loading…
Reference in New Issue
Block a user