diff options
Diffstat (limited to 'riscv/insns/vmulhu_vv.h')
-rw-r--r-- | riscv/insns/vmulhu_vv.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/riscv/insns/vmulhu_vv.h b/riscv/insns/vmulhu_vv.h index 4aff1a2..46e5d46 100644 --- a/riscv/insns/vmulhu_vv.h +++ b/riscv/insns/vmulhu_vv.h @@ -1,11 +1,10 @@ // vmulhu: Unsigned multiply, returning high bits of product require(STATE.VU.ELEN <= 32); reg_t vsew = STATE.VU.vsew; -uint64_t sew_result_bits = vsew * 2; -uint64_t upper_mask = 1 - ((1 << vsew) - 1); +uint64_t lo_mask = (((uint64_t)1 << vsew) - 1); VI_VV_LOOP ({ - uint64_t result = vs1 * vs2; - vd = (result>>(sew_result_bits - sew)) & upper_mask; + uint64_t result = (uint64_t)vs1 * (uint64_t)vs2; + vd = (result >> sew) & lo_mask; }) |