Commit 3bc25406 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Define CPU capabilities for AVX, AVX2, XOP and FMA4

parent 0fbbb451
......@@ -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
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment