From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26533 invoked by alias); 15 Feb 2008 14:46:07 -0000 Received: (qmail 26485 invoked by uid 22791); 15 Feb 2008 14:46:06 -0000 X-Spam-Check-By: sourceware.org Received: from s200aog14.obsmtp.com (HELO s200aog14.obsmtp.com) (207.126.144.128) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Feb 2008 14:45:43 +0000 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob014.postini.com ([207.126.147.11]) with SMTP; Fri, 15 Feb 2008 14:45:39 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5A2E8DABF; Fri, 15 Feb 2008 14:45:38 +0000 (GMT) Received: from mail1.gnb.st.com (mail1.gnb.st.com [164.129.119.58]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 028C84C0CD; Fri, 15 Feb 2008 14:45:37 +0000 (GMT) Received: from [164.129.122.73] (gnx2439.gnb.st.com [164.129.122.73]) by mail1.gnb.st.com (MOS 3.7.5a-GA) with ESMTP id CPD34187 (AUTH bruel); Fri, 15 Feb 2008 15:45:35 +0100 (CET) Message-ID: <47B5A58E.6000008@st.com> Date: Fri, 15 Feb 2008 15:08:00 -0000 From: Christian BRUEL User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060130 Red Hat/1.7.12-1.1.3.4 MIME-Version: 1.0 To: Zdenek Dvorak Cc: gcc-patches@gcc.gnu.org Subject: Re: [PING][patch,loopiv] misaligned packed array memory access References: <47B2F979.30608@st.com> <20080213195614.GA29383@kam.mff.cuni.cz> <47B3E6BF.8010908@st.com> <20080214154447.GA31590@kam.mff.cuni.cz> <47B55494.2060000@st.com> <20080215140437.GA25026@kam.mff.cuni.cz> In-Reply-To: <20080215140437.GA25026@kam.mff.cuni.cz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: 2008-02/txt/msg00560.txt.bz2 ok, I see now what you meant, just that we also need to pass the computed offset: val1 = fold_build2 (MULT_EXPR, type, step, toffset); val = fold_build2 (PLUS_EXPR, base_type, base, val1); as the base from constant_multiple_of. I'll see what this gives. Rgds, -c Zdenek Dvorak wrote: > Hi, > > >>I'm not sure, I tried to use only `constant_multiple_of` but didn't >>succeed without being over-conservative, because we want to check all >>conditions of alignments of base+step+offset. Furthermore we would need >>to duplicate most of the may_be_unaligned_p function (call to >>get_inner_reference). > > > no, that is not what I ment. What I had in mind is something like > the following patch (since we compute the step of the reference anyway, > duplicating that in loop_offset_multiple_of seems redundant): > > Index: tree-ssa-loop-ivopts.c > =================================================================== > *** tree-ssa-loop-ivopts.c (revision 132341) > --- tree-ssa-loop-ivopts.c (working copy) > *************** idx_record_use (tree base, tree *idx, > *** 1391,1400 **** > return true; > } > > ! /* Returns true if memory reference REF may be unaligned. */ > > static bool > ! may_be_unaligned_p (tree ref) > { > tree base; > tree base_type; > --- 1391,1400 ---- > return true; > } > > ! /* Returns true if memory reference REF with step STEP may be unaligned. */ > > static bool > ! may_be_unaligned_p (tree ref, tree step) > { > tree base; > tree base_type; > *************** may_be_unaligned_p (tree ref) > *** 1404,1409 **** > --- 1404,1410 ---- > enum machine_mode mode; > int unsignedp, volatilep; > unsigned base_align; > + double_int mul; > > /* TARGET_MEM_REFs are translated directly to valid MEMs on the target, > thus they are not misaligned. */ > *************** may_be_unaligned_p (tree ref) > *** 1424,1429 **** > --- 1425,1433 ---- > || bitpos % BITS_PER_UNIT != 0)) > return true; > > + if (!constant_multiple_of (step, build_int_cst (TREE_TYPE (step), GET_MODE_ALIGNMENT (mode)), &mul)) > + return true; > + > return false; > } > > *************** find_interesting_uses_address (struct iv > *** 1549,1555 **** > > /* Moreover, on strict alignment platforms, check that it is > sufficiently aligned. */ > ! if (STRICT_ALIGNMENT && may_be_unaligned_p (base)) > goto fail; > > base = build_fold_addr_expr (base); > --- 1553,1559 ---- > > /* Moreover, on strict alignment platforms, check that it is > sufficiently aligned. */ > ! if (STRICT_ALIGNMENT && may_be_unaligned_p (base, step)) > goto fail; > > base = build_fold_addr_expr (base); >