forked from OSchip/llvm-project
[LegalizeTypes] Add SoftenFloatOp_Unary to reduce some duplication for softening LRINT/LLRINT/LROUND/LLROUND
Summary: This will be enhanced in a follow up to add strict fp support Reviewers: efriedma Reviewed By: efriedma Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70751
This commit is contained in:
parent
7ddc6287a0
commit
350565dbc0
|
@ -945,72 +945,53 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_FCOPYSIGN(SDNode *N) {
|
||||||
return DAG.getNode(ISD::FCOPYSIGN, dl, LVT, LHS, RHS);
|
return DAG.getNode(ISD::FCOPYSIGN, dl, LVT, LHS, RHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGTypeLegalizer::SoftenFloatOp_LROUND(SDNode *N) {
|
SDValue DAGTypeLegalizer::SoftenFloatOp_Unary(SDNode *N, RTLIB::Libcall LC) {
|
||||||
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
|
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
|
||||||
|
|
||||||
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
||||||
EVT RetVT = N->getOperand(0).getValueType();
|
|
||||||
TargetLowering::MakeLibCallOptions CallOptions;
|
TargetLowering::MakeLibCallOptions CallOptions;
|
||||||
EVT OpsVT[1] = { N->getOperand(0).getValueType() };
|
EVT OpVT = N->getOperand(0).getValueType();
|
||||||
CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
|
CallOptions.setTypeListBeforeSoften(OpVT, N->getValueType(0), true);
|
||||||
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
|
return TLI.makeLibCall(DAG, LC, NVT, Op, CallOptions, SDLoc(N)).first;
|
||||||
RTLIB::LROUND_F32,
|
}
|
||||||
RTLIB::LROUND_F64,
|
|
||||||
RTLIB::LROUND_F80,
|
SDValue DAGTypeLegalizer::SoftenFloatOp_LROUND(SDNode *N) {
|
||||||
RTLIB::LROUND_F128,
|
EVT OpVT = N->getOperand(0).getValueType();
|
||||||
RTLIB::LROUND_PPCF128),
|
return SoftenFloatOp_Unary(N, GetFPLibCall(OpVT,
|
||||||
NVT, Op, CallOptions, SDLoc(N)).first;
|
RTLIB::LROUND_F32,
|
||||||
|
RTLIB::LROUND_F64,
|
||||||
|
RTLIB::LROUND_F80,
|
||||||
|
RTLIB::LROUND_F128,
|
||||||
|
RTLIB::LROUND_PPCF128));
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGTypeLegalizer::SoftenFloatOp_LLROUND(SDNode *N) {
|
SDValue DAGTypeLegalizer::SoftenFloatOp_LLROUND(SDNode *N) {
|
||||||
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
|
EVT OpVT = N->getOperand(0).getValueType();
|
||||||
|
return SoftenFloatOp_Unary(N, GetFPLibCall(OpVT,
|
||||||
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
RTLIB::LLROUND_F32,
|
||||||
EVT RetVT = N->getOperand(0).getValueType();
|
RTLIB::LLROUND_F64,
|
||||||
TargetLowering::MakeLibCallOptions CallOptions;
|
RTLIB::LLROUND_F80,
|
||||||
EVT OpsVT[1] = { N->getOperand(0).getValueType() };
|
RTLIB::LLROUND_F128,
|
||||||
CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
|
RTLIB::LLROUND_PPCF128));
|
||||||
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
|
|
||||||
RTLIB::LLROUND_F32,
|
|
||||||
RTLIB::LLROUND_F64,
|
|
||||||
RTLIB::LLROUND_F80,
|
|
||||||
RTLIB::LLROUND_F128,
|
|
||||||
RTLIB::LLROUND_PPCF128),
|
|
||||||
NVT, Op, CallOptions, SDLoc(N)).first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGTypeLegalizer::SoftenFloatOp_LRINT(SDNode *N) {
|
SDValue DAGTypeLegalizer::SoftenFloatOp_LRINT(SDNode *N) {
|
||||||
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
|
EVT OpVT = N->getOperand(0).getValueType();
|
||||||
|
return SoftenFloatOp_Unary(N, GetFPLibCall(OpVT,
|
||||||
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
RTLIB::LRINT_F32,
|
||||||
EVT RetVT = N->getOperand(0).getValueType();
|
RTLIB::LRINT_F64,
|
||||||
TargetLowering::MakeLibCallOptions CallOptions;
|
RTLIB::LRINT_F80,
|
||||||
EVT OpsVT[1] = { N->getOperand(0).getValueType() };
|
RTLIB::LRINT_F128,
|
||||||
CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
|
RTLIB::LRINT_PPCF128));
|
||||||
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
|
|
||||||
RTLIB::LRINT_F32,
|
|
||||||
RTLIB::LRINT_F64,
|
|
||||||
RTLIB::LRINT_F80,
|
|
||||||
RTLIB::LRINT_F128,
|
|
||||||
RTLIB::LRINT_PPCF128),
|
|
||||||
NVT, Op, CallOptions, SDLoc(N)).first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGTypeLegalizer::SoftenFloatOp_LLRINT(SDNode *N) {
|
SDValue DAGTypeLegalizer::SoftenFloatOp_LLRINT(SDNode *N) {
|
||||||
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
|
EVT OpVT = N->getOperand(0).getValueType();
|
||||||
|
return SoftenFloatOp_Unary(N, GetFPLibCall(OpVT,
|
||||||
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
RTLIB::LLRINT_F32,
|
||||||
EVT RetVT = N->getOperand(0).getValueType();
|
RTLIB::LLRINT_F64,
|
||||||
TargetLowering::MakeLibCallOptions CallOptions;
|
RTLIB::LLRINT_F80,
|
||||||
EVT OpsVT[1] = { N->getOperand(0).getValueType() };
|
RTLIB::LLRINT_F128,
|
||||||
CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
|
RTLIB::LLRINT_PPCF128));
|
||||||
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
|
|
||||||
RTLIB::LLRINT_F32,
|
|
||||||
RTLIB::LLRINT_F64,
|
|
||||||
RTLIB::LLRINT_F80,
|
|
||||||
RTLIB::LLRINT_F128,
|
|
||||||
RTLIB::LLRINT_PPCF128),
|
|
||||||
NVT, Op, CallOptions, SDLoc(N)).first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -530,6 +530,7 @@ private:
|
||||||
|
|
||||||
// Convert Float Operand to Integer.
|
// Convert Float Operand to Integer.
|
||||||
bool SoftenFloatOperand(SDNode *N, unsigned OpNo);
|
bool SoftenFloatOperand(SDNode *N, unsigned OpNo);
|
||||||
|
SDValue SoftenFloatOp_Unary(SDNode *N, RTLIB::Libcall LC);
|
||||||
SDValue SoftenFloatOp_BITCAST(SDNode *N);
|
SDValue SoftenFloatOp_BITCAST(SDNode *N);
|
||||||
SDValue SoftenFloatOp_BR_CC(SDNode *N);
|
SDValue SoftenFloatOp_BR_CC(SDNode *N);
|
||||||
SDValue SoftenFloatOp_FP_EXTEND(SDNode *N);
|
SDValue SoftenFloatOp_FP_EXTEND(SDNode *N);
|
||||||
|
|
Loading…
Reference in New Issue