summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Muizelaar <jmuizelaar@mozilla.com>2009-04-15 10:38:37 -0400
committerJeff Muizelaar <jmuizelaar@mozilla.com>2009-04-15 10:38:37 -0400
commit2423118e239e9c85dd68403bf8b97b30965df38e (patch)
tree975ceaffeecca37e8e3fc95769dc93a50efefd24
parent3d9716f44ea799e003c19783f087239fe89c88dc (diff)
Add support for doing ARM simd detection on Windows
-rw-r--r--pixman/pixman-arm-detect-win32.asm10
-rw-r--r--pixman/pixman-arm-simd.h2
-rw-r--r--pixman/pixman-pict.c30
3 files changed, 41 insertions, 1 deletions
diff --git a/pixman/pixman-arm-detect-win32.asm b/pixman/pixman-arm-detect-win32.asm
new file mode 100644
index 0000000..dfe363e
--- /dev/null
+++ b/pixman/pixman-arm-detect-win32.asm
@@ -0,0 +1,10 @@
+ area pixman_msvc, code, readonly
+
+ export pixman_msvc_try_armv6_op
+
+pixman_msvc_try_armv6_op
+ uqadd8 r0,r0,r1
+ mov pc,lr
+ endp
+
+ end
diff --git a/pixman/pixman-arm-simd.h b/pixman/pixman-arm-simd.h
index ecaace5..fae7b94 100644
--- a/pixman/pixman-arm-simd.h
+++ b/pixman/pixman-arm-simd.h
@@ -28,7 +28,7 @@
#ifdef USE_ARM_SIMD
-static inline pixman_bool_t pixman_have_arm_simd(void) { return TRUE; }
+pixman_bool_t pixman_have_arm_simd(void);
#else
#define pixman_have_arm_simd() FALSE
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 5f3ddd2..82d7160 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -37,6 +37,11 @@
#include "pixman-arm-simd.h"
#include "pixman-combine32.h"
+#if defined(USE_ARM_SIMD) && defined(_MSC_VER)
+/* Needed for EXCEPTION_ILLEGAL_INSTRUCTION */
+#include <windows.h>
+#endif
+
#define FbFullMask(n) ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1))
#undef READ
@@ -2190,6 +2195,31 @@ pixman_bool_t pixman_have_vmx (void) {
#endif /* __APPLE__ */
#endif /* USE_VMX */
+#ifdef USE_ARM_SIMD
+pixman_bool_t
+pixman_have_arm_simd (void)
+{
+#ifdef _MSC_VER
+ static pixman_bool_t initialized = FALSE;
+ static pixman_bool_t have_arm_simd = FALSE;
+
+ if (!initialized) {
+ __try {
+ pixman_msvc_try_armv6_op();
+ have_arm_simd = TRUE;
+ } __except(GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
+ have_arm_simd = FALSE;
+ }
+ initialized = TRUE;
+ }
+
+ return have_arm_simd;
+#else
+ return TRUE;
+#endif
+}
+#endif
+
#ifdef USE_MMX
/* The CPU detection code needs to be in a file not compiled with
* "-mmmx -msse", as gcc would generate CMOV instructions otherwise