Merge pull request #15228 from unknownbrackets/vrndf

Correct vrndf2 range
This commit is contained in:
Henrik Rydgård 2021-12-12 08:46:35 +01:00 committed by GitHub
commit 3ece12bb64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1549,10 +1549,11 @@ namespace MIPSInt
VectorSize sz = GetVecSize(op);
int n = GetNumVectorElements(sz);
for (int i = 0; i < n; i++) {
// TODO: Make more accurate, use and update RCX regs?
switch ((op >> 16) & 0x1f) {
case 1: d.u[i] = currentMIPS->rng.R32(); break; // vrndi
case 2: d.f[i] = 1.0f + ((float)currentMIPS->rng.R32() / 0xFFFFFFFF); break; // vrndf1 TODO: make more accurate
case 3: d.f[i] = 2.0f + 2 * ((float)currentMIPS->rng.R32() / 0xFFFFFFFF); break; // vrndf2 TODO: make more accurate
case 2: d.u[i] = 0x3F800000 | (currentMIPS->rng.R32() & 0x007FFFFF); break; // vrndf1 (>= 1, < 2)
case 3: d.u[i] = 0x40000000 | (currentMIPS->rng.R32() & 0x007FFFFF); break; // vrndf2 (>= 2, < 4)
default: _dbg_assert_msg_(false,"Trying to interpret instruction that can't be interpreted");
}
}