@@ -3053,17 +3053,15 @@ static SDValue foldAddSubMasked1(bool IsAdd, SDValue N0, SDValue N1,
3053
3053
3054
3054
/// Helper for doing combines based on N0 and N1 being added to each other.
3055
3055
SDValue DAGCombiner::visitADDLikeCommutative(SDValue N0, SDValue N1,
3056
- SDNode *LocReference) {
3056
+ SDNode *LocReference) {
3057
3057
EVT VT = N0.getValueType();
3058
3058
SDLoc DL(LocReference);
3059
3059
3060
3060
// fold (add x, shl(0 - y, n)) -> sub(x, shl(y, n))
3061
- if (N1.getOpcode() == ISD::SHL && N1.getOperand(0).getOpcode() == ISD::SUB &&
3062
- isNullOrNullSplat(N1.getOperand(0).getOperand(0 )))
3061
+ SDValue Y, N;
3062
+ if (sd_match(N1, m_Shl(m_Neg(m_Value(Y)), m_Value(N) )))
3063
3063
return DAG.getNode(ISD::SUB, DL, VT, N0,
3064
- DAG.getNode(ISD::SHL, DL, VT,
3065
- N1.getOperand(0).getOperand(1),
3066
- N1.getOperand(1)));
3064
+ DAG.getNode(ISD::SHL, DL, VT, Y, N));
3067
3065
3068
3066
if (SDValue V = foldAddSubMasked1(true, N0, N1, DAG, DL))
3069
3067
return V;
0 commit comments