@@ -8469,12 +8469,12 @@ SDValue DAGCombiner::MatchRotatePosNeg(SDValue Shifted, SDValue Pos,
8469
8469
SDValue InnerNeg, bool FromAdd,
8470
8470
bool HasPos, unsigned PosOpcode,
8471
8471
unsigned NegOpcode, const SDLoc &DL) {
8472
- // fold (or (shl x, (*ext y)),
8473
- // (srl x, (*ext (sub 32, y)))) ->
8472
+ // fold (or/add (shl x, (*ext y)),
8473
+ // (srl x, (*ext (sub 32, y)))) ->
8474
8474
// (rotl x, y) or (rotr x, (sub 32, y))
8475
8475
//
8476
- // fold (or (shl x, (*ext (sub 32, y))),
8477
- // (srl x, (*ext y))) ->
8476
+ // fold (or/add (shl x, (*ext (sub 32, y))),
8477
+ // (srl x, (*ext y))) ->
8478
8478
// (rotr x, y) or (rotl x, (sub 32, y))
8479
8479
EVT VT = Shifted.getValueType();
8480
8480
if (matchRotateSub(InnerPos, InnerNeg, VT.getScalarSizeInBits(), DAG,
@@ -8499,12 +8499,12 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8499
8499
EVT VT = N0.getValueType();
8500
8500
unsigned EltBits = VT.getScalarSizeInBits();
8501
8501
8502
- // fold (or (shl x0, (*ext y)),
8503
- // (srl x1, (*ext (sub 32, y)))) ->
8502
+ // fold (or/add (shl x0, (*ext y)),
8503
+ // (srl x1, (*ext (sub 32, y)))) ->
8504
8504
// (fshl x0, x1, y) or (fshr x0, x1, (sub 32, y))
8505
8505
//
8506
- // fold (or (shl x0, (*ext (sub 32, y))),
8507
- // (srl x1, (*ext y))) ->
8506
+ // fold (or/add (shl x0, (*ext (sub 32, y))),
8507
+ // (srl x1, (*ext y))) ->
8508
8508
// (fshr x0, x1, y) or (fshl x0, x1, (sub 32, y))
8509
8509
if (matchRotateSub(InnerPos, InnerNeg, EltBits, DAG, /*IsRotate*/ N0 == N1,
8510
8510
FromAdd))
@@ -8516,7 +8516,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8516
8516
// TODO: When can we use the NegOpcode case?
8517
8517
if (PosOpcode == ISD::FSHL && isPowerOf2_32(EltBits)) {
8518
8518
SDValue X;
8519
- // fold (or (shl x0, y), (srl (srl x1, 1), (xor y, 31)))
8519
+ // fold (or/add (shl x0, y), (srl (srl x1, 1), (xor y, 31)))
8520
8520
// -> (fshl x0, x1, y)
8521
8521
if (sd_match(N1, m_Srl(m_Value(X), m_One())) &&
8522
8522
sd_match(InnerNeg,
@@ -8525,7 +8525,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8525
8525
return DAG.getNode(ISD::FSHL, DL, VT, N0, X, Pos);
8526
8526
}
8527
8527
8528
- // fold (or (shl (shl x0, 1), (xor y, 31)), (srl x1, y))
8528
+ // fold (or/add (shl (shl x0, 1), (xor y, 31)), (srl x1, y))
8529
8529
// -> (fshr x0, x1, y)
8530
8530
if (sd_match(N0, m_Shl(m_Value(X), m_One())) &&
8531
8531
sd_match(InnerPos,
@@ -8534,7 +8534,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
8534
8534
return DAG.getNode(ISD::FSHR, DL, VT, X, N1, Neg);
8535
8535
}
8536
8536
8537
- // fold (or (shl (add x0, x0), (xor y, 31)), (srl x1, y))
8537
+ // fold (or/add (shl (add x0, x0), (xor y, 31)), (srl x1, y))
8538
8538
// -> (fshr x0, x1, y)
8539
8539
// TODO: Should add(x,x) -> shl(x,1) be a general DAG canonicalization?
8540
8540
if (sd_match(N0, m_Add(m_Value(X), m_Deferred(X))) &&
@@ -8716,10 +8716,10 @@ SDValue DAGCombiner::MatchRotate(SDValue LHS, SDValue RHS, const SDLoc &DL,
8716
8716
return SDValue(); // Requires funnel shift support.
8717
8717
}
8718
8718
8719
- // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1)
8720
- // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2)
8721
- // fold (or (shl x, C1), (srl y, C2)) -> (fshl x, y, C1)
8722
- // fold (or (shl x, C1), (srl y, C2)) -> (fshr x, y, C2)
8719
+ // fold (or/add (shl x, C1), (srl x, C2)) -> (rotl x, C1)
8720
+ // fold (or/add (shl x, C1), (srl x, C2)) -> (rotr x, C2)
8721
+ // fold (or/add (shl x, C1), (srl y, C2)) -> (fshl x, y, C1)
8722
+ // fold (or/add (shl x, C1), (srl y, C2)) -> (fshr x, y, C2)
8723
8723
// iff C1+C2 == EltSizeInBits
8724
8724
if (ISD::matchBinaryPredicate(LHSShiftAmt, RHSShiftAmt, MatchRotateSum)) {
8725
8725
SDValue Res;
0 commit comments