Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RV64_DYNAREC] Fixed and refined F0 81,83 LOCK prefix opcodes #1595

Merged
merged 1 commit into from
Jun 18, 2024
Merged
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
34 changes: 19 additions & 15 deletions src/dynarec/rv64/dynarec_rv64_f0.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, LOCK_LOCK, 0, (opcode==0x81)?4:1);
if(opcode==0x81) i64 = F32S; else i64 = F8S;
if (i64 < -2048 || i64 >= 2048)
MOV64xw(x4, i64);
MOV64xw(x9, i64);
ANDI(x1, wback, (1 << (rex.w + 2)) - 1);
BNEZ_MARK3(x1);
// Aligned
Expand All @@ -559,7 +559,7 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
if (i64 >= -2048 && i64 < 2048)
ADDIxw(x4, x1, i64);
else
ADDxw(x4, x1, x4);
ADDxw(x4, x1, x9);
SCxw(x3, x4, wback, 1, 1);
BNEZ_MARKLOCK(x3);
B_MARK_nocond;
Expand All @@ -572,7 +572,7 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
if (i64 >= -2048 && i64 < 2048)
ADDIxw(x4, x6, i64);
else
ADDxw(x4, x6, x4);
ADDxw(x4, x6, x9);
SCxw(x3, x1, x5, 1, 1);
BNEZ_MARK2(x3);
SDxw(x4, wback, 0);
Expand All @@ -596,13 +596,14 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, LOCK_LOCK, 0, (opcode==0x81)?4:1);
if(opcode==0x81) i64 = F32S; else i64 = F8S;
if (i64 < -2048 || i64 >= 2048)
MOV64xw(x9, i64);
MARKLOCK;
LRxw(x1, wback, 1, 1);
if (i64>=-2048 && i64<2048) {
if (i64 >= -2048 && i64 < 2048) {
ORI(x4, x1, i64);
} else {
MOV64xw(x4, i64);
OR(x4, x1, x4);
OR(x4, x1, x9);
}
if (!rex.w) ZEROUP(x4);
SCxw(x3, x4, wback, 1, 1);
Expand All @@ -625,13 +626,14 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, LOCK_LOCK, 0, (opcode==0x81)?4:1);
if(opcode==0x81) i64 = F32S; else i64 = F8S;
if (i64 < -2048 || i64 >= 2048)
MOV64xw(x9, i64);
MARKLOCK;
LRxw(x1, wback, 1, 1);
if (i64>=-2048 && i64<2048) {
if (i64 >= -2048 && i64 < 2048) {
ANDI(x4, x1, i64);
} else {
MOV64xw(x4, i64);
AND(x4, x1, x4);
AND(x4, x1, x9);
}
if (!rex.w) ZEROUP(x4);
SCxw(x3, x4, wback, 1, 1);
Expand All @@ -654,13 +656,14 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, LOCK_LOCK, 0, (opcode==0x81)?4:1);
if(opcode==0x81) i64 = F32S; else i64 = F8S;
if (i64 <= -2048 || i64 > 2048)
MOV64xw(x9, i64);
MARKLOCK;
LRxw(x1, wback, 1, 1);
if (i64>-2048 && i64<=2048) {
if (i64 > -2048 && i64 <= 2048) {
ADDIxw(x4, x1, -i64);
} else {
MOV64xw(x4, i64);
SUBxw(x4, x1, x4);
SUBxw(x4, x1, x9);
}
SCxw(x3, x4, wback, 1, 1);
BNEZ_MARKLOCK(x3);
Expand Down Expand Up @@ -688,13 +691,14 @@ uintptr_t dynarec64_F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
i64 = F32S;
else
i64 = F8S;
if (i64 < -2048 || i64 >= 2048)
MOV64xw(x9, i64);
MARKLOCK;
LRxw(x1, wback, 1, 1);
if (i64 >= -2048 && i64 <= 2047) {
if (i64 >= -2048 && i64 < 2048) {
XORI(x4, x1, i64);
} else {
MOV64xw(x4, i64);
XOR(x4, x1, x4);
XOR(x4, x1, x9);
}
SCxw(x3, x4, wback, 1, 1);
BNEZ_MARKLOCK(x3);
Expand Down