aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vnclipu_vi.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/vnclipu_vi.h')
-rw-r--r--riscv/insns/vnclipu_vi.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/riscv/insns/vnclipu_vi.h b/riscv/insns/vnclipu_vi.h
index 61cb015..73ad777 100644
--- a/riscv/insns/vnclipu_vi.h
+++ b/riscv/insns/vnclipu_vi.h
@@ -4,11 +4,13 @@ uint64_t int_max = ~(-1ll << P.VU.vsew);
VI_VVXI_LOOP_NARROW
({
uint64_t result = vs2_u;
+ unsigned shift = zimm5 & ((sew * 2) - 1);
+
// rounding
- INT_ROUNDING(result, xrm, sew);
+ INT_ROUNDING(result, xrm, shift);
// unsigned shifting to rs1
- result = vzext(result, sew * 2) >> (zimm5 & ((sew * 2) < 32? (sew * 2) - 1: 31));
+ result = result >> shift;
// saturation
if (result & (uint64_t)(-1ll << sew)) {