public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
Cc: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>,
	       gcc-patches@gcc.gnu.org
Subject: Re: [AARCH64 ABI PATCH] Change AARCH64 ABI to match AAPCS, provide -Wpsabi notes (PR target/77728)
Date: Tue, 25 Apr 2017 12:58:00 -0000	[thread overview]
Message-ID: <20170425125408.GZ1809@tucnak> (raw)
In-Reply-To: <15612893-a1fc-a385-4c0d-23ee2f9ffd26@arm.com>

On Tue, Apr 25, 2017 at 01:29:06PM +0100, Richard Earnshaw (lists) wrote:
> >        /* C.8 if the argument has an alignment of 16 then the NGRN is
> >           rounded up to the next even number.  */
> > -      if (nregs == 2 && alignment == 16 * BITS_PER_UNIT && ncrn % 2)
> > +      if (nregs == 2 && ncrn % 2)
> >  	{
> > -	  ++ncrn;
> > -	  gcc_assert (ncrn + nregs <= NUM_ARG_REGS);
> > +	  struct aarch64_fn_arg_alignment aa
> > +	    = aarch64_function_arg_alignment (mode, type);
> > +
> > +	  if (aa.warn_alignment == 16 * BITS_PER_UNIT
> 
> I was caught out (again) when reviewing this as to why the test was for
> exactly 16 bytes and not >= 16.  I'd forgotten that anything with higher
> alignment would have a size larger than 16 and thus be passed by

I admit I didn't know why it has been written that way, I was just trying
to write something that would do the same as before if ignoring the
non-FIELD_DECL alignments and warn for the cases that changed ABI;
as there was originally alignment == 16 * BITS_PER_UNIT, I kept using that.
For structs/classes indeed I think alignment of any fields > 16
bytes implies struct size of > 16.  The ARRAY_TYPE case is for some
languages I'm not familiar with, in C/C++/Fortran that doesn't happen, so I
can't guess what those languages can do.  And otherwise it uses mode
alignment or alignment of main variant of scalar/vector/complex types and
I believe those should never be over-aligned.

> reference to a copy.  Could you please add a comment to that effect as
> it's not obvious at this point.

Ok.

	Jakub

  reply	other threads:[~2017-04-25 12:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 10:04 Jakub Jelinek
2017-04-25 12:51 ` Richard Earnshaw (lists)
2017-04-25 12:58   ` Jakub Jelinek [this message]
2017-04-26 16:02 ` [AARCH64 PATCH] Don't provide -Wpsabi notes for AARCH64 " Jakub Jelinek
2017-04-26 16:34   ` Richard Earnshaw (lists)
2017-04-27  1:45   ` Richard Earnshaw (lists)

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=20170425125408.GZ1809@tucnak \
    --to=jakub@redhat.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ramana.radhakrishnan@arm.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).