summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Salazar <bobby8934@gmail.com>2012-01-26 13:19:18 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-02-08 19:01:03 -0500
commit1ceb66750c33c896bdb04b47ed44977112817a86 (patch)
tree0efc209396aefe7715dbfca928d7f65d353d102e
parent7ccb0c45e5f6a0ac23f585e2eda412034c2abe61 (diff)
downloadpixman-1ceb66750c33c896bdb04b47ed44977112817a86.tar.gz
iOS Runtime Detection Support For ARM NEON
This patch adds runtime detection support for the ARM NEON fast paths for code compiled with the iOS SDK.
-rw-r--r--pixman/pixman-cpu.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
index 4172e52..92942b2 100644
--- a/pixman/pixman-cpu.c
+++ b/pixman/pixman-cpu.c
@@ -30,6 +30,10 @@
#include <windows.h>
#endif
+#if defined(__APPLE__)
+#include "TargetConditionals.h"
+#endif
+
#include "pixman-private.h"
#ifdef USE_VMX
@@ -244,6 +248,47 @@ pixman_have_arm_neon (void)
#endif /* USE_ARM_NEON */
+#elif (defined (__APPLE__) && defined(TARGET_OS_IPHONE)) /* iOS (iPhone/iPad/iPod touch) */
+
+/* Detection of ARM NEON on iOS is fairly simple because iOS binaries
+ * contain separate executable images for each processor architecture.
+ * So all we have to do is detect the armv7 architecture build. The
+ * operating system automatically runs the armv7 binary for armv7 devices
+ * and the armv6 binary for armv6 devices.
+ */
+
+pixman_bool_t
+pixman_have_arm_simd (void)
+{
+#if defined(USE_ARM_SIMD)
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+pixman_bool_t
+pixman_have_arm_neon (void)
+{
+#if defined(USE_ARM_NEON) && defined(__ARM_NEON__)
+ /* This is an armv7 cpu build */
+ return TRUE;
+#else
+ /* This is an armv6 cpu build */
+ return FALSE;
+#endif
+}
+
+pixman_bool_t
+pixman_have_arm_iwmmxt (void)
+{
+#if defined(USE_ARM_IWMMXT)
+ return FALSE;
+#else
+ return FALSE;
+#endif
+}
+
#elif defined (__linux__) || defined(__ANDROID__) || defined(ANDROID) /* linux ELF or ANDROID */
static pixman_bool_t arm_has_v7 = FALSE;