Merge pull request #1127 from Sonicadvance1/QGR-BitField
Change the QGR union over to a BitField union.
This commit is contained in:
commit
30d77b38c5
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue