From 1e7aaf682b19939cc85e863937c637f79ac61e0c Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sun, 20 Sep 2020 15:25:57 +0200 Subject: [PATCH] Don't use NEON instructions for non-NEON ARM CPUs Since NDK r21b NEON instructions are used by default. Explicitly disable them for non-NEON CPUs. --- DroidFishApp/src/main/cpp/gtb/Android.mk | 4 ++++ DroidFishApp/src/main/cpp/nativeutil/Android.mk | 9 +++++---- DroidFishApp/src/main/cpp/rtb/Android.mk | 5 ++++- DroidFishApp/src/main/cpp/stockfish/Android.mk | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/DroidFishApp/src/main/cpp/gtb/Android.mk b/DroidFishApp/src/main/cpp/gtb/Android.mk index e6fcfa5..1cb0b46 100644 --- a/DroidFishApp/src/main/cpp/gtb/Android.mk +++ b/DroidFishApp/src/main/cpp/gtb/Android.mk @@ -14,6 +14,10 @@ LOCAL_SRC_FILES := \ compression/zlib/zutil.c compression/liblzf/lzf_c.c compression/liblzf/lzf_d.c \ GtbProbe.cpp +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + LOCAL_ARM_NEON := false +endif + LOCAL_CFLAGS := \ -I $(LOCAL_PATH)/sysport/ -I $(LOCAL_PATH)/compression/ \ -I $(LOCAL_PATH)/compression/liblzf/ -I $(LOCAL_PATH)/compression/zlib/ \ diff --git a/DroidFishApp/src/main/cpp/nativeutil/Android.mk b/DroidFishApp/src/main/cpp/nativeutil/Android.mk index f198f93..e96081d 100644 --- a/DroidFishApp/src/main/cpp/nativeutil/Android.mk +++ b/DroidFishApp/src/main/cpp/nativeutil/Android.mk @@ -12,16 +12,17 @@ CPU_FEATS_SRC_FILES += $(CPU_FEATS)/src/filesystem.c \ $(CPU_FEATS)/src/unix_features_aggregator.c ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) - UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_arm.c + UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_arm.c + LOCAL_ARM_NEON := false endif #ifeq ($(TARGET_ARCH_ABI),arm64-v8a) -# UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_aarch64.c +# UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_aarch64.c #endif ifeq ($(TARGET_ARCH_ABI),x86) - UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_x86.c + UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_x86.c endif #ifeq ($(TARGET_ARCH_ABI),x86_64) -# UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_x86.c +# UTIL_SRC_FILES += $(CPU_FEATS_SRC_FILES) $(CPU_FEATS)/src/cpuinfo_x86.c #endif LOCAL_MODULE := nativeutil diff --git a/DroidFishApp/src/main/cpp/rtb/Android.mk b/DroidFishApp/src/main/cpp/rtb/Android.mk index c19721b..8669af9 100644 --- a/DroidFishApp/src/main/cpp/rtb/Android.mk +++ b/DroidFishApp/src/main/cpp/rtb/Android.mk @@ -2,12 +2,15 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) - LOCAL_MODULE := rtb LOCAL_SRC_FILES := \ bitBoard.cpp material.cpp moveGen.cpp position.cpp rtb-probe.cpp tbprobe.cpp \ RtbProbe.cpp +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + LOCAL_ARM_NEON := false +endif + LOCAL_CFLAGS := --std=c++11 \ -I $(LOCAL_PATH)/sysport/ -I -DNDEBUG -Wall diff --git a/DroidFishApp/src/main/cpp/stockfish/Android.mk b/DroidFishApp/src/main/cpp/stockfish/Android.mk index 72c7aff..a239b2e 100644 --- a/DroidFishApp/src/main/cpp/stockfish/Android.mk +++ b/DroidFishApp/src/main/cpp/stockfish/Android.mk @@ -10,6 +10,7 @@ SF_SRC_FILES := \ MY_ARCH_DEF := ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) MY_ARCH_DEF += -DUSE_NEON -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon + LOCAL_ARM_NEON := true endif ifeq ($(TARGET_ARCH_ABI),arm64-v8a) MY_ARCH_DEF += -DIS_64BIT -DUSE_POPCNT -DUSE_NEON @@ -28,6 +29,7 @@ include $(LOCAL_PATH)/build_sf.mk ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) MY_ARCH_DEF := -mthumb -march=armv7-a -mfloat-abi=softfp include $(CLEAR_VARS) + LOCAL_ARM_NEON := false LOCAL_MODULE := stockfish_nosimd include $(LOCAL_PATH)/build_sf.mk stockfish : stockfish_nosimd