diff --git a/src/dynarec/arm64/dynarec_arm64_00.c b/src/dynarec/arm64/dynarec_arm64_00.c index cafd56329..b711230f2 100644 --- a/src/dynarec/arm64/dynarec_arm64_00.c +++ b/src/dynarec/arm64/dynarec_arm64_00.c @@ -1360,11 +1360,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("MOV Ed, Seg"); nextop=F8; u8 = (nextop&0x38)>>3; - if((nextop&0xC0)==0xC0) { // reg <= seg + if (MODREG) { gd = TO_NAT((nextop & 7) + (rex.b << 3)); LDRH_U12(gd, xEmu, offsetof(x64emu_t, segs[u8])); UXTHw(gd, gd); - } else { // mem <= seg + } else { LDRH_U12(x3, xEmu, offsetof(x64emu_t, segs[u8])); addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, &unscaled, 0xfff<<1, 1, rex, NULL, 0, 0); STH(x3, wback, fixedaddress); @@ -1391,7 +1391,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("MOV Seg,Ew"); nextop = F8; u8 = (nextop&0x38)>>3; - if((nextop&0xC0)==0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/arm64/dynarec_arm64_0f.c b/src/dynarec/arm64/dynarec_arm64_0f.c index e7375bf9c..cdc4b0a27 100644 --- a/src/dynarec/arm64/dynarec_arm64_0f.c +++ b/src/dynarec/arm64/dynarec_arm64_0f.c @@ -337,7 +337,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0x18: nextop = F8; - if((nextop&0xC0)==0xC0) { + if (MODREG) { INST_NAME("NOP (multibyte)"); } else switch((nextop>>3)&7) { @@ -1548,7 +1548,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("MOVD Ed, Gm"); nextop = F8; GETGM(v0); - if((nextop&0xC0)==0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 0x07) + (rex.b << 3)); if(rex.w) { FMOVxD(ed, v0); diff --git a/src/dynarec/arm64/dynarec_arm64_64.c b/src/dynarec/arm64/dynarec_arm64_64.c index a63898611..affde3021 100644 --- a/src/dynarec/arm64/dynarec_arm64_64.c +++ b/src/dynarec/arm64/dynarec_arm64_64.c @@ -945,7 +945,7 @@ uintptr_t dynarec64_64(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin grab_segdata(dyn, addr, ninst, x4, seg); nextop = F8; u8 = (nextop&0x38)>>3; - if((nextop&0xC0)==0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/arm64/dynarec_arm64_66.c b/src/dynarec/arm64/dynarec_arm64_66.c index b9e50d708..b1d66f1c2 100644 --- a/src/dynarec/arm64/dynarec_arm64_66.c +++ b/src/dynarec/arm64/dynarec_arm64_66.c @@ -661,9 +661,9 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin nextop=F8; u8 = (nextop&0x38)>>3; LDRH_U12(x3, xEmu, offsetof(x64emu_t, segs[u8])); - if((nextop&0xC0)==0xC0) { // reg <= seg + if (MODREG) { BFIz(TO_NAT((nextop & 7) + (rex.b << 3)), x3, 0, 16); - } else { // mem <= seg + } else { addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, &unscaled, 0xfff<<1, 1, rex, NULL, 0, 0); STH(x3, wback, fixedaddress); SMWRITE2(); @@ -674,7 +674,7 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("MOV Seg,Ew"); nextop = F8; u8 = (nextop&0x38)>>3; - if((nextop&0xC0)==0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); @@ -689,7 +689,7 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("POP Ew"); nextop = F8; POP1_16(x1); - if((nextop&0xC0)==0xC0) { + if (MODREG) { wback = TO_NAT((nextop & 7) + (rex.b << 3)); BFIz(wback, x1, 0, 16); } else { diff --git a/src/dynarec/arm64/dynarec_arm64_6764_32.c b/src/dynarec/arm64/dynarec_arm64_6764_32.c index 9ca098cf5..71fa7820f 100644 --- a/src/dynarec/arm64/dynarec_arm64_6764_32.c +++ b/src/dynarec/arm64/dynarec_arm64_6764_32.c @@ -135,9 +135,9 @@ uintptr_t dynarec64_6764_32(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, in switch((nextop>>3)&7) { case 6: // Push Ed INST_NAME("PUSH FS:Ew"); - if((nextop&0xC0)==0xC0) { // reg + if (MODREG) { DEFAULT; - } else { // mem <= i32 + } else { SMREAD(); addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, &unscaled, 0, 0, 0); LDRw_REG(x3, ed, x4); diff --git a/src/dynarec/arm64/dynarec_arm64_f0.c b/src/dynarec/arm64/dynarec_arm64_f0.c index f4f0bfe1a..00f8adc80 100644 --- a/src/dynarec/arm64/dynarec_arm64_f0.c +++ b/src/dynarec/arm64/dynarec_arm64_f0.c @@ -60,7 +60,7 @@ uintptr_t dynarec64_F0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin SETFLAGS(X_ALL, SF_SET_PENDING); nextop = F8; GETGB(x2); - if((nextop&0xC0)==0xC0) { + if (MODREG) { if(rex.rex) { wback = TO_NAT((nextop & 0x07) + (rex.b << 3)); wb2 = 0; @@ -147,7 +147,7 @@ uintptr_t dynarec64_F0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin SETFLAGS(X_ALL, SF_SET_PENDING); nextop = F8; GETGB(x2); - if((nextop&0xC0)==0xC0) { + if (MODREG) { if(rex.rex) { wback = TO_NAT((nextop & 0x07) + (rex.b << 3)); wb2 = 0; @@ -865,7 +865,7 @@ uintptr_t dynarec64_F0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin SETFLAGS(X_ALL, SF_SET_PENDING); nextop = F8; GETGB(x2); - if((nextop&0xC0)==0xC0) { + if (MODREG) { if(rex.rex) { wback = TO_NAT((nextop & 0x07) + (rex.b << 3)); wb2 = 0; @@ -1022,7 +1022,7 @@ uintptr_t dynarec64_F0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin SETFLAGS(X_ALL, SF_SET_PENDING); nextop = F8; GETGD; - if((nextop&0xC0)==0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); emit_xor32(dyn, ninst, rex, ed, gd, x3, x4); } else { diff --git a/src/dynarec/arm64/dynarec_arm64_helper.h b/src/dynarec/arm64/dynarec_arm64_helper.h index 3edbec986..0f6f132aa 100644 --- a/src/dynarec/arm64/dynarec_arm64_helper.h +++ b/src/dynarec/arm64/dynarec_arm64_helper.h @@ -74,17 +74,18 @@ LDz(x1, wback, fixedaddress); \ ed = x1; \ } -#define GETEDw(D) if((nextop&0xC0)==0xC0) { \ - ed = xEAX+(nextop&7)+(rex.b<<3); \ - wback = 0; \ - } else { \ - SMREAD(); \ - addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, &unscaled, 0xfff<<2, 3, rex, NULL,0, D); \ - LDW(x1, wback, fixedaddress); \ - ed = x1; \ - } +#define GETEDw(D) \ + if (MODREG) { \ + ed = xEAX + (nextop & 7) + (rex.b << 3); \ + wback = 0; \ + } else { \ + SMREAD(); \ + addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, &unscaled, 0xfff << 2, 3, rex, NULL, 0, D); \ + LDW(x1, wback, fixedaddress); \ + ed = x1; \ + } #define GETSEDw(D) \ - if ((nextop & 0xC0) == 0xC0) { \ + if (MODREG) { \ ed = TO_NAT((nextop & 7) + (rex.b << 3)); \ SXTWx(x1, ed); \ wb = x1; \ @@ -106,7 +107,7 @@ ed = x1; \ } #define GETSED32w(D) \ - if ((nextop & 0xC0) == 0xC0) { \ + if (MODREG) { \ ed = TO_NAT((nextop & 7) + (rex.b << 3)); \ SXTWx(x1, ed); \ wb = x1; \ @@ -211,7 +212,7 @@ ed = x1; \ } #define GETSEDOw(O, D) \ - if ((nextop & 0xC0) == 0xC0) { \ + if (MODREG) { \ ed = TO_NAT((nextop & 7) + (rex.b << 3)); \ SXTWx(x1, ed); \ wb = x1; \ diff --git a/src/dynarec/la64/dynarec_la64_00.c b/src/dynarec/la64/dynarec_la64_00.c index adf19f34c..8a8636676 100644 --- a/src/dynarec/la64/dynarec_la64_00.c +++ b/src/dynarec/la64/dynarec_la64_00.c @@ -1140,9 +1140,9 @@ uintptr_t dynarec64_00(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni case 0x8C: INST_NAME("MOV Ed, Seg"); nextop = F8; - if ((nextop & 0xC0) == 0xC0) { // reg <= seg + if (MODREG) { LD_HU(TO_NAT((nextop & 7) + (rex.b << 3)), xEmu, offsetof(x64emu_t, segs[(nextop & 0x38) >> 3])); - } else { // mem <= seg + } else { addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0); LD_HU(x3, xEmu, offsetof(x64emu_t, segs[(nextop & 0x38) >> 3])); ST_H(x3, ed, fixedaddress); diff --git a/src/dynarec/la64/dynarec_la64_0f.c b/src/dynarec/la64/dynarec_la64_0f.c index d7a0b89bb..f0da22d81 100644 --- a/src/dynarec/la64/dynarec_la64_0f.c +++ b/src/dynarec/la64/dynarec_la64_0f.c @@ -228,7 +228,7 @@ uintptr_t dynarec64_0F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni break; case 0x18: nextop = F8; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { INST_NAME("NOP (multibyte)"); } else switch ((nextop >> 3) & 7) { diff --git a/src/dynarec/la64/dynarec_la64_66.c b/src/dynarec/la64/dynarec_la64_66.c index 70973167b..2cedcf4e4 100644 --- a/src/dynarec/la64/dynarec_la64_66.c +++ b/src/dynarec/la64/dynarec_la64_66.c @@ -501,7 +501,7 @@ uintptr_t dynarec64_66(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni INST_NAME("MOV Seg, Ew"); nextop = F8; u8 = (nextop & 0x38) >> 3; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/la64/dynarec_la64_f0.c b/src/dynarec/la64/dynarec_la64_f0.c index b158a6462..89d85998a 100644 --- a/src/dynarec/la64/dynarec_la64_f0.c +++ b/src/dynarec/la64/dynarec_la64_f0.c @@ -59,7 +59,7 @@ uintptr_t dynarec64_F0(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni nextop = F8; GETGD; SMDMB(); - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); emit_add32(dyn, ninst, rex, ed, gd, x3, x4, x5); } else { diff --git a/src/dynarec/rv64/dynarec_rv64_00_2.c b/src/dynarec/rv64/dynarec_rv64_00_2.c index 2bb44bb2a..4f9941746 100644 --- a/src/dynarec/rv64/dynarec_rv64_00_2.c +++ b/src/dynarec/rv64/dynarec_rv64_00_2.c @@ -465,9 +465,9 @@ uintptr_t dynarec64_00_2(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int case 0x8C: INST_NAME("MOV Ed, Seg"); nextop = F8; - if ((nextop & 0xC0) == 0xC0) { // reg <= seg + if (MODREG) { LHU(TO_NAT((nextop & 7) + (rex.b << 3)), xEmu, offsetof(x64emu_t, segs[(nextop & 0x38) >> 3])); - } else { // mem <= seg + } else { addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0); LHU(x3, xEmu, offsetof(x64emu_t, segs[(nextop & 0x38) >> 3])); SH(x3, ed, fixedaddress); @@ -491,7 +491,7 @@ uintptr_t dynarec64_00_2(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int case 0x8E: INST_NAME("MOV Seg,Ew"); nextop = F8; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/rv64/dynarec_rv64_0f.c b/src/dynarec/rv64/dynarec_rv64_0f.c index 22cc40293..16b414bff 100644 --- a/src/dynarec/rv64/dynarec_rv64_0f.c +++ b/src/dynarec/rv64/dynarec_rv64_0f.c @@ -264,7 +264,7 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni break; case 0x18: nextop = F8; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { INST_NAME("NOP (multibyte)"); } else switch ((nextop >> 3) & 7) { @@ -1641,7 +1641,7 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni nextop = F8; gd = ((nextop & 0x38) >> 3); v0 = mmx_get_reg(dyn, ninst, x1, x2, x3, gd); - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); if (rex.w) FMVXD(ed, v0); diff --git a/src/dynarec/rv64/dynarec_rv64_64.c b/src/dynarec/rv64/dynarec_rv64_64.c index 4b7aaa943..87c2bd619 100644 --- a/src/dynarec/rv64/dynarec_rv64_64.c +++ b/src/dynarec/rv64/dynarec_rv64_64.c @@ -456,7 +456,7 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni grab_segdata(dyn, addr, ninst, x4, seg); nextop = F8; u8 = (nextop & 0x38) >> 3; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/rv64/dynarec_rv64_66.c b/src/dynarec/rv64/dynarec_rv64_66.c index 6c7f98d45..1de9a9b74 100644 --- a/src/dynarec/rv64/dynarec_rv64_66.c +++ b/src/dynarec/rv64/dynarec_rv64_66.c @@ -710,7 +710,7 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni INST_NAME("MOV Ew, Seg"); nextop = F8; LHU(x3, xEmu, offsetof(x64emu_t, segs[(nextop & 0x38) >> 3])); - if ((nextop & 0xC0) == 0xC0) { // reg <= seg + if (MODREG) { INSHz(TO_NAT((nextop & 7) + (rex.b << 3)), x3, x1, x2, 1, 0); } else { // mem <= seg addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0); @@ -722,7 +722,7 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni INST_NAME("MOV Seg, Ew"); nextop = F8; u8 = (nextop & 0x38) >> 3; - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); } else { SMREAD(); diff --git a/src/dynarec/rv64/dynarec_rv64_f0.c b/src/dynarec/rv64/dynarec_rv64_f0.c index 39768752a..7545b1ce1 100644 --- a/src/dynarec/rv64/dynarec_rv64_f0.c +++ b/src/dynarec/rv64/dynarec_rv64_f0.c @@ -61,7 +61,7 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni nextop = F8; GETGD; SMDMB(); - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { ed = TO_NAT((nextop & 7) + (rex.b << 3)); emit_add32(dyn, ninst, rex, ed, gd, x3, x4, x5); } else { @@ -452,7 +452,7 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni nextop = F8; GETGB(x2); SMDMB(); - if ((nextop & 0xC0) == 0xC0) { + if (MODREG) { if (rex.rex) { wback = TO_NAT((nextop & 7) + (rex.b << 3)); wb2 = 0;