public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/25112] New: [m68k] Inefficient equality comparison with small integers
@ 2005-11-27 2:11 kazu at gcc dot gnu dot org
2005-11-28 5:02 ` [Bug target/25112] [m68k] Suboptimal equality comparisons " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: kazu at gcc dot gnu dot org @ 2005-11-27 2:11 UTC (permalink / raw)
To: gcc-bugs
Consider:
int bar (void);
void
foo (void)
{
int a = bar ();
if (a == 1)
bar ();
}
./cc1 -quiet -O2 -m5200 -fomit-frame-pointer generates
foo:
move.l %a2,-(%sp)
lea bar,%a2
jbsr (%a2)
moveq #1,%d1
cmp.l %d0,%d1
jbne .L4
jbsr (%a2)
.L4:
move.l (%sp)+,%a2
rts
Note that
moveq #1,%d1
cmp.l %d0,%d1
can be replaced with
subq.l #1,%d1
as long as the comparison is either == or !=, and %d1 dies at the comparison.
A similar optimization can be done for an equality comparison with
a negative numbers between -8 and -1, inclusive.
--
Summary: [m68k] Inefficient equality comparison with small
integers
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
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
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25112
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/25112] [m68k] Suboptimal equality comparisons with small integers
2005-11-27 2:11 [Bug target/25112] New: [m68k] Inefficient equality comparison with small integers kazu at gcc dot gnu dot org
@ 2005-11-28 5:02 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-28 5:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-11-28 05:02 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-11-28 05:02:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25112
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-28 5:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-27 2:11 [Bug target/25112] New: [m68k] Inefficient equality comparison with small integers kazu at gcc dot gnu dot org
2005-11-28 5:02 ` [Bug target/25112] [m68k] Suboptimal equality comparisons " pinskia at gcc dot gnu dot 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).