about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-18 18:12:38 +0000
committerptitSeb <sebastien.chev@gmail.com>2023-03-18 18:12:47 +0000
commit8c4c87112cf1813ede0d3b00b19acb6bff7a9e28 (patch)
treebf36af601a3788648f8a35a3abd2fc5b79234af7 /src
parentd052603335ad2a2ff415b4e538103421fa3f150e (diff)
downloadbox64-8c4c87112cf1813ede0d3b00b19acb6bff7a9e28.tar.gz
box64-8c4c87112cf1813ede0d3b00b19acb6bff7a9e28.zip
[RV64_DYNAREC] Some optims on XOR opcodes
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_emit_logic.c14
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_emit_logic.c b/src/dynarec/rv64/dynarec_rv64_emit_logic.c
index 371cbd2d..4d399fd8 100644
--- a/src/dynarec/rv64/dynarec_rv64_emit_logic.c
+++ b/src/dynarec/rv64/dynarec_rv64_emit_logic.c
@@ -40,7 +40,7 @@ void emit_xor32(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, int s
         BGE(s1, xZR, 8);
         ORI(xFlags, xFlags, 1 << F_SF);
     }
-    if (!rex.w) {
+    if (!rex.w && s1!=s2) {
         ZEROUP(s1);
     }
 
@@ -172,15 +172,15 @@ void emit_or32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int64_t c, in
 void emit_and32(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, int s3, int s4)
 {
     CLEAR_FLAGS();
-    IFX_PENDOR0 {
+    IFX(X_PEND) {
         SET_DF(s3, rex.w?d_tst64:d_tst32);
-    } else {
+    } else IFX(X_ALL) {
         SET_DFNONE(s4);
     }
 
     AND(s1, s1, s2); // res = s1 & s2
 
-    IFX_PENDOR0 {
+    IFX(X_PEND) {
         SDxw(s1, xEmu, offsetof(x64emu_t, res));
     }
     IFX(X_SF) {
@@ -202,9 +202,9 @@ void emit_and32(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, int s
 void emit_and32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int64_t c, int s3, int s4)
 {
     CLEAR_FLAGS();
-    IFX_PENDOR0 {
+    IFX(X_PEND) {
         SET_DF(s3, rex.w?d_tst64:d_tst32);
-    } else {
+    } else IFX(X_ALL) {
         SET_DFNONE(s4);
     }
 
@@ -215,7 +215,7 @@ void emit_and32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int64_t c, i
         AND(s1, s1, s3); // res = s1 & s2
     }
 
-    IFX_PENDOR0 {
+    IFX(X_PEND) {
         SDxw(s1, xEmu, offsetof(x64emu_t, res));
     }
     IFX(X_SF) {
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h
index 554847b6..0f1a7c80 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.h
+++ b/src/dynarec/rv64/dynarec_rv64_helper.h
@@ -270,7 +270,7 @@
     LOAD_REG(R11);          \
 
 
-#define SET_DFNONE(S)    if(!dyn->f.dfnone) {MOV_U12(S, d_none); SW(S, xEmu, offsetof(x64emu_t, df)); dyn->f.dfnone=1;}
+#define SET_DFNONE(S)    if(!dyn->f.dfnone) {SW(xZR, xEmu, offsetof(x64emu_t, df)); dyn->f.dfnone=1;}
 #define SET_DF(S, N)     if((N)!=d_none) {MOV_U12(S, (N)); SW(S, xEmu, offsetof(x64emu_t, df)); dyn->f.dfnone=0;} else SET_DFNONE(S)
 #define SET_NODF()          dyn->f.dfnone = 0
 #define SET_DFOK()          dyn->f.dfnone = 1