Quick and Dirty AltiVec Anchor

This page is just a starting point for the few AltiVec related things I have done so far.
(There isn't too much content here yet, but I wanted to have a 'final' URL to give to Ian Ollmann. :-)

A table of shortest 'optimal' instruction sequences to generate constant vectors of identical short int elements.

Updated 26-Sep-2003:
The constants have been incorporated into Glen Low's easy-to-use template library macstl. Glen's templates offer the nicest way of utilizing AltiVec I know of: access to all the AltiVec primitives, good code generation if you use a recent compiler, and a much cleaner and more compact syntax than the 'official' lower level interface. This should be especially useful when you want to vectorize larger amounts of code quickly.

21-Mar-2003:
Thanks to John Brisbin the table can now be automatically tested for correctness. The complete package with his modifications is here (ca. 550KB of BZIP2 compressed tar archive). At least three bugs in either the emulation of the vector opcodes or in the output of the discovered instruction sequences have been found and corrected by him.

He also changed the output data to be a directly usable include file of inline functions. These can be downloaded directly:
VecTypes.h (shortcut type definitions to make the inline functions more compact),
AVConstants.h.bz2 (inline functions for eight bit constants only),
AVConstants16.h.bz2 (ca. 480KB, will expand to roughly 16 megabytes(!) of inline function definitions).
All in all, important work that I should have done myself in the first place. Thank You John!

As of 12-May-2001, 36654 values are reached in four instructions or less, and only one value (0x9c69) needs a sequence of six instructions. Just download the GZIP compressed table (ca. 720KB).
The generator program for this table is available under the GNU Public License. Be warned, though, on a 500MHz G4 Mac, it takes almost 10 hours to fill out the table. For experiments, you probably want to limit the search range to a sequence length of four (see line 1797 of the source); that takes just a few seconds and already fills half the table.

The original AltiVec Constants Table (for 8-bit constants). Now hopefully superseded by the new table above.

An ancient introduction to AltiVec from before the official announcement of the MPC7400.

Back to a dilletant's Home Page of student times...