mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-30 05:29:47 +00:00
Simplify SplitVecRes_UnaryOp by removing all the code that is
trying to legalize the operand types when only the result type is required to be legalized - the type legalization machinery will get round to the operands later if they need legalizing. There can be a point to legalizing operands in parallel with the result: when this saves compile time or results in better code. There was only one case in which this was true: when the operand is also split, so keep the logic for that bit. As a result of this change, additional operand legalization methods may need to be introduced to handle nodes where the result and operand types can differ, like SIGN_EXTEND, but the testsuite doesn't contain any tests where this is the case. In any case, it seems better to require such methods (and die with an assert if they doesn't exist) than to quietly produce wrong code if we forgot to special case the node in SplitVecRes_UnaryOp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143026 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
644ce53a30
commit
a921a46854
@ -773,56 +773,18 @@ void DAGTypeLegalizer::SplitVecRes_UnaryOp(SDNode *N, SDValue &Lo,
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
GetSplitDestVTs(N->getValueType(0), LoVT, HiVT);
|
||||
|
||||
// Split the input.
|
||||
// If the input also splits, handle it directly for a compile time speedup.
|
||||
// Otherwise split it by hand.
|
||||
EVT InVT = N->getOperand(0).getValueType();
|
||||
switch (getTypeAction(InVT)) {
|
||||
default: llvm_unreachable("Unexpected type action!");
|
||||
case TargetLowering::TypeLegal: {
|
||||
if (getTypeAction(InVT) == TargetLowering::TypeSplitVector) {
|
||||
GetSplitVector(N->getOperand(0), Lo, Hi);
|
||||
} else {
|
||||
EVT InNVT = EVT::getVectorVT(*DAG.getContext(), InVT.getVectorElementType(),
|
||||
LoVT.getVectorNumElements());
|
||||
Lo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, N->getOperand(0),
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, N->getOperand(0),
|
||||
DAG.getIntPtrConstant(InNVT.getVectorNumElements()));
|
||||
break;
|
||||
}
|
||||
case TargetLowering::TypePromoteInteger: {
|
||||
SDValue InOp;
|
||||
if (N->getOpcode() == ISD::SIGN_EXTEND ||
|
||||
N->getOpcode() == ISD::SINT_TO_FP) {
|
||||
InOp = SExtPromotedInteger(N->getOperand(0));
|
||||
} else if (
|
||||
N->getOpcode() == ISD::ZERO_EXTEND ||
|
||||
N->getOpcode() == ISD::UINT_TO_FP) {
|
||||
InOp = ZExtPromotedInteger(N->getOperand(0));
|
||||
} else {
|
||||
InOp = GetPromotedInteger(N->getOperand(0));
|
||||
}
|
||||
EVT InNVT = EVT::getVectorVT(*DAG.getContext(),
|
||||
InOp.getValueType().getVectorElementType(),
|
||||
LoVT.getVectorNumElements());
|
||||
Lo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, InOp,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, InOp,
|
||||
DAG.getIntPtrConstant(InNVT.getVectorNumElements()));
|
||||
break;
|
||||
}
|
||||
case TargetLowering::TypeSplitVector:
|
||||
GetSplitVector(N->getOperand(0), Lo, Hi);
|
||||
break;
|
||||
case TargetLowering::TypeWidenVector: {
|
||||
// If the result needs to be split and the input needs to be widened,
|
||||
// the two types must have different lengths. Use the widened result
|
||||
// and extract from it to do the split.
|
||||
SDValue InOp = GetWidenedVector(N->getOperand(0));
|
||||
EVT InNVT = EVT::getVectorVT(*DAG.getContext(), InVT.getVectorElementType(),
|
||||
LoVT.getVectorNumElements());
|
||||
Lo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, InOp,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InNVT, InOp,
|
||||
DAG.getIntPtrConstant(InNVT.getVectorNumElements()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (N->getOpcode() == ISD::FP_ROUND) {
|
||||
|
Loading…
Reference in New Issue
Block a user