about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-03 17:57:16 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-03 17:57:16 +0100
commitd5808f6be310d816b18f4f52dd8c4961698a3bf0 (patch)
treed099711dfcdfd4320de029bf971631d0761d5d41 /src
parent2984d3011808e91af9669a2db282e02a5e1f7638 (diff)
downloadbox64-d5808f6be310d816b18f4f52dd8c4961698a3bf0.tar.gz
box64-d5808f6be310d816b18f4f52dd8c4961698a3bf0.zip
[ARM64_DYNAREC] Improved 0F AE opcodes
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/arm64/dynarec_arm64_0f.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_0f.c b/src/dynarec/arm64/dynarec_arm64_0f.c
index a492f285..04573bd4 100644
--- a/src/dynarec/arm64/dynarec_arm64_0f.c
+++ b/src/dynarec/arm64/dynarec_arm64_0f.c
@@ -1687,42 +1687,40 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
 

         case 0xAE:

             nextop = F8;

-            if((nextop&0xF8)==0xE8) {

-                INST_NAME("LFENCE");

-                SMDMB();

-            } else

-            if((nextop&0xF8)==0xF0) {

-                INST_NAME("MFENCE");

-                SMDMB();

-            } else

-            if((nextop&0xF8)==0xF8) {

-                INST_NAME("SFENCE");

-                SMDMB();

-            } else {

+            if(MODREG)

+                switch (nextop) {

+                    case 0xE8:

+                        INST_NAME("LFENCE");

+                        SMDMB();

+                        break;

+                    case 0xF0:

+                        INST_NAME("MFENCE");

+                        SMDMB();

+                        break;

+                    case 0xF8:

+                        INST_NAME("SFENCE");

+                        SMDMB();

+                        break;

+                    default:

+                        DEFAULT;

+                }

+            else

                 switch((nextop>>3)&7) {

                     case 0:

                         INST_NAME("FXSAVE Ed");

                         MESSAGE(LOG_DUMP, "Need Optimization\n");

                         fpu_purgecache(dyn, ninst, 0, x1, x2, x3);

-                        if(MODREG) {

-                            DEFAULT;

-                        } else {

-                            addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, NULL, 0, 0, rex, NULL, 0, 0);

-                            if(ed!=x1) {MOVx_REG(x1, ed);}

-                            CALL(rex.w?((void*)fpu_fxsave64):((void*)fpu_fxsave32), -1);

-                        }

+                        addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, NULL, 0, 0, rex, NULL, 0, 0);

+                        if(ed!=x1) {MOVx_REG(x1, ed);}

+                        CALL(rex.w?((void*)fpu_fxsave64):((void*)fpu_fxsave32), -1);

                         break;

                     case 1:

                         INST_NAME("FXRSTOR Ed");

                         MESSAGE(LOG_DUMP, "Need Optimization\n");

                         fpu_purgecache(dyn, ninst, 0, x1, x2, x3);

-                        if(MODREG) {

-                            DEFAULT;

-                        } else {

-                            addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, NULL, 0, 0, rex, NULL, 0, 0);

-                            if(ed!=x1) {MOVx_REG(x1, ed);}

-                            CALL(rex.w?((void*)fpu_fxrstor64):((void*)fpu_fxrstor32), -1);

-                        }

+                        addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, NULL, 0, 0, rex, NULL, 0, 0);

+                        if(ed!=x1) {MOVx_REG(x1, ed);}

+                        CALL(rex.w?((void*)fpu_fxrstor64):((void*)fpu_fxrstor32), -1);

                         break;

                     case 2:

                         INST_NAME("LDMXCSR Md");

@@ -1755,7 +1753,6 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
                     default:

                         DEFAULT;

                 }

-            }

             break;

         case 0xAF:

             INST_NAME("IMUL Gd, Ed");