This is the mail archive of the gcc@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]

m68k code generation question


   Hi.

   With -O3 -fomit-frame-pointer -m68020-60, EGCS 1.0.2 generates

00000000 <_strcpy>:
   0:	226f 0008	moveal %sp@(8),%a1	movea.l	8(sp),a1
   4:	222f 0004	movel %sp@(4),%d1	move.l	4(sp),d1
   8:	1019		moveb %a1@+,%d0		move.b	(a1)+,d0
   a:	2041		moveal %d1,%a0		movea.l	d1,a0
   c:	6002		bras 10 <_strcpy+10>	bra.s	10
   e:	1019		moveb %a1@+,%d0		move.b	(a1)+,d0
  10:	10c0		moveb %d0,%a0@+		move.b	d0,(a0)+
  12:	66fa		bnes e <_strcpy+e>	bne.s	e
  14:	2001		movel %d1,%d0		move.l	d1,d0
  16:	4e75		rts			rts
  18:	4e71		nop			nop

from

char *strcpy (char *dest, const char *source)
{
    char *deststart = dest;

    while ((*dest ++ = *source ++))
        ;

    return (deststart);
}

while to me,

      moveal %sp@(8),%a1	movea.l	8(sp),a1
      movel %sp@(4),%d1		move.l	4(sp),d1
      moveal %d1,%a0		movea.l	d1,a0
L1    moveb %a1@+,%a0@+		move.b	(a1)+,(a0)+
      bnes L1			bne.s	L1
      movel %d1,%d0		move.l	d1,d0
      rts			rts

seems to be much better (in particular for the mc68010). Why is the move
instruction split into two (also with -m68000)?

Regards,

/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻTŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Rask Ingemann Lambertsen       | E-mail: mailto:rask@kampsax.k-net.dk  |
| Registered Phase5 developer    | WWW: http://www.gbar.dtu.dk/~c948374/ |
| A4000, 775 kkeys/s (RC5-64)    | "ThrustMe" on XPilot, ARCnet and IRC  |
|            Paperweights -- The only way to keep bills down.            |



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