mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Reapply 154397. Original message:
Fix a dagcombine optimization which assumes that the vsetcc result type is always of the same size as the compared values. This is ture for SSE/AVX/NEON but not for all targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
21293ac192
commit
2e506198c8
@ -4354,12 +4354,17 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
|||||||
// Only do this before legalize for now.
|
// Only do this before legalize for now.
|
||||||
if (VT.isVector() && !LegalOperations) {
|
if (VT.isVector() && !LegalOperations) {
|
||||||
EVT N0VT = N0.getOperand(0).getValueType();
|
EVT N0VT = N0.getOperand(0).getValueType();
|
||||||
// We know that the # elements of the results is the same as the
|
// On some architectures (such as SSE/NEON/etc) the SETCC result type is
|
||||||
// # elements of the compare (and the # elements of the compare result
|
// of the same size as the compared operands. Only optimize sext(setcc())
|
||||||
// for that matter). Check to see that they are the same size. If so,
|
// if this is the case.
|
||||||
// we know that the element size of the sext'd result matches the
|
EVT SVT = TLI.getSetCCResultType(N0VT);
|
||||||
// element size of the compare operands.
|
|
||||||
if (VT.getSizeInBits() == N0VT.getSizeInBits())
|
// We know that the # elements of the results is the same as the
|
||||||
|
// # elements of the compare (and the # elements of the compare result
|
||||||
|
// for that matter). Check to see that they are the same size. If so,
|
||||||
|
// we know that the element size of the sext'd result matches the
|
||||||
|
// element size of the compare operands.
|
||||||
|
if (VT.getSizeInBits() == SVT.getSizeInBits())
|
||||||
return DAG.getSetCC(N->getDebugLoc(), VT, N0.getOperand(0),
|
return DAG.getSetCC(N->getDebugLoc(), VT, N0.getOperand(0),
|
||||||
N0.getOperand(1),
|
N0.getOperand(1),
|
||||||
cast<CondCodeSDNode>(N0.getOperand(2))->get());
|
cast<CondCodeSDNode>(N0.getOperand(2))->get());
|
||||||
@ -4373,11 +4378,13 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
|||||||
EVT MatchingVectorType =
|
EVT MatchingVectorType =
|
||||||
EVT::getVectorVT(*DAG.getContext(), MatchingElementType,
|
EVT::getVectorVT(*DAG.getContext(), MatchingElementType,
|
||||||
N0VT.getVectorNumElements());
|
N0VT.getVectorNumElements());
|
||||||
SDValue VsetCC =
|
|
||||||
DAG.getSetCC(N->getDebugLoc(), MatchingVectorType, N0.getOperand(0),
|
if (SVT == MatchingVectorType) {
|
||||||
N0.getOperand(1),
|
SDValue VsetCC = DAG.getSetCC(N->getDebugLoc(), MatchingVectorType,
|
||||||
cast<CondCodeSDNode>(N0.getOperand(2))->get());
|
N0.getOperand(0), N0.getOperand(1),
|
||||||
return DAG.getSExtOrTrunc(VsetCC, N->getDebugLoc(), VT);
|
cast<CondCodeSDNode>(N0.getOperand(2))->get());
|
||||||
|
return DAG.getSExtOrTrunc(VsetCC, N->getDebugLoc(), VT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user