aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vror_vi.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/vror_vi.h')
-rw-r--r--riscv/insns/vror_vi.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/riscv/insns/vror_vi.h b/riscv/insns/vror_vi.h
new file mode 100644
index 0000000..1269c3d
--- /dev/null
+++ b/riscv/insns/vror_vi.h
@@ -0,0 +1,18 @@
+// vror.vi vd, vs2, zimm6, vm
+
+#include "zvk_ext_macros.h"
+
+require_zvbb;
+
+// 'mask' selects the low log2(vsew) bits of the shift amount,
+// to limit the maximum shift to "vsew - 1" bits.
+const reg_t mask = P.VU.vsew - 1;
+
+// For .vi, the shift amount comes from bits [26,19-15].
+const reg_t rshift = insn.v_zimm6() & mask;
+const reg_t lshift = (-rshift) & mask;
+
+VI_V_ULOOP
+({
+ vd = (vs2 << lshift) | (vs2 >> rshift);
+})