2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2014-02-10 11:54:46 -07:00
|
|
|
// Refer to the license.txt file included.
|
2012-12-17 14:01:52 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2012-12-17 14:01:52 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2012-12-17 14:01:52 -07:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
namespace FPURoundMode
|
2012-12-17 14:01:52 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06: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
|
|
|
|
{
|
|
|
|
ROUND_NEAR = 0,
|
|
|
|
ROUND_CHOP = 1,
|
|
|
|
ROUND_UP = 2,
|
|
|
|
ROUND_DOWN = 3
|
|
|
|
};
|
|
|
|
enum PrecisionMode
|
|
|
|
{
|
|
|
|
PREC_24 = 0,
|
|
|
|
PREC_53 = 1,
|
|
|
|
PREC_64 = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetRoundMode(int mode);
|
|
|
|
|
|
|
|
void SetPrecisionMode(PrecisionMode mode);
|
|
|
|
|
|
|
|
void SetSIMDMode(int rounding_mode, bool non_ieee_mode);
|
2013-02-26 12:49:00 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
/*
|
|
|
|
* There are two different flavors of float to int conversion:
|
2013-10-28 23:23:17 -06:00
|
|
|
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
2013-03-19 19:51:12 -06:00
|
|
|
*
|
|
|
|
* The first rounds according to the MXCSR rounding bits.
|
|
|
|
* The second one always uses round towards zero.
|
2013-02-26 12:49:00 -07:00
|
|
|
*/
|
2016-06-24 02:43:46 -06:00
|
|
|
void SaveSIMDState();
|
|
|
|
void LoadSIMDState();
|
|
|
|
void LoadDefaultSIMDState();
|
2019-05-05 17:48:12 -06:00
|
|
|
} // namespace FPURoundMode
|