From 76bbc70fe011921c87f3a21a9175152bae293cdf Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 1 May 2009 02:10:15 +0000 Subject: integer code handling improvements git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@903 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- pm_config.in.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'pm_config.in.h') diff --git a/pm_config.in.h b/pm_config.in.h index c822355e..c44bc72c 100644 --- a/pm_config.in.h +++ b/pm_config.in.h @@ -198,6 +198,60 @@ extern int rand(); #endif #endif +/* CONFIGURE: GNUC extensions are used in performance critical places + when available. Test whether they exist. + + Turn off by defining NO_GCC_BUILTINS. + + Note that though these influence the code produced, the compiler + setting ultimately decides what operands are used. If you + want a generic build, check the manual and adjust CFLAGS in + config.mk accordingly. + + For example, if you want binaries that run on all Intel x86-32 + family CPUs back to 80386, adding "-march=i386" to CFLAGS in + config.mk is much better than setting NO_GCC_BUILTINS to 1. + If you want to be extra sure use: + "-march=i386 -mno-mmx -mno-sse -DNO_GCC_BUILTINS" +*/ + +#if defined(__GNUC__) && !defined(NO_GCC_BUILTINS) + #define GCCVERSION __GNUC__*100 + __GNUC_MINOR__ +#else + #define GCCVERSION 0 +#endif + +#ifndef HAVE_GCC_MMXSSE +#if GCCVERSION >=301 && defined(__MMX__) && defined(__SSE__) + #define HAVE_GCC_MMXSSE 1 + /* Use GCC builtins to directly access MMX/SSE features */ +#else + #define HAVE_GCC_MMXSSE 0 +#endif +#endif + +#ifndef HAVE_GCC_BITCOUNT +#if GCCVERSION >=304 + #define HAVE_GCC_BITCOUNT 1 + /* Use __builtin_clz(), __builtin_ctz() (and variants for long) + to count leading/trailing 0s in int (and long). */ +#else + #define HAVE_GCC_BITCOUNT 0 +#endif +#endif + +#ifndef HAVE_GCC_BSWAP +#if GCCVERSION >=403 + #define HAVE_GCC_BSWAP 1 + /* Use __builtin_bswap32(), __builtin_bswap64() for endian conversion. + Available from GCC v 4.3 onward. + NOTE: On intel CPUs this may produce the bswap operand which is not + available on 80386. */ +#else + #define HAVE_GCC_BSWAP 0 +#endif +#endif + /* CONFIGURE: Some systems seem to need more than standard program linkage -- cgit 1.4.1