@@ -2639,11 +2639,7 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_FCOPYSIGN(SDNode *N, unsigned OpNo) {
2639
2639
// Convert the promoted float value to the desired integer type
2640
2640
SDValue DAGTypeLegalizer::PromoteFloatOp_UnaryOp (SDNode *N, unsigned OpNo) {
2641
2641
SDValue Op = GetPromotedFloat (N->getOperand (0 ));
2642
- if (N->getOpcode () == ISD::AssertNoFPClass)
2643
- return DAG.getNode (N->getOpcode (), SDLoc (N), N->getValueType (0 ), Op,
2644
- N->getOperand (1 ));
2645
- else
2646
- return DAG.getNode (N->getOpcode (), SDLoc (N), N->getValueType (0 ), Op);
2642
+ return DAG.getNode (N->getOpcode (), SDLoc (N), N->getValueType (0 ), Op);
2647
2643
}
2648
2644
2649
2645
// Convert the promoted float value to the desired integer type
@@ -3304,8 +3300,10 @@ void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
3304
3300
case ISD::FTRUNC:
3305
3301
case ISD::FTAN:
3306
3302
case ISD::FTANH:
3307
- case ISD::AssertNoFPClass:
3308
3303
case ISD::FCANONICALIZE: R = SoftPromoteHalfRes_UnaryOp (N); break ;
3304
+ case ISD::AssertNoFPClass:
3305
+ R = SoftPromoteHalfRes_UnaryOpExt1 (N);
3306
+ break ;
3309
3307
3310
3308
// Binary FP Operations
3311
3309
case ISD::FADD:
@@ -3632,6 +3630,21 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_UnaryOp(SDNode *N) {
3632
3630
return DAG.getNode (GetPromotionOpcode (NVT, OVT), dl, MVT::i16 , Res);
3633
3631
}
3634
3632
3633
+ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_UnaryOpExt1 (SDNode *N) {
3634
+ EVT OVT = N->getValueType (0 );
3635
+ EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), OVT);
3636
+ SDValue Op = GetSoftPromotedHalf (N->getOperand (0 ));
3637
+ SDLoc dl (N);
3638
+
3639
+ // Promote to the larger FP type.
3640
+ Op = DAG.getNode (GetPromotionOpcode (OVT, NVT), dl, NVT, Op);
3641
+
3642
+ SDValue Res = DAG.getNode (N->getOpcode (), dl, NVT, Op, N->getOperand (1 ));
3643
+
3644
+ // Convert back to FP16 as an integer.
3645
+ return DAG.getNode (GetPromotionOpcode (NVT, OVT), dl, MVT::i16 , Res);
3646
+ }
3647
+
3635
3648
SDValue DAGTypeLegalizer::SoftPromoteHalfRes_BinOp (SDNode *N) {
3636
3649
EVT OVT = N->getValueType (0 );
3637
3650
EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), OVT);
0 commit comments