[Midnightbsd-cvs] src [11917] trunk/sys/sys/systm.h: use builtin memset for a speedup on ryzen cpus with small buffer sizes
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Jul 19 11:53:15 EDT 2018
Revision: 11917
http://svnweb.midnightbsd.org/src/?rev=11917
Author: laffer1
Date: 2018-07-19 11:53:14 -0400 (Thu, 19 Jul 2018)
Log Message:
-----------
use builtin memset for a speedup on ryzen cpus with small buffer sizes
Modified Paths:
--------------
trunk/sys/sys/systm.h
Modified: trunk/sys/sys/systm.h
===================================================================
--- trunk/sys/sys/systm.h 2018-07-19 15:49:08 UTC (rev 11916)
+++ trunk/sys/sys/systm.h 2018-07-19 15:53:14 UTC (rev 11917)
@@ -239,6 +239,12 @@
#define ovbcopy(f, t, l) bcopy((f), (t), (l))
void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2);
void bzero(void *buf, size_t len) __nonnull(1);
+#define bzero(buf, len) ({ \
+ if (__builtin_constant_p(len) && (len) <= 64) \
+ __builtin_memset((buf), 0, (len)); \
+ else \
+ bzero((buf), (len)); \
+})
void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);
void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2);
More information about the Midnightbsd-cvs
mailing list