[llvm] r370604 - [TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constant inputs
Shiva Chen via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 31 21:52:55 PDT 2019
Author: shiva
Date: Sat Aug 31 21:52:54 2019
New Revision: 370604
URL: http://llvm.org/viewvc/llvm-project?rev=370604&view=rev
Log:
[TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constant inputs
Summary:
This fixes the bugzilla id 43183 which triggerd by the following commit:
[RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall
Added:
llvm/trunk/test/CodeGen/ARM/softfp-constant-comparison.ll
Modified:
llvm/trunk/include/llvm/CodeGen/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/include/llvm/CodeGen/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLowering.h?rev=370604&r1=370603&r2=370604&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLowering.h Sat Aug 31 21:52:54 2019
@@ -3539,19 +3539,19 @@ public:
/// This structure is used to pass arguments to makeLibCall function.
struct MakeLibCallOptions {
- // By passing the node before soften to makeLibCall, the target hook
+ // By passing type list before soften to makeLibCall, the target hook
// shouldExtendTypeInLibCall can get the original type before soften.
- // It could be generalized by passing orignal type lists if necessary
- // in the future.
- SDNode *NodeBeforeSoften = nullptr;
+ ArrayRef<EVT> OpsVTBeforeSoften;
+ EVT RetVTBeforeSoften;
bool IsSExt : 1;
bool DoesNotReturn : 1;
bool IsReturnValueUsed : 1;
bool IsPostTypeLegalization : 1;
+ bool IsSoften : 1;
MakeLibCallOptions()
: IsSExt(false), DoesNotReturn(false), IsReturnValueUsed(true),
- IsPostTypeLegalization(false) {}
+ IsPostTypeLegalization(false), IsSoften(false) {}
MakeLibCallOptions &setSExt(bool Value = true) {
IsSExt = Value;
@@ -3573,8 +3573,11 @@ public:
return *this;
}
- MakeLibCallOptions &setNodeBeforeSoften(SDNode *N) {
- NodeBeforeSoften = N;
+ MakeLibCallOptions &setTypeListBeforeSoften(ArrayRef<EVT> OpsVT, EVT RetVT,
+ bool Value = true) {
+ OpsVTBeforeSoften = OpsVT;
+ RetVTBeforeSoften = RetVT;
+ IsSoften = Value;
return *this;
}
};
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=370604&r1=370603&r2=370604&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Sat Aug 31 21:52:54 2019
@@ -201,7 +201,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::FMIN_F32,
RTLIB::FMIN_F64,
@@ -216,7 +218,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::FMAX_F32,
RTLIB::FMAX_F64,
@@ -231,7 +235,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::ADD_F32,
RTLIB::ADD_F64,
@@ -245,7 +251,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::CEIL_F32,
RTLIB::CEIL_F64,
@@ -310,7 +317,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::COS_F32,
RTLIB::COS_F64,
@@ -325,7 +333,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::DIV_F32,
RTLIB::DIV_F64,
@@ -339,7 +349,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::EXP_F32,
RTLIB::EXP_F64,
@@ -353,7 +364,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::EXP2_F32,
RTLIB::EXP2_F64,
@@ -367,7 +379,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::FLOOR_F32,
RTLIB::FLOOR_F64,
@@ -381,7 +394,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::LOG_F32,
RTLIB::LOG_F64,
@@ -395,7 +409,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::LOG2_F32,
RTLIB::LOG2_F64,
@@ -409,7 +424,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::LOG10_F32,
RTLIB::LOG10_F64,
@@ -425,7 +441,10 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
GetSoftenedFloat(N->getOperand(1)),
GetSoftenedFloat(N->getOperand(2)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[3] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType(),
+ N->getOperand(2).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::FMA_F32,
RTLIB::FMA_F64,
@@ -440,7 +459,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::MUL_F32,
RTLIB::MUL_F64,
@@ -454,7 +475,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::NEARBYINT_F32,
RTLIB::NEARBYINT_F64,
@@ -517,7 +539,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
RTLIB::Libcall LC = RTLIB::getFPEXT(Op.getValueType(), N->getValueType(0));
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_EXTEND!");
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, LC, NVT, Op, CallOptions, SDLoc(N)).first;
}
@@ -527,7 +550,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT MidVT = TLI.getTypeToTransformTo(*DAG.getContext(), MVT::f32);
SDValue Op = N->getOperand(0);
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
SDValue Res32 = TLI.makeLibCall(DAG, RTLIB::FPEXT_F16_F32, MidVT, Op,
CallOptions, SDLoc(N)).first;
if (N->getValueType(0) == MVT::f32)
@@ -551,7 +575,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
RTLIB::Libcall LC = RTLIB::getFPROUND(Op.getValueType(), N->getValueType(0));
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_ROUND!");
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, LC, NVT, Op, CallOptions, SDLoc(N)).first;
}
@@ -560,7 +585,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::POW_F32,
RTLIB::POW_F64,
@@ -576,7 +603,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)), N->getOperand(1) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::POWI_F32,
RTLIB::POWI_F64,
@@ -591,7 +620,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::REM_F32,
RTLIB::REM_F64,
@@ -605,7 +636,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::RINT_F32,
RTLIB::RINT_F64,
@@ -619,7 +651,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::ROUND_F32,
RTLIB::ROUND_F64,
@@ -633,7 +666,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::SIN_F32,
RTLIB::SIN_F64,
@@ -647,7 +681,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::SQRT_F32,
RTLIB::SQRT_F64,
@@ -662,7 +697,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)),
GetSoftenedFloat(N->getOperand(1)) };
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[2] = { N->getOperand(0).getValueType(),
+ N->getOperand(1).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::SUB_F32,
RTLIB::SUB_F64,
@@ -679,7 +716,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(N->getValueType(0),
RTLIB::TRUNC_F32,
RTLIB::TRUNC_F64,
@@ -793,7 +831,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes
NVT, N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
CallOptions.setSExt(Signed);
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, LC,
TLI.getTypeToTransformTo(*DAG.getContext(), RVT),
Op, CallOptions, dl).first;
@@ -931,7 +970,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_EXTEND libcall");
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, LC, RVT, Op, CallOptions, SDLoc(N)).first;
}
@@ -950,7 +990,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, LC, RVT, Op, CallOptions, SDLoc(N)).first;
}
@@ -1030,7 +1071,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
SDValue Res = TLI.makeLibCall(DAG, LC, NVT, Op, CallOptions, dl).first;
// Truncate the result if the libcall returns a larger type.
@@ -1119,7 +1161,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
EVT RetVT = N->getOperand(0).getValueType().getSimpleVT().SimpleTy;
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
RTLIB::LROUND_F32,
RTLIB::LROUND_F64,
@@ -1135,7 +1178,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
EVT RetVT = N->getOperand(0).getValueType().getSimpleVT().SimpleTy;
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
RTLIB::LLROUND_F32,
RTLIB::LLROUND_F64,
@@ -1151,7 +1195,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
EVT RetVT = N->getOperand(0).getValueType().getSimpleVT().SimpleTy;
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
RTLIB::LRINT_F32,
RTLIB::LRINT_F64,
@@ -1167,7 +1212,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_
SDValue Op = GetSoftenedFloat(N->getOperand(0));
EVT RetVT = N->getOperand(0).getValueType().getSimpleVT().SimpleTy;
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(N);
+ EVT OpsVT[1] = { N->getOperand(0).getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, N->getValueType(0), true);
return TLI.makeLibCall(DAG, GetFPLibCall(RetVT,
RTLIB::LLRINT_F32,
RTLIB::LLRINT_F64,
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=370604&r1=370603&r2=370604&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sat Aug 31 21:52:54 2019
@@ -127,7 +127,6 @@ TargetLowering::makeLibCall(SelectionDAG
Args.reserve(Ops.size());
TargetLowering::ArgListEntry Entry;
- SDNode *N = CallOptions.NodeBeforeSoften;
for (unsigned i = 0; i < Ops.size(); ++i) {
SDValue NewOp = Ops[i];
Entry.Node = NewOp;
@@ -136,8 +135,8 @@ TargetLowering::makeLibCall(SelectionDAG
CallOptions.IsSExt);
Entry.IsZExt = !Entry.IsSExt;
- SDValue OldOp = N ? N->getOperand(i) : NewOp;
- if (!shouldExtendTypeInLibCall(OldOp.getValueType())) {
+ if (CallOptions.IsSoften &&
+ !shouldExtendTypeInLibCall(CallOptions.OpsVTBeforeSoften[i])) {
Entry.IsSExt = Entry.IsZExt = false;
}
Args.push_back(Entry);
@@ -153,8 +152,8 @@ TargetLowering::makeLibCall(SelectionDAG
bool signExtend = shouldSignExtendTypeInLibCall(RetVT, CallOptions.IsSExt);
bool zeroExtend = !signExtend;
- RetVT = N ? N->getValueType(0) : RetVT;
- if (!shouldExtendTypeInLibCall(RetVT)) {
+ if (CallOptions.IsSoften &&
+ !shouldExtendTypeInLibCall(CallOptions.RetVTBeforeSoften)) {
signExtend = zeroExtend = false;
}
@@ -379,12 +378,10 @@ void TargetLowering::softenSetCCOperands
// Use the target specific return value for comparions lib calls.
EVT RetVT = getCmpLibcallReturnType();
SDValue Ops[2] = {NewLHS, NewRHS};
- SDValue OldSETCC = DAG.getNode(
- ISD::SETCC, dl,
- getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), RetVT),
- OldLHS, OldRHS, DAG.getCondCode(CCCode));
TargetLowering::MakeLibCallOptions CallOptions;
- CallOptions.setNodeBeforeSoften(OldSETCC.getNode());
+ EVT OpsVT[2] = { OldLHS.getValueType(),
+ OldRHS.getValueType() };
+ CallOptions.setTypeListBeforeSoften(OpsVT, RetVT, true);
NewLHS = makeLibCall(DAG, LC1, RetVT, Ops, CallOptions, dl).first;
NewRHS = DAG.getConstant(0, dl, RetVT);
Added: llvm/trunk/test/CodeGen/ARM/softfp-constant-comparison.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/softfp-constant-comparison.ll?rev=370604&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/softfp-constant-comparison.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/softfp-constant-comparison.ll Sat Aug 31 21:52:54 2019
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv7em-arm-none-eabi < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbv7em-arm-none-eabi"
+
+ at a = hidden global i32 0, align 4
+
+define hidden void @fn1() nounwind #0 {
+; CHECK-LABEL: fn1:
+; CHECK: @ %bb.0: @ %entry
+; CHECK-NEXT: .save {r7, lr}
+; CHECK-NEXT: push {r7, lr}
+; CHECK-NEXT: vldr d0, .LCPI0_0
+; CHECK-NEXT: vmov r0, r1, d0
+; CHECK-NEXT: mov r2, r0
+; CHECK-NEXT: mov r3, r1
+; CHECK-NEXT: bl __aeabi_dcmpeq
+; CHECK-NEXT: cbnz r0, .LBB0_2
+; CHECK-NEXT: b .LBB0_1
+; CHECK-NEXT: .LBB0_1: @ %land.rhs
+; CHECK-NEXT: b .LBB0_2
+; CHECK-NEXT: .LBB0_2: @ %land.end
+; CHECK-NEXT: pop {r7, pc}
+; CHECK-NEXT: .p2align 3
+; CHECK-NEXT: @ %bb.3:
+; CHECK-NEXT: .LCPI0_0:
+; CHECK-NEXT: .long 0 @ double 0
+; CHECK-NEXT: .long 0
+entry:
+ %0 = load i32, i32* @a, align 4
+ %conv = sitofp i32 %0 to double
+ %mul = fmul nnan ninf nsz double 0.000000e+00, %conv
+ %tobool = fcmp nnan ninf nsz une double %mul, 0.000000e+00
+ br i1 %tobool, label %land.rhs, label %land.end
+
+land.rhs: ; preds = %entry
+ br label %land.end
+
+land.end: ; preds = %land.rhs, %entry
+ %1 = phi i1 [ false, %entry ], [ false, %land.rhs ]
+ %land.ext = zext i1 %1 to i32
+ ret void
+}
+
+attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-m4" "target-features"="+armv7e-m,+dsp,+fp16,+fpregs,+hwdiv,+thumb-mode,+vfp2d16sp,+vfp3d16sp,+vfp4d16sp,-aes,-crc,-crypto,-dotprod,-fp16fml,-fullfp16,-hwdiv-arm,-lob,-mve,-mve.fp,-ras,-sb,-sha2" "unsafe-fp-math"="false" "use-soft-float"="false" }
More information about the llvm-commits
mailing list