From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1941 invoked by alias); 14 Jun 2013 10:54:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 1932 invoked by uid 89); 14 Jun 2013 10:54:47 -0000 X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 14 Jun 2013 10:54:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5EAsk5r013855 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Jun 2013 06:54:46 -0400 Received: from zalov.cz (vpn-52-247.rdu2.redhat.com [10.10.52.247]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5EAsisj006722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 14 Jun 2013 06:54:45 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r5EAshkS023840; Fri, 14 Jun 2013 12:54:43 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r5EAsftL023839; Fri, 14 Jun 2013 12:54:41 +0200 Date: Fri, 14 Jun 2013 10:54:00 -0000 From: Jakub Jelinek To: Edmar Wienskoski , gcc-patches@gcc.gnu.org, David Edelsohn Subject: Re: [PATCH] DATA_ALIGNMENT vs. DATA_ABI_ALIGNMENT (PR target/56564) Message-ID: <20130614105440.GJ2336@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20130607192540.GH1493@tucnak.redhat.com> <51B245EF.3080602@redhat.com> <20130613074051.GG21523@bubble.grove.modra.org> <20130613153701.GI21523@bubble.grove.modra.org> <20130613154217.GF2336@tucnak.redhat.com> <20130613224819.GJ21523@bubble.grove.modra.org> <20130614085952.GI2336@tucnak.redhat.com> <20130614104202.GL21523@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130614104202.GL21523@bubble.grove.modra.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-06/txt/msg00849.txt.bz2 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