Subject: CVS commit: basesrc/lib/libc/arch/sh3/string
To: None <source-changes@netbsd.org>
From: ITOH Yasufumi <itohy@netbsd.org>
List: source-changes
Date: 09/01/2002 16:14:54
Module Name:	basesrc
Committed By:	itohy
Date:		Sun Sep  1 13:14:54 UTC 2002

Modified Files:
	basesrc/lib/libc/arch/sh3/string: ffs.S
	syssrc/sys/lib/libkern/arch/sh3: ffs.S

Log Message:
Save 1-4 instructions on all cases except for the ret=0 case.

This is probably the last version from me. :)
You are welcome to speed it up, of course. :)

Here's a benchmark on SH-4 200MHz.
9.2% faster if all the cases occur evenly.

return value	C version	previous vers	this version	speed ratio
of ffs()	(ns/call) *1	(ns/call)	(ns/call) *2	(*1/*2)
------------	------------	-------------	------------	-----------
 0		  86		 81		 81		1.06
 1		 110		106		 91		1.21
 2		 132		106		 92		1.43
 3		 165		117		 96		1.72
 4		 201		116		 95		2.12
 5		 237		107		 99		2.39
 6		 271		106		101		2.68
 7		 307		116		107		2.87
 8		 342		116		105		3.26
 9		 376		126		111		3.39
10		 410		127		110		3.73
11		 446		136		115		3.88
12		 483		134		116		4.16
13		 518		125		119		4.35
14		 551		126		120		4.59
15		 587		135		127		4.62
16		 624		136		126		4.95
17		 658		139		126		5.22
18		 694		140		126		5.51
19		 727		148		131		5.55
20		 764		150		131		5.83
21		 799		141		135		5.92
22		 834		142		135		6.18
23		 868		152		140		6.20
24		 903		153		142		6.36
25		 939		140		127		7.39
26		 974		141		126		7.73
27		1009		152		131		7.70
28		1044		148		130		8.03
29		1080		141		136		7.94
30		1115		141		136		8.20
31		1151		151		141		8.16
32		1185		151		140		8.46


To generate a diff of this commit:
cvs rdiff -r1.3 -r1.4 basesrc/lib/libc/arch/sh3/string/ffs.S
cvs rdiff -r1.3 -r1.4 syssrc/sys/lib/libkern/arch/sh3/ffs.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.