This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/25114] New: [m68k] Inefficient inequality comparisons with small integers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]