shader_jit_a64: Use LDP/STP for address registers (#7225)
Move `address_registers` to be earlier in the `UnitState` structure to allow LDP/STP's 7-bit offset to reach these members. Follow-up of https://github.com/citra-emu/citra/pull/7002#discussion_r1367270804
This commit is contained in:
parent
55e0b02863
commit
ea9f522c0c
@ -132,6 +132,13 @@ static_assert(std::is_standard_layout<GSEmitter>::value, "GSEmitter is not stand
|
|||||||
*/
|
*/
|
||||||
struct UnitState {
|
struct UnitState {
|
||||||
explicit UnitState(GSEmitter* emitter = nullptr);
|
explicit UnitState(GSEmitter* emitter = nullptr);
|
||||||
|
|
||||||
|
// Two Address registers and one loop counter
|
||||||
|
// TODO: How many bits do these actually have?
|
||||||
|
s32 address_registers[3];
|
||||||
|
|
||||||
|
bool conditional_code[2];
|
||||||
|
|
||||||
struct Registers {
|
struct Registers {
|
||||||
// The registers are accessed by the shader JIT using SSE instructions, and are therefore
|
// The registers are accessed by the shader JIT using SSE instructions, and are therefore
|
||||||
// required to be 16-byte aligned.
|
// required to be 16-byte aligned.
|
||||||
@ -150,12 +157,6 @@ struct UnitState {
|
|||||||
} registers;
|
} registers;
|
||||||
static_assert(std::is_trivial_v<Registers>, "Structure is not POD");
|
static_assert(std::is_trivial_v<Registers>, "Structure is not POD");
|
||||||
|
|
||||||
bool conditional_code[2];
|
|
||||||
|
|
||||||
// Two Address registers and one loop counter
|
|
||||||
// TODO: How many bits do these actually have?
|
|
||||||
s32 address_registers[3];
|
|
||||||
|
|
||||||
GSEmitter* emitter_ptr;
|
GSEmitter* emitter_ptr;
|
||||||
|
|
||||||
static std::size_t InputOffset(s32 register_index) {
|
static std::size_t InputOffset(s32 register_index) {
|
||||||
|
@ -632,8 +632,8 @@ void JitShader::Compile_END(Instruction instr) {
|
|||||||
STRB(COND1.toW(), STATE, u32(offsetof(UnitState, conditional_code[1])));
|
STRB(COND1.toW(), STATE, u32(offsetof(UnitState, conditional_code[1])));
|
||||||
|
|
||||||
// Save address/loop registers
|
// Save address/loop registers
|
||||||
STR(ADDROFFS_REG_0.toW(), STATE, u32(offsetof(UnitState, address_registers[0])));
|
STP(ADDROFFS_REG_0.toW(), ADDROFFS_REG_1.toW(), STATE,
|
||||||
STR(ADDROFFS_REG_1.toW(), STATE, u32(offsetof(UnitState, address_registers[1])));
|
u32(offsetof(UnitState, address_registers)));
|
||||||
STR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
|
STR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
|
||||||
|
|
||||||
ABI_PopRegisters(*this, ABI_ALL_CALLEE_SAVED, 16);
|
ABI_PopRegisters(*this, ABI_ALL_CALLEE_SAVED, 16);
|
||||||
@ -942,8 +942,8 @@ void JitShader::Compile(const std::array<u32, MAX_PROGRAM_CODE_LENGTH>* program_
|
|||||||
MOV(STATE, ABI_PARAM2);
|
MOV(STATE, ABI_PARAM2);
|
||||||
|
|
||||||
// Load address/loop registers
|
// Load address/loop registers
|
||||||
LDR(ADDROFFS_REG_0.toW(), STATE, u32(offsetof(UnitState, address_registers[0])));
|
LDP(ADDROFFS_REG_0.toW(), ADDROFFS_REG_1.toW(), STATE,
|
||||||
LDR(ADDROFFS_REG_1.toW(), STATE, u32(offsetof(UnitState, address_registers[1])));
|
u32(offsetof(UnitState, address_registers)));
|
||||||
LDR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
|
LDR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
|
||||||
|
|
||||||
//// Load conditional code
|
//// Load conditional code
|
||||||
|
Loading…
Reference in New Issue
Block a user