Skip to content

Commit 0615847

Browse files
committed
address comment comment
1 parent 9b672d4 commit 0615847

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -8493,12 +8493,12 @@ SDValue DAGCombiner::MatchRotatePosNeg(SDValue Shifted, SDValue Pos,
84938493
SDValue InnerNeg, bool FromAdd,
84948494
bool HasPos, unsigned PosOpcode,
84958495
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)))) ->
84988498
// (rotl x, y) or (rotr x, (sub 32, y))
84998499
//
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))) ->
85028502
// (rotr x, y) or (rotl x, (sub 32, y))
85038503
EVT VT = Shifted.getValueType();
85048504
if (matchRotateSub(InnerPos, InnerNeg, VT.getScalarSizeInBits(), DAG,
@@ -8523,12 +8523,12 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85238523
EVT VT = N0.getValueType();
85248524
unsigned EltBits = VT.getScalarSizeInBits();
85258525

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)))) ->
85288528
// (fshl x0, x1, y) or (fshr x0, x1, (sub 32, y))
85298529
//
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))) ->
85328532
// (fshr x0, x1, y) or (fshl x0, x1, (sub 32, y))
85338533
if (matchRotateSub(InnerPos, InnerNeg, EltBits, DAG, /*IsRotate*/ N0 == N1,
85348534
FromAdd))
@@ -8540,7 +8540,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85408540
// TODO: When can we use the NegOpcode case?
85418541
if (PosOpcode == ISD::FSHL && isPowerOf2_32(EltBits)) {
85428542
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)))
85448544
// -> (fshl x0, x1, y)
85458545
if (sd_match(N1, m_Srl(m_Value(X), m_One())) &&
85468546
sd_match(InnerNeg,
@@ -8549,7 +8549,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85498549
return DAG.getNode(ISD::FSHL, DL, VT, N0, X, Pos);
85508550
}
85518551

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))
85538553
// -> (fshr x0, x1, y)
85548554
if (sd_match(N0, m_Shl(m_Value(X), m_One())) &&
85558555
sd_match(InnerPos,
@@ -8558,7 +8558,7 @@ SDValue DAGCombiner::MatchFunnelPosNeg(SDValue N0, SDValue N1, SDValue Pos,
85588558
return DAG.getNode(ISD::FSHR, DL, VT, X, N1, Neg);
85598559
}
85608560

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))
85628562
// -> (fshr x0, x1, y)
85638563
// TODO: Should add(x,x) -> shl(x,1) be a general DAG canonicalization?
85648564
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,
87408740
return SDValue(); // Requires funnel shift support.
87418741
}
87428742

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

0 commit comments

Comments
 (0)