Always use NEON by default for ARMv8

Signed-off-by: Stefan Weil <stefan.weil@bib.uni-mannheim.de>
This commit is contained in:
Stefan Weil 2020-07-10 15:24:50 +02:00 committed by Stefan Weil
parent 22e6c2e5a7
commit 2db2223b39
3 changed files with 16 additions and 4 deletions

View File

@ -184,7 +184,7 @@ noinst_LTLIBRARIES += libtesseract_sse.la
endif endif
if HAVE_NEON if HAVE_NEON
libtesseract_neon_la_CXXFLAGS = -mfpu=neon libtesseract_neon_la_CXXFLAGS = $(NEON_CXXFLAGS)
libtesseract_neon_la_SOURCES = src/arch/intsimdmatrixneon.cpp libtesseract_neon_la_SOURCES = src/arch/intsimdmatrixneon.cpp
libtesseract_la_LIBADD += libtesseract_neon.la libtesseract_la_LIBADD += libtesseract_neon.la
noinst_LTLIBRARIES += libtesseract_neon.la noinst_LTLIBRARIES += libtesseract_neon.la

View File

@ -160,12 +160,21 @@ case "${host_cpu}" in
;; ;;
aarch64)
# ARMv8 always has NEON and does not need special compiler flags.
AM_CONDITIONAL([HAVE_NEON], true)
AC_DEFINE([HAVE_NEON], [1], [Enable NEON instructions])
;;
arm*) arm*)
AX_CHECK_COMPILE_FLAG([-mfpu=neon], [neon=true], [neon=false], [$WERROR]) AX_CHECK_COMPILE_FLAG([-mfpu=neon], [neon=true], [neon=false], [$WERROR])
AM_CONDITIONAL([HAVE_NEON], $neon) AM_CONDITIONAL([HAVE_NEON], $neon)
if $neon; then if $neon; then
AC_DEFINE([HAVE_NEON], [1], [Enable NEON instructions]) AC_DEFINE([HAVE_NEON], [1], [Enable NEON instructions])
NEON_CXXFLAGS="-mfpu=neon"
AC_SUBST([NEON_CXXFLAGS])
fi fi
;; ;;

View File

@ -37,7 +37,7 @@
#endif #endif
#endif #endif
#ifdef HAVE_NEON #if defined(HAVE_NEON) && !defined(__aarch64__)
#ifdef ANDROID #ifdef ANDROID
#include <cpufeatures.h> #include <cpufeatures.h>
#else #else
@ -66,7 +66,10 @@ static STRING_VAR(dotproduct, "auto",
SIMDDetect SIMDDetect::detector; SIMDDetect SIMDDetect::detector;
#if defined(HAVE_NEON) #if defined(__aarch64__)
// ARMv8 always has NEON.
bool SIMDDetect::neon_available_ = true;
#elif defined(HAVE_NEON)
// If true, then Neon has been detected. // If true, then Neon has been detected.
bool SIMDDetect::neon_available_; bool SIMDDetect::neon_available_;
#else #else
@ -177,7 +180,7 @@ SIMDDetect::SIMDDetect() {
#endif #endif
#endif #endif
#ifdef HAVE_NEON #if defined(HAVE_NEON) && !defined(__aarch64__)
#ifdef ANDROID #ifdef ANDROID
{ {
AndroidCpuFamily family = android_getCpuFamily(); AndroidCpuFamily family = android_getCpuFamily();