@@ -134,6 +134,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
134
134
case ISD::STRICT_FTRUNC:
135
135
case ISD::FTRUNC: R = SoftenFloatRes_FTRUNC (N); break ;
136
136
case ISD::LOAD: R = SoftenFloatRes_LOAD (N); break ;
137
+ case ISD::ATOMIC_LOAD: R = SoftenFloatRes_ATOMIC_LOAD (N); break ;
137
138
case ISD::ATOMIC_SWAP: R = BitcastToInt_ATOMIC_SWAP (N); break ;
138
139
case ISD::SELECT: R = SoftenFloatRes_SELECT (N); break ;
139
140
case ISD::SELECT_CC: R = SoftenFloatRes_SELECT_CC (N); break ;
@@ -815,6 +816,26 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
815
816
return BitConvertToInteger (ExtendNode);
816
817
}
817
818
819
+ SDValue DAGTypeLegalizer::SoftenFloatRes_ATOMIC_LOAD (SDNode *N) {
820
+ AtomicSDNode *L = cast<AtomicSDNode>(N);
821
+ EVT VT = N->getValueType (0 );
822
+ EVT NVT = TLI.getTypeToTransformTo (*DAG.getContext (), VT);
823
+ SDLoc dl (N);
824
+
825
+ if (L->getExtensionType () == ISD::NON_EXTLOAD) {
826
+ SDValue NewL =
827
+ DAG.getAtomic (ISD::ATOMIC_LOAD, dl, NVT, DAG.getVTList (NVT, MVT::Other),
828
+ {L->getChain (), L->getBasePtr ()}, L->getMemOperand ());
829
+
830
+ // Legalized the chain result - switch anything that used the old chain to
831
+ // use the new one.
832
+ ReplaceValueWith (SDValue (N, 1 ), NewL.getValue (1 ));
833
+ return NewL;
834
+ }
835
+
836
+ report_fatal_error (" softening fp extending atomic load not handled" );
837
+ }
838
+
818
839
SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT (SDNode *N) {
819
840
SDValue LHS = GetSoftenedFloat (N->getOperand (1 ));
820
841
SDValue RHS = GetSoftenedFloat (N->getOperand (2 ));
0 commit comments