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