From: Jakub Jelinek <jakub@redhat.com>
To: Edmar Wienskoski <edmarwjr@gmail.com>,
gcc-patches@gcc.gnu.org,
David Edelsohn <dje.gcc@gmail.com>
Subject: Re: [PATCH] DATA_ALIGNMENT vs. DATA_ABI_ALIGNMENT (PR target/56564)
Date: Fri, 14 Jun 2013 10:54:00 -0000 [thread overview]
Message-ID: <20130614105440.GJ2336@tucnak.redhat.com> (raw)
In-Reply-To: <20130614104202.GL21523@bubble.grove.modra.org>
On Fri, Jun 14, 2013 at 08:12:02PM +0930, Alan Modra wrote:
> > As for the
> > typedef int vec_align __attribute__ ((vector_size(16), aligned(32)));
> > vec_align x = { 0, 0, 0, 0 };
> > changes, that is ABI changing bugfix, so the question is, are you fine with
> > breaking the ABI (between 4.8 and 4.9, or if you wanted to backport it to
> > 4.8 too (I certainly plan to backport the non-ppc DATA_ABI_ALIGNMENT changes
> > to 4.8.2, already am using it in our compilers))? The other option is
> > to fix the ABI, but keep things backwards ABI compatible. That would be
> > done by decreasing the alignment as it used to do before in DATA_ABI_ALIGNMENT,
> > and increasing it to the desirable level only in DATA_ALIGNMENT. That has
> > the effect that when emitting the decls into assembly e.g. the above will
> > now be correctly 32 byte aligned, but accesses to such decl in compiler
> > generated code will only assume that alignment if
> > decl_binds_to_current_def_p, otherwise they will keep assuming the old
> > (broken) lowered alignment. At least for 4.8 backport IMHO that would be a
> > better idea (but of course would need big comment explaning it).
>
> I see your point, but for there to be a real problem we'd need
> a) A library exporting such a type with (supposed) increased
> alignment, and,
> b) gcc would need to make use of the increased alignment.
>
> (a) must be rare or non-existent or you'd think we would have had a
> bug report about lack of user alignment in vector typedefs. The code
> has been like this since 2001-11-07, so users have had a long time to
> discover it. (Of course, this is an argument for just ignoring the
> bug too.)
It doesn't have to be an exported symbol from a library, it is enough to
compile some objects using one compiler and other objects using another
compiler, then link into the same library.
> (b) doesn't happen in the rs6000 backend as far as I'm aware. Do you
> know whether there is some optimisation based on alignment in generic
> parts of gcc? A quick test like
Tons of them, the DECL_ALIGN value is used say by get_pointer_alignment,
vectorizer assumptions, is added to MEM_ATTRS, so anything looking at
alignment in RTL can optimize too.
> typedef int vec_align __attribute__ ((vector_size(16), aligned(32)));
> vec_align x = { 0, 0, 0, 0 };
>
> long f1 (void)
> {
> return (long) &x & -32;
> }
Try (long) &x & 31; ? That &x & -32 not being optimized into &x
is guess a missed optimization.
Consider if you put:
typedef int vec_align __attribute__ ((vector_size(16), aligned(32)));
vec_align x = { 0, 0, 0, 0 };
into one TU and compile with gcc 4.8.1, then
typedef int vec_align __attribute__ ((vector_size(16), aligned(32)));
extern vec_align x;
long f1 (void)
{
return (long) &x & 31;
}
in another TU and compile with gcc trunk after your patch. I bet
it will be optimized into return 0; by the trunk + your patch compiler,
while the alignment will be actually just 16 byte.
Jakub
next prev parent reply other threads:[~2013-06-14 10:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 19:26 Jakub Jelinek
2013-06-07 20:43 ` Richard Henderson
2013-06-07 21:14 ` Jakub Jelinek
2013-06-08 15:13 ` Jakub Jelinek
2013-06-10 14:52 ` Richard Henderson
2013-06-10 15:45 ` Jakub Jelinek
2013-06-10 19:44 ` David Edelsohn
2013-06-11 0:44 ` DJ Delorie
2013-06-11 6:06 ` Jakub Jelinek
2013-06-11 15:20 ` DJ Delorie
2013-06-07 22:56 ` Hans-Peter Nilsson
2013-06-08 15:05 ` Jakub Jelinek
2013-06-10 10:51 ` Bernd Schmidt
2013-06-10 10:56 ` Jakub Jelinek
2013-06-10 11:03 ` Bernd Schmidt
2013-06-10 11:52 ` Ulrich Weigand
2013-06-12 17:52 ` Edmar Wienskoski
2013-06-13 7:41 ` Alan Modra
2013-06-13 15:37 ` Alan Modra
2013-06-13 15:42 ` Jakub Jelinek
2013-06-13 22:48 ` Alan Modra
2013-06-14 9:00 ` Jakub Jelinek
2013-06-14 10:42 ` Alan Modra
2013-06-14 10:54 ` Jakub Jelinek [this message]
2013-06-14 14:57 ` Alan Modra
2013-06-17 23:37 ` David Edelsohn
[not found] ` <0EFAB2BDD0F67E4FB6CCC8B9F87D75692B5204DB@IRSMSX101.ger.corp.intel.com>
2013-06-19 7:02 ` FW: " Igor Zamyatin
2013-06-19 7:05 ` Jakub Jelinek
2013-06-19 7:12 Igor Zamyatin
2013-06-19 7:22 ` Jakub Jelinek
2013-06-19 8:38 ` Richard Biener
2013-06-19 8:44 ` Jakub Jelinek
2013-06-19 16:32 ` Mike Stump
2013-06-19 16:25 ` Mike Stump
2013-06-19 19:27 ` Kirill Yukhin
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=20130614105440.GJ2336@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=dje.gcc@gmail.com \
--cc=edmarwjr@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/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).