From: Bobby Salazar Date: Thu, 26 Jan 2012 18:19:18 +0000 (-0500) Subject: iOS Runtime Detection Support For ARM NEON X-Git-Tag: pixman-0.25.2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35577876978e86783d49c500b4bb7ea1fc7fa89c;p=platform%2Fupstream%2Fpixman.git 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. --- 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 #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;