https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95237

--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 2 Jun 2020, hjl.tools at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95237
> 
> --- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
> (In reply to H.J. Lu from comment #10)
> > (In reply to rguent...@suse.de from comment #9)
> > 
> > > > The i386 psABI specifies 4 byte alignment for long long.  But we want to
> > > > use 8 byte alignment if there is no ABI implication and no stack 
> > > > realignment
> > > > is needed.  Will ROUND_TYPE_ALIGN always align long long to 8 bytes?
> > > 
> > > So what we want here is RTL expansion pad out stack slots if they know
> > > to be aligned but not adjust DECL_ALIGN.  Not sure if there's already
> > > a target hook to pad out variables, if not this may be the way to get
> > > what you desire here.
> > > 
> > > I guess the actual reason is crossing of cache-lines?
> > 
> > If the incoming stack is 4 byte aligned, we can't align long long to
> > 8 bytes without stack realignment.
> 
> Only for local variable on stack. We still want to align global/static long
> long to 8 bytes.

Sure.  And yes, ROUND_TYPE_ALIGN doesn't work for that since it only
gets the type and not the decl.  We'd need a ROUND_DECL_ALIGN for this.
I alternatively suggested that LOCAL_DECL_ALIGNMENT should be used
there and I guess we can do that for alignment lowering.

Reply via email to