Commit 29290598 authored by Marc Marí's avatar Marc Marí
Browse files

Add check for Neon support

parent d816abea
...@@ -32,7 +32,12 @@ ...@@ -32,7 +32,12 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#ifdef __ANDROID__
#include <cpu-features.h> #include <cpu-features.h>
#else
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
#include <arm_neon.h> #include <arm_neon.h>
#include <cmath> #include <cmath>
...@@ -48,8 +53,16 @@ float32x4_t log_ps(float32x4_t); ...@@ -48,8 +53,16 @@ float32x4_t log_ps(float32x4_t);
* Determine whether ivec4 and fvec4 are supported on this processor. * Determine whether ivec4 and fvec4 are supported on this processor.
*/ */
static bool isVec4Supported() { static bool isVec4Supported() {
#ifdef __ANDROID__
uint64_t features = android_getCpuFeatures(); uint64_t features = android_getCpuFeatures();
return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0; return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
#elif defined(__ARM__)
unsigned long features = getauxval(AT_HWCAP);
return (features & HWCAP_NEON) != 0;
#else
unsigned long features = getauxval(AT_HWCAP);
return (features & HWCAP_ASIMD) != 0;
#endif
} }
class ivec4; class ivec4;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment