Log In | Not a Member? | Support | |
Highlights and ExamplesExample 1 AltiVec is a Single Instruction Multiple Data (SIMD) machine comprised of
Each value within an AltiVec register is a vector that is made of elements. AltiVec instructions perform operations on all elements within an AltiVec vector register at once. AltiVec has the usual collection of operations that one has come to expect such as: add, subtract, multiply and multiply-add (a.k.a. multiply-add fused). In addition, a set of useful operations such as sum-across (sums all the elements in a vector) and multiply-sum (multiplies and sums elements in 3 vectors) have been added.The data manipulation instructions also have been augmented to include operations such as permute (fills a register with bytes from 2 other registers), merge (merges two vectors into one) and "splat" (duplicates data across elements in a vector). The following are examples of two AltiVec instructions, which are similar to instructions in the PowerPC scalar units. To add 16 bytes to another 16 bytes in one instruction we
can use
To multiply 4 floats by 4 floats and then add the result
to 4 more floats in one instruction and in one rounding, we
can use
The AltiVec unit on the PowerPC goes beyond the common general purpose microprocessor instructions. The following two examples illustrate how AltiVec has encapsulated in a single instruction (executing in 1 cycle) a large combination of several regular scalar operations. The "permute" instruction fills a register with bytes from 2 other registers. The bytes can be specified in any order.
The "splat" instruction is used to copy any element from one register into all of the elements of another register as shown in the diagram below.
|