mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 18:26:02 +00:00
[cleanup] Hoist the promotion dispatch logic into the promote function
so that we can use return to express it more cleanly and avoid so many nested switch statements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -281,27 +281,11 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
|
|||||||
|
|
||||||
switch (TLI.getOperationAction(Node->getOpcode(), QueryType)) {
|
switch (TLI.getOperationAction(Node->getOpcode(), QueryType)) {
|
||||||
case TargetLowering::Promote:
|
case TargetLowering::Promote:
|
||||||
switch (Op.getOpcode()) {
|
Result = Promote(Op);
|
||||||
default:
|
Changed = true;
|
||||||
// "Promote" the operation by bitcasting
|
break;
|
||||||
Result = Promote(Op);
|
case TargetLowering::Legal:
|
||||||
Changed = true;
|
|
||||||
break;
|
|
||||||
case ISD::SINT_TO_FP:
|
|
||||||
case ISD::UINT_TO_FP:
|
|
||||||
// "Promote" the operation by extending the operand.
|
|
||||||
Result = PromoteINT_TO_FP(Op);
|
|
||||||
Changed = true;
|
|
||||||
break;
|
|
||||||
case ISD::FP_TO_UINT:
|
|
||||||
case ISD::FP_TO_SINT:
|
|
||||||
// Promote the operation by extending the operand.
|
|
||||||
Result = PromoteFP_TO_INT(Op, Op->getOpcode() == ISD::FP_TO_SINT);
|
|
||||||
Changed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case TargetLowering::Legal: break;
|
|
||||||
case TargetLowering::Custom: {
|
case TargetLowering::Custom: {
|
||||||
SDValue Tmp1 = TLI.LowerOperation(Op, DAG);
|
SDValue Tmp1 = TLI.LowerOperation(Op, DAG);
|
||||||
if (Tmp1.getNode()) {
|
if (Tmp1.getNode()) {
|
||||||
@@ -343,9 +327,24 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDValue VectorLegalizer::Promote(SDValue Op) {
|
SDValue VectorLegalizer::Promote(SDValue Op) {
|
||||||
// Vector "promotion" is basically just bitcasting and doing the operation
|
// For a few operations there is a specific concept for promotion based on
|
||||||
// in a different type. For example, x86 promotes ISD::AND on v2i32 to
|
// the operand's type.
|
||||||
// v1i64.
|
switch (Op.getOpcode()) {
|
||||||
|
case ISD::SINT_TO_FP:
|
||||||
|
case ISD::UINT_TO_FP:
|
||||||
|
// "Promote" the operation by extending the operand.
|
||||||
|
return PromoteINT_TO_FP(Op);
|
||||||
|
break;
|
||||||
|
case ISD::FP_TO_UINT:
|
||||||
|
case ISD::FP_TO_SINT:
|
||||||
|
// Promote the operation by extending the operand.
|
||||||
|
return PromoteFP_TO_INT(Op, Op->getOpcode() == ISD::FP_TO_SINT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The rest of the time, vector "promotion" is basically just bitcasting and
|
||||||
|
// doing the operation in a different type. For example, x86 promotes
|
||||||
|
// ISD::AND on v2i32 to v1i64.
|
||||||
MVT VT = Op.getSimpleValueType();
|
MVT VT = Op.getSimpleValueType();
|
||||||
assert(Op.getNode()->getNumValues() == 1 &&
|
assert(Op.getNode()->getNumValues() == 1 &&
|
||||||
"Can't promote a vector with multiple results!");
|
"Can't promote a vector with multiple results!");
|
||||||
|
Reference in New Issue
Block a user