Skip to content
Snippets Groups Projects
Commit 04fad74a authored by Lyndon Brown's avatar Lyndon Brown
Browse files

cpu: remove obsolete SSE OS-support test

to use SSE you both need a CPU with the SSE feature, and an OS that has
support for saving the SSE registers during context switches. whilst
detecting SSE CPU support is easy via the `cpuid` instruction and checking
flags, it is not easy to check for OS support which involves trying to use
an SSE instruction in a process fork, and seeing whether or not this
results in SIGILL.

(thankfully cpu designers made things easier for AVX & AVX512).

since SSE support has been around since 1999, and all operating systems
from that time are long since unsupported, we should be able to safely
assume now that SSE OS support is available and thus remove this check.

note, the `vlc_CPU_check()` function is now only used for ppc and only
with `CAN_COMPILE_ALTIVEC` so i've adjusted the preprocessor conditions
accordingly.
parent 9a6c1bcf
No related branches found
No related tags found
No related merge requests found
......@@ -57,9 +57,8 @@
#include <machine/cpu.h>
#endif
#if defined (__i386__) || defined (__x86_64__) || defined (__powerpc__) \
|| defined (__ppc__) || defined (__ppc64__) || defined (__powerpc64__)
# if defined (HAVE_FORK)
#if defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__) || defined (__powerpc64__)
# if defined (HAVE_FORK) && defined (CAN_COMPILE_ALTIVEC)
static bool vlc_CPU_check (const char *name, void (*func) (void))
{
pid_t pid = fork();
......@@ -87,23 +86,14 @@ static bool vlc_CPU_check (const char *name, void (*func) (void))
return false;
}
#if defined (CAN_COMPILE_SSE) && !defined (__SSE__)
VLC_SSE static void SSE_test (void)
{
asm volatile ("xorps %%xmm0,%%xmm0\n" : : : "xmm0", "xmm1");
}
#endif
#if defined (CAN_COMPILE_ALTIVEC)
static void Altivec_test (void)
{
asm volatile ("mtspr 256, %0\n" "vand %%v0, %%v0, %%v0\n" : : "r" (-1));
}
#endif
#else /* _WIN32 || __OS2__ */
# define vlc_CPU_check(name, func) (1)
#endif
# else /* _WIN32 || __OS2__ */
# define vlc_CPU_check(name, func) (1)
# endif
#endif
/**
......@@ -140,23 +130,18 @@ VLC_WEAK unsigned vlc_CPU_raw(void)
cpuid( 0x00000001 );
# if defined (CAN_COMPILE_SSE) && !defined (__SSE__)
if (( i_edx & 0x02000000 ) && vlc_CPU_check ("SSE", SSE_test))
# endif
{
/*if( i_edx & 0x02000000 )*/
i_capabilities |= VLC_CPU_SSE;
if (i_edx & 0x04000000)
i_capabilities |= VLC_CPU_SSE2;
if (i_ecx & 0x00000001)
i_capabilities |= VLC_CPU_SSE3;
if (i_ecx & 0x00000200)
i_capabilities |= VLC_CPU_SSSE3;
if (i_ecx & 0x00080000)
i_capabilities |= VLC_CPU_SSE4_1;
if (i_ecx & 0x00100000)
i_capabilities |= VLC_CPU_SSE4_2;
}
if( i_edx & 0x02000000 )
i_capabilities |= VLC_CPU_SSE;
if (i_edx & 0x04000000)
i_capabilities |= VLC_CPU_SSE2;
if (i_ecx & 0x00000001)
i_capabilities |= VLC_CPU_SSE3;
if (i_ecx & 0x00000200)
i_capabilities |= VLC_CPU_SSSE3;
if (i_ecx & 0x00080000)
i_capabilities |= VLC_CPU_SSE4_1;
if (i_ecx & 0x00100000)
i_capabilities |= VLC_CPU_SSE4_2;
#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __powerpc64__ ) \
|| defined( __ppc64__ )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment