From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78701 invoked by alias); 17 Sep 2015 09:00:01 -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 78629 invoked by uid 48); 17 Sep 2015 08:59:56 -0000 From: "urjaman at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/50749] Auto-inc-dec does not find subsequent contiguous mem accesses Date: Thu, 17 Sep 2015 09:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.7.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: urjaman at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: cc 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: 2015-09/txt/msg01357.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50749 Urja Rannikko changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |urjaman at gmail dot com --- Comment #20 from Urja Rannikko --- I'll add a note here that this seems to also affect the AVR target when it is under register pressure and cant use Z or Y registers which can do Z+n /Y+n addressing, it ends up doing really stupid things with X register (aka r26:r27) (which could post-inc): adiw r26, 0x01 ld r24, X sbiw r26, 0x01 (followed by adiw r26, 2...) This was my test case for showing this behaviour on AVR: unsigned char test_0 (unsigned char* p1, unsigned char *p2, unsigned char *p3) { unsigned char r = 0; r += *p1++; r += *p2++; r += *p3++; r += *p1++; r += *p2++; r += *p3++; r += *p1++; r += *p2++; r += *p3++; return r; } This note added for anyone later trying to google for this after seeing that X reg stupidity on AVR, sorry for maybe-a-bit-noise ...