2014-02-10 18:54:46 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2013-02-26 19:49:00 +00:00
|
|
|
namespace FPURoundMode
|
2012-12-17 21:01:52 +00:00
|
|
|
{
|
2014-03-09 14:21:50 +00:00
|
|
|
// TODO: MSVC currently produces broken code:
|
|
|
|
// https://connect.microsoft.com/VisualStudio/feedback/details/828892/vc-2013-miscompilation-with-enums-and-bit-fields
|
|
|
|
// Once that is fixed, change types in SetRoundMode(), SetSIMDMode(), and in UReg_FPSCR to 'RoundMode'.
|
|
|
|
|
|
|
|
enum RoundMode
|
2013-02-26 19:49:00 +00:00
|
|
|
{
|
|
|
|
ROUND_NEAR = 0,
|
2014-02-23 13:57:31 +00:00
|
|
|
ROUND_CHOP = 1,
|
|
|
|
ROUND_UP = 2,
|
|
|
|
ROUND_DOWN = 3
|
2013-02-26 19:49:00 +00:00
|
|
|
};
|
2014-03-09 14:21:50 +00:00
|
|
|
enum PrecisionMode
|
2014-03-05 06:49:33 +00:00
|
|
|
{
|
2013-02-26 19:49:00 +00:00
|
|
|
PREC_24 = 0,
|
2014-02-23 13:57:31 +00:00
|
|
|
PREC_53 = 1,
|
|
|
|
PREC_64 = 2
|
2013-02-26 19:49:00 +00:00
|
|
|
};
|
|
|
|
|
2014-03-09 14:21:50 +00:00
|
|
|
void SetRoundMode(int mode);
|
|
|
|
|
|
|
|
void SetPrecisionMode(PrecisionMode mode);
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2014-03-09 14:21:50 +00:00
|
|
|
void SetSIMDMode(int rounding_mode, bool non_ieee_mode);
|
2013-02-26 19:49:00 +00:00
|
|
|
|
2013-03-20 01:51:12 +00:00
|
|
|
/*
|
|
|
|
* There are two different flavors of float to int conversion:
|
2013-10-29 05:23:17 +00:00
|
|
|
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
2013-03-20 01:51:12 +00:00
|
|
|
*
|
|
|
|
* The first rounds according to the MXCSR rounding bits.
|
|
|
|
* The second one always uses round towards zero.
|
2013-02-26 19:49:00 +00:00
|
|
|
*/
|
|
|
|
void SaveSIMDState();
|
|
|
|
void LoadSIMDState();
|
|
|
|
void LoadDefaultSIMDState();
|
|
|
|
}
|