Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/dynarec/rv64/dynarec_rv64_66f0.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ uintptr_t dynarec64_66F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
u8 &= 0x0f;
ADDI(x3, wback, u8 >> 3);
ANDI(x4, x3, 3);
SLLI(x4, x4, 3);
ADDI(x5, xZR, u8 & 7);
ADD(x5, x4, x5);
ADDSL(x5, x5, x4, 3, x4);
ANDI(x3, x3, ~3);
ADDI(x6, xZR, 1);
SLL(x6, x6, x5);
Expand Down Expand Up @@ -143,9 +142,8 @@ uintptr_t dynarec64_66F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
u8 &= 0x0f;
ADDI(x3, wback, u8 >> 3);
ANDI(x4, x3, 3);
SLLI(x4, x4, 3);
ADDI(x5, xZR, u8 & 7);
ADD(x5, x4, x5);
ADDSL(x5, x5, x4, 3, x4);
ANDI(x3, x3, ~3);
ADDI(x6, xZR, 1);
SLL(x6, x6, x5);
Expand Down Expand Up @@ -174,9 +172,8 @@ uintptr_t dynarec64_66F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
u8 &= 0x0f;
ADDI(x3, wback, u8 >> 3);
ANDI(x4, x3, 3);
SLLI(x4, x4, 3);
ADDI(x5, xZR, u8 & 7);
ADD(x5, x4, x5);
ADDSL(x5, x5, x4, 3, x4);
ANDI(x3, x3, ~3);
ADDI(x6, xZR, 1);
SLL(x6, x6, x5);
Expand Down
24 changes: 8 additions & 16 deletions src/dynarec/rv64/dynarec_rv64_avx_66_0f38.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,7 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
for (int i = 0; i < 4; ++i) {
LWU(x4, xEmu, offsetof(x64emu_t, scratch) + 16 + 4 * i);
ANDI(x4, x4, 3);
SLLI(x4, x4, 2);
ADD(x4, x4, xEmu);
ADDSL(x4, xEmu, x4, 2, x4);
LWU(x5, x4, offsetof(x64emu_t, scratch) + 0);
SW(x5, gback, gdoffset + 4 * i);
}
Expand All @@ -604,8 +603,7 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
for (int i = 0; i < 4; ++i) {
LWU(x4, xEmu, offsetof(x64emu_t, scratch) + 16 + 4 * i);
ANDI(x4, x4, 3);
SLLI(x4, x4, 2);
ADD(x4, x4, xEmu);
ADDSL(x4, xEmu, x4, 2, x4);
LWU(x5, x4, offsetof(x64emu_t, scratch) + 0);
SW(x5, gback, gyoffset + 4 * i);
}
Expand All @@ -631,8 +629,7 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
LD(x4, xEmu, offsetof(x64emu_t, scratch) + 16 + 8 * i);
SRLI(x4, x4, 1);
ANDI(x4, x4, 1);
SLLI(x4, x4, 3);
ADD(x4, x4, xEmu);
ADDSL(x4, xEmu, x4, 3, x4);
LD(x5, x4, offsetof(x64emu_t, scratch) + 0);
SD(x5, gback, gdoffset + 8 * i);
}
Expand All @@ -651,8 +648,7 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
LD(x4, xEmu, offsetof(x64emu_t, scratch) + 16 + 8 * i);
SRLI(x4, x4, 1);
ANDI(x4, x4, 1);
SLLI(x4, x4, 3);
ADD(x4, x4, xEmu);
ADDSL(x4, xEmu, x4, 3, x4);
LD(x5, x4, offsetof(x64emu_t, scratch) + 0);
SD(x5, gback, gyoffset + 8 * i);
}
Expand Down Expand Up @@ -727,16 +723,14 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
for (int i = 0; i < 4; ++i) {
LWU(x3, vback, vxoffset + 4 * i);
ANDI(x3, x3, 7);
SLLI(x3, x3, 2);
ADD(x4, wback, x3);
ADDSL(x4, wback, x3, 2, x3);
LWU(x5, x4, fixedaddress);
SW(x5, gback, gdoffset + 4 * i);
}
for (int i = 0; i < 4; ++i) {
LWU(x3, vback, vyoffset + 4 * i);
ANDI(x3, x3, 7);
SLLI(x3, x3, 2);
ADD(x4, wback, x3);
ADDSL(x4, wback, x3, 2, x3);
LWU(x5, x4, fixedaddress);
SW(x5, gback, gyoffset + 4 * i);
}
Expand Down Expand Up @@ -1474,16 +1468,14 @@ uintptr_t dynarec64_AVX_66_0F38(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
for (int i = 0; i < 4; ++i) {
LWU(x3, vback, vxoffset + 4 * i);
ANDI(x3, x3, 7);
SLLI(x3, x3, 2);
ADD(x4, wback, x3);
ADDSL(x4, wback, x3, 2, x3);
LWU(x5, x4, fixedaddress);
SW(x5, gback, gdoffset + 4 * i);
}
for (int i = 0; i < 4; ++i) {
LWU(x3, vback, vyoffset + 4 * i);
ANDI(x3, x3, 7);
SLLI(x3, x3, 2);
ADD(x4, wback, x3);
ADDSL(x4, wback, x3, 2, x3);
LWU(x5, x4, fixedaddress);
SW(x5, gback, gyoffset + 4 * i);
}
Expand Down
7 changes: 1 addition & 6 deletions src/dynarec/rv64/dynarec_rv64_d9.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,7 @@ uintptr_t dynarec64_D9(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
ANDI(x5, x5, 7); // (emu->top + i)&7
}
// load x2 with ST0 anyway, for sign extraction
if (cpuext.zba)
SH3ADD(x1, x5, xEmu);
else {
SLLI(x5, x5, 3);
ADD(x1, xEmu, x5);
}
ADDSL(x1, xEmu, x5, 3, x5);
LD(x2, x1, offsetof(x64emu_t, x87));
// load tag
if (i2 >= 0) {
Expand Down
70 changes: 10 additions & 60 deletions src/dynarec/rv64/dynarec_rv64_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,7 @@ void x87_purgecache(dynarec_rv64_t* dyn, int ninst, int next, int s1, int s2, in
#endif
ADDI(s3, s2, dyn->e.x87cache[i]); // unadjusted count, as it's relative to real top
ANDI(s3, s3, 7); // (emu->top + st)&7
if (cpuext.zba)
SH3ADD(s1, s3, xEmu);
else {
SLLI(s1, s3, 3);
ADD(s1, xEmu, s1);
}
ADDSL(s1, xEmu, s3, 3, s1);
switch (extcache_get_current_st(dyn, ninst, st)) {
case EXT_CACHE_ST_D:
FSD(dyn->e.x87reg[i], s1, offsetof(x64emu_t, x87)); // save the value
Expand Down Expand Up @@ -1054,12 +1049,7 @@ static void x87_reflectcache(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int
if (dyn->e.x87cache[i] != -1) {
ADDI(s3, s2, dyn->e.x87cache[i]);
ANDI(s3, s3, 7); // (emu->top + i)&7
if (cpuext.zba)
SH3ADD(s1, s3, xEmu);
else {
SLLI(s1, s3, 3);
ADD(s1, xEmu, s1);
}
ADDSL(s1, xEmu, s3, 3, s1);
if (extcache_get_current_st_f(dyn, dyn->e.x87cache[i]) >= 0) {
FCVTDS(SCRATCH0, dyn->e.x87reg[i]);
FSD(SCRATCH0, s1, offsetof(x64emu_t, x87));
Expand Down Expand Up @@ -1136,12 +1126,7 @@ int x87_get_cache(dynarec_rv64_t* dyn, int ninst, int populate, int s1, int s2,
ADDI(s2, s2, a);
ANDI(s2, s2, 7);
}
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
FLD(dyn->e.x87reg[ret], s1, offsetof(x64emu_t, x87));
}
MESSAGE(LOG_DUMP, "\t-------x87 Cache for ST%d\n", st);
Expand Down Expand Up @@ -1188,12 +1173,7 @@ void x87_refresh(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int st)
ADDI(s2, s2, a);
ANDI(s2, s2, 7); // (emu->top + i)&7
}
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
if (dyn->e.extcache[EXTIDX(reg)].t == EXT_CACHE_ST_F) {
FCVTDS(SCRATCH0, reg);
FSD(SCRATCH0, s1, offsetof(x64emu_t, x87));
Expand Down Expand Up @@ -1231,12 +1211,7 @@ void x87_forget(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int st)
ADDI(s2, s2, a);
ANDI(s2, s2, 7); // (emu->top + i)&7
}
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
if (dyn->e.extcache[EXTIDX(reg)].t == EXT_CACHE_ST_F) {
FCVTDS(SCRATCH0, reg);
FSD(SCRATCH0, s1, offsetof(x64emu_t, x87));
Expand Down Expand Up @@ -1275,12 +1250,7 @@ void x87_reget_st(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int st)
ADDI(s2, s2, a);
AND(s2, s2, 7);
}
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
FLD(dyn->e.x87reg[i], s1, offsetof(x64emu_t, x87));
MESSAGE(LOG_DUMP, "\t-------x87 Cache for ST%d\n", st);
// ok
Expand All @@ -1300,12 +1270,7 @@ void x87_reget_st(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int st)
int a = st - dyn->e.x87stack;
ADDI(s2, s2, a);
ANDI(s2, s2, 7); // (emu->top + i)&7
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
FLD(dyn->e.x87reg[ret], s1, offsetof(x64emu_t, x87));
MESSAGE(LOG_DUMP, "\t-------x87 Cache for ST%d\n", st);
}
Expand Down Expand Up @@ -1335,12 +1300,7 @@ void x87_free(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int st)
}
ANDI(s2, s2, 7); // (emu->top + i)&7
}
if (cpuext.zba)
SH3ADD(s1, s2, xEmu);
else {
SLLI(s2, s2, 3);
ADD(s1, xEmu, s2);
}
ADDSL(s1, xEmu, s2, 3, s2);
if (dyn->e.extcache[EXTIDX(reg)].t == EXT_CACHE_ST_F) {
FCVTDS(SCRATCH0, reg);
FSD(SCRATCH0, s1, offsetof(x64emu_t, x87));
Expand Down Expand Up @@ -2356,12 +2316,7 @@ static void loadCache(dynarec_rv64_t* dyn, int ninst, int stack_cnt, int s1, int
}
*s3_top += a;
*s2_val = 0;
if (cpuext.zba)
SH3ADD(s2, s3, xEmu);
else {
SLLI(s2, s3, 3);
ADD(s2, xEmu, s2);
}
ADDSL(s2, xEmu, s3, 3, s2);
FLD(reg, s2, offsetof(x64emu_t, x87));
if (t == EXT_CACHE_ST_F) {
FCVTSD(reg, reg);
Expand Down Expand Up @@ -2433,12 +2388,7 @@ static void unloadCache(dynarec_rv64_t* dyn, int ninst, int stack_cnt, int s1, i
ANDI(s3, s3, 7);
}
*s3_top += a;
if (cpuext.zba)
SH3ADD(s2, s3, xEmu);
else {
SLLI(s2, s3, 3);
ADD(s2, xEmu, s2);
}
ADDSL(s2, xEmu, s3, 3, s2);
*s2_val = 0;
if (t == EXT_CACHE_ST_F) {
FCVTDS(reg, reg);
Expand Down
Loading