From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4777 invoked by alias); 23 Jun 2011 16:22:21 -0000 Received: (qmail 4760 invoked by uid 22791); 23 Jun 2011 16:22:20 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Jun 2011 16:22:06 +0000 Received: by wwj26 with SMTP id 26so1902020wwj.8 for ; Thu, 23 Jun 2011 09:22:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.175.12 with SMTP id v12mr2141309wbz.110.1308846124870; Thu, 23 Jun 2011 09:22:04 -0700 (PDT) Received: by 10.227.36.212 with HTTP; Thu, 23 Jun 2011 09:22:04 -0700 (PDT) In-Reply-To: <20110623140738.GQ16443@tyan-ft48-01.lab.bos.redhat.com> References: <20110623140738.GQ16443@tyan-ft48-01.lab.bos.redhat.com> Date: Thu, 23 Jun 2011 16:28:00 -0000 Message-ID: Subject: Re: [PATCH] Use get_pointer_alignment in vect_compute_data_ref_alignment From: Richard Guenther To: Jakub Jelinek Cc: Ira Rosen , Richard Guenther , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-06/txt/msg01789.txt.bz2 On Thu, Jun 23, 2011 at 4:07 PM, Jakub Jelinek wrote: > Hi! > > This is a precondition of the __builtin_assume_aligned patch (otherwise > it wouldn't be useful for vectorization for which it has been designed), > but I've bootstrapped/regtested it on x86_64-linux and i686-linux > separately. > > get_pointer_alignment can tell us that a pointer is already sufficiently > aligned and we don't need to use misaligned loads/stores. =A0It should be > useful even in other cases, such as when the code contains explicit > ptr =3D (double *) (((uintptr_t) ptr) & ~(uintptr_t) 15); > and similar to guarantee that ptr is already 16 byte aligned, etc. > > I haven't played with doing something additionally just with > SSA_NAME_PTR_INFO (base_addr)->misalign yet if it isn't sufficiently alig= ned, > but ->align is big enough, for integer_zerop (misalign) I guess we could > just set misalign to that, otherwise? =A0Also, I think we can't leave out= the > TYPE_ALIGN_UNIT test, because get_pointer_alignment will often return > just BITS_PER_UNIT, e.g. for PARM_DECLs, even if they are pointers > to sufficiently aligned types. > > Ok for trunk? Looks good to me. To make use of misalign info we have to fold it into that of DR_OFFSET/INIT though. I eventually wanted to make get_pointer_alignment to also return misalign info (like get_object_alignment_1 does). Thanks, Richard. > 2011-06-23 =A0Jakub Jelinek =A0 > > =A0 =A0 =A0 =A0* tree-vect-data-refs.c (vect_compute_data_ref_alignment):= Use > =A0 =A0 =A0 =A0get_pointer_alignment to see if base isn't sufficiently al= igned. > > --- gcc/tree-vect-data-refs.c.jj =A0 =A0 =A0 =A02011-06-17 11:02:19.00000= 0000 +0200 > +++ gcc/tree-vect-data-refs.c =A0 2011-06-23 12:37:43.000000000 +0200 > @@ -859,7 +859,9 @@ vect_compute_data_ref_alignment (struct > =A0 =A0 =A0 || (TREE_CODE (base_addr) =3D=3D SSA_NAME > =A0 =A0 =A0 =A0 =A0&& tree_int_cst_compare (ssize_int (TYPE_ALIGN_UNIT (T= REE_TYPE ( > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TREE_TYPE (base_addr)))), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0alig= nment) >=3D 0)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0alig= nment) >=3D 0) > + =A0 =A0 =A0|| (get_pointer_alignment (base_addr, TYPE_ALIGN (vectype)) > + =A0 =A0 =A0 =A0 >=3D TYPE_ALIGN (vectype))) > =A0 =A0 base_aligned =3D true; > =A0 else > =A0 =A0 base_aligned =3D false; > > =A0 =A0 =A0 =A0Jakub >