about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2023-06-24 14:14:10 +0800
committerGitHub <noreply@github.com>2023-06-24 08:14:10 +0200
commit0077fbe9163911a07e8db239c5887b1ebcbe27f6 (patch)
tree4c7317e8538c762d9051c9484bd8a05e81d0d74b
parentb263d1a0490a508dbaf6fb0496a7c0ad6fe6e5ed (diff)
downloadbox64-0077fbe9163911a07e8db239c5887b1ebcbe27f6.tar.gz
box64-0077fbe9163911a07e8db239c5887b1ebcbe27f6.zip
[DYNAREC_RV64] Small optim to FLAGS_ADJUST_TO11 (#854)
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h
index a366b09d..0bca2b18 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.h
+++ b/src/dynarec/rv64/dynarec_rv64_helper.h
@@ -614,7 +614,7 @@
 #define STORE_REG(A)    SD(x##A, xEmu, offsetof(x64emu_t, regs[_##A]))
 #define LOAD_REG(A)     LD(x##A, xEmu, offsetof(x64emu_t, regs[_##A]))
 
-// Need to also store current value of some register, as they may be used by functions like setjump
+// Need to also store current value of some register, as they may be used by functions like setjmp
 #define STORE_XEMU_CALL()   \
     STORE_REG(RBX);         \
     STORE_REG(RDX);         \
@@ -694,11 +694,11 @@
 
 // Adjust the xFlags bit 5 -> bit 11, src and dst can be the same (and can be xFlags, but not s1)
 #define FLAGS_ADJUST_TO11(dst, src, s1) \
-    MOV64x(s1, ~(1<<11));               \
-    AND(dst, src, s1);                  \
-    ANDI(s1, dst, 1<<5);                \
-    SLLI(s1, s1, 11-5);                 \
-    ANDI(dst, dst, ~(1<<5));            \
+    LUI(s1, 0xFFFFF);                   \
+    ADDIW(s1, s1, 0x7DF);               \
+    AND(s1, src, s1);                   \
+    ANDI(dst, src, 1<<5);               \
+    SLLI(dst, dst, 11-5);               \
     OR(dst, dst, s1)
 
 #ifndef MAYSETFLAGS