Check vl first
The current vl determines the number of body elements. Typical code executes vsetvli, vsetivli, or vsetvl before this instruction.
Pack the VL bits from the source mask register into ceil(vl/8) contiguous bytes and store them starting at x[rs1].
VSM.V is the RISC-V V extension unit-stride mask store. It places source mask bit i into bit i mod 8 of byte floor(i/8) and stores ceil(vl/8) packed bytes. The instruction stores mask bits, not ordinary vector elements using SEW.
Decode the packed mask store, then compute each element address as x[rs1] + floor(i/8).
The animation starts from the 32-bit vector memory encoding and shows the official bit fields: nf, mew, mop, vm, rs2/vs2 or lumop/sumop, width, register fields, and opcode.
VSM.V compresses a mask register into a byte stream: with VL=16 it writes only 2 bytes, one bit contributed by each lane.
When reading VSM.V, 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 «vsm.v v0, (a0) # store ceil(vl/8) packed mask bytes».
Understand this scenario with real code like «vsm.v v0, (a0) # store ceil(vl/8) packed mask bytes».
Understand this scenario with real code like «vsm.v v0, (a0) # store ceil(vl/8) packed mask bytes».
VSM.V stores packed mask bits with a length of ceil(vl/8) bytes; VSE8.V stores 8-bit data elements.
No. The syntax source operand is vs3, a vector mask register; v0 is only the commonly used mask register.