SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
It is useful to initialize vector register with constants provided in the parameter file. As parameter file is scalar (not NWAY SIMD), each value is broadcast to all NWAY of the destination vector register. Assembly syntax:
| VINITtype_init_loop preg, vreg |
The data type can be signed/unsigned halfword or word. In case of word, two parameter register entries (16-bit each) are used, first one being copied to the lower halfword, and the second one to the upper halfword.
For the word type initialization, preg specified is the lower halfword and must be even. For example, VINITWU_ONCE P10, V2 initializes V2 using (P11 << 16) + P10.
The init_loop field can be {ONCE, I234_ZERO, I34_ZERO, I4_ZERO, ALWS }.
The VINIT instruction is equivalent to initializing a specific vector register in the nested i1/i2/i3/i4 loop shown in Section 8.3.5.3.2:
The VINIT feature is used to initialize vector registers to certain initial values. For example, FIR filtering is implemented by iterating over filter taps with MADD instructions, and VINIT is used to initialize the accumulator to zero at the proper iteration, i4 for 1-D filter, and i3 for 2-D filter. Constants are brought into the computation loop with VINIT as well. For example, to scale an entire input array by a constant factor.
Note that VINIT broadcasts one value to all SIMD lanes. Initializing a vector register to multiple values is accomplished with a vector load (VLD) with zero address increment.
Sometimes it is useful to refer to loop variables in the computation. For example, to collect the maximal five values in an array and recording their indices, software can first do this in SIMD fashion to get to 5 sets of values and indices, then merge among SIMD lanes. Indices are readily copied from the loop variable i4, instead of spending cycles to compute with ALU operations.
VINIT provides this capability by extending the parameter count to cover loop variables:
When using these parameter counts, only the unsigned halfword type is supported.