From d7a652e3976dbd06e41f81e116199c7dd2ec1f6c Mon Sep 17 00:00:00 2001 From: Mark Dietzer Date: Tue, 29 Mar 2022 10:10:57 -0700 Subject: [PATCH] Check for aarch64 as well --- client/deps/hardnested/Makefile | 19 ++++++++++++++----- client/deps/hardnested/hardnested_bf_core.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/client/deps/hardnested/Makefile b/client/deps/hardnested/Makefile index 5f58606ae..a7512ec91 100644 --- a/client/deps/hardnested/Makefile +++ b/client/deps/hardnested/Makefile @@ -5,13 +5,22 @@ MYDEFS = MYSRCS = hardnested_bruteforce.c cpu_arch = $(shell uname -m) + +IS_SIMD_ARCH = ifneq ($(findstring 86, $(cpu_arch)), ) - MULTIARCHSRCS = hardnested_bf_core.c hardnested_bitarray_core.c + IS_SIMD_ARCH=x86 endif ifneq ($(findstring amd64, $(cpu_arch)), ) - MULTIARCHSRCS = hardnested_bf_core.c hardnested_bitarray_core.c + IS_SIMD_ARCH=x86 endif ifneq ($(findstring arm64, $(cpu_arch)), ) + IS_SIMD_ARCH=arm64 +endif +ifneq ($(findstring aarch64, $(cpu_arch)), ) + IS_SIMD_ARCH=arm64 +endif + +ifneq ($(IS_SIMD_ARCH), ) MULTIARCHSRCS = hardnested_bf_core.c hardnested_bitarray_core.c endif ifeq ($(MULTIARCHSRCS), ) @@ -21,7 +30,7 @@ endif LIB_A = libhardnested.a MYOBJS = $(MYSRCS:%.c=$(OBJDIR)/%.o) -ifneq ($(findstring arm64, $(cpu_arch)), ) +ifeq ($(IS_SIMD_ARCH), arm64) MYOBJS += $(MULTIARCHSRCS:%.c=$(OBJDIR)/%_NOSIMD.o) \ $(MULTIARCHSRCS:%.c=$(OBJDIR)/%_NEON.o) else @@ -41,8 +50,8 @@ HARD_SWITCH_SSE2 = -mmmx -msse2 -mno-avx -mno-avx2 HARD_SWITCH_AVX = -mmmx -msse2 -mavx -mno-avx2 HARD_SWITCH_AVX2 = -mmmx -msse2 -mavx -mavx2 HARD_SWITCH_AVX512 = -mmmx -msse2 -mavx -mavx2 -mavx512f -ifneq ($(findstring arm64, $(cpu_arch)), ) - SUPPORTS_AVX512=0 +ifeq ($(IS_SIMD_ARCH), arm64) + SUPPORTS_AVX512=False HARD_SWITCH_NOSIMD = -DNOSIMD_BUILD endif ifeq "$(SUPPORTS_AVX512)" "True" diff --git a/client/deps/hardnested/hardnested_bf_core.h b/client/deps/hardnested/hardnested_bf_core.h index 006b85da2..9e941c350 100644 --- a/client/deps/hardnested/hardnested_bf_core.h +++ b/client/deps/hardnested/hardnested_bf_core.h @@ -62,7 +62,7 @@ THE SOFTWARE. #endif // ARM64 mandates implementation of NEON -#if defined(__arm64__) +#if defined(__arm64__) || defined(__aarch64__) #define COMPILER_HAS_SIMD_NEON #define arm_has_neon() (true) // ARMv7 or older, NEON is optional and autodetection is difficult