summaryrefslogtreecommitdiffstats
path: root/external/cairo/pixman/pixman-wasm.patch
blob: a04aa7ccca1beb6fdf1051bda698abaf28cc3008 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
--- a/pixman/pixman/pixman-x86.c
+++ b/pixman/pixman/pixman-x86.c
@@ -77,13 +77,20 @@
 
 #else
 
-#define _PIXMAN_X86_64							\
-    (defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64))
+#if (defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64))
+#define _PIXMAN_X86_64 1
+#else
+#define _PIXMAN_X86_64 0
+#endif
 
 static pixman_bool_t
 have_cpuid (void)
 {
-#if _PIXMAN_X86_64 || defined (_MSC_VER)
+#if defined(__EMSCRIPTEN__)
+
+    return FALSE;
+
+#elif _PIXMAN_X86_64 || defined (_MSC_VER)
 
     return TRUE;
 
@@ -109,6 +109,8 @@
 #endif
 }
 
+#if !defined(__EMSCRIPTEN__)
+
 static void
 pixman_cpuid (uint32_t feature,
 	      uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
@@ -156,10 +156,17 @@
 #error Unknown compiler
 #endif
 }
+ 
+#endif // !__EMSCRIPTEN__
 
 static cpu_features_t
 detect_cpu_features (void)
 {
+#if defined(__EMSCRIPTEN__)
+
+    return X86_MMX | X86_MMX_EXTENSIONS | X86_SSE | X86_SSE2 | X86_SSSE3;
+
+#else
     uint32_t a, b, c, d;
     cpu_features_t features = 0;
 
@@ -202,6 +202,8 @@
     }
 
     return features;
+
+#endif // !__EMSCRIPTEN__
 }
 
 #endif
--- a/pixman/pixman/pixman-ssse3.c
+++ b/pixman/pixman/pixman-ssse3.c
@@ -28,7 +28,9 @@
 #endif
 
 #include <stdlib.h>
+#if !defined(__EMSCRIPTEN__)
 #include <mmintrin.h>
+#endif
 #include <xmmintrin.h>
 #include <emmintrin.h>
 #include <tmmintrin.h>
--- a/pixman/configure
+++ b/pixman/configure
@@ -14207,7 +14207,11 @@
 #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
 #error "Need GCC >= 3.4 for MMX intrinsics"
 #endif
+#if !defined(__EMSCRIPTEN__)
 #include <mmintrin.h>
+#else
+#include <xmmintrin.h>
+#endif
 #include <stdint.h>
 
 /* Check support for block expressions */
@@ -14308,7 +14308,9 @@
 #      error "Need GCC >= 4.2 for SSE2 intrinsics on x86"
 #   endif
 #endif
+#if !defined(__EMSCRIPTEN__)
 #include <mmintrin.h>
+#endif
 #include <xmmintrin.h>
 #include <emmintrin.h>
 int param;
@@ -14380,7 +14380,9 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#if !defined(__EMSCRIPTEN__)
 #include <mmintrin.h>
+#endif
 #include <xmmintrin.h>
 #include <emmintrin.h>
 #include <tmmintrin.h>