cpu.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef AVUTIL_X86_CPU_H
  19. #define AVUTIL_X86_CPU_H
  20. #include "config.h"
  21. #include "libavutil/cpu.h"
  22. #define CPUEXT(flags, suffix, cpuext) \
  23. (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
  24. #define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
  25. #define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
  26. #define EXTERNAL_AMD3DNOW(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOW)
  27. #define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOWEXT)
  28. #define EXTERNAL_MMX(flags) CPUEXT(flags, _EXTERNAL, MMX)
  29. #define EXTERNAL_MMXEXT(flags) CPUEXT(flags, _EXTERNAL, MMXEXT)
  30. #define EXTERNAL_SSE(flags) CPUEXT(flags, _EXTERNAL, SSE)
  31. #define EXTERNAL_SSE2(flags) CPUEXT(flags, _EXTERNAL, SSE2)
  32. #define EXTERNAL_SSE3(flags) CPUEXT(flags, _EXTERNAL, SSE3)
  33. #define EXTERNAL_SSSE3(flags) CPUEXT(flags, _EXTERNAL, SSSE3)
  34. #define EXTERNAL_SSE4(flags) CPUEXT(flags, _EXTERNAL, SSE4)
  35. #define EXTERNAL_SSE42(flags) CPUEXT(flags, _EXTERNAL, SSE42)
  36. #define EXTERNAL_AVX(flags) CPUEXT(flags, _EXTERNAL, AVX)
  37. #define EXTERNAL_FMA4(flags) CPUEXT(flags, _EXTERNAL, FMA4)
  38. #define INLINE_AMD3DNOW(flags) CPUEXT(flags, _INLINE, AMD3DNOW)
  39. #define INLINE_AMD3DNOWEXT(flags) CPUEXT(flags, _INLINE, AMD3DNOWEXT)
  40. #define INLINE_MMX(flags) CPUEXT(flags, _INLINE, MMX)
  41. #define INLINE_MMXEXT(flags) CPUEXT(flags, _INLINE, MMXEXT)
  42. #define INLINE_SSE(flags) CPUEXT(flags, _INLINE, SSE)
  43. #define INLINE_SSE2(flags) CPUEXT(flags, _INLINE, SSE2)
  44. #define INLINE_SSE3(flags) CPUEXT(flags, _INLINE, SSE3)
  45. #define INLINE_SSSE3(flags) CPUEXT(flags, _INLINE, SSSE3)
  46. #define INLINE_SSE4(flags) CPUEXT(flags, _INLINE, SSE4)
  47. #define INLINE_SSE42(flags) CPUEXT(flags, _INLINE, SSE42)
  48. #define INLINE_AVX(flags) CPUEXT(flags, _INLINE, AVX)
  49. #define INLINE_FMA4(flags) CPUEXT(flags, _INLINE, FMA4)
  50. void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
  51. void ff_cpu_xgetbv(int op, int *eax, int *edx);
  52. int ff_cpu_cpuid_test(void);
  53. #endif /* AVUTIL_X86_CPU_H */