@@ -2764,9 +2764,11 @@ void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, unsigned ResNo) {
27642764 report_fatal_error (" Do not know how to promote this operator's result!" );
27652765
27662766 case ISD::BITCAST:
2767- case ISD::FREEZE:
27682767 R = PromoteFloatRes_BITCAST (N);
27692768 break ;
2769+ case ISD::FREEZE:
2770+ R = PromoteFloatRes_FREEZE (N);
2771+ break ;
27702772 case ISD::ConstantFP: R = PromoteFloatRes_ConstantFP (N); break ;
27712773 case ISD::EXTRACT_VECTOR_ELT:
27722774 R = PromoteFloatRes_EXTRACT_VECTOR_ELT (N); break ;
@@ -2879,6 +2881,18 @@ SDValue DAGTypeLegalizer::PromoteFloatRes_BITCAST(SDNode *N) {
28792881 return DAG.getNode (GetPromotionOpcode (VT, NVT), SDLoc (N), NVT, Cast);
28802882}
28812883
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+
28822896SDValue DAGTypeLegalizer::PromoteFloatRes_ConstantFP (SDNode *N) {
28832897 ConstantFPSDNode *CFPNode = cast<ConstantFPSDNode>(N);
28842898 EVT VT = N->getValueType (0 );
0 commit comments