Merge pull request #12209 from JosJuice/frsqrte-exp-lsb
PowerPC: Flip the order of frsqrte_expected
This commit is contained in:
commit
1b7a590b4b
|
@ -74,14 +74,14 @@ u32 ClassifyFloat(float fvalue)
|
|||
}
|
||||
|
||||
const std::array<BaseAndDec, 32> frsqrte_expected = {{
|
||||
{0x3ffa000, 0x7a4}, {0x3c29000, 0x700}, {0x38aa000, 0x670}, {0x3572000, 0x5f2},
|
||||
{0x3279000, 0x584}, {0x2fb7000, 0x524}, {0x2d26000, 0x4cc}, {0x2ac0000, 0x47e},
|
||||
{0x2881000, 0x43a}, {0x2665000, 0x3fa}, {0x2468000, 0x3c2}, {0x2287000, 0x38e},
|
||||
{0x20c1000, 0x35e}, {0x1f12000, 0x332}, {0x1d79000, 0x30a}, {0x1bf4000, 0x2e6},
|
||||
{0x1a7e800, 0x568}, {0x17cb800, 0x4f3}, {0x1552800, 0x48d}, {0x130c000, 0x435},
|
||||
{0x10f2000, 0x3e7}, {0x0eff000, 0x3a2}, {0x0d2e000, 0x365}, {0x0b7c000, 0x32e},
|
||||
{0x09e5000, 0x2fc}, {0x0867000, 0x2d0}, {0x06ff000, 0x2a8}, {0x05ab800, 0x283},
|
||||
{0x046a000, 0x261}, {0x0339800, 0x243}, {0x0218800, 0x226}, {0x0105800, 0x20b},
|
||||
{0x3ffa000, 0x7a4}, {0x3c29000, 0x700}, {0x38aa000, 0x670}, {0x3572000, 0x5f2},
|
||||
{0x3279000, 0x584}, {0x2fb7000, 0x524}, {0x2d26000, 0x4cc}, {0x2ac0000, 0x47e},
|
||||
{0x2881000, 0x43a}, {0x2665000, 0x3fa}, {0x2468000, 0x3c2}, {0x2287000, 0x38e},
|
||||
{0x20c1000, 0x35e}, {0x1f12000, 0x332}, {0x1d79000, 0x30a}, {0x1bf4000, 0x2e6},
|
||||
}};
|
||||
|
||||
double ApproximateReciprocalSquareRoot(double val)
|
||||
|
@ -128,13 +128,12 @@ double ApproximateReciprocalSquareRoot(double val)
|
|||
exponent += 1LL << 52;
|
||||
}
|
||||
|
||||
const bool odd_exponent = !(exponent & (1LL << 52));
|
||||
const s64 exponent_lsb = exponent & (1LL << 52);
|
||||
exponent = ((0x3FFLL << 52) - ((exponent - (0x3FELL << 52)) / 2)) & (0x7FFLL << 52);
|
||||
integral = sign | exponent;
|
||||
|
||||
const int i = static_cast<int>(mantissa >> 37);
|
||||
const int index = i / 2048 + (odd_exponent ? 16 : 0);
|
||||
const auto& entry = frsqrte_expected[index];
|
||||
const int i = static_cast<int>((exponent_lsb | mantissa) >> 37);
|
||||
const auto& entry = frsqrte_expected[i / 2048];
|
||||
integral |= static_cast<s64>(entry.m_base - entry.m_dec * (i % 2048)) << 26;
|
||||
|
||||
return BitCast<double>(integral);
|
||||
|
|
|
@ -141,7 +141,6 @@ void CommonAsmRoutines::GenFrsqrte()
|
|||
MOV(64, R(RSCRATCH_EXTRA), R(RSCRATCH));
|
||||
SHR(64, R(RSCRATCH_EXTRA), Imm8(48));
|
||||
AND(32, R(RSCRATCH_EXTRA), Imm8(0x1F));
|
||||
XOR(32, R(RSCRATCH_EXTRA), Imm8(0x10)); // int index = i / 2048 + (odd_exponent ? 16 : 0);
|
||||
|
||||
PUSH(RSCRATCH2);
|
||||
MOV(64, R(RSCRATCH2), ImmPtr(GetConstantFromPool(Common::frsqrte_expected)));
|
||||
|
|
|
@ -343,7 +343,6 @@ void JitArm64::GenerateFrsqrte()
|
|||
AND(ARM64Reg::X2, ARM64Reg::X2, LogicalImm(0x10, 64));
|
||||
MOVP2R(ARM64Reg::X1, &Common::frsqrte_expected);
|
||||
ORR(ARM64Reg::X2, ARM64Reg::X2, ARM64Reg::X3, ArithOption(ARM64Reg::X3, ShiftType::LSR, 48));
|
||||
EOR(ARM64Reg::X2, ARM64Reg::X2, LogicalImm(0x10, 64));
|
||||
ADD(ARM64Reg::X2, ARM64Reg::X1, ARM64Reg::X2, ArithOption(ARM64Reg::X2, ShiftType::LSL, 3));
|
||||
LDP(IndexType::Signed, ARM64Reg::W1, ARM64Reg::W2, ARM64Reg::X2, 0);
|
||||
UBFX(ARM64Reg::X3, ARM64Reg::X3, 37, 11);
|
||||
|
|
Loading…
Reference in New Issue