@@ -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,8 @@ 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: R = SoftPromoteHalfRes_UnaryOpExt1 (N); break ;
3309
3305
3310
3306
// Binary FP Operations
3311
3307
case ISD::FADD:
@@ -3632,6 +3628,21 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_UnaryOp(SDNode *N) {
3632
3628
return DAG.getNode (GetPromotionOpcode (NVT, OVT), dl, MVT::i16 , Res);
3633
3629
}
3634
3630
3631
+ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_UnaryOpExt1 (SDNode *N) {
3632
+ EVT OVT = N->getValueType (0 );
3633
+ EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), OVT);
3634
+ SDValue Op = GetSoftPromotedHalf (N->getOperand (0 ));
3635
+ SDLoc dl (N);
3636
+
3637
+ // Promote to the larger FP type.
3638
+ Op = DAG.getNode (GetPromotionOpcode (OVT, NVT), dl, NVT, Op);
3639
+
3640
+ SDValue Res = DAG.getNode (N->getOpcode (), dl, NVT, Op, N->getOperand (1 ));
3641
+
3642
+ // Convert back to FP16 as an integer.
3643
+ return DAG.getNode (GetPromotionOpcode (NVT, OVT), dl, MVT::i16 , Res);
3644
+ }
3645
+
3635
3646
SDValue DAGTypeLegalizer::SoftPromoteHalfRes_BinOp (SDNode *N) {
3636
3647
EVT OVT = N->getValueType (0 );
3637
3648
EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), OVT);
0 commit comments