From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5452 invoked by alias); 12 Sep 2012 09:37:10 -0000 Received: (qmail 5402 invoked by uid 22791); 12 Sep 2012 09:37:09 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_NL X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Sep 2012 09:36:56 +0000 From: "schwab@linux-m68k.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising Date: Wed, 12 Sep 2012 09:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: schwab@linux-m68k.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-Changed-Fields: Message-ID: 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: 2012-09/txt/msg00913.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54555 Bug #: 54555 Summary: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: schwab@linux-m68k.org Target: m68k-*-* Postreload (reload_cse_move2add) transforms (set (REGX) (CONST_INT A)) ... (set (REGX) (CONST_INT B)) into (set (REGX) (CONST_INT A)) ... (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) which is a pessimisation on m68k if REGX is a data register and B is a small constant in range for moveq which can no longer be used for the second SET; instead moveb is used which is bigger and also slower on <= m68030. $ cat moveb.c void foo (void); void bar (int a) { if (a == 16 || a == 23) foo (); if (a == -110 || a == -128) foo (); } $ gcc -O2 -S moveb.c $ cat moveb.s #NO_APP .file "moveb.c" .text .align 2 .globl f .type f, @function f: link.w %fp,#0 move.l %d2,-(%sp) move.l 8(%fp),%d2 moveq #16,%d0 cmp.l %d2,%d0 jeq .L2 move.b #23,%d0 <--- should be moveq #23,%d0 cmp.l %d2,%d0 jeq .L2 moveq #-110,%d0 cmp.l %d2,%d0 jeq .L4 .L13: move.b #-128,%d0 <--- should be moveq #-128,%d0 cmp.l %d2,%d0 jeq .L4 move.l -4(%fp),%d2 unlk %fp rts .L2: jsr foo moveq #-110,%d0 cmp.l %d2,%d0 jne .L13 .L4: move.l -4(%fp),%d2 unlk %fp jra bar .size f, .-f .ident "GCC: (GNU) 4.8.0 20120912 (experimental)" .section .note.GNU-stack,"",@progbits This transformation was introduced in r68532 (gcc 3.4).