9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] more libc/power assembly bits (with attachments this time!)
@ 2003-07-04  1:59 Tad Hunt
  0 siblings, 0 replies; only message in thread
From: Tad Hunt @ 2003-07-04  1:59 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

Two more assembler goodies: strchr() and strlen().

NetBSD has an even more optimized strlen().  According to the
comment at the top it originated in 'The PowerPC Compiler Writer's
Guide', by Steve Hoxey, Faraydon Karim, Bill Hay and Hank Warren.

(http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/arch/powerpc/string/strlen.S?rev=1.2)

However, it would have been way too much work to convert the powerpc
assembly source into qa(1) source.

In any case, these ones should be faster than the C versions from
the libc/port directory.

-Tad


[-- Attachment #2.1: Type: text/plain, Size: 322 bytes --]

The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/plain; name="strlen.s"; charset="us-ascii"
	Content-ID: <24249.1057283924.2@entrisphere.com>
	Content-Description:  strlen.s

[-- Attachment #2.2: strlen.s.suspect --]
[-- Type: application/octet-stream, Size: 126 bytes --]

TEXT	strlen(SB), $0
	MOVW	R3, R4
	SUB	$1, R4
loop:
	MOVBZU	1(R4), R5
	CMP	R5, $0
	BNE	loop

	SUB	R3, R4, R3
	RETURN

[-- Attachment #3.1: Type: text/plain, Size: 322 bytes --]

The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/plain; name="strchr.s"; charset="us-ascii"
	Content-ID: <24249.1057283924.3@entrisphere.com>
	Content-Description:  strchr.s

[-- Attachment #3.2: strchr.s.suspect --]
[-- Type: application/octet-stream, Size: 201 bytes --]

TEXT	strchr(SB), $0
	MOVW	R3, R4
	MOVBZ	v+7(FP), R6
	SUB	$1, R4
loop:
	MOVBZU	1(R4), R5
	CMP	R5, R6
	BEQ	found
	CMP	R5, $0
	BNE	loop

	MOVW	$0, R3
	RETURN

found:
	MOVW	R4, R3
	RETURN

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-04  1:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-04  1:59 [9fans] more libc/power assembly bits (with attachments this time!) Tad Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).