This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: copy_addr_to_reg: Convert to Pmode if needed


"H.J. Lu" <hongjiu.lu@intel.com> writes:
> diff --git a/gcc/explow.c b/gcc/explow.c
> index 460af1f..9b3c082 100644
> --- a/gcc/explow.c
> +++ b/gcc/explow.c
> @@ -611,6 +611,8 @@ copy_to_reg (rtx x)
>  rtx
>  copy_addr_to_reg (rtx x)
>  {
> +  if (GET_MODE (x) != VOIDmode && GET_MODE (x) != Pmode)
> +    x = convert_to_mode (Pmode, x, 1);
>    return copy_to_mode_reg (Pmode, x);
>  }

I think you need to say why the conversion should be done here
rather than in the caller.

Regardless of that, though: I think this should be convert_memory_address
rather than convert_to_mode.  Paasing 1 is wrong, because pointers are
signed on some targets.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]