This is an alternative to the AArch64 part of D59174. Instead of checking for and x, -1 specifically, this turns the and to bic transformation from custom lowering to a custom DAG combine. This gives a chance for generic DAG combines to apply first.
Details
Diff Detail
Event Timeline
I agree it doesn't really make sense to custom-lower this operation. That said, off the top of my head, I'm not sure why we're doing this at the DAG level at all, given the available instructions; it should be possible to pattern match (and x, (mvni imm)) during isel. (If there's some reason that doesn't work, a brief comment explaining it would be helpful.)
My guess would be that this would miss some cases that get lowered to (and x, (movi imm)), even though a representation using mvni would also be possible. The code for lowering constant build vectors first tries movi variants, then mvni, then movi with undef bits and finally mvni with undef bits.
Add comment on why this is not done in isel. Add updates to signed saturation tests added in the meantime.