mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Refactor the code to grab the low and high parts of a value
using EXTRACT_ELEMENT into a utility function. llvm-svn: 70056
This commit is contained in:
parent
d13f1a3b59
commit
1031d09a38
@ -860,12 +860,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDValue &Lo,
|
||||
RTLIB::ADD_F32, RTLIB::ADD_F64,
|
||||
RTLIB::ADD_F80, RTLIB::ADD_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N,
|
||||
@ -874,12 +869,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N,
|
||||
RTLIB::CEIL_F32, RTLIB::CEIL_F64,
|
||||
RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FCOS(SDNode *N,
|
||||
@ -888,12 +878,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FCOS(SDNode *N,
|
||||
RTLIB::COS_F32, RTLIB::COS_F64,
|
||||
RTLIB::COS_F80, RTLIB::COS_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FDIV(SDNode *N, SDValue &Lo,
|
||||
@ -906,12 +891,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FDIV(SDNode *N, SDValue &Lo,
|
||||
RTLIB::DIV_PPCF128),
|
||||
N->getValueType(0), Ops, 2, false,
|
||||
N->getDebugLoc());
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FEXP(SDNode *N,
|
||||
@ -920,12 +900,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FEXP(SDNode *N,
|
||||
RTLIB::EXP_F32, RTLIB::EXP_F64,
|
||||
RTLIB::EXP_F80, RTLIB::EXP_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FEXP2(SDNode *N,
|
||||
@ -934,12 +909,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FEXP2(SDNode *N,
|
||||
RTLIB::EXP2_F32, RTLIB::EXP2_F64,
|
||||
RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(SDNode *N,
|
||||
@ -948,12 +918,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(SDNode *N,
|
||||
RTLIB::FLOOR_F32,RTLIB::FLOOR_F64,
|
||||
RTLIB::FLOOR_F80,RTLIB::FLOOR_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FLOG(SDNode *N,
|
||||
@ -962,12 +927,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG(SDNode *N,
|
||||
RTLIB::LOG_F32, RTLIB::LOG_F64,
|
||||
RTLIB::LOG_F80, RTLIB::LOG_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FLOG2(SDNode *N,
|
||||
@ -976,12 +936,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG2(SDNode *N,
|
||||
RTLIB::LOG2_F32, RTLIB::LOG2_F64,
|
||||
RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FLOG10(SDNode *N,
|
||||
@ -990,12 +945,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG10(SDNode *N,
|
||||
RTLIB::LOG10_F32,RTLIB::LOG10_F64,
|
||||
RTLIB::LOG10_F80,RTLIB::LOG10_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FMUL(SDNode *N, SDValue &Lo,
|
||||
@ -1008,12 +958,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FMUL(SDNode *N, SDValue &Lo,
|
||||
RTLIB::MUL_PPCF128),
|
||||
N->getValueType(0), Ops, 2, false,
|
||||
N->getDebugLoc());
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(SDNode *N,
|
||||
@ -1024,12 +969,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(SDNode *N,
|
||||
RTLIB::NEARBYINT_F80,
|
||||
RTLIB::NEARBYINT_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FNEG(SDNode *N, SDValue &Lo,
|
||||
@ -1053,12 +993,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FPOW(SDNode *N,
|
||||
RTLIB::POW_F32, RTLIB::POW_F64,
|
||||
RTLIB::POW_F80, RTLIB::POW_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FPOWI(SDNode *N,
|
||||
@ -1067,12 +1002,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FPOWI(SDNode *N,
|
||||
RTLIB::POWI_F32, RTLIB::POWI_F64,
|
||||
RTLIB::POWI_F80, RTLIB::POWI_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FRINT(SDNode *N,
|
||||
@ -1081,12 +1011,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FRINT(SDNode *N,
|
||||
RTLIB::RINT_F32, RTLIB::RINT_F64,
|
||||
RTLIB::RINT_F80, RTLIB::RINT_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FSIN(SDNode *N,
|
||||
@ -1095,12 +1020,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FSIN(SDNode *N,
|
||||
RTLIB::SIN_F32, RTLIB::SIN_F64,
|
||||
RTLIB::SIN_F80, RTLIB::SIN_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FSQRT(SDNode *N,
|
||||
@ -1109,12 +1029,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FSQRT(SDNode *N,
|
||||
RTLIB::SQRT_F32, RTLIB::SQRT_F64,
|
||||
RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FSUB(SDNode *N, SDValue &Lo,
|
||||
@ -1127,12 +1042,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FSUB(SDNode *N, SDValue &Lo,
|
||||
RTLIB::SUB_PPCF128),
|
||||
N->getValueType(0), Ops, 2, false,
|
||||
N->getDebugLoc());
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(SDNode *N,
|
||||
@ -1141,12 +1051,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(SDNode *N,
|
||||
RTLIB::TRUNC_F32, RTLIB::TRUNC_F64,
|
||||
RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128),
|
||||
N, false);
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Call,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDValue &Lo,
|
||||
@ -1214,10 +1119,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
|
||||
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported XINT_TO_FP!");
|
||||
|
||||
Hi = MakeLibCall(LC, VT, &Src, 1, true, dl);
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Hi,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Hi,
|
||||
DAG.getIntPtrConstant(1));
|
||||
GetPairElements(Hi, Lo, Hi);
|
||||
}
|
||||
|
||||
if (isSigned)
|
||||
@ -1252,8 +1154,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
|
||||
MVT::ppcf128));
|
||||
Lo = DAG.getNode(ISD::SELECT_CC, dl, VT, Src, DAG.getConstant(0, SrcVT),
|
||||
Lo, Hi, DAG.getCondCode(ISD::SETLT));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Lo, DAG.getIntPtrConstant(1));
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Lo, DAG.getIntPtrConstant(0));
|
||||
GetPairElements(Lo, Lo, Hi);
|
||||
}
|
||||
|
||||
|
||||
|
@ -933,6 +933,18 @@ void DAGTypeLegalizer::GetSplitDestVTs(MVT InVT, MVT &LoVT, MVT &HiVT) {
|
||||
}
|
||||
}
|
||||
|
||||
/// GetPairElements - Use ISD::EXTRACT_ELEMENT nodes to extract the low and
|
||||
/// high parts of the given value.
|
||||
void DAGTypeLegalizer::GetPairElements(SDValue Pair,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
DebugLoc dl = Pair.getDebugLoc();
|
||||
MVT NVT = TLI.getTypeToTransformTo(Pair.getValueType());
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Pair,
|
||||
DAG.getIntPtrConstant(0));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Pair,
|
||||
DAG.getIntPtrConstant(1));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::GetVectorElementPointer(SDValue VecPtr, MVT EltVT,
|
||||
SDValue Index) {
|
||||
DebugLoc dl = Index.getDebugLoc();
|
||||
|
@ -695,6 +695,10 @@ private:
|
||||
/// which is split (or expanded) into two not necessarily identical pieces.
|
||||
void GetSplitDestVTs(MVT InVT, MVT &LoVT, MVT &HiVT);
|
||||
|
||||
/// GetPairElements - Use ISD::EXTRACT_ELEMENT nodes to extract the low and
|
||||
/// high parts of the given value.
|
||||
void GetPairElements(SDValue Pair, SDValue &Lo, SDValue &Hi);
|
||||
|
||||
// Generic Result Splitting.
|
||||
void SplitRes_MERGE_VALUES(SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void SplitRes_SELECT (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
|
@ -135,16 +135,11 @@ void DAGTypeLegalizer::ExpandRes_EXTRACT_ELEMENT(SDNode *N, SDValue &Lo,
|
||||
GetExpandedOp(N->getOperand(0), Lo, Hi);
|
||||
SDValue Part = cast<ConstantSDNode>(N->getOperand(1))->getZExtValue() ?
|
||||
Hi : Lo;
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
||||
assert(Part.getValueType() == N->getValueType(0) &&
|
||||
"Type twice as big as expanded type not itself expanded!");
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Part,
|
||||
DAG.getConstant(0, TLI.getPointerTy()));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Part,
|
||||
DAG.getConstant(1, TLI.getPointerTy()));
|
||||
GetPairElements(Part, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo,
|
||||
|
Loading…
Reference in New Issue
Block a user