[PATCH] osmo-trx[master]: ssedetect: call __builtin_cpu_supports() only if supported

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Fri May 19 22:56:27 UTC 2017


Review at  https://gerrit.osmocom.org/2690

ssedetect: call __builtin_cpu_supports() only if supported

Some compilers don't support the __builtin_cpu_supports built-in,
so let's make them able to compile the project anyway.

Change-Id: I0c90402d8e4c9f196c54b066ff30891c8de3ad2b
---
M Transceiver52M/osmo-trx.cpp
M Transceiver52M/x86/convert.c
M Transceiver52M/x86/convolve.c
3 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/90/2690/1

diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 1c0ceb1..31a99cf 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -397,18 +397,26 @@
 
 #ifdef HAVE_SSE3
 	printf("Info: SSE3 support compiled in");
+#ifdef HAVE___BUILTIN_CPU_SUPPORTS
 	if (__builtin_cpu_supports("sse3"))
 		printf(" and supported by CPU\n");
 	else
 		printf(", but not supported by CPU\n");
+#else
+	printf(", but runtime SIMD detection disabled\n");
+#endif
 #endif
 
 #ifdef HAVE_SSE4_1
 	printf("Info: SSE4.1 support compiled in");
+#ifdef HAVE___BUILTIN_CPU_SUPPORTS
 	if (__builtin_cpu_supports("sse4.1"))
 		printf(" and supported by CPU\n");
 	else
 		printf(", but not supported by CPU\n");
+#else
+	printf(", but runtime SIMD detection disabled\n");
+#endif
 #endif
 
 	convolve_init();
diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c
index db98050..07cdf59 100644
--- a/Transceiver52M/x86/convert.c
+++ b/Transceiver52M/x86/convert.c
@@ -46,6 +46,7 @@
 	c.convert_si16_ps_16n = base_convert_short_float;
 	c.convert_si16_ps = base_convert_short_float;
 
+#ifdef HAVE___BUILTIN_CPU_SUPPORTS
 #ifdef HAVE_SSE4_1
 	if (__builtin_cpu_supports("sse4.1")) {
 		c.convert_si16_ps_16n = &_sse_convert_si16_ps_16n;
@@ -60,6 +61,7 @@
 		c.convert_scale_ps_si16 = _sse_convert_scale_ps_si16;
 	}
 #endif
+#endif
 }
 
 void convert_float_short(short *out, const float *in, float scale, int len)
diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c
index 35cba29..eb38f64 100644
--- a/Transceiver52M/x86/convolve.c
+++ b/Transceiver52M/x86/convolve.c
@@ -82,7 +82,7 @@
 	c.conv_real4n = (void *)_base_convolve_real;
 	c.conv_real = (void *)_base_convolve_real;
 
-#ifdef HAVE_SSE3
+#if defined(HAVE_SSE3) && defined(HAVE___BUILTIN_CPU_SUPPORTS)
 	if (__builtin_cpu_supports("sse3")) {
 		c.conv_cmplx_4n = sse_conv_cmplx_4n;
 		c.conv_cmplx_8n = sse_conv_cmplx_8n;

-- 
To view, visit https://gerrit.osmocom.org/2690
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c90402d8e4c9f196c54b066ff30891c8de3ad2b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list