about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-18 10:12:17 +0000
committerptitSeb <sebastien.chev@gmail.com>2023-03-18 10:12:17 +0000
commit5705e471b7a19ecc1a445316da43a84d308ebb72 (patch)
tree3eb5c1fbc51db97ee4f69c8e302440f06c6d1054 /src
parentd8e30eb79331c84a400c4c02622cc5efbc29d473 (diff)
downloadbox64-5705e471b7a19ecc1a445316da43a84d308ebb72.tar.gz
box64-5705e471b7a19ecc1a445316da43a84d308ebb72.zip
[RV64_DYNAREC] Added 69 IMUL opcode
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_00.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_00.c b/src/dynarec/rv64/dynarec_rv64_00.c
index 70ada069..b654d1a9 100644
--- a/src/dynarec/rv64/dynarec_rv64_00.c
+++ b/src/dynarec/rv64/dynarec_rv64_00.c
@@ -211,6 +211,39 @@ uintptr_t dynarec64_00(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                 PUSH1(x3);
             }
             break;
+        case 0x69:
+            INST_NAME("IMUL Gd, Ed, Id");
+            SETFLAGS(X_ALL, SF_PENDING);
+            nextop = F8;
+            GETGD;
+            GETED(4);
+            i64 = F32S;
+            MOV64xw(x4, i64);
+            if(rex.w) {
+                // 64bits imul
+                UFLAG_IF {
+                    MULH(x3, ed, x4);
+                    MULW(gd, ed, x4);
+                    UFLAG_OP1(x3);
+                    UFLAG_RES(gd);
+                    UFLAG_DF(x3, d_imul64);
+                } else {
+                    MULxw(gd, ed, x4);
+                }
+            } else {
+                // 32bits imul
+                UFLAG_IF {
+                    MUL(gd, ed, x4);
+                    UFLAG_RES(gd);
+                    SRLI(x3, gd, 32);
+                    UFLAG_OP1(x3);
+                    UFLAG_DF(x3, d_imul32);
+                    ZEROUP(gd);
+                } else {
+                    MULxw(gd, ed, x4);
+                }
+            }
+            break;
 
         #define GO(GETFLAGS, NO, YES, F)                                \
             READFLAGS(F);                                               \