aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vpopc_m.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/vpopc_m.h')
-rw-r--r--riscv/insns/vpopc_m.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/riscv/insns/vpopc_m.h b/riscv/insns/vpopc_m.h
index de50943..9eaca1e 100644
--- a/riscv/insns/vpopc_m.h
+++ b/riscv/insns/vpopc_m.h
@@ -8,9 +8,8 @@ reg_t rs2_num = insn.rs2();
require(P.VU.vstart == 0);
reg_t popcount = 0;
for (reg_t i=P.VU.vstart; i<vl; ++i) {
- const int mlen = P.VU.vmlen;
- const int midx = (mlen * i) / 32;
- const int mpos = (mlen * i) % 32;
+ const int midx = i / 32;
+ const int mpos = i % 32;
bool vs2_lsb = ((P.VU.elt<uint32_t>(rs2_num, midx ) >> mpos) & 0x1) == 1;
if (insn.v_vm() == 1) {