[Python-checkins] r70781 - in python/branches/py3k-short-float-repr: configure configure.in

mark.dickinson python-checkins at python.org
Tue Mar 31 01:16:08 CEST 2009


Author: mark.dickinson
Date: Tue Mar 31 01:16:07 2009
New Revision: 70781

Log:
Use SSE2 instructions in preference to the x87 FPU whenever possible.


Modified:
   python/branches/py3k-short-float-repr/configure
   python/branches/py3k-short-float-repr/configure.in

Modified: python/branches/py3k-short-float-repr/configure
==============================================================================
--- python/branches/py3k-short-float-repr/configure	(original)
+++ python/branches/py3k-short-float-repr/configure	Tue Mar 31 01:16:07 2009
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 70459 .
+# From configure.in Revision: 70732 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.1.
 #
@@ -4583,6 +4583,76 @@
       BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
     fi
 
+    # On x86/x86-64, use the SSE2 instruction set when available.
+    { echo "$as_me:$LINENO: checking whether $CC accepts -msse2 -mfpmath=sse" >&5
+echo $ECHO_N "checking whether $CC accepts -msse2 -mfpmath=sse... $ECHO_C" >&6; }
+     ac_save_cc="$CC"
+     CC="$CC -msse2 -mfpmath=sse"
+     if test "$cross_compiling" = yes; then
+  ac_cv_msse2_ok=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int main() { return 0; }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_msse2_ok=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_msse2_ok=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+     CC="$ac_save_cc"
+    { echo "$as_me:$LINENO: result: $ac_cv_msse2_ok" >&5
+echo "${ECHO_T}$ac_cv_msse2_ok" >&6; }
+    { echo "$as_me:$LINENO: checking whether SSE2 instructions are already enabled for math" >&5
+echo $ECHO_N "checking whether SSE2 instructions are already enabled for math... $ECHO_C" >&6; }
+      if [ "`$CC -dM -E - </dev/null | grep __SSE2_MATH__`" == "" ]
+      then
+        ac_sse2_enabled=no
+      else
+        ac_sse2_enabled=yes
+      fi
+    { echo "$as_me:$LINENO: result: $ac_sse2_enabled" >&5
+echo "${ECHO_T}$ac_sse2_enabled" >&6; }
+    if test $ac_sse2_enabled = no
+    then
+      if test $ac_cv_msse2_ok = yes
+      then
+        BASECFLAGS="$BASECFLAGS -msse2 -mfpmath=sse"
+      fi
+    fi
+
     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
     # support.  Without this, treatment of subnormals doesn't follow
     # the standard.

Modified: python/branches/py3k-short-float-repr/configure.in
==============================================================================
--- python/branches/py3k-short-float-repr/configure.in	(original)
+++ python/branches/py3k-short-float-repr/configure.in	Tue Mar 31 01:16:07 2009
@@ -849,6 +849,32 @@
       BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
     fi
 
+    # On x86/x86-64, use the SSE2 instruction set when available.
+    AC_MSG_CHECKING(whether $CC accepts -msse2 -mfpmath=sse)
+     ac_save_cc="$CC"
+     CC="$CC -msse2 -mfpmath=sse"
+     AC_TRY_RUN([int main() { return 0; }],
+     ac_cv_msse2_ok=yes,
+     ac_cv_msse2_ok=no,
+     ac_cv_msse2_ok=no)
+     CC="$ac_save_cc"
+    AC_MSG_RESULT($ac_cv_msse2_ok)
+    AC_MSG_CHECKING(whether SSE2 instructions are already enabled for math)
+      if [[ "`$CC -dM -E - </dev/null | grep __SSE2_MATH__`" == "" ]]
+      then
+        ac_sse2_enabled=no
+      else
+        ac_sse2_enabled=yes
+      fi
+    AC_MSG_RESULT($ac_sse2_enabled)
+    if test $ac_sse2_enabled = no
+    then
+      if test $ac_cv_msse2_ok = yes
+      then
+        BASECFLAGS="$BASECFLAGS -msse2 -mfpmath=sse"
+      fi
+    fi
+
     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
     # support.  Without this, treatment of subnormals doesn't follow
     # the standard.


More information about the Python-checkins mailing list