On Mon, Jan 26, 2026 at 11:46:56AM +0100, Robin Dapp wrote:
> --- a/gcc/tree-ssa-forwprop.cc
> +++ b/gcc/tree-ssa-forwprop.cc
> @@ -4139,12 +4139,17 @@ simplify_vector_constructor (gimple_stmt_iterator
> *gsi)
> perm_type = TREE_TYPE (orig[0]);
> /* Determine the element type for the conversion source.
> As orig_elem_type keeps track of the original type, check
> - if we need to perform a sign swap after permuting. */
> + if we need to perform a sign swap after permuting.
> + We need to be able to construct a vector type from the element
> + type which is not possible for e.g. BitInt or pointers
> + so pun with an integer type if needed. */
> tree conv_elem_type = TREE_TYPE (perm_type);
> if (conv_code != ERROR_MARK
> && orig_elem_type[0]
> - && tree_nop_conversion_p (orig_elem_type[0], conv_elem_type))
> - conv_elem_type = orig_elem_type[0];
> + && TYPE_SIGN (orig_elem_type[0]) != TYPE_SIGN (conv_elem_type))
> + conv_elem_type = TYPE_UNSIGNED (orig_elem_type[0])
> + ? unsigned_type_for (conv_elem_type)
> + : signed_type_for (conv_elem_type);
That would be
conv_elem_type
= signed_or_unsigned_type_for (TYPE_UNSIGNED (orig_elem_type[0]),
conv_elem_type);
Jakub