mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
Fix spelling, fix some broken canonicalizations by my last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4cf009f49c
commit
bd8625b062
@ -386,8 +386,8 @@ SDOperand SelectionDAG::getCondCode(ISD::CondCode Cond) {
|
|||||||
return SDOperand(CondCodeNodes[Cond], 0);
|
return SDOperand(CondCodeNodes[Cond], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDOperand SelectionDAG::SimplfySetCC(MVT::ValueType VT, SDOperand N1,
|
SDOperand SelectionDAG::SimplifySetCC(MVT::ValueType VT, SDOperand N1,
|
||||||
SDOperand N2, ISD::CondCode Cond) {
|
SDOperand N2, ISD::CondCode Cond) {
|
||||||
// These setcc operations always fold.
|
// These setcc operations always fold.
|
||||||
switch (Cond) {
|
switch (Cond) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -484,17 +484,15 @@ SDOperand SelectionDAG::SimplfySetCC(MVT::ValueType VT, SDOperand N1,
|
|||||||
if (Cond == ISD::SETGE || Cond == ISD::SETUGE) {
|
if (Cond == ISD::SETGE || Cond == ISD::SETUGE) {
|
||||||
if (C2 == MinVal) return getConstant(1, VT); // X >= MIN --> true
|
if (C2 == MinVal) return getConstant(1, VT); // X >= MIN --> true
|
||||||
--C2; // X >= C1 --> X > (C1-1)
|
--C2; // X >= C1 --> X > (C1-1)
|
||||||
Cond = (Cond == ISD::SETGE) ? ISD::SETGT : ISD::SETUGT;
|
return getSetCC(VT, N1, getConstant(C2, N2.getValueType()),
|
||||||
N2 = getConstant(C2, N2.getValueType());
|
(Cond == ISD::SETGE) ? ISD::SETGT : ISD::SETUGT);
|
||||||
N2C = cast<ConstantSDNode>(N2.Val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cond == ISD::SETLE || Cond == ISD::SETULE) {
|
if (Cond == ISD::SETLE || Cond == ISD::SETULE) {
|
||||||
if (C2 == MaxVal) return getConstant(1, VT); // X <= MAX --> true
|
if (C2 == MaxVal) return getConstant(1, VT); // X <= MAX --> true
|
||||||
++C2; // X <= C1 --> X < (C1+1)
|
++C2; // X <= C1 --> X < (C1+1)
|
||||||
Cond = (Cond == ISD::SETLE) ? ISD::SETLT : ISD::SETULT;
|
return getSetCC(VT, N1, getConstant(C2, N2.getValueType()),
|
||||||
N2 = getConstant(C2, N2.getValueType());
|
(Cond == ISD::SETLE) ? ISD::SETLT : ISD::SETULT);
|
||||||
N2C = cast<ConstantSDNode>(N2.Val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Cond == ISD::SETLT || Cond == ISD::SETULT) && C2 == MinVal)
|
if ((Cond == ISD::SETLT || Cond == ISD::SETULT) && C2 == MinVal)
|
||||||
@ -566,8 +564,7 @@ SDOperand SelectionDAG::SimplfySetCC(MVT::ValueType VT, SDOperand N1,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ensure that the constant occurs on the RHS.
|
// Ensure that the constant occurs on the RHS.
|
||||||
Cond = ISD::getSetCCSwappedOperands(Cond);
|
return getSetCC(VT, N2, N1, ISD::getSetCCSwappedOperands(Cond));
|
||||||
std::swap(N1, N2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (N1 == N2) {
|
if (N1 == N2) {
|
||||||
@ -581,7 +578,9 @@ SDOperand SelectionDAG::SimplfySetCC(MVT::ValueType VT, SDOperand N1,
|
|||||||
return getConstant(UOF, VT);
|
return getConstant(UOF, VT);
|
||||||
// Otherwise, we can't fold it. However, we can simplify it to SETUO/SETO
|
// Otherwise, we can't fold it. However, we can simplify it to SETUO/SETO
|
||||||
// if it is not already.
|
// if it is not already.
|
||||||
Cond = UOF == 0 ? ISD::SETUO : ISD::SETO;
|
ISD::CondCode NewCond = UOF == 0 ? ISD::SETUO : ISD::SETO;
|
||||||
|
if (NewCond != Cond)
|
||||||
|
return getSetCC(VT, N1, N2, NewCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) &&
|
if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) &&
|
||||||
@ -1356,7 +1355,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
|
|||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
case ISD::SETCC: {
|
case ISD::SETCC: {
|
||||||
// Use SimplifySetCC to simplify SETCC's.
|
// Use SimplifySetCC to simplify SETCC's.
|
||||||
SDOperand Simp = SimplfySetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->get());
|
SDOperand Simp = SimplifySetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->get());
|
||||||
if (Simp.Val) return Simp;
|
if (Simp.Val) return Simp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user