VROL.VX

RISC-V VROL.VX Instruction Details

Instruction ManualR-type

Vector rotate left by scalar amount; each vs2 element uses the low log2(SEW) bits of the amount.

Instruction Syntax

vrol.vx vd, vs2, rs1, vm
Operand Breakdown
vd: destination vector register group.
vs2/vs1 or scalar source: selected by suffixes such as .vv, .vx, .vi, or .vf.
vm: when present, vm=0 uses v0 as the execution mask and vm=1 is unmasked.
ZvbbVector Bit Manipulation

Instruction Behavior

VROL.VX is a Zvbb vector rotate-left instruction. Each active element takes data from vs2 and rotates it by the amount from x[rs1]; only the low log2(SEW) bits of the amount are used.

Quick Understanding & Search Notes

VROL.VX performs a Zvbb rotate left on each active element; the scalar operand supplies only the rotate amount and data comes from vs2.

Only the low log2(SEW) bits of the amount are used; no extra rotation beyond SEW is represented.
There is no official vrol.vi; immediate rotate-left can be expressed through vror.vi with the complementary amount.

Vector Execution Context

When reading VROL.VX, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. .vx: one vector source and one integer scalar source participate.

Check vl first

The current vl determines the number of body elements. Typical code executes vsetvli, vsetivli, or vsetvl before this instruction.

Then check vtype

The current vtype supplies SEW, LMUL, tail policy, and mask policy; these affect element width, register-group size, and inactive/tail destination elements.

Then check vm/v0

For ordinary vector instructions with vm, vm=0 uses v0 as the execution mask and vm=1 is unmasked. A few forms such as VMERGE use v0 as data-selection input.

Official source: RISC-V V Standard Extension for Vector Operations

Common Usage Scenarios

Crypto & Security

Understand this scenario with real code like «vrol.vx vd, vs2, a1».

Vector Acceleration

Understand this scenario with real code like «vrol.vx vd, vs2, a1».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

This is rotate left; shifted-out bits wrap around rather than being discarded.
The rotate amount is truncated to the element width through the low log2(SEW) bits.
It follows V-extension vl, vstart, vtype, and optional vm mask rules.

FAQ

Does VROL.VX change element width?

No. The result element width remains the current SEW.

How is VROL.VX different from VWSLL?

Rotate keeps the same width and wraps bits; VWSLL is a widening logical left shift with a 2*SEW destination.