Check vl first
The current vl determines the number of body elements. Typical code executes vsetvli, vsetivli, or vsetvl before this instruction.
VREDSUM.VS uses the vs1[0] seed to perform sum reduction over active vs2 elements, writing only vd[0].
VREDSUM.VS is a RISC-V V extension single-width integer reduction instruction. Syntax is `vredsum.vs vd, vs2, vs1, vm`; it uses vs1[0] as the seed, includes only masked-in active vs2 elements within the current vl in the sum reduction, and writes the final SEW-width result to vd[0]. Integer overflow wraps at SEW width.
Starts from OP-V encoding fields, then shows how VREDSUM uses vs1[0] as the seed, reduces only active vs2 elements, and writes the SEW-width result to vd[0].
vredsum.vs uses OP-V encoding. The animation places fixed fields, register fields, vm, and the vs1 field in one encoding strip.
This animation shows only ISA-visible relationships from the official V extension: OP-V field decode, active-element reads, vs1[0]-seeded reduction integer sum reduction, mask participation filtering, and vd[0] writeback. It does not model pipelines, caches, or timing.
VREDSUM.VS is single-width integer sum reduction. It uses vs1[0] as the scalar seed, accumulates active elements from vs2, and writes the final result to vd[0]; it does not broadcast the result to the whole vector.
When reading VREDSUM.VS, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. The suffix and operand form determine whether sources are vector, scalar, or immediate values.
The current vl determines the number of body elements. Typical code executes vsetvli, vsetivli, or vsetvl before this instruction.
The current vtype supplies SEW, LMUL, tail policy, and mask policy; these affect element width, register-group size, and inactive/tail destination elements.
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.
Understand this scenario with real code like «vredsum.vs v1, v2, v3 # reduce active v2 elements with seed v3[0], result in v1[0]».
Understand this scenario with real code like «vredsum.vs v1, v2, v3 # reduce active v2 elements with seed v3[0], result in v1[0]».
Use jal x0, target or j target.
The seed comes from element 0 of vs1, namely vs1[0].
The effective reduction result is in vd[0]. Other destination elements are not element-wise reduction results and should be understood according to the specification rules for tail/destination elements.