public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: rth@redhat.com
Cc: gcc@gcc.gnu.org
Subject: Re: alignment: store_one_arg vs emit_push_insn
Date: Sat, 10 May 2003 00:27:00 -0000	[thread overview]
Message-ID: <200305100027.h4A0Ru724325@greed.delorie.com> (raw)
In-Reply-To: <20030510000312.GN23973@redhat.com> (message from Richard Henderson on Fri, 9 May 2003 17:03:12 -0700)


> MAX is correct in this case because we know that we're storing
> to a parameter, and we know that PARM_BOUNDARY is the minimum
> alignment of any parameter.

The problem is that the alignment is used to choose a move_by_pieces
mode, and HImode is chosen, and the object we're copying *from* is not
HI-aligned.

There are two alignments, the alignment of the object on the stack,
and the alignment of the object we're copying from.  parm_align is
computed as if it were the stack alignment, but used as if it were the
"from" alignment also.

> > The way the code is now, xstormy16 is trying to access
> > a byte-aligned object with a HImode move, and failing
> 
> You don't give enough information to determine why this might
> be the case.

parm_align is used here:

      emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
		      parm_align, partial, reg, excess, argblock,
		      ARGS_SIZE_RTX (arg->locate.offset), reg_parm_stack_space,
		      ARGS_SIZE_RTX (arg->locate.alignment_pad));

The comments in front of emit_push_insn state:

   ALIGN (in bits) is maximum alignment we can assume.

and later used here:

	  move_by_pieces (NULL, xinner, INTVAL (size) - used, align);

In the xstormy16 case, parm_align is 16 (the stack is HI-aligned), but
the array we're pushing on the stack is QI-aligned (the tree for it
has align=8).  But we end up passing "16" to move_by_pieces, which is
wrong.

It looks like emit_push_insn does *not* want the alignment on the
stack, or at least needs both the desired final alignment *and* the
worst-case alignment.  Or at least emit_push_insn needs to check the
alignment of the type tree passed to it, and do the right thing wrt
move_by_pieces.

  reply	other threads:[~2003-05-10  0:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-09 23:34 DJ Delorie
2003-05-10  0:05 ` Richard Henderson
2003-05-10  0:27   ` DJ Delorie [this message]
2003-05-12  3:54     ` Richard Henderson
2003-05-12 18:19       ` DJ Delorie
2003-05-12 19:41         ` Richard Henderson
2003-05-12 22:47           ` DJ Delorie
2003-05-12 23:14             ` Richard Henderson
2003-05-13  1:04             ` Paul Koning
2003-05-10  2:24 Richard Kenner
2003-05-11  2:22 ` DJ Delorie
2003-05-11 11:31 Richard Kenner
2003-05-11 14:33 ` DJ Delorie
2003-05-11 14:49 Richard Kenner
2003-05-11 15:30 ` DJ Delorie

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=200305100027.h4A0Ru724325@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@redhat.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).