From c9369c5ea1e3358f7c689d8e6a080d0361df88c5 Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Fri, 14 Feb 2025 00:43:59 +0800 Subject: [RV64_DYNAREC] Added a fastpath to SHL/SHR CL opcodes (#2355) --- src/dynarec/rv64/dynarec_rv64_00_3.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dynarec/rv64/dynarec_rv64_00_3.c b/src/dynarec/rv64/dynarec_rv64_00_3.c index a3e4aee6..ff8d67b9 100644 --- a/src/dynarec/rv64/dynarec_rv64_00_3.c +++ b/src/dynarec/rv64/dynarec_rv64_00_3.c @@ -794,9 +794,21 @@ uintptr_t dynarec64_00_3(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int case 6: INST_NAME("SHL Ed, CL"); SETFLAGS(X_ALL, SF_SET_PENDING, NAT_FLAGS_FUSION); // some flags are left undefined + if (!dyn->insts[ninst].x64.gen_flags) { + GETED(0); + SLL(ed, ed, xRCX); + if (dyn->insts[ninst].nat_flags_fusion) { + if (!rex.w) ZEROUP(ed); + NAT_FLAGS_OPS(ed, xZR); + } else if (!rex.w && MODREG) { + ZEROUP(ed); + } + WBACK; + break; + } ANDI(x3, xRCX, rex.w ? 0x3f : 0x1f); GETED(0); - if (!rex.w && MODREG) { ZEROUP(ed); } + if (!rex.w && MODREG) ZEROUP(ed); CBZ_NEXT(x3); emit_shl32(dyn, ninst, rex, ed, x3, x5, x4, x6); WBACK; @@ -804,6 +816,18 @@ uintptr_t dynarec64_00_3(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int case 5: INST_NAME("SHR Ed, CL"); SETFLAGS(X_ALL, SF_SET_PENDING, NAT_FLAGS_FUSION); // some flags are left undefined + if (!dyn->insts[ninst].x64.gen_flags) { + GETED(0); + SRL(ed, ed, xRCX); + if (dyn->insts[ninst].nat_flags_fusion) { + if (!rex.w) ZEROUP(ed); + NAT_FLAGS_OPS(ed, xZR); + } else if (!rex.w && MODREG) { + ZEROUP(ed); + } + WBACK; + break; + } ANDI(x3, xRCX, rex.w ? 0x3f : 0x1f); GETED(0); if (!rex.w && MODREG) { ZEROUP(ed); } -- cgit 1.4.1