From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30575 invoked by alias); 2 Apr 2014 11:17:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30545 invoked by uid 48); 2 Apr 2014 11:17:26 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/53090] suboptimal ivopt Date: Wed, 02 Apr 2014 11:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00137.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53090 --- Comment #3 from Richard Biener --- I think the main observation is that use 1 address in statement _15 = *_14; at position *_14 type int * base perm_9(D) + (sizetype) ((long unsigned int) (k_4(D) + -1) * 4) step 18446744073709551612 base object (void *) perm_9(D) related candidates ((long unsigned int) (k_4(D) + -1) * 4) is a widening multiplication and the x86 addressing mode widens(?). Note that with the current specification of TARGET_MEM_REF: /* Low-level memory addressing. Operands are BASE (address of static or global variable or register), OFFSET (integer constant), INDEX (register), STEP (integer constant), INDEX2 (register), The corresponding address is BASE + STEP * INDEX + INDEX2 + OFFSET. Only variations and values valid on the target are allowed. The type of STEP, INDEX and INDEX2 is sizetype. this isn't allowed. One would need to a) extend the spec to allow step * index be a widening multiplication, b) extend the recog code in tree-ssa-address.c properly to see what the target does here, esp. whether it treats INDEX as signed or unsigned. Then IVOPTs could choose (unsigned) k_4 as IV and use it directly in the widening multiplication places. A way to test this would be to emit the widening multiplies from c-common.c:pointer_int_sum already. (but expect lots of fallout, there is a lot of code handling MULT_EXPR but not a lot handling WIDEN_MULT_EXPR)