diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-02-24 02:29:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-23 19:29:59 +0100 |
| commit | f9b6ea48e9f19cef8d299835751b17e5af2391dd (patch) | |
| tree | 4ea9808911789d3c5288fc0ed12c484b92328acf /src | |
| parent | 3567c6da2b1378500fc46549b4f6ca464fd4d69c (diff) | |
| download | box64-f9b6ea48e9f19cef8d299835751b17e5af2391dd.tar.gz box64-f9b6ea48e9f19cef8d299835751b17e5af2391dd.zip | |
[RV64_DYNAREC] Fixed swapCache scratch register usage (#2405)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_helper.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c index ca01e696..8dc8f9a4 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.c +++ b/src/dynarec/rv64/dynarec_rv64_helper.c @@ -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; |