]> git.sesse.net Git - vlc/commitdiff
Define CPU capabilities for AVX, AVX2, XOP and FMA4
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 4 Aug 2012 14:27:34 +0000 (17:27 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 4 Aug 2012 14:28:59 +0000 (17:28 +0300)
include/vlc_cpu.h
src/misc/cpu.c

index 83a85be92905074cd9ae2aaf7217fe7daf9d4f39..ec2a8164c5cb7608317687267ab7295af044ffe6 100644 (file)
@@ -40,6 +40,10 @@ VLC_API unsigned vlc_CPU(void);
 #  define VLC_CPU_SSE4_1 1024
 #  define VLC_CPU_SSE4_2 2048
 #  define VLC_CPU_SSE4A  4096
+#  define VLC_CPU_AVX    8192
+#  define VLC_CPU_AVX2   16384
+#  define VLC_CPU_XOP    32768
+#  define VLC_CPU_FMA4   65536
 
 # if defined (__MMX__)
 #  define vlc_CPU_MMX() (1)
@@ -103,12 +107,36 @@ VLC_API unsigned vlc_CPU(void);
 #  define vlc_CPU_SSE4A() ((vlc_CPU() & VLC_CPU_SSE4A) != 0)
 # endif
 
+# ifdef __AVX__
+#  define vlc_CPU_AVX() (1)
+# else
+#  define vlc_CPU_AVX() ((vlc_CPU() & VLC_CPU_AVX) != 0)
+# endif
+
+# ifdef __AVX2__
+#  define vlc_CPU_AVX2() (1)
+# else
+#  define vlc_CPU_AVX2() ((vlc_CPU() & VLC_CPU_AVX2) != 0)
+# endif
+
 # ifdef __3dNOW__
 #  define vlc_CPU_3dNOW() (1)
 # else
 #  define vlc_CPU_3dNOW() ((vlc_CPU() & VLC_CPU_3dNOW) != 0)
 # endif
 
+# ifdef __XOP__
+#  define vlc_CPU_XOP() (1)
+# else
+#  define vlc_CPU_XOP() ((vlc_CPU() & VLC_CPU_XOP) != 0)
+# endif
+
+# ifdef __FMA4__
+#  define vlc_CPU_FMA4() (1)
+# else
+#  define vlc_CPU_FMA4() ((vlc_CPU() & VLC_CPU_FMA4) != 0)
+# endif
+
 # elif defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
 #  define HAVE_FPU 1
 #  define VLC_CPU_ALTIVEC 2
index 6b284a8eaaeee8645bac71aad945dcbc2eed8b39..4923d3e7a4baee0777e96fc35c1921a1340a0ddc 100644 (file)
@@ -330,14 +330,18 @@ void vlc_CPU_dump (vlc_object_t *obj)
 #if defined (__i386__) || defined (__x86_64__)
     if (vlc_CPU_MMX()) p += sprintf (p, "MMX ");
     if (vlc_CPU_MMXEXT()) p += sprintf (p, "MMXEXT ");
-    if (vlc_CPU_SSE()) p += sprintf (p, "SSE ");;
-    if (vlc_CPU_SSE2()) p += sprintf (p, "SSE2 ");;
-    if (vlc_CPU_SSE3()) p += sprintf (p, "SSE2 ");;
-    if (vlc_CPU_SSSE3()) p += sprintf (p, "SSSE3 ");;
-    if (vlc_CPU_SSE4_1()) p += sprintf (p, "SSE4.1 ");;
-    if (vlc_CPU_SSE4_2()) p += sprintf (p, "SSE4.2 ");;
-    if (vlc_CPU_SSE4A()) p += sprintf (p, "SSE4A ");;
-    if (vlc_CPU_3dNOW()) p += sprintf (p, "3DNow! ");;
+    if (vlc_CPU_SSE()) p += sprintf (p, "SSE ");
+    if (vlc_CPU_SSE2()) p += sprintf (p, "SSE2 ");
+    if (vlc_CPU_SSE3()) p += sprintf (p, "SSE2 ");
+    if (vlc_CPU_SSSE3()) p += sprintf (p, "SSSE3 ");
+    if (vlc_CPU_SSE4_1()) p += sprintf (p, "SSE4.1 ");
+    if (vlc_CPU_SSE4_2()) p += sprintf (p, "SSE4.2 ");
+    if (vlc_CPU_SSE4A()) p += sprintf (p, "SSE4A ");
+    if (vlc_CPU_AVX()) p += sprintf (p, "AVX ");
+    if (vlc_CPU_AVX2()) p += sprintf (p, "AVX ");
+    if (vlc_CPU_3dNOW()) p += sprintf (p, "3DNow! ");
+    if (vlc_CPU_XOP()) p += sprintf (p, "XOP ");
+    if (vlc_CPU_FMA4()) p += sprintf (p, "FMA4 ");
 
 #elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
     if (vlc_CPU_ALTIVEC())  p += sprintf (p, "AltiVec");