[RFC] Port of NetBSD's optimized amd64 string code

Giorgos Keramidas keramida at linux.gr
Mon Aug 1 19:55:45 GMT 2005


On 2005-08-02 02:25, Xin LI <delphij at frontfree.net> wrote:
> Hi, Guys,
>
> Here is a patchset that I have produced to make our libc aware of the
> NetBSD assembly implementation of the string related operations.

I can't speak for the asm code, since I know barely enough amd64 things
to read it, but there are a few typos you might want to fix before this
gets committed.

> +	/*
> +	 * Align to word boundry
> +	 * Consider unrolling loop?

s/boundry/boundary/

> +	 * (1)  ~(((x & 0x7f....7f) + 0x7f....7f) | (x | 0x7f....7f))
> +	 *
> +	 * evaluates to a non-zero value if any of the bytes in the
> +	 * original word is zero.
> +	 *
> +	 * It also has the useful property that bytes in the result word
> +	 * that coorespond to non-zero bytes in the original word have
> +	 * the value 0x00, while bytes cooresponding to zero bytes have

s/coorespond/correspond/ in the 2 last lines.

> +	 * On little endian machines, the first byte in the result word
> +	 * that cooresponds to a zero byte in the original byte is 0x80,

Ditto.

> +	 * so clz() can be used as above.  On big endian machines, and
> +	 * little endian machines without (or with a slow) clz() insn,
> +	 * testing each byte in the original for zero is necessary

Missing final period.

> +	testq	$7,%rdx			# copy first group of 1 to 7 words
> +	jz	L2			# while swaping alternate bytes.

s/swaping/swapping/

That's all I could spot.



More information about the freebsd-amd64 mailing list