]> git.sesse.net Git - vlc/blobdiff - src/misc/cpu.c
SSE3 detection (runtime)
[vlc] / src / misc / cpu.c
index 615484cbef4af059d994c1b5fac5849042b67eb9..9ca2ab8bf69cce8d53f93e7ee3451686c50407b3 100644 (file)
@@ -201,6 +201,24 @@ uint32_t CPUCapabilities( void )
     }
 # endif
 
+# if defined (__SSE3__)
+    i_capabilities |= CPU_CAPABILITY_SSE3;
+# elif defined (CAN_COMPILE_SSE3)
+    if( i_ecx & 0x00000001 )
+    {
+        /* We test if OS supports the SSE3 instructions */
+        pid_t pid = fork();
+        if( pid == 0 )
+        {
+            /* Test a SSE3 instruction */
+            __asm__ __volatile__ ( "movsldup %%xmm1, %%xmm0\n" : : );
+            exit(0);
+        }
+        if( check_OS_capability( "SSE3", pid ) )
+            i_capabilities |= CPU_CAPABILITY_SSE3;
+    }
+# endif
+
     /* test for additional capabilities */
     cpuid( 0x80000000 );