GTE: Fix MVMVA flags due to missing 43-bit-sign-extend

This commit is contained in:
Connor McLaughlin
2019-09-28 15:18:50 +10:00
parent d3893bc9f2
commit 8841934009
4 changed files with 69 additions and 42 deletions

View File

@ -35,15 +35,22 @@ private:
static constexpr s32 IR123_MIN_VALUE = -(INT64_C(1) << 15);
static constexpr s32 IR123_MAX_VALUE = (INT64_C(1) << 15) - 1;
// Checks for underflow/overflow. Returns the value untouched so it can be threaded through an expression.
// Checks for underflow/overflow.
template<u32 index>
s64 CheckMACResult(s64 value);
void CheckMACOverflow(s64 value);
// Checks for underflow/overflow, sign-extending to 31/43 bits.
template<u32 index>
s64 SignExtendMACResult(s64 value);
template<u32 index>
s64 TruncateAndSetMAC(s64 value, u8 shift);
void TruncateAndSetMAC(s64 value, u8 shift);
template<u32 index>
s16 TruncateAndSetIR(s32 value, bool lm);
void TruncateAndSetMACAndIR(s64 value, u8 shift, bool lm);
template<u32 index>
void TruncateAndSetIR(s32 value, bool lm);
template<u32 index>
u8 TruncateRGB(s32 value);
@ -55,7 +62,7 @@ private:
// 3x3 matrix * 3x1 vector, updates MAC[1-3] and IR[1-3]
void MulMatVec(const s16 M[3][3], const s16 Vx, const s16 Vy, const s16 Vz, u8 shift, bool lm);
// 3x3 matrix * 3x1 vector with translation, updates MAC[1-3] and IR[1-3]
void MulMatVec(const s16 M[3][3], const s32 T[3], const s16 Vx, const s16 Vy, const s16 Vz, u8 shift, bool lm);