On Fri, Nov 17, 2017 at 07:45:28PM +0000, Jeff Law wrote: > On 11/17/2017 09:03 AM, Richard Sandiford wrote: > > This patch: > > > > - tweaks the handling of legitimize_address_displacement > > so that it gets called before rather than after the address has > > been expanded. This means that we're no longer at the mercy > > of LRA being able to interpret the expanded instructions. > > > > - passes the original offset to legitimize_address_displacement. > > > > - adds SVE support to the AArch64 implementation of > > legitimize_address_displacement. > > > > Tested on aarch64-linux-gnu (with and without SVE), x86_64-linux-gnu > > and powerpc64le-linux-gnu. OK to install? > > > > Richard > > > > > > 2017-11-17 Richard Sandiford <richard.sandif...@linaro.org> > > Alan Hayward <alan.hayw...@arm.com> > > David Sherwood <david.sherw...@arm.com> > > > > gcc/ > > * target.def (legitimize_address_displacement): Take the original > > offset as a poly_int. > > * targhooks.h (default_legitimize_address_displacement): Update > > accordingly. > > * targhooks.c (default_legitimize_address_displacement): Likewise. > > * doc/tm.texi: Regenerate. > > * lra-constraints.c (base_plus_disp_to_reg): Take the displacement > > as an argument, moving assert of ad->disp == ad->disp_term to... > > (process_address_1): ...here. Update calls to base_plus_disp_to_reg. > > Try calling targetm.legitimize_address_displacement before expanding > > the address rather than afterwards, and adjust for the new interface. > > * config/aarch64/aarch64.c (aarch64_legitimize_address_displacement): > > Match the new hook interface. Handle SVE addresses. > > * config/sh/sh.c (sh_legitimize_address_displacement): Make the > > new hook interface. > It depends on poly, so it can't go in yet. But if/when poly is > approved, the target independent bits are fine as are the sh changes. > I'll let the aarch64 maintainers chime in on those bits.
> > Index: gcc/config/aarch64/aarch64.c > > =================================================================== > > --- gcc/config/aarch64/aarch64.c 2017-11-17 16:01:54.798206825 +0000 > > +++ gcc/config/aarch64/aarch64.c 2017-11-17 16:01:54.992032358 +0000 > > @@ -5902,32 +5902,78 @@ aarch64_legitimate_address_p (machine_mo > > return aarch64_classify_address (&addr, x, mode, strict_p, type); > > } > > > > -/* Split an out-of-range address displacement into a base and offset. > > - Use 4KB range for 1- and 2-byte accesses and a 16KB range otherwise > > - to increase opportunities for sharing the base address of different > > sizes. > > - Unaligned accesses use the signed 9-bit range, TImode/TFmode use > > - the intersection of signed scaled 7-bit and signed 9-bit offset. */ > > +/* Implement TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT. */ > > + The new comment is not especially descriptive of the arguments for this hook. If you could update it, that would be helpful, though I appreciate it will be documented at the definition of the hook itself. Otherwise, this is OK. Thanks, James