diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-04-01 20:40:00 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-04-01 20:40:00 +0000 |
commit | 810f5285cd821bed9114d9d5c2b24eb521965dfb (patch) | |
tree | 277c41ca4c53c7f945d699e3cfb65e778e05414f /lib | |
parent | 7859146b9a9d558cf4f3341b9a31e62894396128 (diff) |
It turns out that the so-called fast ffs(3) routines were wrong, as soon as
more than one bit is set, as the ff1 instruction counts from the highest
order.
However, gcc/m88k with optimization enabled would use a correct, short
sequence based upon ff1 and tweaks, to achieve the intended result, hence
i did not catch this flaw initially.
So revert to the C implementation - it is correct, still decently fast, and
will only be used when compiling at -O0.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/m88k/string/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/m88k/string/ffs.S | 16 |
2 files changed, 2 insertions, 18 deletions
diff --git a/lib/libc/arch/m88k/string/Makefile.inc b/lib/libc/arch/m88k/string/Makefile.inc index 7b2bddad6c5..918aa9c2789 100644 --- a/lib/libc/arch/m88k/string/Makefile.inc +++ b/lib/libc/arch/m88k/string/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.4 2004/01/26 20:05:29 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2004/04/01 20:39:55 miod Exp $ # $NetBSD: Makefile.inc,v 1.1 1995/03/20 14:45:45 mycroft Exp $ -SRCS+= bcmp.c bcopy.c bzero.c ffs.S index.c memchr.c memcmp.c memset.c \ +SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memchr.c memcmp.c memset.c \ rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlcpy.c strlen.c \ strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \ strspn.c strstr.c swab.c diff --git a/lib/libc/arch/m88k/string/ffs.S b/lib/libc/arch/m88k/string/ffs.S deleted file mode 100644 index b851d315749..00000000000 --- a/lib/libc/arch/m88k/string/ffs.S +++ /dev/null @@ -1,16 +0,0 @@ -/* $OpenBSD: ffs.S,v 1.1 2004/01/26 20:05:29 miod Exp $ */ - -/* - * Written by Miodrag Vallat, 2004 - Public Domain - */ - -#include "DEFS.h" - -ENTRY(ffs) - bcnd eq0, r2, 1f /* ff1(0) = 32, treat differently */ - ff1 r3, r2 - jmp.n r1 - add r2, r3, 1 /* ff1 returns 0-31, need to increment */ -1: - jmp.n r1 - or r2, r0, r0 |