diff options
| author | 2020-06-10 20:19:29 +0000 | |
|---|---|---|
| committer | 2020-06-10 20:19:29 +0000 | |
| commit | d41240fab998b3c42f736af0544339ebedba7e73 (patch) | |
| tree | 19d408af44104ca010e71bc6b888b8b60e576e69 /sys/lib/libkern/arch/powerpc64 | |
| parent | Add clock interrupt support, adapted from the randomized dual clock (diff) | |
| download | wireguard-openbsd-d41240fab998b3c42f736af0544339ebedba7e73.tar.xz wireguard-openbsd-d41240fab998b3c42f736af0544339ebedba7e73.zip | |
Provide an optimized implementation of ffs(3) in the kernel on
arm64/powerpc/powerpc64, making use of the count leading zeros
instruction.
powerpc testing by cwen@; ok kettenis@ deraadt@
Diffstat (limited to 'sys/lib/libkern/arch/powerpc64')
| -rw-r--r-- | sys/lib/libkern/arch/powerpc64/ffs.S | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/lib/libkern/arch/powerpc64/ffs.S b/sys/lib/libkern/arch/powerpc64/ffs.S new file mode 100644 index 00000000000..13fe17fb4f8 --- /dev/null +++ b/sys/lib/libkern/arch/powerpc64/ffs.S @@ -0,0 +1,15 @@ +/* $OpenBSD: ffs.S,v 1.1 2020/06/10 20:19:29 naddy Exp $ */ +/* + * Written by Christian Weisgerber <naddy@openbsd.org>. + * Public domain. + */ + +#include <machine/asm.h> + +ENTRY(ffs) + neg %r4, %r3 + and %r3, %r3, %r4 + cntlzw %r3, %r3 + subfic %r3, %r3, 32 + blr +END(ffs) |
