about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-04-23 18:20:38 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-04-23 18:20:38 +0200
commit223de50ec94de8b0bf0bce39fcd235c74992d135 (patch)
tree7c26ae5d7e695ed49b336b8dfff05a417d54603d
parent5cfad2216584fae41c1575ca4034e2d24f3b0be2 (diff)
downloadbox64-223de50ec94de8b0bf0bce39fcd235c74992d135.tar.gz
box64-223de50ec94de8b0bf0bce39fcd235c74992d135.zip
[INTERP] Fex fixes and small cosmetic changes to some partial (V)MOV opcodes
-rw-r--r--src/emu/x64run0f.c14
-rw-r--r--src/emu/x64run660f.c32
-rw-r--r--src/emu/x64runavx0f.c14
-rw-r--r--src/emu/x64runavx660f.c62
-rw-r--r--src/emu/x64runavxf30f.c5
5 files changed, 80 insertions, 47 deletions
diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c
index a89ac9d2..86d49178 100644
--- a/src/emu/x64run0f.c
+++ b/src/emu/x64run0f.c
@@ -228,16 +228,18 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
             nextop = F8;

             GETEX(0);

             GETGX;

-            if(MODREG)    /* MOVHLPS Gx,Ex */

+            if(MODREG)    /* MOVHLPS Gx, Ex */

                 GX->q[0] = EX->q[1];

             else

-                GX->q[0] = EX->q[0];    /* MOVLPS Gx,Ex */

+                GX->q[0] = EX->q[0];    /* MOVLPS Gx, Ex */

             break;

-        case 0x13:                      /* MOVLPS Ex,Gx */

+        case 0x13:                      /* MOVLPS Ex, Gx */

             nextop = F8;

-            GETEX(0);

-            GETGX;

-            EX->q[0] = GX->q[0];

+            if(!MODREG) {

+                GETEX(0);

+                GETGX;

+                EX->q[0] = GX->q[0];

+            }

             break;

         case 0x14:                      /* UNPCKLPS Gx, Ex */

             nextop = F8;

diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c
index 0ccc466c..b16a276e 100644
--- a/src/emu/x64run660f.c
+++ b/src/emu/x64run660f.c
@@ -137,15 +137,19 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr)
         break;

     case 0x12:                      /* MOVLPD Gx, Eq */

         nextop = F8;

-        GETE8(0);

-        GETGX;

-        GX->q[0] = ED->q[0];

+        if(!MODREG) {

+            GETE8(0);

+            GETGX;

+            GX->q[0] = ED->q[0];

+        }

         break;

     case 0x13:                      /* MOVLPD Eq, Gx */

         nextop = F8;

-        GETE8(0);

-        GETGX;

-        ED->q[0] = GX->q[0];

+        if(!MODREG) {

+            GETE8(0);

+            GETGX;

+            ED->q[0] = GX->q[0];

+        }

         break;

     case 0x14:                      /* UNPCKLPD Gx, Ex */

         nextop = F8;

@@ -162,15 +166,19 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr)
         break;

     case 0x16:                      /* MOVHPD Gx, Ed */

         nextop = F8;

-        GETE8(0);

-        GETGX;

-        GX->q[1] = ED->q[0];

+        if(!MODREG) {

+            GETE8(0);

+            GETGX;

+            GX->q[1] = ED->q[0];

+        }

         break;

     case 0x17:                      /* MOVHPD Ed, Gx */

         nextop = F8;

-        GETE8(0);

-        GETGX;

-        ED->q[0] = GX->q[1];

+        if(!MODREG) {

+            GETE8(0);

+            GETGX;

+            ED->q[0] = GX->q[1];

+        }

         break;

 

     case 0x18:

diff --git a/src/emu/x64runavx0f.c b/src/emu/x64runavx0f.c
index 5412a743..8509f270 100644
--- a/src/emu/x64runavx0f.c
+++ b/src/emu/x64runavx0f.c
@@ -105,9 +105,11 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
             break;
         case 0x13:                      /* VMOVLPS Ex, Gx */
             nextop = F8;
-            GETEX(0);
-            GETGX;
-            EX->q[0] = GX->q[0];
+            if(!MODREG) {
+                GETEX(0);
+                GETGX;
+                EX->q[0] = GX->q[0];
+            }
             break;
         case 0x14:  /* VUNPCKLPS Gx, Vx, Ex */
             nextop = F8;
@@ -155,7 +157,7 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
             if(MODREG) {                /* VMOVLHPS Gx, Vx, Ex */
                 GX->q[1] = EX->q[0];
             } else {
-                GX->q[1] = EX->q[0];    /* MOVHPS Gx,Ex */
+                GX->q[1] = EX->q[0];    /* VMOVHPS Gx, Vx, Ex */
             }
             GX->q[0] = VX->q[0];
             GY->u128 = 0;
@@ -165,6 +167,10 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
             GETEX(0);
             GETGX;
             EX->q[0] = GX->q[1];
+            if(MODREG) {
+                GETEY;
+                EY->u128 = 0;
+            }
             break;
 
         case 0x28:  /* VMOVAPS Gx, Ex */
diff --git a/src/emu/x64runavx660f.c b/src/emu/x64runavx660f.c
index 195d950b..0e440eff 100644
--- a/src/emu/x64runavx660f.c
+++ b/src/emu/x64runavx660f.c
@@ -61,7 +61,7 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
 
     switch(opcode) {
 
-        case 0x10:                      /* MOVUPD Gx, Ex */
+        case 0x10:                      /* VMOVUPD Gx, Ex */
             nextop = F8;
             GETEX(0);
             GETGX;
@@ -73,7 +73,7 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
             } else
                 GY->u128 = 0;
             break;
-        case 0x11:                      /* MOVUPD Ex, Gx */
+        case 0x11:                      /* VMOVUPD Ex, Gx */
             nextop = F8;
             GETEX(0);
             GETGX;
@@ -82,23 +82,30 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
                 GETEY;
                 GETGY;
                 memcpy(EY, GY, 16); // unaligned...
+            } else if(MODREG) {
+                GETEY;
+                EY->u128 = 0;
             }
             break;
         case 0x12:                      /* VMOVLPD Gx, Vx, Eq */
             nextop = F8;
-            GETE8(0);
-            GETGX;
-            GETVX;
-            GETGY;
-            GX->q[0] = ED->q[0];
-            GX->q[1] = VX->q[1];
-            GY->u128 = 0;
+            if(!MODREG) {
+                GETE8(0);
+                GETGX;
+                GETVX;
+                GETGY;
+                GX->q[0] = ED->q[0];
+                GX->q[1] = VX->q[1];
+                GY->u128 = 0;
+            }
             break;
         case 0x13:                      /* VMOVLPD Eq, Gx */
             nextop = F8;
-            GETE8(0);
-            GETGX;
-            ED->q[0] = GX->q[0];
+            if(!MODREG) {
+                GETE8(0);
+                GETGX;
+                ED->q[0] = GX->q[0];
+            }
             break;
         case 0x14:                      /* VUNPCKLPD Gx, Vx, Ex */
             nextop = F8;
@@ -128,19 +135,23 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
             break;
         case 0x16:                      /* VMOVHPD Gx, Vx, Ed */
             nextop = F8;
-            GETE8(0);
-            GETGX;
-            GETVX;
-            GX->q[1] = ED->q[0];
-            GX->q[0] = VX->q[0];
-            GETGY;
-            GY->u128 = 0;
+            if(!MODREG) {
+                GETE8(0);
+                GETGX;
+                GETVX;
+                GX->q[1] = ED->q[0];
+                GX->q[0] = VX->q[0];
+                GETGY;
+                GY->u128 = 0;
+            }
             break;
         case 0x17:                      /* VMOVHPD Ed, Gx */
             nextop = F8;
-            GETE8(0);
-            GETGX;
-            ED->q[0] = GX->q[1];
+            if(!MODREG) {
+                GETE8(0);
+                GETGX;
+                ED->q[0] = GX->q[1];
+            }
             break;
 
         case 0x28:                      /* VMOVAPD Gx, Ex */
@@ -833,7 +844,7 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
                 GETEY;
                 GY->q[0] = EY->q[0];
                 GY->q[1] = EY->q[1];
-            }   else
+            } else
                 GY->u128 = 0;
             break;
         case 0x70:  /* VPSHUFD Gx,Ex,Ib */
@@ -1196,7 +1207,10 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
                 GETEY;
                 EY->q[0] = GY->q[0];
                 EY->q[1] = GY->q[1];
-            } // no upper raz?
+            } else if(MODREG) {
+                GETEY;
+                EY->u128 = 0;
+            }
             break;
 
         case 0xC2:                      /* VCMPPD Gx, Vx, Ex, Ib */
diff --git a/src/emu/x64runavxf30f.c b/src/emu/x64runavxf30f.c
index 9c5e6327..1338e228 100644
--- a/src/emu/x64runavxf30f.c
+++ b/src/emu/x64runavxf30f.c
@@ -432,7 +432,10 @@ uintptr_t RunAVX_F30F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
                 GETGY;
                 GETEY;
                 memcpy(EY, GY, 16);
-            } // no ymm raz here it seems
+            } else if(MODREG) {
+                GETEY;
+                EY->u128 = 0;
+            }
             break;
 
         case 0xC2:  /* VCMPSS Gx, Vx, Ex, Ib */