This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Missed optimization in m68k
- From: law at redhat dot com
- To: Peter Barada <pbarada at mail dot wm dot sps dot mot dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 14 Jun 2002 13:48:58 -0600
- Subject: Re: Missed optimization in m68k
- Reply-to: law at redhat dot com
In message <200206141923.g5EJNeK22444@hyper.wm.sps.mot.com>, Peter Barada write
s:
>
> I'm compiling the small snippet:
>
> char *copy(const char *src, char *dst)
> {
> char *dst0 = dst;
> while (*dst++ = *src++)
> ;
> return dst0;
> }
>
> And when compiled with 3.0.4 I get:
>
> copy:
> move.l 4(%sp),%a1
> move.l 8(%sp),%a0
> move.l %a0,%d0
> .L2:
> move.b (%a1)+,(%a0)
> tst.b (%a0)+
> jbne .L2
> rts
>
>
> The problem is that the tst.b is not necessary since the move.b
> updated the condition codes as part of the move. How can I best
> convince gcc that it should generate the follwing instead:
>
> copy:
> move.l 4(%sp),%a1
> move.l 8(%sp),%a0
> move.l %a0,%d0
> .L2:
> move.b (%a1)+,(%a0)+
> jbne .L2
> rts
>
> Thanx...
I believe you'll be hacking in NOTICE_UPDATE_CC.
jeff