aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vrol_vx.h
blob: b0c89a27b749511b7b5565a96c6f3e425c81a47d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// vrol.vx vd, vs2, rs1, 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 .vx, the shift amount comes from rs1.
const reg_t lshift = ((reg_t)RS1) & mask;
const reg_t rshift = (-lshift) & mask;

VI_V_ULOOP
({
  vd = (vs2 << lshift) | (vs2 >> rshift);
})