When visiting we crash in t16: i64 = srl t40, Constant:i8<0> because we don't expect a shift-by-zero in visitAndLike.
I don't see a reason why this is invalid, and as discussed with Matt on IRC (which originally introduced this assertion) is probably fine to relax the condition a bit.
SelectionDAG has 11 nodes:
t0: ch = EntryToken
t2: i64 = Constant<0>
t29: i32,ch = load<LD2[undef](align=8), sext from i16> t0, undef:i64, undef:i64
t19: ch = TokenFactor t29:1, t0
t40: i64 = sign_extend t29
t16: i64 = srl t40, Constant:i8<0>
t24: i64 = and t16, Constant:i64<65535>
t20: ch = store<ST8[undef]> t19, t24, undef:i64, undef:i64
To micro-optimize, I'd move this to before we count bits in the AndMask and get the integer VT. Otherwise, LGTM.