Hi,

the NEON optimisation is always used on all ARMs, even if not
supported. Another problem is that in Fedora we build with
-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard, so
the compilation fails even on machine with NEON.

The proposed patch adds guard to NEON assembly code and the guard
depends on have_mfpu_neon cmake internal variable. The value of
this variable is autodetected during cmake initialisation, but
can be also overriden by e.g.:

cmake -Dhave_mfpu_neon=0

The performance/usability of binary compiled without NEON is
probably not good, but at least it compiles fine on more
machines.

This issue was originally reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=837028

regards

Jaroslav
diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt
index facaff7..088d337 100644
--- a/gnuradio-core/src/lib/filter/CMakeLists.txt
+++ b/gnuradio-core/src/lib/filter/CMakeLists.txt
@@ -210,6 +210,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
         ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_powerpc.cc
     )
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+    if(have_mfpu_neon)
+        add_definitions(-DHAVE_MFPU_NEON)
+    endif()
     list(APPEND gnuradio_core_sources
         ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_armv7_a.cc
         ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_armv7_a.cc
diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
index e7c6b26..c125b49 100644
--- a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
+++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
@@ -37,7 +37,7 @@ gr_p2_round_down(size_t x, size_t pow2)
 }
 
 
-#if 0
+#ifndef HAVE_MFPU_NEON
 
 void
 dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n)
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
index 68c448b..23bbef0 100644
--- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
@@ -37,7 +37,7 @@ gr_p2_round_down(size_t x, size_t pow2)
 }
 
 
-#if 0
+#ifndef HAVE_MFPU_NEON
 
 float
 dotprod_fff_armv7_a(const float *a, const float *b, size_t n)
_______________________________________________
Patch-gnuradio mailing list
Patch-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/patch-gnuradio

Reply via email to