For binop opcodes that are commutable + reassociatable (ISD::AND/OR/OR/ADD/MUL etc.) we need support for variable args matchers that can match operands that might be in different locations in a dependency chain:
e.g.
(add X, (add Y, Z))
(add (add X, Y), (add Z, W))
(add X, (add Y, (add Z, W)))
SDValue X, Y, Z, W;
m_Add(m_Value(X), m_Value(Y), m_Value(Z))
m_Add(m_Value(X), m_Value(Y), m_Value(Z), m_Value(W))
We probably only need the 3 and 4 argument patterns for this initial ticket.