A lookup operation is carried out on a data table by logically dividing
the data table into a number of smaller sets of data that can be indexed
with a single byte of data. Each set of data consists of two vectors,
which constitute the operands for a permute instruction. Only a limited
number of bits are required to index into the table during the execution
of this instruction. The remaining bits of each index are used as masks
into a series of select instructions. The select instruction chooses
between two vector components, based on the mask, and places the selected
components into a new vector. The mask is generated by shifting one of
the higher order bits of the index to the most significant position, and
then propagating that bit throughout a byte, for example by means of an
arithmetic shift. This procedure is carried out for all of the index
bytes in the vector, to generate a select mask. The select mask is then
used during a select operation, to choose between the results of permute
instructions on different ones of the logically divided sets of data.
Multi-byte table entries are retrieved by replicating each index value
and adding consecutive values to form multiple consecutive index values
that are then used in multiple permute operations.