@@ -2764,9 +2764,11 @@ void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, unsigned ResNo) {
2764
2764
report_fatal_error (" Do not know how to promote this operator's result!" );
2765
2765
2766
2766
case ISD::BITCAST:
2767
- case ISD::FREEZE:
2768
2767
R = PromoteFloatRes_BITCAST (N);
2769
2768
break ;
2769
+ case ISD::FREEZE:
2770
+ R = PromoteFloatRes_FREEZE (N);
2771
+ break ;
2770
2772
case ISD::ConstantFP: R = PromoteFloatRes_ConstantFP (N); break ;
2771
2773
case ISD::EXTRACT_VECTOR_ELT:
2772
2774
R = PromoteFloatRes_EXTRACT_VECTOR_ELT (N); break ;
@@ -2879,6 +2881,18 @@ SDValue DAGTypeLegalizer::PromoteFloatRes_BITCAST(SDNode *N) {
2879
2881
return DAG.getNode (GetPromotionOpcode (VT, NVT), SDLoc (N), NVT, Cast);
2880
2882
}
2881
2883
2884
+ SDValue DAGTypeLegalizer::PromoteFloatRes_FREEZE (SDNode *N) {
2885
+ EVT VT = N->getValueType (0 );
2886
+ EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), VT);
2887
+ // Input type isn't guaranteed to be a scalar int so bitcast if not. The
2888
+ // bitcast will be legalized further if necessary.
2889
+ EVT IVT = EVT::getIntegerVT (*DAG.getContext (),
2890
+ N->getOperand (0 ).getValueType ().getSizeInBits ());
2891
+ SDValue Cast = DAG.getBitcast (IVT, N->getOperand (0 ));
2892
+ return DAG.getNode (GetPromotionOpcode (VT, NVT), SDLoc (N), NVT,
2893
+ DAG.getFreeze (Cast));
2894
+ }
2895
+
2882
2896
SDValue DAGTypeLegalizer::PromoteFloatRes_ConstantFP (SDNode *N) {
2883
2897
ConstantFPSDNode *CFPNode = cast<ConstantFPSDNode>(N);
2884
2898
EVT VT = N->getValueType (0 );
0 commit comments