Subject: Re: question about sys/arch/m68k/m68k/copypage.s
To: <>
From: Ignatios Souvatzis <is@beverly.kleinbus.org>
List: port-m68k
Date: 02/07/2001 18:47:16
On Wed, Feb 07, 2001 at 10:41:14AM +0200, Arto Huusko wrote:
> On 07-Hel-01, Matthew wrote:
> 
> > Hi.  I've got a quick question about sys/arch/m68k/m68k/copypage.s.
> > This is the copypage function in -current:
> > 
> > ENTRY(copypage)
> >        movl        %sp@(4),%a0           | source address
> >        movl        %sp@(8),%a1           | destiniation address
> >        movw        #NBPG/32-1,%d0        | number of 32 byte chunks - 1
> > Lmlloop:
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        movl        %a0@+,%a1@+
> >        dbf        %d0,Lmlloop
> >        rts
> 
> I just started thinking, that it appears the loop copies a bit
> more of bytes than just a trivial amount. Although I have spent
> my fair share with m68k asm, I never got the hang of so "elegant"
> optimizations as these... but I think I am right in saying that the
> above loop is about as unoptimizied as anything.
> 
> To my understanding there are, well, so many ways of doing memory
> copying on m68k and the above is the naive implementation. Well,
> I don't know where the above code is used, so it even may be
> correct not to optimize... well, just thinking aloud.

How do you expect to optimize copying page-aligned, page-sized data more
than that?

	-is