summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Gekko.h39
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp33
2 files changed, 33 insertions, 39 deletions
diff --git a/Source/Core/Core/PowerPC/Gekko.h b/Source/Core/Core/PowerPC/Gekko.h
index d776e53a5c..f0b219616e 100644
--- a/Source/Core/Core/PowerPC/Gekko.h
+++ b/Source/Core/Core/PowerPC/Gekko.h
@@ -7,6 +7,7 @@
#pragma once
+#include "Common/BitField.h"
#include "Common/CommonTypes.h"
// --- Gekko Instruction ---
@@ -300,25 +301,28 @@ union UGeckoInstruction
// --- Gekko Special Registers ---
//
+// quantize types
+enum EQuantizeType : u32
+{
+ QUANTIZE_FLOAT = 0,
+ QUANTIZE_U8 = 4,
+ QUANTIZE_U16 = 5,
+ QUANTIZE_S8 = 6,
+ QUANTIZE_S16 = 7,
+};
// GQR Register
union UGQR
{
+ BitField< 0, 3, EQuantizeType> st_type;
+ BitField< 8, 6, u32> st_scale;
+ BitField<16, 3, EQuantizeType> ld_type;
+ BitField<24, 6, u32> ld_scale;
+
u32 Hex;
- struct
- {
- u32 ST_TYPE : 3;
- u32 : 5;
- u32 ST_SCALE : 6;
- u32 : 2;
- u32 LD_TYPE : 3;
- u32 : 5;
- u32 LD_SCALE : 6;
- u32 : 2;
- };
UGQR(u32 _hex) { Hex = _hex; }
- UGQR() {Hex = 0; }
+ UGQR() { Hex = 0; }
};
// FPU Register
@@ -723,17 +727,6 @@ union UReg_PTE
// --- Gekko Types and Defs ---
//
-
-// quantize types
-enum EQuantizeType
-{
- QUANTIZE_FLOAT = 0,
- QUANTIZE_U8 = 4,
- QUANTIZE_U16 = 5,
- QUANTIZE_S8 = 6,
- QUANTIZE_S16 = 7,
-};
-
// branches
enum
{
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
index 5299f5056c..760f61b429 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
@@ -136,10 +136,11 @@ float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quant
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 EQuantizeType ldType = 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;
+ printf("psq_l at offset %d\n", _inst.SIMM_12);
int c = 4;
if (ldType == QUANTIZE_U8 || ldType == QUANTIZE_S8)
@@ -173,8 +174,8 @@ void Interpreter::psq_l(UGeckoInstruction _inst)
void Interpreter::psq_lu(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 EQuantizeType ldType = gqr.ld_type;
+ const unsigned int ldScale = gqr.ld_scale;
const u32 EA = m_GPR[_inst.RA] + _inst.SIMM_12;
int c = 4;
@@ -210,8 +211,8 @@ void Interpreter::psq_lu(UGeckoInstruction _inst)
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 EQuantizeType stType = 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;
@@ -235,8 +236,8 @@ void Interpreter::psq_st(UGeckoInstruction _inst)
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 EQuantizeType stType = gqr.st_type;
+ const unsigned int stScale = gqr.st_scale;
const u32 EA = m_GPR[_inst.RA] + _inst.SIMM_12;
int c = 4;
@@ -264,8 +265,8 @@ void Interpreter::psq_stu(UGeckoInstruction _inst)
void Interpreter::psq_lx(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 EQuantizeType ldType = gqr.ld_type;
+ const unsigned int ldScale = gqr.ld_scale;
const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + m_GPR[_inst.RB]) : m_GPR[_inst.RB];
int c = 4;
@@ -305,8 +306,8 @@ void Interpreter::psq_lx(UGeckoInstruction _inst)
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 EQuantizeType stType = 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;
@@ -329,8 +330,8 @@ void Interpreter::psq_stx(UGeckoInstruction _inst)
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 EQuantizeType ldType = gqr.ld_type;
+ const unsigned int ldScale = gqr.ld_scale;
const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB];
int c = 4;
@@ -366,8 +367,8 @@ void Interpreter::psq_lux(UGeckoInstruction _inst)
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 EQuantizeType stType = gqr.st_type;
+ const unsigned int stScale = gqr.st_scale;
const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB];
int c = 4;