Skip to content

Commit

Permalink
[ARM64_DYNAREC] Use YIELD instead of WFE (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco authored Nov 24, 2024
1 parent ab65422 commit 2d04cbe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/dynarec/arm64/arm64_emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ int convert_bitmask(uint64_t bitmask);

#define NOP EMIT(0b11010101000000110010000000011111)
#define WFE EMIT(0b11010101000000110010000001011111)
#define WFI EMIT(0b11010101000000110010000001111111)
#define YIELD EMIT(0b11010101000000110010000000111111)

#define CSINC_gen(sf, Rm, cond, Rn, Rd) ((sf)<<31 | 0b11010100<<21 | (Rm)<<16 | (cond)<<12 | 1<<10 | (Rn)<<5 | (Rd))
#define CSINCx(Rd, Rn, Rm, cond) EMIT(CSINC_gen(1, Rm, cond, Rn, Rd))
Expand Down
12 changes: 12 additions & 0 deletions src/dynarec/arm64/arm64_printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ const char* arm64_print(uint32_t opcode, uintptr_t addr)
snprintf(buff, sizeof(buff), "NOP");
return buff;
}
if(isMask(opcode, "11010101000000110010000001011111", &a)) {
snprintf(buff, sizeof(buff), "WFE");
return buff;
}
if(isMask(opcode, "11010101000000110010000001111111", &a)) {
snprintf(buff, sizeof(buff), "WFI");
return buff;
}
if(isMask(opcode, "11010101000000110010000000111111", &a)) {
snprintf(buff, sizeof(buff), "YIELD");
return buff;
}
// --- LDR / STR
if(isMask(opcode, "f010100011iiiiiii22222nnnnnttttt", &a)) {
int offset = signExtend(imm, 7)<<(2+sf);
Expand Down
2 changes: 1 addition & 1 deletion src/dynarec/arm64/dynarec_arm64_00.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
if(gd==xRAX) {
if (rep == 2) {
INST_NAME("PAUSE");
WFE;
YIELD;
} else {
INST_NAME("NOP");
}
Expand Down

0 comments on commit 2d04cbe

Please sign in to comment.