Skip to content

Commit 1b0efe2

Browse files
committed
[LegalizeTypes] When expanding the integer result of LLROUND/LLRINT, also call GetSoftenedFloat if the floating point input needs to be softened.
Before this we were emitting a bitcast to integer from the lowering code that itself will need to be legalized. By calling GetSoftenedFloat we get the integer conversion in one step without needing to relegalize a bitcast.
1 parent 9b515b6 commit 1b0efe2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,12 @@ void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(SDNode *N, SDValue &Lo,
26252625
EVT RetVT = N->getValueType(0);
26262626
TargetLowering::MakeLibCallOptions CallOptions;
26272627
CallOptions.setSExt(true);
2628+
2629+
if (getTypeAction(VT) == TargetLowering::TypeSoftenFloat) {
2630+
Op = GetSoftenedFloat(Op);
2631+
CallOptions.setTypeListBeforeSoften(VT, RetVT, true);
2632+
}
2633+
26282634
SplitInteger(TLI.makeLibCall(DAG, LC, RetVT, Op, CallOptions, dl).first,
26292635
Lo, Hi);
26302636
}

0 commit comments

Comments
 (0)