mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-26 21:47:23 +01:00
Use NEON dotprod instructions in Stockfish if supported by CPU
This commit is contained in:
parent
bb02fffabd
commit
fd23962fc4
|
@ -15,9 +15,9 @@ 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
|
LOCAL_ARM_NEON := false
|
||||||
endif
|
endif
|
||||||
#ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
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
|
endif
|
||||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
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
|
endif
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#if defined(__arm__)
|
#if defined(__arm__)
|
||||||
#include "cpuinfo_arm.h"
|
#include "cpuinfo_arm.h"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#include "cpuinfo_aarch64.h"
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
#include "cpuinfo_x86.h"
|
#include "cpuinfo_x86.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,10 +67,14 @@ extern "C" JNIEXPORT jboolean JNICALL Java_org_petero_droidfish_engine_EngineUti
|
||||||
using namespace cpu_features;
|
using namespace cpu_features;
|
||||||
ArmFeatures features = GetArmInfo().features;
|
ArmFeatures features = GetArmInfo().features;
|
||||||
return features.neon ? JNI_TRUE : JNI_FALSE;
|
return features.neon ? JNI_TRUE : JNI_FALSE;
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
using namespace cpu_features;
|
||||||
|
Aarch64Features features = GetAarch64Info().features;
|
||||||
|
return features.asimddp ? JNI_TRUE : JNI_FALSE;
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
using namespace cpu_features;
|
using namespace cpu_features;
|
||||||
X86Features features = GetX86Info().features;
|
X86Features features = GetX86Info().features;
|
||||||
return features.sse4_1 ? JNI_TRUE : JNI_FALSE;
|
return features.sse4_1 ? JNI_TRUE : JNI_FALSE;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||||
LOCAL_ARM_NEON := true
|
LOCAL_ARM_NEON := true
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||||
MY_ARCH_DEF += -DIS_64BIT -DUSE_POPCNT -DUSE_NEON
|
MY_ARCH_DEF += -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -march=armv8.2-a+dotprod -DUSE_NEON_DOTPROD
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_ARCH_ABI),x86_64)
|
ifeq ($(TARGET_ARCH_ABI),x86_64)
|
||||||
MY_ARCH_DEF += -DIS_64BIT -DUSE_SSE41 -msse4.1
|
MY_ARCH_DEF += -DIS_64BIT -DUSE_SSE41 -msse4.1
|
||||||
|
@ -25,6 +25,15 @@ include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := stockfish
|
LOCAL_MODULE := stockfish
|
||||||
include $(LOCAL_PATH)/build_sf.mk
|
include $(LOCAL_PATH)/build_sf.mk
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||||
|
MY_ARCH_DEF := -DIS_64BIT -DUSE_POPCNT -DUSE_NEON
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_ARM_NEON := true
|
||||||
|
LOCAL_MODULE := stockfish_nosimd
|
||||||
|
include $(LOCAL_PATH)/build_sf.mk
|
||||||
|
stockfish : stockfish_nosimd
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||||
MY_ARCH_DEF := -mthumb -march=armv7-a -mfloat-abi=softfp
|
MY_ARCH_DEF := -mthumb -march=armv7-a -mfloat-abi=softfp
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user