freebsd-src/sys/amd64
Mateusz Guzik 5fa12fe0cd amd64: implement strlen in assembly, take 2
Tested with glibc test suite.

The C variant in libkern performs excessive branching to find the zero
byte instead of using the bsfq instruction. The same code patched to use
it is still slower than the routine implemented here as the compiler
keeps neglecting to perform certain optimizations (like using leaq).

On top of that the routine can be used as a starting point for copyinstr
which operates on words intead of bytes.

The previous attempt had an instance of swapped operands to andq when
dealing with fully aligned case, which had a side effect of breaking the
code for certain corner cases. Noted by jrtc27.

Sample results:

$(perl -e "print 'A' x 3"):
stock:  211198039
patched:338626619
asm:    465609618

$(perl -e "print 'A' x 100"):
stock:   83151997
patched: 98285919
asm:    120719888

Reviewed by:	jhb, kib
Differential Revision:	https://reviews.freebsd.org/D28779
2021-02-21 00:43:05 +00:00
..
acpica amd64: clean up empty lines in .c and .h files 2020-09-01 21:16:54 +00:00
amd64 amd64: implement strlen in assembly, take 2 2021-02-21 00:43:05 +00:00
cloudabi32 Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead. 2020-09-27 18:47:06 +00:00
cloudabi64 Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead. 2020-09-27 18:47:06 +00:00
conf amd64 GENERIC: compile in mlx5en(4) 2021-02-05 03:22:26 +02:00
ia32 Improve FPU Tag Word reconstruction on i386 to indicate register states. 2020-10-21 00:15:12 +00:00
include amd64: use compiler intrinsics for bsf* and bsr* 2021-02-01 04:53:23 +00:00
linux linux: Unmap the VDSO page when unloading 2021-02-16 09:40:02 -05:00
linux32 linux: Unmap the VDSO page when unloading 2021-02-16 09:40:02 -05:00
pci pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
sgx Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
vmm bhyve/ioapic: improve the tracking of IRR bit 2021-02-02 09:47:00 +01:00
Makefile