Consider: unsigned int bar (void);
void foo (void) { unsigned int a = bar (); if (65536 > a) bar (); } ./cc1 -quiet -O2 -fomit-frame-pointer generates foo: move.l %a2,-(%sp) lea bar,%a2 jbsr (%a2) cmp.l #65535,%d0 jbhi .L10 jbsr (%a2) .L10: move.l (%sp)+,%a2 rts Note that cmp.l #65535,%d0 jbhi .L10 can be replaced with swap %d0 tst.w %d0 jbne .L10 A similar trick can be applied to signed comparisons as well. -- Summary: [m68k] Suboptimal comparisons against 65536 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 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25128