mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
[PowerPC] Add an ISD::TRUNCATE to the legalization for ppc_is_decremented_ctr_nonzero
Summary: I believe legalization is really expecting that ReplaceNodeResults will return something with the same type as the thing that's being legalized. Ultimately, it uses the output to replace the uses in the DAG so the type should match to make that work. There are two relevant cases here. When crbits are enabled, then i1 is a legal type and getSetCCResultType should return i1. In this case, the truncate will be between i1 and i1 and should be removed (SelectionDAG::getNode does this). Otherwise, getSetCCResultType will be i32 and the legalizer will promote the truncate to be i32 -> i32 which will be similarly removed. With this fixed we can remove some code from PromoteIntRes_SETCC that seemed to only exist to deal with the intrinsic being replaced with a larger type without changing the other operand. With the truncate being used for connectivity this doesn't happen anymore. Reviewers: hfinkel Reviewed By: hfinkel Subscribers: nemanjai, llvm-commits, kbarton Differential Revision: https://reviews.llvm.org/D41654 llvm-svn: 321959
This commit is contained in:
parent
0141386f6a
commit
bafeab90b0
@ -599,20 +599,9 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
|
|||||||
assert(SVT.isVector() == N->getOperand(0).getValueType().isVector() &&
|
assert(SVT.isVector() == N->getOperand(0).getValueType().isVector() &&
|
||||||
"Vector compare must return a vector result!");
|
"Vector compare must return a vector result!");
|
||||||
|
|
||||||
SDValue LHS = N->getOperand(0);
|
|
||||||
SDValue RHS = N->getOperand(1);
|
|
||||||
if (LHS.getValueType() != RHS.getValueType()) {
|
|
||||||
if (getTypeAction(LHS.getValueType()) == TargetLowering::TypePromoteInteger &&
|
|
||||||
!LHS.getValueType().isVector())
|
|
||||||
LHS = GetPromotedInteger(LHS);
|
|
||||||
if (getTypeAction(RHS.getValueType()) == TargetLowering::TypePromoteInteger &&
|
|
||||||
!RHS.getValueType().isVector())
|
|
||||||
RHS = GetPromotedInteger(RHS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the SETCC result using the canonical SETCC type.
|
// Get the SETCC result using the canonical SETCC type.
|
||||||
SDValue SetCC = DAG.getNode(N->getOpcode(), dl, SVT, LHS, RHS,
|
SDValue SetCC = DAG.getNode(N->getOpcode(), dl, SVT, N->getOperand(0),
|
||||||
N->getOperand(2));
|
N->getOperand(1), N->getOperand(2));
|
||||||
|
|
||||||
// Convert to the expected type.
|
// Convert to the expected type.
|
||||||
return DAG.getSExtOrTrunc(SetCC, dl, NVT);
|
return DAG.getSExtOrTrunc(SetCC, dl, NVT);
|
||||||
|
@ -9357,7 +9357,7 @@ void PPCTargetLowering::ReplaceNodeResults(SDNode *N,
|
|||||||
SDValue NewInt = DAG.getNode(N->getOpcode(), dl, VTs, N->getOperand(0),
|
SDValue NewInt = DAG.getNode(N->getOpcode(), dl, VTs, N->getOperand(0),
|
||||||
N->getOperand(1));
|
N->getOperand(1));
|
||||||
|
|
||||||
Results.push_back(NewInt);
|
Results.push_back(DAG.getNode(ISD::TRUNCATE, dl, MVT::i1, NewInt));
|
||||||
Results.push_back(NewInt.getValue(1));
|
Results.push_back(NewInt.getValue(1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user