mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Fix branches on FP compares
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d9d681d128
commit
4bb91024ac
@ -665,13 +665,7 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
SDOperand Cond = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
SDOperand Cond = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
||||||
return DAG.getNode(V8ISD::BRICC, MVT::Other, Chain, Dest, CC, Cond);
|
return DAG.getNode(V8ISD::BRICC, MVT::Other, Chain, Dest, CC, Cond);
|
||||||
} else {
|
} else {
|
||||||
std::vector<MVT::ValueType> VTs;
|
SDOperand Cond = DAG.getNode(V8ISD::CMPFCC, MVT::Flag, LHS, RHS);
|
||||||
VTs.push_back(MVT::i32);
|
|
||||||
VTs.push_back(MVT::Flag);
|
|
||||||
std::vector<SDOperand> Ops;
|
|
||||||
Ops.push_back(LHS);
|
|
||||||
Ops.push_back(RHS);
|
|
||||||
SDOperand Cond = DAG.getNode(V8ISD::CMPFCC, VTs, Ops).getValue(1);
|
|
||||||
return DAG.getNode(V8ISD::BRFCC, MVT::Other, Chain, Dest, CC, Cond);
|
return DAG.getNode(V8ISD::BRFCC, MVT::Other, Chain, Dest, CC, Cond);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,18 +676,21 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
SDOperand TrueVal = Op.getOperand(2);
|
SDOperand TrueVal = Op.getOperand(2);
|
||||||
SDOperand FalseVal = Op.getOperand(3);
|
SDOperand FalseVal = Op.getOperand(3);
|
||||||
|
|
||||||
|
SDOperand CompareFlag;
|
||||||
unsigned Opc;
|
unsigned Opc;
|
||||||
Opc = LHS.getValueType() == MVT::i32 ? V8ISD::CMPICC : V8ISD::CMPFCC;
|
if (LHS.getValueType() == MVT::i32) {
|
||||||
std::vector<MVT::ValueType> VTs;
|
std::vector<MVT::ValueType> VTs;
|
||||||
VTs.push_back(LHS.getValueType());
|
VTs.push_back(LHS.getValueType()); // subcc returns a value
|
||||||
VTs.push_back(MVT::Flag);
|
VTs.push_back(MVT::Flag);
|
||||||
std::vector<SDOperand> Ops;
|
std::vector<SDOperand> Ops;
|
||||||
Ops.push_back(LHS);
|
Ops.push_back(LHS);
|
||||||
Ops.push_back(RHS);
|
Ops.push_back(RHS);
|
||||||
SDOperand CompareFlag = DAG.getNode(Opc, VTs, Ops).getValue(1);
|
CompareFlag = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
||||||
|
Opc = V8ISD::SELECT_ICC;
|
||||||
Opc = LHS.getValueType() == MVT::i32 ?
|
} else {
|
||||||
V8ISD::SELECT_ICC : V8ISD::SELECT_FCC;
|
CompareFlag = DAG.getNode(V8ISD::CMPFCC, MVT::Flag, LHS, RHS);
|
||||||
|
Opc = V8ISD::SELECT_FCC;
|
||||||
|
}
|
||||||
return DAG.getNode(Opc, TrueVal.getValueType(), TrueVal, FalseVal,
|
return DAG.getNode(Opc, TrueVal.getValueType(), TrueVal, FalseVal,
|
||||||
DAG.getConstant(CC, MVT::i32), CompareFlag);
|
DAG.getConstant(CC, MVT::i32), CompareFlag);
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,8 @@ SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>;
|
|||||||
def SDTV8ITOF :
|
def SDTV8ITOF :
|
||||||
SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
|
SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
|
||||||
|
|
||||||
def V8cmpicc : SDNode<"V8ISD::CMPICC", SDTIntBinOp,
|
def V8cmpicc : SDNode<"V8ISD::CMPICC", SDTIntBinOp, [SDNPOutFlag]>;
|
||||||
[SDNPCommutative, SDNPOutFlag]>;
|
def V8cmpfcc : SDNode<"V8ISD::CMPFCC", SDTV8cmpfcc, [SDNPOutFlag]>;
|
||||||
def V8cmpfcc : SDNode<"V8ISD::CMPFCC", SDTV8cmpfcc>;
|
|
||||||
def V8bricc : SDNode<"V8ISD::BRICC", SDTV8brcc, [SDNPHasChain]>;
|
def V8bricc : SDNode<"V8ISD::BRICC", SDTV8brcc, [SDNPHasChain]>;
|
||||||
def V8brfcc : SDNode<"V8ISD::BRFCC", SDTV8brcc, [SDNPHasChain]>;
|
def V8brfcc : SDNode<"V8ISD::BRFCC", SDTV8brcc, [SDNPHasChain]>;
|
||||||
|
|
||||||
|
@ -665,13 +665,7 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
SDOperand Cond = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
SDOperand Cond = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
||||||
return DAG.getNode(V8ISD::BRICC, MVT::Other, Chain, Dest, CC, Cond);
|
return DAG.getNode(V8ISD::BRICC, MVT::Other, Chain, Dest, CC, Cond);
|
||||||
} else {
|
} else {
|
||||||
std::vector<MVT::ValueType> VTs;
|
SDOperand Cond = DAG.getNode(V8ISD::CMPFCC, MVT::Flag, LHS, RHS);
|
||||||
VTs.push_back(MVT::i32);
|
|
||||||
VTs.push_back(MVT::Flag);
|
|
||||||
std::vector<SDOperand> Ops;
|
|
||||||
Ops.push_back(LHS);
|
|
||||||
Ops.push_back(RHS);
|
|
||||||
SDOperand Cond = DAG.getNode(V8ISD::CMPFCC, VTs, Ops).getValue(1);
|
|
||||||
return DAG.getNode(V8ISD::BRFCC, MVT::Other, Chain, Dest, CC, Cond);
|
return DAG.getNode(V8ISD::BRFCC, MVT::Other, Chain, Dest, CC, Cond);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,18 +676,21 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
SDOperand TrueVal = Op.getOperand(2);
|
SDOperand TrueVal = Op.getOperand(2);
|
||||||
SDOperand FalseVal = Op.getOperand(3);
|
SDOperand FalseVal = Op.getOperand(3);
|
||||||
|
|
||||||
|
SDOperand CompareFlag;
|
||||||
unsigned Opc;
|
unsigned Opc;
|
||||||
Opc = LHS.getValueType() == MVT::i32 ? V8ISD::CMPICC : V8ISD::CMPFCC;
|
if (LHS.getValueType() == MVT::i32) {
|
||||||
std::vector<MVT::ValueType> VTs;
|
std::vector<MVT::ValueType> VTs;
|
||||||
VTs.push_back(LHS.getValueType());
|
VTs.push_back(LHS.getValueType()); // subcc returns a value
|
||||||
VTs.push_back(MVT::Flag);
|
VTs.push_back(MVT::Flag);
|
||||||
std::vector<SDOperand> Ops;
|
std::vector<SDOperand> Ops;
|
||||||
Ops.push_back(LHS);
|
Ops.push_back(LHS);
|
||||||
Ops.push_back(RHS);
|
Ops.push_back(RHS);
|
||||||
SDOperand CompareFlag = DAG.getNode(Opc, VTs, Ops).getValue(1);
|
CompareFlag = DAG.getNode(V8ISD::CMPICC, VTs, Ops).getValue(1);
|
||||||
|
Opc = V8ISD::SELECT_ICC;
|
||||||
Opc = LHS.getValueType() == MVT::i32 ?
|
} else {
|
||||||
V8ISD::SELECT_ICC : V8ISD::SELECT_FCC;
|
CompareFlag = DAG.getNode(V8ISD::CMPFCC, MVT::Flag, LHS, RHS);
|
||||||
|
Opc = V8ISD::SELECT_FCC;
|
||||||
|
}
|
||||||
return DAG.getNode(Opc, TrueVal.getValueType(), TrueVal, FalseVal,
|
return DAG.getNode(Opc, TrueVal.getValueType(), TrueVal, FalseVal,
|
||||||
DAG.getConstant(CC, MVT::i32), CompareFlag);
|
DAG.getConstant(CC, MVT::i32), CompareFlag);
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,8 @@ SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>;
|
|||||||
def SDTV8ITOF :
|
def SDTV8ITOF :
|
||||||
SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
|
SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
|
||||||
|
|
||||||
def V8cmpicc : SDNode<"V8ISD::CMPICC", SDTIntBinOp,
|
def V8cmpicc : SDNode<"V8ISD::CMPICC", SDTIntBinOp, [SDNPOutFlag]>;
|
||||||
[SDNPCommutative, SDNPOutFlag]>;
|
def V8cmpfcc : SDNode<"V8ISD::CMPFCC", SDTV8cmpfcc, [SDNPOutFlag]>;
|
||||||
def V8cmpfcc : SDNode<"V8ISD::CMPFCC", SDTV8cmpfcc>;
|
|
||||||
def V8bricc : SDNode<"V8ISD::BRICC", SDTV8brcc, [SDNPHasChain]>;
|
def V8bricc : SDNode<"V8ISD::BRICC", SDTV8brcc, [SDNPHasChain]>;
|
||||||
def V8brfcc : SDNode<"V8ISD::BRFCC", SDTV8brcc, [SDNPHasChain]>;
|
def V8brfcc : SDNode<"V8ISD::BRFCC", SDTV8brcc, [SDNPHasChain]>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user