@@ -2577,13 +2577,13 @@ bool DAGTypeLegalizer::PromoteFloatOperand(SDNode *N, unsigned OpNo) {
2577
2577
R = PromoteFloatOp_FAKE_USE (N, OpNo);
2578
2578
break ;
2579
2579
case ISD::FCOPYSIGN: R = PromoteFloatOp_FCOPYSIGN (N, OpNo); break ;
2580
- case ISD::AssertNoFPClass:
2581
2580
case ISD::FP_TO_SINT:
2582
2581
case ISD::FP_TO_UINT:
2583
2582
case ISD::LROUND:
2584
2583
case ISD::LLROUND:
2585
2584
case ISD::LRINT:
2586
2585
case ISD::LLRINT: R = PromoteFloatOp_UnaryOp (N, OpNo); break ;
2586
+ case ISD::AssertNoFPClass: R = PromoteFloatOp_UnaryOpExt1 (N, OpNo); break ;
2587
2587
case ISD::FP_TO_SINT_SAT:
2588
2588
case ISD::FP_TO_UINT_SAT:
2589
2589
R = PromoteFloatOp_FP_TO_XINT_SAT (N, OpNo); break ;
@@ -2646,6 +2646,13 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_UnaryOp(SDNode *N, unsigned OpNo) {
2646
2646
return DAG.getNode (N->getOpcode (), SDLoc (N), N->getValueType (0 ), Op);
2647
2647
}
2648
2648
2649
+ // Convert the promoted float value to the desired integer type
2650
+ SDValue DAGTypeLegalizer::PromoteFloatOp_UnaryOpExt1 (SDNode *N, unsigned OpNo) {
2651
+ SDValue Op = GetPromotedFloat (N->getOperand (0 ));
2652
+ return DAG.getNode (N->getOpcode (), SDLoc (N), N->getValueType (0 ), Op,
2653
+ N->getOperand (1 ));
2654
+ }
2655
+
2649
2656
SDValue DAGTypeLegalizer::PromoteFloatOp_FP_TO_XINT_SAT (SDNode *N,
2650
2657
unsigned OpNo) {
2651
2658
SDValue Op = GetPromotedFloat (N->getOperand (0 ));
@@ -2809,8 +2816,10 @@ void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, unsigned ResNo) {
2809
2816
case ISD::FTRUNC:
2810
2817
case ISD::FTAN:
2811
2818
case ISD::FTANH:
2812
- case ISD::AssertNoFPClass:
2813
2819
case ISD::FCANONICALIZE: R = PromoteFloatRes_UnaryOp (N); break ;
2820
+ case ISD::AssertNoFPClass:
2821
+ R = PromoteFloatRes_UnaryOpExt1 (N);
2822
+ break ;
2814
2823
2815
2824
// Binary FP Operations
2816
2825
case ISD::FADD:
@@ -3003,12 +3012,18 @@ SDValue DAGTypeLegalizer::PromoteFloatRes_UnaryOp(SDNode *N) {
3003
3012
EVT VT = N->getValueType (0 );
3004
3013
EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), VT);
3005
3014
SDValue Op = GetPromotedFloat (N->getOperand (0 ));
3006
- if (N->getOpcode () == ISD::AssertNoFPClass)
3007
- return DAG.getNode (N->getOpcode (), SDLoc (N), NVT, Op, N->getOperand (1 ));
3008
- else
3009
- return DAG.getNode (N->getOpcode (), SDLoc (N), NVT, Op);
3015
+ return DAG.getNode (N->getOpcode (), SDLoc (N), NVT, Op);
3010
3016
}
3011
3017
3018
+ // Unary operation with a more non-float operand where the result and the
3019
+ // operand have PromoteFloat type action. Construct a new SDNode with the
3020
+ // promoted float value of the old operand.
3021
+ SDValue DAGTypeLegalizer::PromoteFloatRes_UnaryOpExt1 (SDNode *N) {
3022
+ EVT VT = N->getValueType (0 );
3023
+ EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), VT);
3024
+ SDValue Op = GetPromotedFloat (N->getOperand (0 ));
3025
+ return DAG.getNode (N->getOpcode (), SDLoc (N), NVT, Op, N->getOperand (1 ));
3026
+ }
3012
3027
// Binary operations where the result and both operands have PromoteFloat type
3013
3028
// action. Construct a new SDNode with the promoted float values of the old
3014
3029
// operands.
@@ -3251,8 +3266,6 @@ void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
3251
3266
report_fatal_error (" Do not know how to soft promote this operator's "
3252
3267
" result!" );
3253
3268
3254
- // case ISD::AssertNoFPClass:
3255
- // break;
3256
3269
case ISD::ARITH_FENCE:
3257
3270
R = SoftPromoteHalfRes_ARITH_FENCE (N); break ;
3258
3271
case ISD::BITCAST: R = SoftPromoteHalfRes_BITCAST (N); break ;
@@ -3613,11 +3626,7 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_UnaryOp(SDNode *N) {
3613
3626
// Promote to the larger FP type.
3614
3627
Op = DAG.getNode (GetPromotionOpcode (OVT, NVT), dl, NVT, Op);
3615
3628
3616
- SDValue Res;
3617
- if (N->getOpcode () == ISD::AssertNoFPClass)
3618
- Res = DAG.getNode (N->getOpcode (), dl, NVT, Op, N->getOperand (1 ));
3619
- else
3620
- Res = DAG.getNode (N->getOpcode (), dl, NVT, Op);
3629
+ SDValue Res = DAG.getNode (N->getOpcode (), dl, NVT, Op, N->getOperand (1 ));
3621
3630
3622
3631
// Convert back to FP16 as an integer.
3623
3632
return DAG.getNode (GetPromotionOpcode (NVT, OVT), dl, MVT::i16 , Res);
0 commit comments