Skip to content

Commit 6df5ebb

Browse files
committed
address comment comment
1 parent 2021f4b commit 6df5ebb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8469,12 +8469,12 @@ SDValue DAGCombiner::MatchRotatePosNeg(SDValue Shifted, SDValue Pos,
84698469
SDValue InnerNeg, bool FromAdd,
84708470
bool HasPos, unsigned PosOpcode,
84718471
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)))) ->
84748474
// (rotl x, y) or (rotr x, (sub 32, y))
84758475
//
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))) ->
84788478
// (rotr x, y) or (rotl x, (sub 32, y))
84798479
EVT VT = Shifted.getValueType();
84808480
if (matchRotateSub(InnerPos, InnerNeg, VT.getScalarSizeInBits(), DAG,
@@ -8499,12 +8499,12 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
84998499
EVT VT = N0.getValueType();
85008500
unsigned EltBits = VT.getScalarSizeInBits();
85018501

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)))) ->
85048504
// (fshl x0, x1, y) or (fshr x0, x1, (sub 32, y))
85058505
//
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))) ->
85088508
// (fshr x0, x1, y) or (fshl x0, x1, (sub 32, y))
85098509
if (matchRotateSub(InnerPos, InnerNeg, EltBits, DAG, /*IsRotate*/ N0 == N1,
85108510
FromAdd))
@@ -8516,7 +8516,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85168516
// TODO: When can we use the NegOpcode case?
85178517
if (PosOpcode == ISD::FSHL && isPowerOf2_32(EltBits)) {
85188518
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)))
85208520
// -> (fshl x0, x1, y)
85218521
if (sd_match(N1, m_Srl(m_Value(X), m_One())) &&
85228522
sd_match(InnerNeg,
@@ -8525,7 +8525,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85258525
return DAG.getNode(ISD::FSHL, DL, VT, N0, X, Pos);
85268526
}
85278527

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))
85298529
// -> (fshr x0, x1, y)
85308530
if (sd_match(N0, m_Shl(m_Value(X), m_One())) &&
85318531
sd_match(InnerPos,
@@ -8534,7 +8534,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85348534
return DAG.getNode(ISD::FSHR, DL, VT, X, N1, Neg);
85358535
}
85368536

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))
85388538
// -> (fshr x0, x1, y)
85398539
// TODO: Should add(x,x) -> shl(x,1) be a general DAG canonicalization?
85408540
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,
87168716
return SDValue(); // Requires funnel shift support.
87178717
}
87188718

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)
87238723
// iff C1+C2 == EltSizeInBits
87248724
if (ISD::matchBinaryPredicate(LHSShiftAmt, RHSShiftAmt, MatchRotateSum)) {
87258725
SDValue Res;

0 commit comments

Comments
 (0)