Optimizations.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using ARMeilleure.CodeGen.X86;
  2. namespace ARMeilleure
  3. {
  4. public static class Optimizations
  5. {
  6. public static bool AssumeStrictAbiCompliance { get; set; } = true;
  7. public static bool FastFP { get; set; } = true;
  8. public static bool UseSseIfAvailable { get; set; } = true;
  9. public static bool UseSse2IfAvailable { get; set; } = true;
  10. public static bool UseSse3IfAvailable { get; set; } = true;
  11. public static bool UseSsse3IfAvailable { get; set; } = true;
  12. public static bool UseSse41IfAvailable { get; set; } = true;
  13. public static bool UseSse42IfAvailable { get; set; } = true;
  14. public static bool UsePopCntIfAvailable { get; set; } = true;
  15. public static bool UseAvxIfAvailable { get; set; } = true;
  16. public static bool ForceLegacySse
  17. {
  18. get => HardwareCapabilities.ForceLegacySse;
  19. set => HardwareCapabilities.ForceLegacySse = value;
  20. }
  21. internal static bool UseSse => UseSseIfAvailable && HardwareCapabilities.SupportsSse;
  22. internal static bool UseSse2 => UseSse2IfAvailable && HardwareCapabilities.SupportsSse2;
  23. internal static bool UseSse3 => UseSse3IfAvailable && HardwareCapabilities.SupportsSse3;
  24. internal static bool UseSsse3 => UseSsse3IfAvailable && HardwareCapabilities.SupportsSsse3;
  25. internal static bool UseSse41 => UseSse41IfAvailable && HardwareCapabilities.SupportsSse41;
  26. internal static bool UseSse42 => UseSse42IfAvailable && HardwareCapabilities.SupportsSse42;
  27. internal static bool UsePopCnt => UsePopCntIfAvailable && HardwareCapabilities.SupportsPopcnt;
  28. internal static bool UseAvx => UseAvxIfAvailable && HardwareCapabilities.SupportsAvx && !ForceLegacySse;
  29. }
  30. }