https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113576
--- Comment #29 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Hongtao Liu from comment #28)
> I saw we already maskoff integral modes for vector mask in store_constructor
>
> /* Use sign-extension for uniform boolean vectors with
> integer modes and single-bit mask entries.
> Effectively "vec_duplicate" for bitmasks. */
> if (elt_size == 1
> && !TREE_SIDE_EFFECTS (exp)
> && VECTOR_BOOLEAN_TYPE_P (type)
> && SCALAR_INT_MODE_P (TYPE_MODE (type))
> && (elt = uniform_vector_p (exp))
> && !VECTOR_TYPE_P (TREE_TYPE (elt)))
> {
> rtx op0 = force_reg (TYPE_MODE (TREE_TYPE (elt)),
> expand_normal (elt));
> rtx tmp = gen_reg_rtx (mode);
> convert_move (tmp, op0, 0);
>
> /* Ensure no excess bits are set.
> GCN needs this for nunits < 64.
> x86 needs this for nunits < 8. */
> auto nunits = TYPE_VECTOR_SUBPARTS (type).to_constant ();
> if (maybe_ne (GET_MODE_PRECISION (mode), nunits))
> tmp = expand_binop (mode, and_optab, tmp,
> GEN_INT ((1 << nunits) - 1), target,
> true, OPTAB_WIDEN);
> if (tmp != target)
> emit_move_insn (target, tmp);
> break;
> }
But that's just for CONSTRUCTORs, we got the VIEW_CONVERT_EXPR path for
VECTOR_CSTs. But yeah, that _might_ argue we should perform the same
masking for VECTOR_CST expansion as well, instead of trying to fixup
in do_compare_and_jump?