From 73264b2e80c8aeeb32d5121b0dc11284b4560cae Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Sun, 26 Mar 2023 04:23:46 +0800 Subject: [RV64_DYNAREC] Fixes and some optims (#638) --- src/dynarec/rv64/dynarec_rv64_66.c | 2 +- src/dynarec/rv64/dynarec_rv64_emit_tests.c | 6 ++++-- src/dynarec/rv64/dynarec_rv64_helper.h | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dynarec/rv64/dynarec_rv64_66.c b/src/dynarec/rv64/dynarec_rv64_66.c index 1caf2a74..c59325e2 100644 --- a/src/dynarec/rv64/dynarec_rv64_66.c +++ b/src/dynarec/rv64/dynarec_rv64_66.c @@ -326,7 +326,7 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni GETEW(x1, (opcode==0x81)?2:1); if(opcode==0x81) i16 = F16S; else i16 = F8S; if(i16) { - MOV64xw(x2, i16); + MOV64x(x2, i16); emit_cmp16(dyn, ninst, x1, x2, x3, x4, x5, x6); } else emit_cmp16_0(dyn, ninst, x1, x3, x4); diff --git a/src/dynarec/rv64/dynarec_rv64_emit_tests.c b/src/dynarec/rv64/dynarec_rv64_emit_tests.c index 16a580da..e60ff103 100644 --- a/src/dynarec/rv64/dynarec_rv64_emit_tests.c +++ b/src/dynarec/rv64/dynarec_rv64_emit_tests.c @@ -107,8 +107,10 @@ void emit_cmp16(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4, // It's a cmp, we can't store the result back to s1. SUB(s6, s1, s2); - SLLI(s6, s6, 48); - SRLI(s6, s6, 48); + IFX(X_ALL) { + SLLI(s6, s6, 48); + SRLI(s6, s6, 48); + } IFX_PENDOR0 { SH(s6, xEmu, offsetof(x64emu_t, res)); } diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h index 223fc5a3..4d6a1044 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.h +++ b/src/dynarec/rv64/dynarec_rv64_helper.h @@ -451,7 +451,11 @@ /* cf = bc & (1<<(width-1)) */ \ if ((width) == 8) { \ ANDI(scratch1, scratch2, 0x80); \ + } else if ((width) == 16) { \ + SLLI(scratch2, scratch2, 48); \ + SRLI(scratch1, scratch2, 63); \ } else { \ + if ((width) == 32) { ZEROUP(scratch2); } \ SRLI(scratch1, scratch2, (width)-1); \ if(width!=64) ANDI(scratch1, scratch1, 1); \ } \ -- cgit 1.4.1