opnsense-src/lib/libc/amd64/string
Mateusz Guzik 088ac3ef4b amd64: handle small memset buffers with overlapping stores
Instead of jumping to locations which store the exact number of bytes,
use displacement to move the destination.

In particular the following clears an area between 8-16 (inclusive)
branch-free:

movq    %r10,(%rdi)
movq    %r10,-8(%rdi,%rcx)

For instance for rcx of 10 the second line is rdi + 10 - 8 = rdi + 2.
Writing 8 bytes starting at that offset overlaps with 6 bytes written
previously and writes 2 new, giving 10 in total.

Provides a nice win for smaller stores. Other ones are erratic depending
on the microarchitecture.

General idea taken from NetBSD (restricted use of the trick) and bionic
string functions (use for various ranges like in this patch).

Reviewed by:	kib (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17660
2018-11-16 00:44:22 +00:00
..
bcmp.S amd64: reimplement libc memcmp and bcmp with kernel memcmp 2018-09-27 17:08:29 +00:00
bcopy.c amd64: convert libc bcopy to a C func to avoid future bloat 2018-10-13 21:17:28 +00:00
bzero.c amd64: convert libc bzero to a C func to avoid future bloat 2018-11-15 20:20:39 +00:00
Makefile.inc amd64: convert libc bzero to a C func to avoid future bloat 2018-11-15 20:20:39 +00:00
memcmp.S amd64: reimplement libc memcmp and bcmp with kernel memcmp 2018-09-27 17:08:29 +00:00
memcpy.S amd64: import updated kernel memmove to libc 2018-10-13 21:15:47 +00:00
memmove.S amd64: import updated kernel memmove to libc 2018-10-13 21:15:47 +00:00
memset.S amd64: handle small memset buffers with overlapping stores 2018-11-16 00:44:22 +00:00
stpcpy.S Remove incorrect attribution. 2011-07-21 20:06:14 +00:00
strcat.S Add section .note.GNU-stack for assembly files used by 386 and amd64. 2011-01-07 16:08:40 +00:00
strcmp.S libc: spelling fixes. 2016-04-30 01:24:24 +00:00
strcpy.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00