@@ -6405,12 +6405,7 @@ SDValue TargetLowering::BuildSDIV(SDNode *N, SelectionDAG &DAG,
64056405 if (VT.isVector ())
64066406 WideVT = EVT::getVectorVT (*DAG.getContext (), WideVT,
64076407 VT.getVectorElementCount ());
6408- // Some targets like AMDGPU try to go from SDIV to SDIVREM which is then
6409- // custom lowered. This is very expensive so avoid it at all costs for
6410- // constant divisors.
6411- if ((isOperationExpand (ISD::SDIV, VT) &&
6412- isOperationCustom (ISD::SDIVREM, VT.getScalarType ())) ||
6413- isOperationLegalOrCustom (ISD::MUL, WideVT)) {
6408+ if (isOperationLegalOrCustom (ISD::MUL, WideVT)) {
64146409 X = DAG.getNode (ISD::SIGN_EXTEND, dl, WideVT, X);
64156410 Y = DAG.getNode (ISD::SIGN_EXTEND, dl, WideVT, Y);
64166411 Y = DAG.getNode (ISD::MUL, dl, WideVT, X, Y);
@@ -6593,12 +6588,7 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
65936588 if (VT.isVector ())
65946589 WideVT = EVT::getVectorVT (*DAG.getContext (), WideVT,
65956590 VT.getVectorElementCount ());
6596- // Some targets like AMDGPU try to go from UDIV to UDIVREM which is then
6597- // custom lowered. This is very expensive so avoid it at all costs for
6598- // constant divisors.
6599- if ((isOperationExpand (ISD::UDIV, VT) &&
6600- isOperationCustom (ISD::UDIVREM, VT.getScalarType ())) ||
6601- isOperationLegalOrCustom (ISD::MUL, WideVT)) {
6591+ if (isOperationLegalOrCustom (ISD::MUL, WideVT)) {
66026592 X = DAG.getNode (ISD::ZERO_EXTEND, dl, WideVT, X);
66036593 Y = DAG.getNode (ISD::ZERO_EXTEND, dl, WideVT, Y);
66046594 Y = DAG.getNode (ISD::MUL, dl, WideVT, X, Y);
0 commit comments