For cases where we TRUNCATE and then ZERO_EXTEND to a larger size (often from vector legalization), see if we can mask the source data and then ZERO_EXTEND (instead of after a ANY_EXTEND). This can help avoid having to generate a larger mask, and possibly applying it to several sub-vectors.
(zext (truncate x)) -> (zext (and(x, m))
This is the first of a number of minor patches to help improve the conversion of byte masks to clear mask shuffles.
Ulrich - this includes some changes in SystemZ, please can you check them? A quick search indicates they make sense but I want to make sure.