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
This commit is contained in:
Vadim Yanitskiy 2017-05-20 01:46:51 +03:00 committed by Tom Tsou
parent ee57357682
commit 3bd763d2a1
3 changed files with 11 additions and 1 deletions

View File

@ -397,18 +397,26 @@ int main(int argc, char *argv[])
#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();

View File

@ -46,6 +46,7 @@ void convert_init(void)
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 @@ void convert_init(void)
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)

View File

@ -82,7 +82,7 @@ void convolve_init(void)
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;