[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] build-sys: meson: check HAVE_MMX and HAVE_SSE before calling initializers

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Sat Jun 5 15:14:19 UTC 2021



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
e0d9231b by Igor V. Kovalenko at 2021-06-05T15:16:37+03:00
build-sys: meson: check HAVE_MMX and HAVE_SSE before calling initializers

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/575>

- - - - -


3 changed files:

- src/pulsecore/cpu-x86.c
- src/tests/cpu-remap-test.c
- src/tests/cpu-sconv-test.c


Changes:

=====================================
src/pulsecore/cpu-x86.c
=====================================
@@ -114,16 +114,20 @@ bool pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) {
     pa_cpu_get_x86_flags(flags);
 
     /* activate various optimisations */
+#ifdef HAVE_MMX
     if (*flags & PA_CPU_X86_MMX) {
         pa_volume_func_init_mmx(*flags);
         pa_remap_func_init_mmx(*flags);
     }
+#endif
 
+#ifdef HAVE_SSE
     if (*flags & (PA_CPU_X86_SSE | PA_CPU_X86_SSE2)) {
         pa_volume_func_init_sse(*flags);
         pa_remap_func_init_sse(*flags);
         pa_convert_func_init_sse(*flags);
     }
+#endif
 
     return true;
 #else /* defined (__i386__) || defined (__amd64__) */


=====================================
src/tests/cpu-remap-test.c
=====================================
@@ -358,7 +358,7 @@ START_TEST (rearrange_special_test) {
 }
 END_TEST
 
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_MMX)
 START_TEST (remap_mmx_test) {
     pa_cpu_x86_flag_t flags = 0;
     pa_init_remap_func_t init_func, orig_init_func;
@@ -382,7 +382,9 @@ START_TEST (remap_mmx_test) {
     remap_init_test_channels(init_func, orig_init_func, PA_SAMPLE_S16NE, 1, 2, false);
 }
 END_TEST
+#endif /* (defined (__i386__) || defined (__amd64__)) && defined (HAVE_MMX) */
 
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE)
 START_TEST (remap_sse2_test) {
     pa_cpu_x86_flag_t flags = 0;
     pa_init_remap_func_t init_func, orig_init_func;
@@ -406,7 +408,7 @@ START_TEST (remap_sse2_test) {
     remap_init_test_channels(init_func, orig_init_func, PA_SAMPLE_S16NE, 1, 2, false);
 }
 END_TEST
-#endif /* defined (__i386__) || defined (__amd64__) */
+#endif /* (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE) */
 
 #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 START_TEST (remap_neon_test) {
@@ -513,8 +515,10 @@ int main(int argc, char *argv[]) {
 
     tc = tcase_create("remap");
     tcase_add_test(tc, remap_special_test);
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_MMX)
     tcase_add_test(tc, remap_mmx_test);
+#endif
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE)
     tcase_add_test(tc, remap_sse2_test);
 #endif
 #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)


=====================================
src/tests/cpu-sconv-test.c
=====================================
@@ -134,7 +134,7 @@ static void run_conv_test_s16_to_float(
 }
 #endif /* defined (__arm__) && defined (__linux__) && defined (HAVE_NEON) */
 
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE)
 START_TEST (sconv_sse2_test) {
     pa_cpu_x86_flag_t flags = 0;
     pa_convert_func_t orig_func, sse2_func;
@@ -188,7 +188,7 @@ START_TEST (sconv_sse_test) {
     run_conv_test_float_to_s16(sse_func, orig_func, 7, true, true);
 }
 END_TEST
-#endif /* defined (__i386__) || defined (__amd64__) */
+#endif /* (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE) */
 
 #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
 START_TEST (sconv_neon_test) {
@@ -244,7 +244,7 @@ int main(int argc, char *argv[]) {
     s = suite_create("CPU");
 
     tc = tcase_create("sconv");
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) || defined (__amd64__)) && defined (HAVE_SSE)
     tcase_add_test(tc, sconv_sse2_test);
     tcase_add_test(tc, sconv_sse_test);
 #endif



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e0d9231bf4c15e63add2268762744c266002a040

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e0d9231bf4c15e63add2268762744c266002a040
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210605/da356928/attachment-0001.htm>


More information about the pulseaudio-commits mailing list