svn commit: r363242 - head/sys/amd64/include

Mateusz Guzik mjg at FreeBSD.org
Thu Jul 16 11:28:25 UTC 2020


Author: mjg
Date: Thu Jul 16 11:28:24 2020
New Revision: 363242
URL: https://svnweb.freebsd.org/changeset/base/363242

Log:
  amd64: patch ffsl to use the compiler builtin
  
  This shortens fdalloc by over 60 bytes. Correctness verified by running both
  variants at the same time and comparing the result of each call.
  
  Note someone(tm) should make a pass at converting everything else feasible.

Modified:
  head/sys/amd64/include/cpufunc.h

Modified: head/sys/amd64/include/cpufunc.h
==============================================================================
--- head/sys/amd64/include/cpufunc.h	Thu Jul 16 10:20:35 2020	(r363241)
+++ head/sys/amd64/include/cpufunc.h	Thu Jul 16 11:28:24 2020	(r363242)
@@ -167,7 +167,8 @@ enable_intr(void)
 static __inline __pure2 int
 ffsl(long mask)
 {
-	return (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1);
+
+	return (__builtin_ffsl(mask));
 }
 
 #define	HAVE_INLINE_FFSLL


More information about the svn-src-head mailing list