public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: Jeff Law <jlaw@tachyum.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Michael Meissner <meissner@linux.ibm.com>
Subject: Re: Aligning stack offsets for spills
Date: Thu, 10 Jun 2021 16:34:18 -0500	[thread overview]
Message-ID: <20210610213418.GP18427@gate.crashing.org> (raw)
In-Reply-To: <960271b1-f8e5-48a1-576a-e655babd4e32@linux.ibm.com>

On Thu, Jun 10, 2021 at 02:28:34PM -0500, Peter Bergner via Gcc-patches wrote:
> On 6/7/21 2:00 PM, Jeff Law wrote:
> > I can't divulge many of the details right now, but one of the quirks of our
> > architecture is that reg+d addressing modes for our vector loads/stores require
> > the displacement to be aligned.  This is an artifact of how these instructions
> > are encoded.
> 
> Given what you're describing, it sounds like POWER has something similar.
> Our reg+displacement addressing uses 16-bit displacements using D, DS or DQ
> operand fields.  The D field encodes the entire 16-bits, but the DS and DQ
> fields only encode 14-bits and 12-bits respectively.

Yes, the low 2 resp. 4 bits of the offset are used for other things in
the instruction encoding for DS and DQ.

> The DS and DQ operands
> have the same maximum displacement as D operands, we just force that their
> bottom 2-bits/4-bits must be zero, so we don't need to include them in the
> insn encoding.  I believe this is all just handled in our legitimate address
> routines, but maybe Segher and/or Mike can correct me if I'm wrong?

This is all correct.  But probably the main thing is that our ABIs
require most things to be naturally aligned (up to 16 bytes).  The
machines do not require that (anymore), but requiring this in the ABI
still is a performance win afaics (and a lot easier for (compiler)
implementers -- most issues you describe just disappear ;-) )

Something tells me this won't work for you though?


Segher

      reply	other threads:[~2021-06-10 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 19:00 Jeff Law
2021-06-08  6:56 ` Richard Biener
2021-06-08 15:00   ` Jeff Law
2021-06-08 14:08 ` Michael Matz
2021-06-08 14:47   ` Jeff Law
2021-06-08 14:55     ` Jakub Jelinek
2021-06-08 15:06       ` H.J. Lu
2021-06-08 15:18         ` Jeff Law
2021-06-08 15:56           ` Michael Matz
2021-06-10 22:49       ` Jeff Law
2021-06-10 19:28 ` Peter Bergner
2021-06-10 21:34   ` Segher Boessenkool [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210610213418.GP18427@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jlaw@tachyum.com \
    --cc=meissner@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).