about summary refs log tree commit diff
path: root/pm_config.in.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-05-01 02:10:15 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-05-01 02:10:15 +0000
commit76bbc70fe011921c87f3a21a9175152bae293cdf (patch)
tree81f642174b1507dea2a4855dc13a1a096cb3c31b /pm_config.in.h
parentb5049ee52a113d7bfa24a7bb2fdd9c0e6292dc2f (diff)
downloadnetpbm-mirror-76bbc70fe011921c87f3a21a9175152bae293cdf.tar.gz
netpbm-mirror-76bbc70fe011921c87f3a21a9175152bae293cdf.tar.xz
netpbm-mirror-76bbc70fe011921c87f3a21a9175152bae293cdf.zip
integer code handling improvements
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@903 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'pm_config.in.h')
-rw-r--r--pm_config.in.h54
1 files changed, 54 insertions, 0 deletions
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