diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-01-14 15:13:18 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-14 08:13:18 +0100 |
| commit | d91461f4681ebb61310a227a519cd6982e135e1a (patch) | |
| tree | 990fbe56e5183a6cd1c497467d92ab9c4305f479 /src | |
| parent | bcc497c865b4a7a5717a6aefb6c03b3d1c4c1856 (diff) | |
| download | box64-d91461f4681ebb61310a227a519cd6982e135e1a.tar.gz box64-d91461f4681ebb61310a227a519cd6982e135e1a.zip | |
[RV64_DYNAREC] Fixed SET_ELEMENT_WIDTH (#2260)
... also removed some unnecessary instructions in vector_loadmask
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_helper.c | 3 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_helper.h | 20 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_pass0.h | 12 |
3 files changed, 16 insertions, 19 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c index 3b73d8b4..ebf8cd97 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.c +++ b/src/dynarec/rv64/dynarec_rv64_helper.c @@ -3035,7 +3035,6 @@ void vector_loadmask(dynarec_rv64_t* dyn, int ninst, int vreg, uint64_t imm, int int scratch = fpu_get_scratch(dyn); vector_vsetvli(dyn, ninst, s1, VECTOR_SEW64, VECTOR_LMUL1, 1); VMV_V_I(scratch, 1); - VMV_S_X(vreg, xZR); VSLIDE1UP_VX(vreg, scratch, xZR, VECTOR_UNMASKED); vector_vsetvli(dyn, ninst, s1, sew, vlmul, multiple); return; @@ -3068,7 +3067,6 @@ void vector_loadmask(dynarec_rv64_t* dyn, int ninst, int vreg, uint64_t imm, int vector_vsetvli(dyn, ninst, s1, VECTOR_SEW64, VECTOR_LMUL1, 1); MOV64x(s1, 0x100000000ULL); VMV_V_X(scratch, s1); - VMV_S_X(vreg, xZR); VSLIDE1UP_VX(vreg, scratch, xZR, VECTOR_UNMASKED); vector_vsetvli(dyn, ninst, s1, sew, vlmul, multiple); return; @@ -3104,7 +3102,6 @@ void vector_loadmask(dynarec_rv64_t* dyn, int ninst, int vreg, uint64_t imm, int vector_vsetvli(dyn, ninst, s1, VECTOR_SEW64, VECTOR_LMUL1, 1); MOV64x(s1, 0x100000001ULL); VMV_V_X(scratch, s1); - VMV_S_X(vreg, xZR); VSLIDE1UP_VX(vreg, scratch, xZR, VECTOR_UNMASKED); vector_vsetvli(dyn, ninst, s1, sew, vlmul, multiple); return; diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h index 24be91df..40146b77 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.h +++ b/src/dynarec/rv64/dynarec_rv64_helper.h @@ -1147,16 +1147,16 @@ #define MODREG ((nextop & 0xC0) == 0xC0) #ifndef SET_ELEMENT_WIDTH -#define SET_ELEMENT_WIDTH(s1, sew, set) \ - do { \ - if (sew == VECTOR_SEWANY && dyn->vector_sew != VECTOR_SEWNA) { \ - dyn->vector_eew = dyn->vector_sew; \ - } else if (sew == dyn->vector_sew) { \ - dyn->vector_eew = dyn->vector_sew; \ - } else { \ - dyn->vector_eew = vector_vsetvli(dyn, ninst, s1, sew, VECTOR_LMUL1, 1); \ - } \ - if (set) dyn->vector_sew = dyn->vector_eew; \ +#define SET_ELEMENT_WIDTH(s1, sew, set) \ + do { \ + if ((sew) == VECTOR_SEWANY && dyn->vector_sew != VECTOR_SEWNA) { \ + dyn->vector_eew = dyn->vector_sew; \ + } else if ((sew) == dyn->vector_sew) { \ + dyn->vector_eew = dyn->vector_sew; \ + } else { \ + dyn->vector_eew = vector_vsetvli(dyn, ninst, s1, (sew), VECTOR_LMUL1, 1); \ + } \ + if (set) dyn->vector_sew = dyn->vector_eew; \ } while (0) #endif diff --git a/src/dynarec/rv64/dynarec_rv64_pass0.h b/src/dynarec/rv64/dynarec_rv64_pass0.h index 3ecaad3e..10dfeb0e 100644 --- a/src/dynarec/rv64/dynarec_rv64_pass0.h +++ b/src/dynarec/rv64/dynarec_rv64_pass0.h @@ -86,10 +86,10 @@ dynarec_log(LOG_NONE, "\n"); \ } -#define SET_ELEMENT_WIDTH(s1, sew, set) \ - do { \ - if (sew != VECTOR_SEWANY && set) \ - dyn->vector_sew = sew; \ - else if (dyn->vector_sew == VECTOR_SEWNA && set) \ - dyn->vector_sew = VECTOR_SEW8; \ +#define SET_ELEMENT_WIDTH(s1, sew, set) \ + do { \ + if ((sew) != VECTOR_SEWANY && (set)) \ + dyn->vector_sew = (sew); \ + else if (dyn->vector_sew == VECTOR_SEWNA && (set)) \ + dyn->vector_sew = VECTOR_SEW8; \ } while (0) |