This is the mail archive of the
mailing list for the GCC project.
Re: [RS6000] pr65810, powerpc64 alignment of r2
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Alan Modra <amodra at gmail dot com>
- Date: Mon, 27 Apr 2015 17:11:36 -0400
- Subject: Re: [RS6000] pr65810, powerpc64 alignment of r2
- Authentication-results: sourceware.org; auth=none
- References: <20150420135317 dot GE12627 at bubble dot grove dot modra dot org> <CAGWvnym9axON+wOpyX=iN6KtpwZayJ-CsivhnPu6Ryx51aGC5w at mail dot gmail dot com> <20150420223232 dot GF12627 at bubble dot grove dot modra dot org> <20150423112443 dot GP12627 at bubble dot grove dot modra dot org>
On Thu, Apr 23, 2015 at 7:24 AM, Alan Modra <firstname.lastname@example.org> wrote:
> Revised patch, supporting linker that aligns the toc base.
> This fixes a thinko in offsettable_ok_by_alignment. It's not the
> absolute placement that matters, but the toc-pointer relative offset.
> So alignment of r2 also needs to be taken into account.
> Changing offsettable_ok_by_alignment has a ripple effect into the 'm'
> constraint so we also need to ensure rs6000_legitimize_reload_address
> does not create invalid toc-relative addresses. As found by
> gcc.dg/torture/builtin-math-2.c -Os. That's the reason for the
> use_toc_relative_ref change. I hope the size check along with
> reg_offset_p is sufficient here. It seems so, but it's difficult to
> be certain due to how hard it is to get just the right combination of
> reload conditions to trigger.
> Bootstrapped and regression tested powerpc64-linux and
> powerpc64le-linux, both with a new and old linker. OK for mainline?
> PR target/65810
> * config/rs6000/rs6000.c (POWERPC64_TOC_POINTER_ALIGNMENT): Define.
> (offsettable_ok_by_alignment): Use minimum of decl and toc
> pointer alignment. Replace dead code with assertion.
> (use_toc_relative_ref): Add mode arg. Return false in -mcmodel=medium
> case if size exceeds toc pointer alignment.
> (rs6000_legitimize_reload_address): Update use_toc_relative_ref call.
> (rs6000_emit_move): Likewise.
> * configure.ac: Add linker toc pointer alignment check.
> * configure: Regenerate.
> * config.in: Regenerate.