diff --git a/Makefile.am b/Makefile.am index 8f7f6900..6db0d0c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -184,7 +184,7 @@ noinst_LTLIBRARIES += libtesseract_sse.la endif if HAVE_NEON -libtesseract_neon_la_CXXFLAGS = -mfpu=neon +libtesseract_neon_la_CXXFLAGS = $(NEON_CXXFLAGS) libtesseract_neon_la_SOURCES = src/arch/intsimdmatrixneon.cpp libtesseract_la_LIBADD += libtesseract_neon.la noinst_LTLIBRARIES += libtesseract_neon.la diff --git a/configure.ac b/configure.ac index a92d80f8..23d0893c 100644 --- a/configure.ac +++ b/configure.ac @@ -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*) AX_CHECK_COMPILE_FLAG([-mfpu=neon], [neon=true], [neon=false], [$WERROR]) AM_CONDITIONAL([HAVE_NEON], $neon) if $neon; then AC_DEFINE([HAVE_NEON], [1], [Enable NEON instructions]) + NEON_CXXFLAGS="-mfpu=neon" + AC_SUBST([NEON_CXXFLAGS]) fi ;; diff --git a/src/arch/simddetect.cpp b/src/arch/simddetect.cpp index 74919acf..5b789466 100644 --- a/src/arch/simddetect.cpp +++ b/src/arch/simddetect.cpp @@ -37,7 +37,7 @@ #endif #endif -#ifdef HAVE_NEON +#if defined(HAVE_NEON) && !defined(__aarch64__) #ifdef ANDROID #include #else @@ -66,7 +66,10 @@ static STRING_VAR(dotproduct, "auto", 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. bool SIMDDetect::neon_available_; #else @@ -177,7 +180,7 @@ SIMDDetect::SIMDDetect() { #endif #endif -#ifdef HAVE_NEON +#if defined(HAVE_NEON) && !defined(__aarch64__) #ifdef ANDROID { AndroidCpuFamily family = android_getCpuFamily();