From a021fc200532a7cdd769f733a2f857616fbdb655 Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Tue, 25 Mar 2025 15:59:34 +0800 Subject: [RV64_DYNAREC] Small optim to vsetvli usage (#2465) --- src/dynarec/rv64/dynarec_rv64_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c index 31b35811..25a1a469 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.c +++ b/src/dynarec/rv64/dynarec_rv64_helper.c @@ -2976,7 +2976,9 @@ int vector_vsetvli(dynarec_rv64_t* dyn, int ninst, int s1, int sew, int vlmul, f uint32_t vl = (int)((float)(16 >> sew) * multiple); uint32_t vtypei = (sew << (3 - !!rv64_xtheadvector)) | vlmul; if (dyn->inst_sew == VECTOR_SEWNA || dyn->inst_vl == 0 || dyn->inst_sew != sew || dyn->inst_vl != vl || dyn->inst_vlmul != vlmul) { - if (vl <= 31 && !rv64_xtheadvector) { + if (vl == (rv64_vlen >> (3 + sew - vlmul))) { + VSETVLI(s1, xZR, vtypei); + } else if (vl <= 31 && !rv64_xtheadvector) { VSETIVLI(xZR, vl, vtypei); } else { ADDI(s1, xZR, vl); -- cgit 1.4.1