@@ -6405,12 +6405,7 @@ SDValue TargetLowering::BuildSDIV(SDNode *N, SelectionDAG &DAG,
6405
6405
if (VT.isVector ())
6406
6406
WideVT = EVT::getVectorVT (*DAG.getContext (), WideVT,
6407
6407
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)) {
6414
6409
X = DAG.getNode (ISD::SIGN_EXTEND, dl, WideVT, X);
6415
6410
Y = DAG.getNode (ISD::SIGN_EXTEND, dl, WideVT, Y);
6416
6411
Y = DAG.getNode (ISD::MUL, dl, WideVT, X, Y);
@@ -6593,12 +6588,7 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
6593
6588
if (VT.isVector ())
6594
6589
WideVT = EVT::getVectorVT (*DAG.getContext (), WideVT,
6595
6590
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)) {
6602
6592
X = DAG.getNode (ISD::ZERO_EXTEND, dl, WideVT, X);
6603
6593
Y = DAG.getNode (ISD::ZERO_EXTEND, dl, WideVT, Y);
6604
6594
Y = DAG.getNode (ISD::MUL, dl, WideVT, X, Y);
0 commit comments