about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2023-04-20 21:27:38 +0800
committerGitHub <noreply@github.com>2023-04-20 15:27:38 +0200
commit84b0ee2284598a65ef7f727bb27b8c1527e8b5a3 (patch)
tree80dc90fad422643b1457c0222687507212df5eb4 /src
parent4e9005be1489133ff25f75b74dccbb2d316ea673 (diff)
downloadbox64-84b0ee2284598a65ef7f727bb27b8c1527e8b5a3.tar.gz
box64-84b0ee2284598a65ef7f727bb27b8c1527e8b5a3.zip
[RV64_DYNAREC] Added more opcodes (#717)
* Added 66 0F 5A CVTPD2PS opcode

* Fixed 66 0F 14 opcode

* Added 0F 13 MOVLPS opcode
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_0f.c12
-rw-r--r--src/dynarec/rv64/dynarec_rv64_660f.c25
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.h12
3 files changed, 39 insertions, 10 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_0f.c b/src/dynarec/rv64/dynarec_rv64_0f.c
index 40e52e63..47624789 100644
--- a/src/dynarec/rv64/dynarec_rv64_0f.c
+++ b/src/dynarec/rv64/dynarec_rv64_0f.c
@@ -151,6 +151,16 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                 FMVD(v1, v0);
             }
             break;
+        case 0x13:
+            INST_NAME("MOVLPS Ex,Gx");
+            nextop = F8;
+            GETGX(x1);
+            GETEX(x2, 0);
+            LD(x3, gback, 0);
+            SD(x3, wback, fixedaddress+0);
+            if(!MODREG)
+                SMWRITE2();
+            break;
         case 0x14:
             INST_NAME("UNPCKLPS Gx,Ex");
             nextop = F8;
@@ -191,8 +201,8 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             SD(x4, gback, 8);
             break;
         case 0x17:
-            nextop = F8;
             INST_NAME("MOVHPS Ex,Gx");
+            nextop = F8;
             GETGX(x1);
             GETEX(x2, 0);
             LD(x4, gback, 8);
diff --git a/src/dynarec/rv64/dynarec_rv64_660f.c b/src/dynarec/rv64/dynarec_rv64_660f.c
index 962ddce3..1f2babbc 100644
--- a/src/dynarec/rv64/dynarec_rv64_660f.c
+++ b/src/dynarec/rv64/dynarec_rv64_660f.c
@@ -69,9 +69,11 @@ uintptr_t dynarec64_660F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
         case 0x14:
             INST_NAME("UNPCKLPD Gx, Ex");
             nextop = F8;
-            GETEXSD(d0, 0);
-            GETGX(x3);
-            FSD(d0, x3, 8);
+            GETGX(x1);
+            GETEX(x2, 0);
+            // GX->q[1] = EX->q[0];
+            LD(x3, wback, fixedaddress+0);
+            SD(x3, gback, 8);
             break;
         case 0x15:
             INST_NAME("UNPCKHPD Gx, Ex");
@@ -397,6 +399,23 @@ uintptr_t dynarec64_660F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
                 }
             });
             break;
+        case 0x5A:
+            INST_NAME("CVTPD2PS Gx, Ex");
+            nextop = F8;
+            GETGX(x1);
+            GETEX(x2, 0);
+            d0 = fpu_get_scratch(dyn);
+            // GX->f[0] = EX->d[0];
+            FLD(d0, wback, fixedaddress+0);
+            FCVTSD(d0, d0);
+            FSD(d0, gback, 0);
+            // GX->f[1] = EX->d[1];
+            FLD(d0, wback, fixedaddress+8);
+            FCVTSD(d0, d0);
+            FSD(d0, gback, 4);
+            // GX->q[1] = 0;
+            SD(xZR, gback, 8);
+            break;
         case 0x5C:
             INST_NAME("SUBPD Gx, Ex");
             nextop = F8;
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h
index 76792594..2785ce99 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.h
+++ b/src/dynarec/rv64/dynarec_rv64_helper.h
@@ -266,20 +266,20 @@
 // Generic get GD, but reg value in gd (R_RAX is not added)
 #define GETG        gd = ((nextop&0x38)>>3)+(rex.r<<3)
 
-// Get GX as a Single (might use x1)
+// Get GX as a Single (might use x2)
 #define GETGXSS(a)                      \
     gd = ((nextop&0x38)>>3)+(rex.r<<3); \
-    a = sse_get_reg(dyn, ninst, x1, gd, 1)
+    a = sse_get_reg(dyn, ninst, x2, gd, 1)
 
-// Get GX as a Single (might use x1), no fetching old value
+// Get GX as a Single (might use x2), no fetching old value
 #define GETGXSS_empty(a)                \
     gd = ((nextop&0x38)>>3)+(rex.r<<3); \
-    a = sse_get_reg_empty(dyn, ninst, x1, gd, 1)
+    a = sse_get_reg_empty(dyn, ninst, x2, gd, 1)
 
-// Get GX as a Double (might use x1)
+// Get GX as a Double (might use x2)
 #define GETGXSD(a)                      \
     gd = ((nextop&0x38)>>3)+(rex.r<<3); \
-    a = sse_get_reg(dyn, ninst, x1, gd, 0)
+    a = sse_get_reg(dyn, ninst, x2, gd, 0)
 
 // Get GX as a Double (might use x2), no fetching old value
 #define GETGXSD_empty(a)                \