mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06:00
Merge pull request #13666 from tygyh/UnitTests/PowerPC-Use-constant-functions-variables-parameters
UnitTests/PowerPC: Use constant functions, variables and parameters
This commit is contained in:
@ -9,12 +9,12 @@ using namespace JitCommon;
|
|||||||
|
|
||||||
TEST(DivUtils, Signed)
|
TEST(DivUtils, Signed)
|
||||||
{
|
{
|
||||||
SignedMagic m3 = SignedDivisionConstants(3);
|
const SignedMagic m3 = SignedDivisionConstants(3);
|
||||||
SignedMagic m5 = SignedDivisionConstants(5);
|
const SignedMagic m5 = SignedDivisionConstants(5);
|
||||||
SignedMagic m7 = SignedDivisionConstants(7);
|
const SignedMagic m7 = SignedDivisionConstants(7);
|
||||||
SignedMagic minus3 = SignedDivisionConstants(-3);
|
const SignedMagic minus3 = SignedDivisionConstants(-3);
|
||||||
SignedMagic minus5 = SignedDivisionConstants(-5);
|
const SignedMagic minus5 = SignedDivisionConstants(-5);
|
||||||
SignedMagic minus7 = SignedDivisionConstants(-7);
|
const SignedMagic minus7 = SignedDivisionConstants(-7);
|
||||||
|
|
||||||
EXPECT_EQ(0x55555556, m3.multiplier);
|
EXPECT_EQ(0x55555556, m3.multiplier);
|
||||||
EXPECT_EQ(0, m3.shift);
|
EXPECT_EQ(0, m3.shift);
|
||||||
@ -33,11 +33,11 @@ TEST(DivUtils, Signed)
|
|||||||
|
|
||||||
TEST(DivUtils, Unsigned)
|
TEST(DivUtils, Unsigned)
|
||||||
{
|
{
|
||||||
UnsignedMagic m3 = UnsignedDivisionConstants(3);
|
const UnsignedMagic m3 = UnsignedDivisionConstants(3);
|
||||||
UnsignedMagic m5 = UnsignedDivisionConstants(5);
|
const UnsignedMagic m5 = UnsignedDivisionConstants(5);
|
||||||
UnsignedMagic m7 = UnsignedDivisionConstants(7);
|
const UnsignedMagic m7 = UnsignedDivisionConstants(7);
|
||||||
UnsignedMagic m9 = UnsignedDivisionConstants(9);
|
const UnsignedMagic m9 = UnsignedDivisionConstants(9);
|
||||||
UnsignedMagic m19 = UnsignedDivisionConstants(19);
|
const UnsignedMagic m19 = UnsignedDivisionConstants(19);
|
||||||
|
|
||||||
EXPECT_EQ(0xAAAAAAABU, m3.multiplier);
|
EXPECT_EQ(0xAAAAAAABU, m3.multiplier);
|
||||||
EXPECT_EQ(1, m3.shift);
|
EXPECT_EQ(1, m3.shift);
|
||||||
|
@ -57,7 +57,7 @@ TEST(Jit64, ConvertDoubleToSingle)
|
|||||||
Core::DeclareAsCPUThread();
|
Core::DeclareAsCPUThread();
|
||||||
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
||||||
|
|
||||||
TestCommonAsmRoutines routines(Core::System::GetInstance());
|
const TestCommonAsmRoutines routines(Core::System::GetInstance());
|
||||||
|
|
||||||
for (const u64 input : double_test_values)
|
for (const u64 input : double_test_values)
|
||||||
{
|
{
|
||||||
|
@ -64,13 +64,13 @@ TEST(Jit64, Frsqrte)
|
|||||||
Core::DeclareAsCPUThread();
|
Core::DeclareAsCPUThread();
|
||||||
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
||||||
|
|
||||||
TestCommonAsmRoutines routines(Core::System::GetInstance());
|
const TestCommonAsmRoutines routines(Core::System::GetInstance());
|
||||||
|
|
||||||
UReg_FPSCR fpscr;
|
UReg_FPSCR fpscr;
|
||||||
|
|
||||||
for (const u64 ivalue : double_test_values)
|
for (const u64 ivalue : double_test_values)
|
||||||
{
|
{
|
||||||
double dvalue = std::bit_cast<double>(ivalue);
|
const double dvalue = std::bit_cast<double>(ivalue);
|
||||||
|
|
||||||
u64 expected = std::bit_cast<u64>(Common::ApproximateReciprocalSquareRoot(dvalue));
|
u64 expected = std::bit_cast<u64>(Common::ApproximateReciprocalSquareRoot(dvalue));
|
||||||
|
|
||||||
|
@ -98,16 +98,16 @@ public:
|
|||||||
FreeCodeSpace();
|
FreeCodeSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 ConvertSingleToDouble(u32 value) { return convert_single_to_double_lower(value); }
|
u64 ConvertSingleToDouble(const u32 value) const { return convert_single_to_double_lower(value); }
|
||||||
|
|
||||||
Pair<u64> ConvertSingleToDouble(u32 value1, u32 value2)
|
Pair<u64> ConvertSingleToDouble(const u32 value1, const u32 value2) const
|
||||||
{
|
{
|
||||||
return convert_single_to_double_pair(value1, value2);
|
return convert_single_to_double_pair(value1, value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ConvertDoubleToSingle(u64 value) { return convert_double_to_single_lower(value); }
|
u32 ConvertDoubleToSingle(const u64 value) const { return convert_double_to_single_lower(value); }
|
||||||
|
|
||||||
Pair<u32> ConvertDoubleToSingle(u64 value1, u64 value2)
|
Pair<u32> ConvertDoubleToSingle(const u64 value1, const u64 value2) const
|
||||||
{
|
{
|
||||||
return convert_double_to_single_pair(value1, value2);
|
return convert_double_to_single_pair(value1, value2);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ TEST(JitArm64, Frsqrte)
|
|||||||
Core::DeclareAsCPUThread();
|
Core::DeclareAsCPUThread();
|
||||||
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
|
||||||
|
|
||||||
TestFrsqrte test(Core::System::GetInstance());
|
const TestFrsqrte test(Core::System::GetInstance());
|
||||||
|
|
||||||
for (const u64 ivalue : double_test_values)
|
for (const u64 ivalue : double_test_values)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user