PATCH: PR target/58690: internal compiler error: in copy_to_mode_reg, at explow.c:641

Uros Bizjak ubizjak@gmail.com
Sat Oct 12 07:50:00 GMT 2013


On Fri, Oct 11, 2013 at 8:38 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> In x32, when a TLS address is in DImode and Pmode is SImode,
> copy_addr_to_reg will fail.  This patch adds ix86_copy_addr_to_reg
> to first copy DImode address into a DImode register and then to generate
> SImode SUBREG in this case.  Tested on x32.  OK for trunk?
>
> 2013-10-11  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR target/58690
>         * config/i386/i386.c (ix86_copy_addr_to_reg): New function.
>         (ix86_expand_movmem): Replace copy_addr_to_reg with
>         ix86_copy_addr_to_reg.
>         (ix86_expand_setmem): Likewise.
>
> gcc/testsuite/
>
> 2013-10-11  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR target/58690
>         * gcc.target/i386/pr58690.c: New test
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 37c1bec..e39d63db 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -22076,6 +22076,21 @@ counter_mode (rtx count_exp)
>    return SImode;
>  }
>
> +/* Copy the address to a register in Pmode.  Support x32 TLS address in
> +   DImode and Pmode in SImode.  */

Copy the address to a Pmode register.  This is used for x32 to truncate
DImode TLS address to a SImode register.

> +static rtx
> +ix86_copy_addr_to_reg (rtx addr)
> +{
> +  if (GET_MODE (addr) != Pmode)
> +    {
> +      gcc_assert (GET_MODE (addr) == DImode && Pmode == SImode);
> +      return gen_rtx_SUBREG (SImode, copy_to_mode_reg (DImode, addr), 0);
> +    }
> +  else
> +    return copy_addr_to_reg (addr);
> +}

No negative conditions please. Just switch arms of the if clause.

OK with these changes.

Do we also need this patch on 4.8?

Thanks,
Uros.



More information about the Gcc-patches mailing list