mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 15:40:02 +00:00
Merge pull request #6774 from lioncash/enum
Interpreter_FPUtils: Make FPCC enum an enum class
This commit is contained in:
commit
b007210761
@ -17,7 +17,7 @@
|
|||||||
constexpr double PPC_NAN = std::numeric_limits<double>::quiet_NaN();
|
constexpr double PPC_NAN = std::numeric_limits<double>::quiet_NaN();
|
||||||
|
|
||||||
// the 4 less-significand bits in FPSCR[FPRF]
|
// the 4 less-significand bits in FPSCR[FPRF]
|
||||||
enum FPCC
|
enum class FPCC
|
||||||
{
|
{
|
||||||
FL = 8, // <
|
FL = 8, // <
|
||||||
FG = 4, // >
|
FG = 4, // >
|
||||||
|
@ -20,11 +20,11 @@ void Interpreter::Helper_UpdateCR1()
|
|||||||
|
|
||||||
void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction inst, double fa, double fb)
|
void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction inst, double fa, double fb)
|
||||||
{
|
{
|
||||||
int compareResult;
|
FPCC compare_result;
|
||||||
|
|
||||||
if (std::isnan(fa) || std::isnan(fb))
|
if (std::isnan(fa) || std::isnan(fb))
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FU;
|
compare_result = FPCC::FU;
|
||||||
if (MathUtil::IsSNAN(fa) || MathUtil::IsSNAN(fb))
|
if (MathUtil::IsSNAN(fa) || MathUtil::IsSNAN(fb))
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXSNAN);
|
SetFPException(FPSCR_VXSNAN);
|
||||||
@ -40,30 +40,32 @@ void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction inst, double fa,
|
|||||||
}
|
}
|
||||||
else if (fa < fb)
|
else if (fa < fb)
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FL;
|
compare_result = FPCC::FL;
|
||||||
}
|
}
|
||||||
else if (fa > fb)
|
else if (fa > fb)
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FG;
|
compare_result = FPCC::FG;
|
||||||
}
|
}
|
||||||
else // Equals
|
else // Equals
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FE;
|
compare_result = FPCC::FE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear and set the FPCC bits accordingly.
|
const u32 compare_value = static_cast<u32>(compare_result);
|
||||||
FPSCR.FPRF = (FPSCR.FPRF & ~0xF) | compareResult;
|
|
||||||
|
|
||||||
PowerPC::SetCRField(inst.CRFD, compareResult);
|
// Clear and set the FPCC bits accordingly.
|
||||||
|
FPSCR.FPRF = (FPSCR.FPRF & ~0xF) | compare_value;
|
||||||
|
|
||||||
|
PowerPC::SetCRField(inst.CRFD, compare_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction inst, double fa, double fb)
|
void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction inst, double fa, double fb)
|
||||||
{
|
{
|
||||||
int compareResult;
|
FPCC compare_result;
|
||||||
|
|
||||||
if (std::isnan(fa) || std::isnan(fb))
|
if (std::isnan(fa) || std::isnan(fb))
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FU;
|
compare_result = FPCC::FU;
|
||||||
|
|
||||||
if (MathUtil::IsSNAN(fa) || MathUtil::IsSNAN(fb))
|
if (MathUtil::IsSNAN(fa) || MathUtil::IsSNAN(fb))
|
||||||
{
|
{
|
||||||
@ -72,21 +74,23 @@ void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction inst, double fa
|
|||||||
}
|
}
|
||||||
else if (fa < fb)
|
else if (fa < fb)
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FL;
|
compare_result = FPCC::FL;
|
||||||
}
|
}
|
||||||
else if (fa > fb)
|
else if (fa > fb)
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FG;
|
compare_result = FPCC::FG;
|
||||||
}
|
}
|
||||||
else // Equals
|
else // Equals
|
||||||
{
|
{
|
||||||
compareResult = FPCC::FE;
|
compare_result = FPCC::FE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear and set the FPCC bits accordingly.
|
const u32 compare_value = static_cast<u32>(compare_result);
|
||||||
FPSCR.FPRF = (FPSCR.FPRF & ~0xF) | compareResult;
|
|
||||||
|
|
||||||
PowerPC::SetCRField(inst.CRFD, compareResult);
|
// Clear and set the FPCC bits accordingly.
|
||||||
|
FPSCR.FPRF = (FPSCR.FPRF & ~0xF) | compare_value;
|
||||||
|
|
||||||
|
PowerPC::SetCRField(inst.CRFD, compare_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::fcmpo(UGeckoInstruction inst)
|
void Interpreter::fcmpo(UGeckoInstruction inst)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user