[pypy-commit] pypy default: Adding untested code: sse2 detection for windows.
arigo
noreply at buildbot.pypy.org
Thu Mar 15 20:26:46 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r53697:2a7f6e4fdd77
Date: 2012-03-15 12:26 -0700
http://bitbucket.org/pypy/pypy/changeset/2a7f6e4fdd77/
Log: Adding untested code: sse2 detection for windows.
diff --git a/pypy/jit/backend/x86/support.py b/pypy/jit/backend/x86/support.py
--- a/pypy/jit/backend/x86/support.py
+++ b/pypy/jit/backend/x86/support.py
@@ -36,15 +36,15 @@
# ____________________________________________________________
-if sys.platform == 'win32':
- ensure_sse2_floats = lambda : None
- # XXX check for SSE2 on win32 too
+if WORD == 4:
+ extra = ['-DPYPY_X86_CHECK_SSE2']
else:
- if WORD == 4:
- extra = ['-DPYPY_X86_CHECK_SSE2']
- else:
- extra = []
- ensure_sse2_floats = rffi.llexternal_use_eci(ExternalCompilationInfo(
- compile_extra = ['-msse2', '-mfpmath=sse',
- '-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra,
- ))
+ extra = []
+
+if sys.platform != 'win32':
+ extra = ['-msse2', '-mfpmath=sse',
+ '-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra
+
+ensure_sse2_floats = rffi.llexternal_use_eci(ExternalCompilationInfo(
+ compile_extra = extra,
+))
diff --git a/pypy/translator/c/src/asm.h b/pypy/translator/c/src/asm.h
--- a/pypy/translator/c/src/asm.h
+++ b/pypy/translator/c/src/asm.h
@@ -14,4 +14,8 @@
# include "src/asm_ppc.h"
#endif
+#if defined(MS_WINDOWS) && defined(_MSC_VER)
+# include "src/asm_msvc.h"
+#endif
+
#endif /* _PYPY_ASM_H */
diff --git a/pypy/translator/c/src/asm_msvc.h b/pypy/translator/c/src/asm_msvc.h
new file mode 100644
--- /dev/null
+++ b/pypy/translator/c/src/asm_msvc.h
@@ -0,0 +1,31 @@
+
+#ifdef PYPY_X86_CHECK_SSE2
+#define PYPY_X86_CHECK_SSE2_DEFINED
+extern void pypy_x86_check_sse2(void);
+#endif
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+#ifdef PYPY_X86_CHECK_SSE2
+#include <intrin.h>
+void pypy_x86_check_sse2(void)
+{
+ int features;
+ int CPUInfo[4];
+ CPUInfo[3] = 0;
+ __cpuid(CPUInfo, 1);
+ features = CPUInfo[3];
+
+ //Check bits 25 and 26, this indicates SSE2 support
+ if (((features & (1 << 25)) == 0) || ((features & (1 << 26)) == 0))
+ {
+ fprintf(stderr, "Old CPU with no SSE2 support, cannot continue.\n"
+ "You need to re-translate with "
+ "'--jit-backend=x86-without-sse2'\n");
+ abort();
+ }
+}
+#endif
+#endif
More information about the pypy-commit
mailing list