From bb41d37104bc1cf78e60b0f735d29fcd903895ef Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 19 Aug 1999 00:32:48 +0000 Subject: Try using the builtin ffs() for egcs, it (by random inspection) generates slightly better code and avoids the incl then subl when using ffs(foo) - 1. --- sys/amd64/include/cpufunc.h | 6 +++++- sys/i386/include/cpufunc.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index c5ba2de5de53..60928b844a71 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.87 1999/05/09 23:30:01 peter Exp $ + * $Id: cpufunc.h,v 1.88 1999/07/23 23:45:19 alc Exp $ */ /* @@ -84,6 +84,9 @@ enable_intr(void) #define HAVE_INLINE_FFS +#if __GNUC__ == 2 && __GNUC_MINOR__ > 8 +#define ffs(mask) __builtin_ffs(mask) +#else static __inline int ffs(int mask) { @@ -102,6 +105,7 @@ ffs(int mask) : "=r" (result) : "0" (mask)); return (result); } +#endif #define HAVE_INLINE_FLS diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index c5ba2de5de53..60928b844a71 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.87 1999/05/09 23:30:01 peter Exp $ + * $Id: cpufunc.h,v 1.88 1999/07/23 23:45:19 alc Exp $ */ /* @@ -84,6 +84,9 @@ enable_intr(void) #define HAVE_INLINE_FFS +#if __GNUC__ == 2 && __GNUC_MINOR__ > 8 +#define ffs(mask) __builtin_ffs(mask) +#else static __inline int ffs(int mask) { @@ -102,6 +105,7 @@ ffs(int mask) : "=r" (result) : "0" (mask)); return (result); } +#endif #define HAVE_INLINE_FLS -- cgit v1.3