index
SVE Create Index Vector
INDEX <Zd>.<T>, <Start>, <Step>
Generates a vector of indices: V[i] = Start + i * Step.
Details
Generates an index vector where each element contains a value computed as Start + element_index × Step. The Start and Step operands may be immediate values or scalar registers. Operates on elements of type T and no flags are affected. This is an AArch64-only SVE instruction.
Pseudocode Operation
for i = 0 to VL/esize-1
Zd[i] ← Start + (i * Step)
Example
INDEX z0.s.T, Start, Step
Encoding
Binary Layout
00000100
size
1
Rm
010011
Rn
Zd
Operands
-
Zd
Destination scalable vector register (SVE) -
Start
Scalar/Imm -
Step
Scalar/Imm
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x04204000 | INDEX <Zd>.<T>, #<imm1>, #<imm2> | A64 | 00000100 | size | 1 | imm5b | 010000 | imm5 | Zd | ||
| 0x04204800 | INDEX <Zd>.<T>, #<imm>, <R><m> | A64 | 00000100 | size | 1 | Rm | 010010 | imm5 | Zd | ||
| 0x04204400 | INDEX <Zd>.<T>, <R><n>, #<imm> | A64 | 00000100 | size | 1 | imm5 | 010001 | Rn | Zd | ||
| 0x04204C00 | INDEX <Zd>.<T>, <R><n>, <R><m> | A64 | 00000100 | size | 1 | Rm | 010011 | Rn | Zd |
Description
Populates the destination vector by setting the first element to the first signed scalar integer operand and monotonically incrementing the value by the second signed scalar integer operand for each subsequent element. The scalar source operands are general-purpose registers in which only the least significant bits corresponding to the vector element size are used and any remaining bits are ignored. This instruction is unpredicated.
Operation
CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(esize) operand1 = X[n, esize];
integer element1 = SInt(operand1);
bits(esize) operand2 = X[m, esize];
integer element2 = SInt(operand2);
bits(VL) result;
for e = 0 to elements-1
integer index = element1 + e * element2;
Elem[result, e, esize] = index<esize-1:0>;
Z[d, VL] = result;