Bug 25113 - [m68k] lshiftrt and some other insns are conservative on cc0
Summary: [m68k] lshiftrt and some other insns are conservative on cc0
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks: 25114
  Show dependency treegraph
 
Reported: 2005-11-27 02:29 UTC by Kazu Hirata
Modified: 2010-02-24 22:02 UTC (History)
1 user (show)

See Also:
Host:
Target: m68k-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-28 05:06:13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kazu Hirata 2005-11-27 02:29:58 UTC
Consider:

unsigned int bar (void);

void
foo (void)
{
  unsigned int a = bar ();
  a >>= 2;
  if (a == 0)
    bar ();
}

./cc1 -quiet -O2 -m5200 -fomit-frame-pointer generates

foo:
        move.l %a2,-(%sp)
        lea bar,%a2
        jbsr (%a2)
        lsr.l #2,%d0
        tst.l %d0
        jbne .L4
        jbsr (%a2)
.L4:
        move.l (%sp)+,%a2
        rts

Note that tst.l is not necessary because lsr.l sets the zero flag correctly.

See notice_update_cc and its frequent use of CC_STATUS_INIT.
Comment 1 Andrew Pinski 2005-11-28 05:06:13 UTC
Confirmed, isn't it better just to convert m68k to a non cc0 target?
Comment 2 Jeffrey A. Law 2010-02-24 22:02:59 UTC
This was fixed by the cond-optab merge.  The redundant tst instruction is no longer generated.