From 1d4d42109717a509490aef8df6e754763448d4c9 Mon Sep 17 00:00:00 2001 From: Wunk Date: Tue, 7 Nov 2023 11:46:40 -0800 Subject: [PATCH] shader_jit_a64: Optimize `MOVA` dest-enable (#7122) Rather than branching the 3 cases of dest-enablement, just emit a single move-and-sign-extend instruction for each case. From this review: https://github.com/citra-emu/citra/pull/7002#discussion_r1381560584 --- .../shader/shader_jit_a64_compiler.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/video_core/shader/shader_jit_a64_compiler.cpp b/src/video_core/shader/shader_jit_a64_compiler.cpp index 176a14f26a..99a0c0d091 100644 --- a/src/video_core/shader/shader_jit_a64_compiler.cpp +++ b/src/video_core/shader/shader_jit_a64_compiler.cpp @@ -580,22 +580,13 @@ void JitShader::Compile_MOVA(Instruction instr) { MOV(XSCRATCH0, SRC1.Delem()[0]); // Handle destination enable - if (swiz.DestComponentEnabled(0) && swiz.DestComponentEnabled(1)) { + if (swiz.DestComponentEnabled(0)) { // Move and sign-extend low 32 bits SXTW(ADDROFFS_REG_0, XSCRATCH0.toW()); - + } + if (swiz.DestComponentEnabled(1)) { // Move and sign-extend high 32 bits - LSR(XSCRATCH0, XSCRATCH0, 32); - SXTW(ADDROFFS_REG_1, XSCRATCH0.toW()); - } else { - if (swiz.DestComponentEnabled(0)) { - // Move and sign-extend low 32 bits - SXTW(ADDROFFS_REG_0, XSCRATCH0.toW()); - } else if (swiz.DestComponentEnabled(1)) { - // Move and sign-extend high 32 bits - LSR(XSCRATCH0, XSCRATCH0, 32); - SXTW(ADDROFFS_REG_1, XSCRATCH0.toW()); - } + ASR(ADDROFFS_REG_1, XSCRATCH0, 32); } }