public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising
@ 2012-09-12  9:37 schwab@linux-m68k.org
  2014-06-16 13:14 ` [Bug rtl-optimization/54555] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2012-09-12  9:37 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/54555] (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising
  2012-09-12  9:37 [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising schwab@linux-m68k.org
@ 2014-06-16 13:14 ` schwab@linux-m68k.org
  2014-06-18 10:37 ` schwab at gcc dot gnu.org
  2014-06-18 10:41 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2014-06-16 13:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54555

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Introduced in r63426.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/54555] (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising
  2012-09-12  9:37 [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising schwab@linux-m68k.org
  2014-06-16 13:14 ` [Bug rtl-optimization/54555] " schwab@linux-m68k.org
@ 2014-06-18 10:37 ` schwab at gcc dot gnu.org
  2014-06-18 10:41 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at gcc dot gnu.org @ 2014-06-18 10:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54555

--- Comment #2 from Andreas Schwab <schwab at gcc dot gnu.org> ---
Author: schwab
Date: Wed Jun 18 10:37:14 2014
New Revision: 211777

URL: https://gcc.gnu.org/viewcvs?rev=211777&root=gcc&view=rev
Log:
Use strict_low_part for loading a constant only if it is cheaper

    PR rtl-optimization/54555
    * postreload.c (move2add_use_add2_insn): Substitute
    STRICT_LOW_PART only if it is cheaper.

testsuite/:
    PR rtl-optimization/54555
    * gcc.target/m68k/pr54555.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/m68k/pr54555.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/postreload.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/54555] (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising
  2012-09-12  9:37 [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising schwab@linux-m68k.org
  2014-06-16 13:14 ` [Bug rtl-optimization/54555] " schwab@linux-m68k.org
  2014-06-18 10:37 ` schwab at gcc dot gnu.org
@ 2014-06-18 10:41 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2014-06-18 10:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54555

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
Fixed for 4.10.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-18 10:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12  9:37 [Bug rtl-optimization/54555] New: (set (REGX) (CONST_INT B)) -> (set (STRICT_LOW_PART (REGX)) (CONST_INT B)) is pessimising schwab@linux-m68k.org
2014-06-16 13:14 ` [Bug rtl-optimization/54555] " schwab@linux-m68k.org
2014-06-18 10:37 ` schwab at gcc dot gnu.org
2014-06-18 10:41 ` schwab@linux-m68k.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).