Home/Instructions/VRGATHER-VX
VRGATHER.VX

RISC-V VRGATHER.VX Instruction Details

Instruction ManualR-type

Gather source-vector elements by index.

Instruction Syntax

vrgather.vx vd, vs2, rs1, vm
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
VVector PermutationGather

Instruction Behavior

VRGATHER.VX uses indices from rs1 to select elements from vs2 into vd; an index outside VLMAX produces a zero result element.

Quick Understanding & Search Notes

VRGATHER.VX handles index-based rearrangement of vector elements, with source data coming from vs2.

The index selects an element of vs2; it is not a memory address.
An index outside VLMAX writes zero to the destination element.
VI/VX/VV forms take indices from an immediate, scalar register, or vector elements respectively.

Common Usage Scenarios

Table Lookup

Understand this scenario with real code like «vrgather.vx v8, v12, x5, v0.t».

Reorder

Understand this scenario with real code like «vrgather.vx v8, v12, x5, v0.t».

Compress/Decompress

Understand this scenario with real code like «vrgather.vx v8, v12, x5, v0.t».

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

OOB (>=VLMAX) returns 0, no exception
Dest cannot overlap source
SEW=8 vrgather.vv only 0-255; vrgatherei16→64K

FAQ

Are VRGATHER.VX indices byte offsets?

No. VRGATHER indices select source-vector elements; byte offsets belong to indexed load/store instructions.