cpu_detect.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2013 Dolphin Emulator Project / 2015 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <string>
  6. namespace Common {
  7. /// x86/x64 CPU vendors that may be detected by this module
  8. enum class CPUVendor {
  9. INTEL,
  10. AMD,
  11. OTHER,
  12. };
  13. /// x86/x64 CPU capabilities that may be detected by this module
  14. struct CPUCaps {
  15. CPUVendor vendor;
  16. char cpu_string[0x21];
  17. char brand_string[0x41];
  18. int num_cores;
  19. bool sse;
  20. bool sse2;
  21. bool sse3;
  22. bool ssse3;
  23. bool sse4_1;
  24. bool sse4_2;
  25. bool lzcnt;
  26. bool avx;
  27. bool avx2;
  28. bool bmi1;
  29. bool bmi2;
  30. bool fma;
  31. bool fma4;
  32. bool aes;
  33. // Support for the FXSAVE and FXRSTOR instructions
  34. bool fxsave_fxrstor;
  35. bool movbe;
  36. // This flag indicates that the hardware supports some mode in which denormal inputs and outputs
  37. // are automatically set to (signed) zero.
  38. bool flush_to_zero;
  39. // Support for LAHF and SAHF instructions in 64-bit mode
  40. bool lahf_sahf_64;
  41. bool long_mode;
  42. };
  43. /**
  44. * Gets the supported capabilities of the host CPU
  45. * @return Reference to a CPUCaps struct with the detected host CPU capabilities
  46. */
  47. const CPUCaps& GetCPUCaps();
  48. /**
  49. * Gets a string summary of the name and supported capabilities of the host CPU
  50. * @return String summary
  51. */
  52. std::string GetCPUCapsString();
  53. } // namespace Common