about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-05-18 08:03:16 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-05-18 08:03:16 +0200
commit73619f4d75e2ee502748b641450ebc90398d7fce (patch)
tree1e1c5f4165bb00d58ffa21ad82e5584e8cf1751d /src
parent5228338f97b27b5d2c2de028552a593e1d1f5578 (diff)
downloadbox64-73619f4d75e2ee502748b641450ebc90398d7fce.tar.gz
box64-73619f4d75e2ee502748b641450ebc90398d7fce.zip
[ARM64_DYNAREC] Small optimisation for edge case on a few shift emiter
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/arm64/dynarec_arm64_emit_shift.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_emit_shift.c b/src/dynarec/arm64/dynarec_arm64_emit_shift.c
index e1f88393..5fc6bf9b 100644
--- a/src/dynarec/arm64/dynarec_arm64_emit_shift.c
+++ b/src/dynarec/arm64/dynarec_arm64_emit_shift.c
@@ -133,7 +133,12 @@ void emit_shl32c(dynarec_arm_t* dyn, int ninst, rex_t rex, int s1, uint32_t c, i
             BFCw(xFlags, F_AF, 1);
         }
     IFX(X_PF) {
-        emit_pf(dyn, ninst, s1, s3, s4);
+        if(c>7) {
+            // the 0xff area will be 0, so PF is known
+            MOV32w(s3, 1);
+            BFIw(xFlags, s3, F_PF, 1);
+        } else
+            emit_pf(dyn, ninst, s1, s3, s4);
     }
 }
 
@@ -221,8 +226,8 @@ void emit_shr32c(dynarec_arm_t* dyn, int ninst, rex_t rex, int s1, uint32_t c, i
         BFIw(xFlags, s4, F_ZF, 1);
     }
     IFX(X_SF) {
-        LSRxw(s4, s1, (rex.w)?63:31);
-        BFIx(xFlags, s4, F_SF, 1);
+        // no sign if c>0
+        BFCw(xFlags, F_SF, 1);
     }
     if(box64_dynarec_test)
         IFX(X_AF) {
@@ -612,7 +617,12 @@ void emit_shl16c(dynarec_arm_t* dyn, int ninst, int s1, uint32_t c, int s3, int
             BFCw(xFlags, F_AF, 1);
         }
         IFX(X_PF) {
-            emit_pf(dyn, ninst, s1, s3, s4);
+            if(c>7) {
+                // the 0xff area will be 0, so PF is known
+                MOV32w(s3, 1);
+                BFIw(xFlags, s3, F_PF, 1);
+            } else
+                emit_pf(dyn, ninst, s1, s3, s4);
         }
     } else {
         IFX(X_CF) {