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: unassig...@gcc.gnu.org ReportedBy: sch...@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).