VIOTA.M

Vector Iota

VIOTA.M vd, vs2, vm

Writes the index of the active element to the destination. Useful for parallel prefix sums.

Encoding

Binary Layout
010100
31:26
vm
25
vs2
24:20
10000010
19:12
vd
11:7
1010111
6:0
 
Format OPMVV
Opcode 0x50082057
Extension V

Operands

  • vd
    Destination vector register
  • vs2
    Mask Src

Example

VIOTA.M v1, v4, v0.t

Related

More in V

Description

Writes to each element of vd the sum of set mask bits in vs2 at positions less than the current element index.

Operation

count = 0; foreach(i < vl): if vm[i]: vd[i] = count++;