1
0
Fork 0

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:
Wunk 2023-12-03 05:07:21 -08:00 committed by GitHub
parent 55e0b02863
commit ea9f522c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -132,6 +132,13 @@ static_assert(std::is_standard_layout<GSEmitter>::value, "GSEmitter is not stand
*/
struct UnitState {
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 {
// The registers are accessed by the shader JIT using SSE instructions, and are therefore
// required to be 16-byte aligned.
@ -150,12 +157,6 @@ struct UnitState {
} registers;
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;
static std::size_t InputOffset(s32 register_index) {

View File

@ -632,8 +632,8 @@ void JitShader::Compile_END(Instruction instr) {
STRB(COND1.toW(), STATE, u32(offsetof(UnitState, conditional_code[1])));
// Save address/loop registers
STR(ADDROFFS_REG_0.toW(), STATE, u32(offsetof(UnitState, address_registers[0])));
STR(ADDROFFS_REG_1.toW(), STATE, u32(offsetof(UnitState, address_registers[1])));
STP(ADDROFFS_REG_0.toW(), ADDROFFS_REG_1.toW(), STATE,
u32(offsetof(UnitState, address_registers)));
STR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
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);
// Load address/loop registers
LDR(ADDROFFS_REG_0.toW(), STATE, u32(offsetof(UnitState, address_registers[0])));
LDR(ADDROFFS_REG_1.toW(), STATE, u32(offsetof(UnitState, address_registers[1])));
LDP(ADDROFFS_REG_0.toW(), ADDROFFS_REG_1.toW(), STATE,
u32(offsetof(UnitState, address_registers)));
LDR(LOOPCOUNT_REG.toW(), STATE, u32(offsetof(UnitState, address_registers[2])));
//// Load conditional code