Skip site navigation (1)Skip section navigation (2)
Date:      18 Feb 1999 21:20:19 +0100
From:      Dag-Erling Smorgrav <des@flood.ping.uio.no>
To:        hackers@freebsd.org
Subject:   [Alfred Perlstein <bright@cygnus.rush.net>] Re: vm_page_zero_fill
Message-ID:  <xzp678zlb0c.fsf@flood.ping.uio.no>

next in thread | raw e-mail | index | archive | help
------- Start of forwarded message -------
Date: Thu, 18 Feb 1999 15:18:54 -0500 (EST)
From: Alfred Perlstein <bright@cygnus.rush.net>
To: Dag-Erling Smorgrav <des@flood.ping.uio.no>
Subject: Re: vm_page_zero_fill
Message-ID: <Pine.BSF.3.96.990218150741.10060J-100000@cygnus.rush.net>


Last night i was kinda bored so i started looking for things to
optimize in freebsd, i noticed that the function src/sys/libkern/bcmp.c
looked not optimal.

After playing with "gcc -O -S bcmp.c" on several platforms, i386,
sparc32, alpha.  It seems to me that the function ought to be
replaced with this:


#include <string.h>

/*
 * bcmp -- vax cmpc3 instruction
 */
int
bcmp(b1, b2, length)
        const void *b1, *b2;
        register size_t length;

{
        register size_t i;

        for (i=0 ; i<length ; i++)
                if( ((char *)b1)[i] != ((char *)b2)[i] )
                        break;

        return( length - i );
}

what i hadn't realized was that i386 already has this rolled as
assembler by hand, just to let you know though, that i thinks there
may be a deficiency with the ASM code in the hand crafted i386 one.

it uses the "rep cmpsl" opcode, i have heard that using "movs/lods/cmps"
was no longer optimal after the 486 line, but i'm unsure.

anyhow i'm quite sure the alpha port could use this code, if you
can email John Birell about it if you are unsure if the change in
the generated code is suboptimal. (in re alpha port)

oh yeah, the code looks correct to me, but i guess having someone
look at this routine would be a good idea as well. :)


------- End of forwarded message -------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp678zlb0c.fsf>