[pulseaudio-discuss] [PATCH 04/13] tests: Use single-line #ifdef for ARM NEON code

Peter Meerwald pmeerw at pmeerw.net
Thu Apr 24 09:50:56 PDT 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/tests/cpu-mix-test.c   |   16 +++++-----------
 src/tests/cpu-sconv-test.c |   16 +++++-----------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/tests/cpu-mix-test.c b/src/tests/cpu-mix-test.c
index a1a16d4..1808556 100644
--- a/src/tests/cpu-mix-test.c
+++ b/src/tests/cpu-mix-test.c
@@ -27,8 +27,7 @@
 
 /* Only ARM NEON has mix tests, so disable the related functions for other
  * architectures for now to avoid compiler warnings about unused functions. */
-#if defined (__arm__) && defined (__linux__)
-#ifdef HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 
 #define SAMPLES 1028
 #define TIMES 1000
@@ -145,11 +144,9 @@ static void run_mix_test(
 
     pa_mempool_free(pool);
 }
-#endif /* HAVE_NEON */
-#endif /* defined (__arm__) && defined (__linux__) */
+#endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
 
-#if defined (__arm__) && defined (__linux__)
-#ifdef HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 START_TEST (mix_neon_test) {
     pa_do_mix_func_t orig_func, neon_func;
     pa_cpu_arm_flag_t flags = 0;
@@ -169,8 +166,7 @@ START_TEST (mix_neon_test) {
     run_mix_test(neon_func, orig_func, 7, 2, true, true);
 }
 END_TEST
-#endif /* HAVE_NEON */
-#endif /* defined (__arm__) && defined (__linux__) */
+#endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
 
 int main(int argc, char *argv[]) {
     int failed = 0;
@@ -184,11 +180,9 @@ int main(int argc, char *argv[]) {
     s = suite_create("CPU");
 
     tc = tcase_create("mix");
-#if defined (__arm__) && defined (__linux__)
-#if HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
     tcase_add_test(tc, mix_neon_test);
 #endif
-#endif
     tcase_set_timeout(tc, 120);
     suite_add_tcase(s, tc);
 
diff --git a/src/tests/cpu-sconv-test.c b/src/tests/cpu-sconv-test.c
index b75e0af..6899b72 100644
--- a/src/tests/cpu-sconv-test.c
+++ b/src/tests/cpu-sconv-test.c
@@ -81,8 +81,7 @@ static void run_conv_test_float_to_s16(
 }
 
 /* This test is currently only run under NEON */
-#if defined (__arm__) && defined (__linux__)
-#ifdef HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 static void run_conv_test_s16_to_float(
         pa_convert_func_t func,
         pa_convert_func_t orig_func,
@@ -130,8 +129,7 @@ static void run_conv_test_s16_to_float(
         } PA_RUNTIME_TEST_RUN_STOP
     }
 }
-#endif /* HAVE_NEON */
-#endif /* defined (__arm__) && defined (__linux__) */
+#endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
 
 #if defined (__i386__) || defined (__amd64__)
 START_TEST (sconv_sse2_test) {
@@ -189,8 +187,7 @@ START_TEST (sconv_sse_test) {
 END_TEST
 #endif /* defined (__i386__) || defined (__amd64__) */
 
-#if defined (__arm__) && defined (__linux__)
-#ifdef HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 START_TEST (sconv_neon_test) {
     pa_cpu_arm_flag_t flags = 0;
     pa_convert_func_t orig_from_func, neon_from_func;
@@ -230,8 +227,7 @@ START_TEST (sconv_neon_test) {
     run_conv_test_s16_to_float(neon_to_func, orig_to_func, 7, true, true);
 }
 END_TEST
-#endif /* HAVE_NEON */
-#endif /* defined (__arm__) && defined (__linux__) */
+#endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
 
 int main(int argc, char *argv[]) {
     int failed = 0;
@@ -249,11 +245,9 @@ int main(int argc, char *argv[]) {
     tcase_add_test(tc, sconv_sse2_test);
     tcase_add_test(tc, sconv_sse_test);
 #endif
-#if defined (__arm__) && defined (__linux__)
-#if HAVE_NEON
+#if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
     tcase_add_test(tc, sconv_neon_test);
 #endif
-#endif
     tcase_set_timeout(tc, 120);
     suite_add_tcase(s, tc);
 
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list