PERFORCE change 43332 for review
Peter Wemm
peter at FreeBSD.org
Tue Dec 2 17:19:42 PST 2003
http://perforce.freebsd.org/chv.cgi?CH=43332
Change 43332 by peter at peter_overcee on 2003/12/02 17:19:39
replace the handrolled ffs() with __builtin_ffs(), which gcc
does a better job of with instruction sets >= pentiumpro.
For example, it uses the conditional move instructions to avoid
branches.
Affected files ...
.. //depot/projects/hammer/sys/amd64/include/cpufunc.h#13 edit
Differences ...
==== //depot/projects/hammer/sys/amd64/include/cpufunc.h#13 (text+ko) ====
@@ -129,13 +129,18 @@
static __inline int
ffs(int mask)
{
+#if 0
/*
* Note that gcc-2's builtin ffs would be used if we didn't declare
* this inline or turn off the builtin. The builtin is faster but
* broken in gcc-2.4.5 and slower but working in gcc-2.5 and later
* versions.
*/
- return (mask == 0 ? mask : (int)bsfl((u_int)mask) + 1);
+ return (mask == 0 ? mask : (int)bsfl((u_int)mask) + 1);
+#else
+ /* Actually, the above is way out of date. The builtins use cmov etc */
+ return (__builtin_ffs(mask));
+#endif
}
#define HAVE_INLINE_FLS
More information about the p4-projects
mailing list