[vlc-commits] Simplify SSE tests

Rémi Denis-Courmont git at videolan.org
Sun Aug 5 11:36:27 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug  5 12:24:32 2012 +0300| [0fa7047b91016922d104214d8c8b46e8cd308f00] | committer: Rémi Denis-Courmont

Simplify SSE tests

There is no need to test OS support for SSE2, and later. If plain SSE
works, the OS preserves the XMM registers and that's all we care.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0fa7047b91016922d104214d8c8b46e8cd308f00
---

 src/misc/cpu.c |   74 ++++++++++++--------------------------------------------
 1 file changed, 15 insertions(+), 59 deletions(-)

diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index 4bdc4d8..f9927ac 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -99,36 +99,6 @@ VLC_SSE static void SSE_test (void)
     asm volatile ("xorps %%xmm0,%%xmm0\n" : : : "xmm0", "xmm1");
 }
 #endif
-#if defined (CAN_COMPILE_SSE2) && !defined (__SSE2__)
-VLC_SSE static void SSE2_test (void)
-{
-    asm volatile ("movupd %%xmm0, %%xmm0\n" : : : "xmm0", "xmm1");
-}
-#endif
-#if defined (CAN_COMPILE_SSE3) && !defined (__SSE3__)
-VLC_SSE static void SSE3_test (void)
-{
-    asm volatile ("movsldup %%xmm1, %%xmm0\n" : : : "xmm0", "xmm1");
-}
-#endif
-#if defined (CAN_COMPILE_SSSE3) && !defined (__SSSE3__)
-VLC_SSE static void SSSE3_test (void)
-{
-    asm volatile ("pabsw %%xmm1, %%xmm0\n" : : : "xmm0", "xmm1");
-}
-#endif
-#if defined (CAN_COMPILE_SSE4_1) && !defined (__SSE4_1__)
-VLC_SSE static void SSE4_1_test (void)
-{
-    asm volatile ("pmaxsb %%xmm1, %%xmm0\n" : : : "xmm0", "xmm1");
-}
-#endif
-#if defined (CAN_COMPILE_SSE4_2) && !defined (__SSE4_2__)
-VLC_SSE static void SSE4_2_test (void)
-{
-    asm volatile ("pcmpgtq %%xmm1, %%xmm0\n" : : : "xmm0", "xmm1");
-}
-#endif
 #if defined (CAN_COMPILE_3DNOW) && !defined (__3dNOW__)
 VLC_MMX static void ThreeD_Now_test (void)
 {
@@ -224,39 +194,25 @@ void vlc_CPU_init (void)
     i_capabilities |= VLC_CPU_MMX;
 
     if( i_edx & 0x02000000 )
-    {
         i_capabilities |= VLC_CPU_MMXEXT;
-#   ifdef CAN_COMPILE_SSE
-        if (vlc_CPU_check ("SSE", SSE_test))
+# 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;
-#   endif
+        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 defined (CAN_COMPILE_SSE2)
-    if ((i_edx & 0x04000000) && vlc_CPU_check ("SSE2", SSE2_test))
-        i_capabilities |= VLC_CPU_SSE2;
-# endif
-
-# if defined (CAN_COMPILE_SSE3)
-    if ((i_ecx & 0x00000001) && vlc_CPU_check ("SSE3", SSE3_test))
-        i_capabilities |= VLC_CPU_SSE3;
-# endif
-
-# if defined (CAN_COMPILE_SSSE3)
-    if ((i_ecx & 0x00000200) && vlc_CPU_check ("SSSE3", SSSE3_test))
-        i_capabilities |= VLC_CPU_SSSE3;
-# endif
-
-# if defined (CAN_COMPILE_SSE4_1)
-    if ((i_ecx & 0x00080000) && vlc_CPU_check ("SSE4.1", SSE4_1_test))
-        i_capabilities |= VLC_CPU_SSE4_1;
-# endif
-
-# if defined (CAN_COMPILE_SSE4_2)
-    if ((i_ecx & 0x00100000) && vlc_CPU_check ("SSE4.2", SSE4_2_test))
-        i_capabilities |= VLC_CPU_SSE4_2;
-# endif
-
     /* test for additional capabilities */
     cpuid( 0x80000000 );
 



More information about the vlc-commits mailing list