On Mon, Mar 09, 2026 at 05:27:42AM -0700, H.J. Lu wrote:
> --- a/gcc/config/i386/i386-features.cc
> +++ b/gcc/config/i386/i386-features.cc
> @@ -3331,9 +3331,26 @@ ix86_place_single_vector_set (rtx dest, rtx src, 
> bitmap bbs,
>        rtx inner_scalar = load->val;
>        /* Set the source in (vec_duplicate:V4SI (reg:SI 99)).  */
>        rtx reg = XEXP (src, 0);
> -      if ((REG_P (inner_scalar) || MEM_P (inner_scalar))
> -       && GET_MODE (reg) != GET_MODE (inner_scalar))
> -     inner_scalar = gen_rtx_SUBREG (GET_MODE (reg), inner_scalar, 0);
> +      machine_mode reg_mode = GET_MODE (reg);
> +      if (reg_mode != GET_MODE (inner_scalar))
> +     {
> +       if (REG_P (inner_scalar) || MEM_P (inner_scalar))
> +         inner_scalar = gen_rtx_SUBREG (GET_MODE (reg), inner_scalar,
> +                                        0);
> +       else if (!SCALAR_INT_MODE_P (reg_mode))
> +         {
> +           /* For non-int load with integer constant, generate
> +
> +              (set (subreg:SI (reg/v:SF 105 [ f ]) 0)
> +                   (const_int 1313486336 [0x4e4a3600]))
> +
> +            */
> +           gcc_assert (CONST_INT_P (inner_scalar));
> +           unsigned int bits = GET_MODE_BITSIZE (reg_mode);
> +           machine_mode mode = int_mode_for_size (bits, 0).require ();
> +           reg = gen_rtx_SUBREG (mode, reg, 0);

I think handling const0_rtx the way you did in the other patch and only
doing this for other constants would be better.

        Jakub

Reply via email to