Skip to content
This repository was archived by the owner on Apr 2, 2021. It is now read-only.

Use getauxval to check for NEON on Linux. #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions FastNoiseSIMD/FastNoiseSIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@
#ifdef _WIN32
#include <intrin.h>
#elif defined(FN_ARM)
#if !defined(__aarch64__) && !defined(FN_IOS)
#if !defined(__ANDROID__) && (defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux))
#include <sys/auxv.h>
#include <asm/hwcap.h>
#elif !defined(__aarch64__) && !defined(FN_IOS)
#include "ARM/cpu-features.h"
#endif
#else
Expand All @@ -81,6 +84,10 @@ int GetFastestSIMD()
{
#if defined(__aarch64__) || defined(FN_IOS)
return FN_NEON;
#elif !defined(__ANDROID__) && (defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux))
if ((getauxval(AT_HWCAP) & HWCAP_NEON) != 0) {
return FN_NEON;
}
#else
if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM)
{
Expand All @@ -92,9 +99,9 @@ int GetFastestSIMD()
#endif
return FN_NEON;
}
#endif

return FN_NO_SIMD_FALLBACK;
#endif
}
#else

Expand Down