VSRA.VI

RISC-V VSRA.VI Instruction Details

Instruction ManualI-type

Element-wise arithmetic right shift.

Instruction Syntax

vsra.vi vd, vs2, uimm, vm
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
VVector Operations

Instruction Behavior

VSRA.VI applies an element-wise arithmetic right shift using the shift amount from uimm and writes vd.

Quick Understanding & Search Notes

VSRA.VI is a ordinary vector shift instruction; the shift amount uses only the architecturally specified low bits.

Ordinary VSLL/VSRL/VSRA do not use vxrm rounding.
Arithmetic right shift preserves sign-extension semantics.
VI/VV/VX forms take shift amounts from an immediate, vector elements, or a scalar register respectively.

Common Usage Scenarios

Bit Operations & Masks

Understand this scenario with real code like «vsra.vi v8, v12, 3, v0.t».

Data Storing

Understand this scenario with real code like «vsra.vi v8, v12, 3, v0.t».

Vector Operations

Understand this scenario with real code like «vsra.vi v8, v12, 3, v0.t».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is I-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

The shift amount comes from immediate; only the architecturally specified low bits are used.
Arithmetic right shift preserves the sign bit.
Ordinary shifts do not use vxrm and do not set vxsat.

FAQ

Does VSRA.VI set vxsat?

No. Ordinary shifts do not use the fixed-point saturation flag.