VRSUB.VX

RISC-V VRSUB.VX Instruction Details

Instruction ManualR-type

Subtract vector elements from a scalar register.

Instruction Syntax

vrsub.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 IntegerArithmetic

Instruction Behavior

VRSUB.VX computes x[rs1] - vs2[i] for active elements and writes the low SEW bits to vd.

Quick Understanding & Search Notes

VRSUB.VX reverses the operand direction of VSUB and computes scalar/immediate minus each element.

Results wrap at SEW width and do not raise integer overflow exceptions.
The VX scalar comes from integer register rs1.
Use VSUB.VX, not VRSUB.VX, when you need vector minus scalar.

Common Usage Scenarios

Symmetric Range

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

Complement

Understand this scenario with real code like «vrsub.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

Order reversed: imm/scalar-vector (not vector-imm/scalar)

FAQ

How is VRSUB.VX different from VSUB?

VRSUB is reverse subtraction: scalar or immediate minus vs2. VSUB computes vs2 minus the other operand.