void Interpreter::psq_stux(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix)); const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE); const unsigned int stScale = gqr.ST_SCALE; const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB]; int c = 4; if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8) c = 0x1; else if (stType == QUANTIZE_U16 || stType == QUANTIZE_S16) c = 0x2; if (_inst.Wx == 0) { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); Helper_Quantize(EA + c, rPS1(_inst.RS), stType, stScale); } else { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); } if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } m_GPR[_inst.RA] = EA; } // namespace=======
// TODO: is this right? // FIXME: Should rollback if a DSI occurs void Interpreter::lswx(UGeckoInstruction _inst) { u32 EA = Helper_Get_EA_X(_inst); u32 n = rSPR(SPR_XER) & 0x7F; int r = _inst.RD; int i = 0; if (n > 0) { m_GPR[r] = 0; do { u32 TempValue = Memory::Read_U8(EA) << (24 - i); if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { PanicAlert("DSI exception in lswx."); NOTICE_LOG(POWERPC, "DSI exception in lswx"); return; } m_GPR[r] |= TempValue; EA++; n--; i += 8; if (i == 32) { i = 0; r = (r + 1) & 31; m_GPR[r] = 0; } } while (n > 0); } }
void Interpreter::psq_lux(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix)); const EQuantizeType ldType = static_cast<EQuantizeType>(gqr.LD_TYPE); const unsigned int ldScale = gqr.LD_SCALE; const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB]; int c = 4; if ((ldType == 4) || (ldType == 6)) c = 0x1; if ((ldType == 5) || (ldType == 7)) c = 0x2; if (_inst.Wx == 0) { float ps0 = Helper_Dequantize( EA, ldType, ldScale ); float ps1 = Helper_Dequantize( EA+c, ldType, ldScale ); if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } rPS0(_inst.RS) = ps0; rPS1(_inst.RS) = ps1; } else { float ps0 = Helper_Dequantize( EA, ldType, ldScale ); if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } rPS0(_inst.RS) = ps0; rPS1(_inst.RS) = 1.0f; } m_GPR[_inst.RA] = EA; }
void Interpreter::psq_stu(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.I)); const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE); const unsigned int stScale = gqr.ST_SCALE; const u32 EA = m_GPR[_inst.RA] + _inst.SIMM_12; int c = 4; if ((stType == 4) || (stType == 6)) c = 0x1; if ((stType == 5) || (stType == 7)) c = 0x2; if (_inst.W == 0) { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); Helper_Quantize(EA+c, rPS1(_inst.RS), stType, stScale); } else { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); } if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } m_GPR[_inst.RA] = EA; }
void Interpreter::psq_l(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.I)); const EQuantizeType ldType = static_cast<EQuantizeType>(gqr.LD_TYPE); const unsigned int ldScale = gqr.LD_SCALE; const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12; int c = 4; if ((ldType == QUANTIZE_U8) || (ldType == QUANTIZE_S8)) c = 0x1; if ((ldType == QUANTIZE_U16) || (ldType == QUANTIZE_S16)) c = 0x2; if (_inst.W == 0) { float ps0 = Helper_Dequantize(EA, ldType, ldScale); float ps1 = Helper_Dequantize(EA+c, ldType, ldScale); if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } rPS0(_inst.RS) = ps0; rPS1(_inst.RS) = ps1; } else { float ps0 = Helper_Dequantize(EA, ldType, ldScale); if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) { return; } rPS0(_inst.RS) = ps0; rPS1(_inst.RS) = 1.0f; } }
// TODO: is this right? is it DSI interruptible? void Interpreter::stswx(UGeckoInstruction _inst) { u32 EA = Helper_Get_EA_X(_inst); u32 n = rSPR(SPR_XER) & 0x7F; int r = _inst.RS; int i = 0; while (n > 0) { Memory::Write_U8((m_GPR[r] >> (24 - i)) & 0xFF, EA); EA++; n--; i += 8; if (i == 32) { i = 0; r++; } } }
void Interpreter::psq_stx(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix)); const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE); const unsigned int stScale = gqr.ST_SCALE; const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + m_GPR[_inst.RB]) : m_GPR[_inst.RB]; int c = 4; if ((stType == 4) || (stType == 6)) c = 0x1; if ((stType == 5) || (stType == 7)) c = 0x2; if (_inst.Wx == 0) { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); Helper_Quantize(EA+c, rPS1(_inst.RS), stType, stScale); } else { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); } }
void Interpreter::psq_st(UGeckoInstruction _inst) { const UGQR gqr(rSPR(SPR_GQR0 + _inst.I)); const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE); const unsigned int stScale = gqr.ST_SCALE; const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12; int c = 4; if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8) c = 0x1; else if (stType == QUANTIZE_U16 || stType == QUANTIZE_S16) c = 0x2; if (_inst.W == 0) { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); Helper_Quantize(EA + c, rPS1(_inst.RS), stType, stScale); } else { Helper_Quantize(EA, rPS0(_inst.RS), stType, stScale); } }