Package: julia / 0.4.7-6

require-sse2-on-i386.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: Julia requires SSE2 on i386
 This patch adds an explicit error message if the CPU does not support SSE2.
 The CPU features are queried using the x86 CPUID opcode. The wrapper function
 __get_cpuid() is provided by GCC and Clang. See <cpuid.h> for the list of
 supported CPU extension flags.
Author: S├ębastien Villemot <sebastien@debian.org>
Author: Peter Colberg <peter@colberg.org>
Bug: https://github.com/JuliaLang/julia/issues/7185
Forwarded: no
Last-Update: 2015-11-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -96,6 +96,10 @@
 
 #include <setjmp.h>
 
+#ifdef __i386__
+#include <cpuid.h>
+#endif
+
 #include <string>
 #include <sstream>
 #include <fstream>
@@ -5715,6 +5719,15 @@
 
 extern "C" void jl_init_codegen(void)
 {
+#ifdef __i386__
+    unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
+    __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+    if (!(edx & bit_SSE2)) {
+        fprintf(stderr, "Your processor does not have SSE2 extension, which is required by Julia. Exiting.\n");
+        exit(EXIT_FAILURE);
+    }
+#endif
+
     const char *const argv_tailmerge[] = {"", "-enable-tail-merge=0"}; // NOO TOUCHIE; NO TOUCH! See #922
     cl::ParseCommandLineOptions(sizeof(argv_tailmerge)/sizeof(argv_tailmerge[0]), argv_tailmerge, "disable-tail-merge\n");
 #if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_)