From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32190 invoked by alias); 20 Jan 2013 14:40:04 -0000 Received: (qmail 32070 invoked by uid 48); 20 Jan 2013 14:39:44 -0000 From: "vda.linux at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/21182] [4.6/4.7/4.8 Regression] gcc can use registers but uses stack instead Date: Sun, 20 Jan 2013 14:40: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-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: vda.linux at googlemail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.4 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-01/txt/msg01882.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21182 --- Comment #11 from Denis Vlasenko 2013-01-20 14:39:42 UTC --- (In reply to comment #10) > 4.4.7 and 4.5.4 generate the same code (no stack use) for -D/-UNAIL_REGS. > With 4.6.3, the -DNAIL_REGS code regresses very much (IRA ...), the > -UNAIL_REGS code is nearly perfect but less good than 4.4/4.5 (if you > only consider grep esp serpent.s | wc -l). Same behavior with 4.7.2. > > Trunk got somewhat worse with -UNAIL_REGS but better with -DNAIL_REGS (at -O2): > > -UNAIL_REGS -DNAIL_REGS > 4.5.4 3 3 > 4.6.3 15 101 This matches what I see with 4.6.3 - 15 insns with %esp (and no %ebp): $ grep '%esp' serpent-4.6.3-O2.asm 4: 83 ec 04 sub $0x4,%esp 7: 8b 4c 24 20 mov 0x20(%esp),%ecx b: 8b 44 24 18 mov 0x18(%esp),%eax 22e: 89 0c 24 mov %ecx,(%esp) 239: 23 3c 24 and (%esp),%edi 588: 89 0c 24 mov %ecx,(%esp) 58f: 23 3c 24 and (%esp),%edi 8f4: 89 0c 24 mov %ecx,(%esp) 8fd: 23 3c 24 and (%esp),%edi c60: 89 0c 24 mov %ecx,(%esp) c6b: 23 3c 24 and (%esp),%edi d37: 89 14 24 mov %edx,(%esp) d5a: 8b 44 24 1c mov 0x1c(%esp),%eax d5e: 33 14 24 xor (%esp),%edx d70: 83 c4 04 add $0x4,%esp > The most important thing to fix is the -UNAIL_REGS case of course. Sure. NAIL_REGS is only a hack meant to demonstrate that regs *can* be allocated optimally.