SIMD module

get_looping_indices

procedureSource

Returns N lanes of type I holding 0, STEP, 2 * STEP, ...: lane i is i * STEP. STEP can be negative. Useful as the offsets of a gather or scatter. N must be positive.

Example↗
indices := get_looping_indices(4, s32);
assert(indices.data[0] == 0 && indices.data[3] == 3);
stepped := get_looping_indices(4, s32, 3);
assert(stepped.data[2] == 6);
get_looping_indices :: ($N: int, $I: Type, $STEP := 1) -> SIMD_Array(N, I)

Parameters

$N: int
$I: Type
$STEP := 1

Returns

See also