FPURoundMode.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "Common/CommonTypes.h"
  6. namespace FPURoundMode
  7. {
  8. // TODO: MSVC currently produces broken code:
  9. // https://connect.microsoft.com/VisualStudio/feedback/details/828892/vc-2013-miscompilation-with-enums-and-bit-fields
  10. // Once that is fixed, change types in SetRoundMode(), SetSIMDMode(), and in UReg_FPSCR to 'RoundMode'.
  11. enum RoundMode
  12. {
  13. ROUND_NEAR = 0,
  14. ROUND_CHOP = 1,
  15. ROUND_UP = 2,
  16. ROUND_DOWN = 3
  17. };
  18. enum PrecisionMode
  19. {
  20. PREC_24 = 0,
  21. PREC_53 = 1,
  22. PREC_64 = 2
  23. };
  24. void SetRoundMode(int mode);
  25. void SetPrecisionMode(PrecisionMode mode);
  26. void SetSIMDMode(int rounding_mode, bool non_ieee_mode);
  27. /*
  28. * There are two different flavors of float to int conversion:
  29. * _mm_cvtps_epi32() and _mm_cvttps_epi32().
  30. *
  31. * The first rounds according to the MXCSR rounding bits.
  32. * The second one always uses round towards zero.
  33. */
  34. void SaveSIMDState();
  35. void LoadSIMDState();
  36. void LoadDefaultSIMDState();
  37. }