This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/25114] New: [m68k] Inefficient inequality comparisons with small integers
- From: "kazu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Nov 2005 02:36:02 -0000
- Subject: [Bug target/25114] New: [m68k] Inefficient inequality comparisons with small integers
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
unsigned int bar (void);
void
foo (void)
{
unsigned int a = bar ();
if (a <= 3)
bar ();
}
./cc1 -quiet -O2 -fomit-frame-pointer generates
foo:
move.l %a2,-(%sp)
lea bar,%a2
jbsr (%a2)
moveq #3,%d1
cmp.l %d0,%d1
jbcs .L4
jbsr (%a2)
.L4:
move.l (%sp)+,%a2
rts
Note that
moveq #3,%d1
cmp.l %d0,%d1
jbcs .L4
can be replaced with
lsr.l #2,%d0
jbne .L4
This bug depends on PR 25113 because GCC needs to know that lsr.l sets
the zero flag correctly.
--
Summary: [m68k] Inefficient inequality comparisons with small
integers
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at gcc dot gnu dot org
GCC target triplet: m68k-elf
BugsThisDependsOn: 25113
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25114