On Fri, Aug 05, 2016 at 11:35:11AM +0930, Alan Modra wrote:
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 779ba1f..c59d07a 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -7717,8 +7717,34 @@ mem_operand_gpr (rtx op, machine_mode mode)
>    if (TARGET_POWERPC64 && (offset & 3) != 0)
>      return false;
>  
> -  if (mode_supports_vsx_dform_quad (mode)
> -      && !quad_address_offset_p (offset))
> +  extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD;
> +  if (extra < 0)
> +    extra = 0;
> +
> +  if (GET_CODE (addr) == LO_SUM)
> +    /* For lo_sum addresses, we must allow any offset except one that
> +       causes a wrap, so test only the low 16 bits.  */
> +    offset = ((offset & 0xffff) ^ 0x8000) - 0x8000;

You could use sext_hwi instead?   offset = sext_hwi (offset, 16);
There are many other explicit manipulations in the code already of course,
just FYI.

This seems like an improvement; okay for trunk, thanks.  I don't think
we're there yet though, there is more wrong / suboptimal than just the
PR :-/


Segher

Reply via email to