@@ -8493,12 +8493,12 @@ SDValue DAGCombiner::MatchRotatePosNeg(SDValue Shifted, SDValue Pos,
8493
8493
SDValue InnerNeg, bool FromAdd,
8494
8494
bool HasPos, unsigned PosOpcode,
8495
8495
unsigned NegOpcode, const SDLoc &DL) {
8496
- // fold (or (shl x, (*ext y)),
8497
- // (srl x, (*ext (sub 32, y)))) ->
8496
+ // fold (or/add (shl x, (*ext y)),
8497
+ // (srl x, (*ext (sub 32, y)))) ->
8498
8498
// (rotl x, y) or (rotr x, (sub 32, y))
8499
8499
//
8500
- // fold (or (shl x, (*ext (sub 32, y))),
8501
- // (srl x, (*ext y))) ->
8500
+ // fold (or/add (shl x, (*ext (sub 32, y))),
8501
+ // (srl x, (*ext y))) ->
8502
8502
// (rotr x, y) or (rotl x, (sub 32, y))
8503
8503
EVT VT = Shifted.getValueType();
8504
8504
if (matchRotateSub(InnerPos, InnerNeg, VT.getScalarSizeInBits(), DAG,
@@ -8523,12 +8523,12 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8523
8523
EVT VT = N0.getValueType();
8524
8524
unsigned EltBits = VT.getScalarSizeInBits();
8525
8525
8526
- // fold (or (shl x0, (*ext y)),
8527
- // (srl x1, (*ext (sub 32, y)))) ->
8526
+ // fold (or/add (shl x0, (*ext y)),
8527
+ // (srl x1, (*ext (sub 32, y)))) ->
8528
8528
// (fshl x0, x1, y) or (fshr x0, x1, (sub 32, y))
8529
8529
//
8530
- // fold (or (shl x0, (*ext (sub 32, y))),
8531
- // (srl x1, (*ext y))) ->
8530
+ // fold (or/add (shl x0, (*ext (sub 32, y))),
8531
+ // (srl x1, (*ext y))) ->
8532
8532
// (fshr x0, x1, y) or (fshl x0, x1, (sub 32, y))
8533
8533
if (matchRotateSub(InnerPos, InnerNeg, EltBits, DAG, /*IsRotate*/ N0 == N1,
8534
8534
FromAdd))
@@ -8540,7 +8540,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8540
8540
// TODO: When can we use the NegOpcode case?
8541
8541
if (PosOpcode == ISD::FSHL && isPowerOf2_32(EltBits)) {
8542
8542
SDValue X;
8543
- // fold (or (shl x0, y), (srl (srl x1, 1), (xor y, 31)))
8543
+ // fold (or/add (shl x0, y), (srl (srl x1, 1), (xor y, 31)))
8544
8544
// -> (fshl x0, x1, y)
8545
8545
if (sd_match(N1, m_Srl(m_Value(X), m_One())) &&
8546
8546
sd_match(InnerNeg,
@@ -8549,7 +8549,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8549
8549
return DAG.getNode(ISD::FSHL, DL, VT, N0, X, Pos);
8550
8550
}
8551
8551
8552
- // fold (or (shl (shl x0, 1), (xor y, 31)), (srl x1, y))
8552
+ // fold (or/add (shl (shl x0, 1), (xor y, 31)), (srl x1, y))
8553
8553
// -> (fshr x0, x1, y)
8554
8554
if (sd_match(N0, m_Shl(m_Value(X), m_One())) &&
8555
8555
sd_match(InnerPos,
@@ -8558,7 +8558,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8558
8558
return DAG.getNode(ISD::FSHR, DL, VT, X, N1, Neg);
8559
8559
}
8560
8560
8561
- // fold (or (shl (add x0, x0), (xor y, 31)), (srl x1, y))
8561
+ // fold (or/add (shl (add x0, x0), (xor y, 31)), (srl x1, y))
8562
8562
// -> (fshr x0, x1, y)
8563
8563
// TODO: Should add(x,x) -> shl(x,1) be a general DAG canonicalization?
8564
8564
if (sd_match(N0, m_Add(m_Value(X), m_Deferred(X))) &&
@@ -8740,10 +8740,10 @@ SDValue DAGCombiner::MatchRotate(SDValue LHS, SDValue RHS, const SDLoc &DL,
8740
8740
return SDValue(); // Requires funnel shift support.
8741
8741
}
8742
8742
8743
- // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1)
8744
- // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2)
8745
- // fold (or (shl x, C1), (srl y, C2)) -> (fshl x, y, C1)
8746
- // fold (or (shl x, C1), (srl y, C2)) -> (fshr x, y, C2)
8743
+ // fold (or/add (shl x, C1), (srl x, C2)) -> (rotl x, C1)
8744
+ // fold (or/add (shl x, C1), (srl x, C2)) -> (rotr x, C2)
8745
+ // fold (or/add (shl x, C1), (srl y, C2)) -> (fshl x, y, C1)
8746
+ // fold (or/add (shl x, C1), (srl y, C2)) -> (fshr x, y, C2)
8747
8747
// iff C1+C2 == EltSizeInBits
8748
8748
if (ISD::matchBinaryPredicate(LHSShiftAmt, RHSShiftAmt, MatchRotateSum)) {
8749
8749
SDValue Res;
0 commit comments