@@ -5096,11 +5096,11 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
5096
5096
case ISD::SETCC: Res = ExpandIntOp_SETCC (N); break ;
5097
5097
case ISD::SETCCCARRY: Res = ExpandIntOp_SETCCCARRY (N); break ;
5098
5098
case ISD::STRICT_SINT_TO_FP:
5099
- case ISD::SINT_TO_FP: Res = ExpandIntOp_SINT_TO_FP (N); break ;
5099
+ case ISD::SINT_TO_FP:
5100
+ case ISD::STRICT_UINT_TO_FP:
5101
+ case ISD::UINT_TO_FP: Res = ExpandIntOp_XINT_TO_FP (N); break ;
5100
5102
case ISD::STORE: Res = ExpandIntOp_STORE (cast<StoreSDNode>(N), OpNo); break ;
5101
5103
case ISD::TRUNCATE: Res = ExpandIntOp_TRUNCATE (N); break ;
5102
- case ISD::STRICT_UINT_TO_FP:
5103
- case ISD::UINT_TO_FP: Res = ExpandIntOp_UINT_TO_FP (N); break ;
5104
5104
5105
5105
case ISD::SHL:
5106
5106
case ISD::SRA:
@@ -5385,14 +5385,17 @@ SDValue DAGTypeLegalizer::ExpandIntOp_RETURNADDR(SDNode *N) {
5385
5385
return SDValue (DAG.UpdateNodeOperands (N, Lo), 0 );
5386
5386
}
5387
5387
5388
- SDValue DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP (SDNode *N) {
5388
+ SDValue DAGTypeLegalizer::ExpandIntOp_XINT_TO_FP (SDNode *N) {
5389
5389
bool IsStrict = N->isStrictFPOpcode ();
5390
+ bool IsSigned = N->getOpcode () == ISD::SINT_TO_FP ||
5391
+ N->getOpcode () == ISD::STRICT_SINT_TO_FP;
5390
5392
SDValue Chain = IsStrict ? N->getOperand (0 ) : SDValue ();
5391
5393
SDValue Op = N->getOperand (IsStrict ? 1 : 0 );
5392
5394
EVT DstVT = N->getValueType (0 );
5393
- RTLIB::Libcall LC = RTLIB::getSINTTOFP (Op.getValueType (), DstVT);
5395
+ RTLIB::Libcall LC = IsSigned ? RTLIB::getSINTTOFP (Op.getValueType (), DstVT)
5396
+ : RTLIB::getUINTTOFP (Op.getValueType (), DstVT);
5394
5397
assert (LC != RTLIB::UNKNOWN_LIBCALL &&
5395
- " Don't know how to expand this SINT_TO_FP !" );
5398
+ " Don't know how to expand this XINT_TO_FP !" );
5396
5399
TargetLowering::MakeLibCallOptions CallOptions;
5397
5400
CallOptions.setSExt (true );
5398
5401
std::pair<SDValue, SDValue> Tmp =
@@ -5505,27 +5508,6 @@ SDValue DAGTypeLegalizer::ExpandIntOp_TRUNCATE(SDNode *N) {
5505
5508
return DAG.getNode (ISD::TRUNCATE, SDLoc (N), N->getValueType (0 ), InL);
5506
5509
}
5507
5510
5508
- SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP (SDNode *N) {
5509
- bool IsStrict = N->isStrictFPOpcode ();
5510
- SDValue Chain = IsStrict ? N->getOperand (0 ) : SDValue ();
5511
- SDValue Op = N->getOperand (IsStrict ? 1 : 0 );
5512
- EVT DstVT = N->getValueType (0 );
5513
- RTLIB::Libcall LC = RTLIB::getUINTTOFP (Op.getValueType (), DstVT);
5514
- assert (LC != RTLIB::UNKNOWN_LIBCALL &&
5515
- " Don't know how to expand this UINT_TO_FP!" );
5516
- TargetLowering::MakeLibCallOptions CallOptions;
5517
- CallOptions.setSExt (true );
5518
- std::pair<SDValue, SDValue> Tmp =
5519
- TLI.makeLibCall (DAG, LC, DstVT, Op, CallOptions, SDLoc (N), Chain);
5520
-
5521
- if (!IsStrict)
5522
- return Tmp.first ;
5523
-
5524
- ReplaceValueWith (SDValue (N, 1 ), Tmp.second );
5525
- ReplaceValueWith (SDValue (N, 0 ), Tmp.first );
5526
- return SDValue ();
5527
- }
5528
-
5529
5511
SDValue DAGTypeLegalizer::ExpandIntOp_ATOMIC_STORE (SDNode *N) {
5530
5512
SDLoc dl (N);
5531
5513
SDValue Swap = DAG.getAtomic (ISD::ATOMIC_SWAP, dl,
0 commit comments