VFIRST.M
Vector Find First Set Mask Bit
VFIRST.M rd, vs2, vm
Finds the index of the first set bit in the mask.
Encoding
Binary Layout
010000
31:26
vm
25
vs2
24:20
10001010
19:12
rd
11:7
1010111
6:0
Operands
-
rd
Dest (Index) -
vs2
Src Mask
Example
VFIRST.M t0, v4, v0.t
Related
More in V
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
Finds the index of the lowest-numbered active set bit in mask register vs2, writing the index to rd. Returns -1 if no bit is set.
Operation
rd = find_first_set(vs2 & vm);