Subject: Re: question about sys/arch/m68k/m68k/copypage.s
To: None <port-m68k@netbsd.org>
From: Arto Huusko <arto.huusko@maailma.yok.utu.fi>
List: port-m68k
Date: 02/07/2001 10:41:14
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.

-- 
Arto Huusko  --  WWW: http://maailma.yok.utu.fi/
                  ** Divecalc **
The Diving Software @ http://maailma.yok.utu.fi/Divecalc