• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVUTIL_X86_CPU_H
20 #define AVUTIL_X86_CPU_H
21 
22 #include "libavutil/cpu.h"
23 #include "libavutil/cpu_internal.h"
24 
25 #define AV_CPU_FLAG_AMD3DNOW    AV_CPU_FLAG_3DNOW
26 #define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
27 
28 #define X86_AMD3DNOW(flags)         CPUEXT(flags, AMD3DNOW)
29 #define X86_AMD3DNOWEXT(flags)      CPUEXT(flags, AMD3DNOWEXT)
30 #define X86_MMX(flags)              CPUEXT(flags, MMX)
31 #define X86_MMXEXT(flags)           CPUEXT(flags, MMXEXT)
32 #define X86_SSE(flags)              CPUEXT(flags, SSE)
33 #define X86_SSE2(flags)             CPUEXT(flags, SSE2)
34 #define X86_SSE2_FAST(flags)        CPUEXT_FAST(flags, SSE2)
35 #define X86_SSE2_SLOW(flags)        CPUEXT_SLOW(flags, SSE2)
36 #define X86_SSE3(flags)             CPUEXT(flags, SSE3)
37 #define X86_SSE3_FAST(flags)        CPUEXT_FAST(flags, SSE3)
38 #define X86_SSE3_SLOW(flags)        CPUEXT_SLOW(flags, SSE3)
39 #define X86_SSSE3(flags)            CPUEXT(flags, SSSE3)
40 #define X86_SSSE3_FAST(flags)       CPUEXT_FAST(flags, SSSE3)
41 #define X86_SSSE3_SLOW(flags)       CPUEXT_SLOW(flags, SSSE3)
42 #define X86_SSE4(flags)             CPUEXT(flags, SSE4)
43 #define X86_SSE42(flags)            CPUEXT(flags, SSE42)
44 #define X86_AVX(flags)              CPUEXT(flags, AVX)
45 #define X86_AVX_FAST(flags)         CPUEXT_FAST(flags, AVX)
46 #define X86_AVX_SLOW(flags)         CPUEXT_SLOW(flags, AVX)
47 #define X86_XOP(flags)              CPUEXT(flags, XOP)
48 #define X86_FMA3(flags)             CPUEXT(flags, FMA3)
49 #define X86_FMA4(flags)             CPUEXT(flags, FMA4)
50 #define X86_AVX2(flags)             CPUEXT(flags, AVX2)
51 #define X86_AESNI(flags)            CPUEXT(flags, AESNI)
52 #define X86_AVX512(flags)           CPUEXT(flags, AVX512)
53 
54 #define EXTERNAL_AMD3DNOW(flags)    CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
55 #define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
56 #define EXTERNAL_MMX(flags)         CPUEXT_SUFFIX(flags, _EXTERNAL, MMX)
57 #define EXTERNAL_MMXEXT(flags)      CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT)
58 #define EXTERNAL_SSE(flags)         CPUEXT_SUFFIX(flags, _EXTERNAL, SSE)
59 #define EXTERNAL_SSE2(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2)
60 #define EXTERNAL_SSE2_FAST(flags)   CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSE2)
61 #define EXTERNAL_SSE2_SLOW(flags)   CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSE2)
62 #define EXTERNAL_SSE3(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3)
63 #define EXTERNAL_SSE3_FAST(flags)   CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSE3)
64 #define EXTERNAL_SSE3_SLOW(flags)   CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSE3)
65 #define EXTERNAL_SSSE3(flags)       CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
66 #define EXTERNAL_SSSE3_FAST(flags)  CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSSE3)
67 #define EXTERNAL_SSSE3_SLOW(flags)  CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSSE3)
68 #define EXTERNAL_SSE4(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
69 #define EXTERNAL_SSE42(flags)       CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
70 #define EXTERNAL_AVX(flags)         CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
71 #define EXTERNAL_AVX_FAST(flags)    CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, AVX)
72 #define EXTERNAL_AVX_SLOW(flags)    CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, AVX)
73 #define EXTERNAL_XOP(flags)         CPUEXT_SUFFIX(flags, _EXTERNAL, XOP)
74 #define EXTERNAL_FMA3(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, FMA3)
75 #define EXTERNAL_FMA3_FAST(flags)   CPUEXT_SUFFIX_FAST2(flags, _EXTERNAL, FMA3, AVX)
76 #define EXTERNAL_FMA3_SLOW(flags)   CPUEXT_SUFFIX_SLOW2(flags, _EXTERNAL, FMA3, AVX)
77 #define EXTERNAL_FMA4(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
78 #define EXTERNAL_AVX2(flags)        CPUEXT_SUFFIX(flags, _EXTERNAL, AVX2)
79 #define EXTERNAL_AVX2_FAST(flags)   CPUEXT_SUFFIX_FAST2(flags, _EXTERNAL, AVX2, AVX)
80 #define EXTERNAL_AVX2_SLOW(flags)   CPUEXT_SUFFIX_SLOW2(flags, _EXTERNAL, AVX2, AVX)
81 #define EXTERNAL_AESNI(flags)       CPUEXT_SUFFIX(flags, _EXTERNAL, AESNI)
82 #define EXTERNAL_AVX512(flags)      CPUEXT_SUFFIX(flags, _EXTERNAL, AVX512)
83 #define EXTERNAL_AVX512ICL(flags)   CPUEXT_SUFFIX(flags, _EXTERNAL, AVX512ICL)
84 
85 #define INLINE_AMD3DNOW(flags)      CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)
86 #define INLINE_AMD3DNOWEXT(flags)   CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT)
87 #define INLINE_MMX(flags)           CPUEXT_SUFFIX(flags, _INLINE, MMX)
88 #define INLINE_MMXEXT(flags)        CPUEXT_SUFFIX(flags, _INLINE, MMXEXT)
89 #define INLINE_SSE(flags)           CPUEXT_SUFFIX(flags, _INLINE, SSE)
90 #define INLINE_SSE2(flags)          CPUEXT_SUFFIX(flags, _INLINE, SSE2)
91 #define INLINE_SSE2_FAST(flags)     CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE2)
92 #define INLINE_SSE2_SLOW(flags)     CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE2)
93 #define INLINE_SSE3(flags)          CPUEXT_SUFFIX(flags, _INLINE, SSE3)
94 #define INLINE_SSE3_FAST(flags)     CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE3)
95 #define INLINE_SSE3_SLOW(flags)     CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE3)
96 #define INLINE_SSSE3(flags)         CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
97 #define INLINE_SSSE3_FAST(flags)    CPUEXT_SUFFIX_FAST(flags, _INLINE, SSSE3)
98 #define INLINE_SSSE3_SLOW(flags)    CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSSE3)
99 #define INLINE_SSE4(flags)          CPUEXT_SUFFIX(flags, _INLINE, SSE4)
100 #define INLINE_SSE42(flags)         CPUEXT_SUFFIX(flags, _INLINE, SSE42)
101 #define INLINE_AVX(flags)           CPUEXT_SUFFIX(flags, _INLINE, AVX)
102 #define INLINE_AVX_FAST(flags)      CPUEXT_SUFFIX_FAST(flags, _INLINE, AVX)
103 #define INLINE_AVX_SLOW(flags)      CPUEXT_SUFFIX_SLOW(flags, _INLINE, AVX)
104 #define INLINE_XOP(flags)           CPUEXT_SUFFIX(flags, _INLINE, XOP)
105 #define INLINE_FMA3(flags)          CPUEXT_SUFFIX(flags, _INLINE, FMA3)
106 #define INLINE_FMA4(flags)          CPUEXT_SUFFIX(flags, _INLINE, FMA4)
107 #define INLINE_AVX2(flags)          CPUEXT_SUFFIX(flags, _INLINE, AVX2)
108 #define INLINE_AESNI(flags)         CPUEXT_SUFFIX(flags, _INLINE, AESNI)
109 
110 void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
111 void ff_cpu_xgetbv(int op, int *eax, int *edx);
112 int  ff_cpu_cpuid_test(void);
113 
114 #endif /* AVUTIL_X86_CPU_H */
115