Skip to content

Commit

Permalink
[RV64_DYNAREC] Fixed swapCache scratch register usage (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco authored Feb 23, 2025
1 parent 3567c6d commit f9b6ea4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/dynarec/rv64/dynarec_rv64_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2389,19 +2389,16 @@ static void swapCache(dynarec_rv64_t* dyn, int ninst, int i, int j, extcache_t*
MESSAGE(LOG_DUMP, "\t - Swapping %d <-> %d\n", i, j);
// There is no swap instruction in RV64 to swap 2 float registers!
// so use a scratch...
#define SCRATCH 2
if (i_single)
#define SCRATCH 0 // f0 is not used anywhere else
if (i_single) {
FMVS(SCRATCH, reg_i);
else
FMVD(SCRATCH, reg_i);
if (j_single)
FMVS(reg_i, reg_j);
else
FMVD(reg_i, reg_j);
if (i_single)
FMVS(reg_j, SCRATCH);
else
} else {
FMVD(SCRATCH, reg_i);
FMVD(reg_i, reg_j);
FMVD(reg_j, SCRATCH);
}
#undef SCRATCH
tmp.v = cache->extcache[i].v;
cache->extcache[i].v = cache->extcache[j].v;
Expand Down

0 comments on commit f9b6ea4

Please sign in to comment.