[Next] [Up] [Previous]

Additional Features

This section describes several additional features available in this mode over and above basic memory-reference operations applied to vectors.

It describes extra instructions that perform functions such as setting mask bits based on the individual elements of a vector, other extra instructions that assist with performing the Fast Fourier Transform, and a class of instructions that allows different operations to be performed in parallel on the individual elements of a vector.

Additional Operations

Instructions for setting mask bits corresponding to the values in a vector were present among the short vector instructions. These instructions were special instructions, not standard memory-reference instructions, but had four-bit opcodes patterned after those of the standard memory-reference instructions, along with a separate three-bit byte indication, as part of the second word of the instruction.

Instructions having this function are also provided for use with those long vector addressing modes that have a long vector register as their destination. These instructions, however, are standard memory-reference instructions.

No opcodes exist corresponding to the opcodes used for this purpose with short vectors for the floating types, however. As this is a function requiring only one operand, this is dealt with by performing the integer operation when the destination register is zero, and the corresponding floating-point operation when the destination register is four.

The opcodes so used are the ones corresponding to the unsigned compare, multiply extensibly, and divide extensibly instructions, which are not usable with long vectors.

That is, for testing a vector in memory, we have the opcodes:

011700  SMBLVZB   Set Mask Bit Long Vector if Zero Byte
016700  SMBLVPB   Set Mask Bit Long Vector if Positive Byte
017700  SMBLVNB   Set Mask Bit Long Vector if Negative Byte

011704  SMBLVZM   Set Mask Bit Long Vector if Zero Medium
016704  SMBLVPM   Set Mask Bit Long Vector if Positive Medium
017704  SMBLVPM   Set Mask Bit Long Vector if Negative Medium

031700  SMBLVZH   Set Mask Bit Long Vector if Zero Halfword
036700  SMBLVPH   Set Mask Bit Long Vector if Positive Halfword
037700  SMBLVNH   Set Mask Bit Long Vector if Negative Halfword

031704  SMBLVZF   Set Mask Bit Long Vector if Zero Floating
036704  SMBLVPF   Set Mask Bit Long Vector if Positive Floating
037704  SMBLVPF   Set Mask Bit Long Vector if Negative Floating

011710  SMBLVZ    Set Mask Bit Long Vector if Zero
016710  SMBLVP    Set Mask Bit Long Vector if Positive
017710  SMBLVN    Set Mask Bit Long Vector if Negative

011714  SMBLVZD   Set Mask Bit Long Vector if Zero Double
016714  SMBLVPD   Set Mask Bit Long Vector if Positive Double
017714  SMBLVND   Set Mask Bit Long Vector if Negative Double

031710  SMBLVZL   Set Mask Bit Long Vector if Zero Long
036710  SMBLVPL   Set Mask Bit Long Vector if Positive Long
037710  SMBLVNL   Set Mask Bit Long Vector if Negative Long

031714  SMBLVZQ   Set Mask Bit Long Vector if Zero Quad
036714  SMBLVPQ   Set Mask Bit Long Vector if Medium Quad
037714  SMBLVPQ   Set Mask Bit Long Vector if Negative Quad

based on the use of these opcodes within vector-to-vector register mode, and these opcodes, that is, the ones for the unsigned compare, multiply extensibly, and divide extensibly instructions, can also be used for setting mask bits based on the contents of a vector register, or a vector scratchpad element, by using them within the vector register address format, or the vector scratchpad to vector register address format, respectively.

With long vectors, the medium and quad types are allowed, unlike the case of short vectors. This is true both of the long vector registers and the register scratchpad. And the mask bits are only used to control operations involving those registers as well.

In the memory to memory vector instructions of constant and reversed constant type, the S bit, which replaces the I bit for the constant register operand, indicates if 0 that it is found in one of the regular registers, and is indicated by the oR or sR field, and if 1 that it is found in one of the supplementary registers, and is indicated by the oS or sS field of the instruction.

As the identities of the low and high scratchpad registers define the length, the vector-to-scratchpad instructions need no length field; they are similar to multiple-register instructions. None of the vector instruction formats allows the multiply extensibly or divide extensibly instructions, as they have operands of unequal length.

In the vector register constant and vector scratchpad constant modes, the R bit in the instruction allows the destination vector to be subtracted from the source scalar, or the source scalar to be divided by the destination vector, in forming the result to be placed in the destination vector.


The seven-bit opcode 0110000, which would correspond to an "insert long" instruction, is used for those addressing modes in which the destination is the supplementary registers, for the LTL (Load Transposed Long) instruction. This instruction loads the 64 supplementary arithmetic-index registers with the bit matrix transpose of the operand consisting of 64 values each 64 bits long. Using this instruction twice, combined with rearranging the individual 64-bit values in the supplementary arithmetic/index registers, and moving them out, allows sixty-four bit transpositions on 64-bit words to be carried out in parallel.

As with vector mode, the opcodes that would be used for compare instructions instead specify multiply and accumulate instructions when used in conjunction with long vector instruction formats, giving the seven-bit opcodes:

0010001  MAH  Multiply and Accumulate Halfword
0100001  MA   Multiply and Accumulate
0110001  MAL  Multiply and Accumulate Long
1000001  MAM  Multiply and Accumulate Medium
1001001  MAF  Multiply and Accumulate Floating
1010001  MAD  Multiply and Accumulate Double
1011001  MAQ  Multiply and Accumulate Quad

As well, the op2 and op3 fields shown for some instructions are zero when those instructions are used with the seven-bit opcode field having its normal meaning.

When the op2 field equals 1, the following additional operations involving long vectors are defined:

0000000  BRL16B    0010000  BRL16H    0100000  BRL16     0110000  BRL16L

0000010  BRL32B    0010010  BRL32H    0100010  BRL32     0110010  BRL32L
0000011  SH32B     0010011  SH32H     0100011  SH32      0110011  SH32L
0000100  BRL64B    0010100  BRL64H    0100100  BRL64     0110100  BRL64L
0000101  SH64B     0010101  SH64H     0100101  SH64      0110101  SH64L
0000110  US128B    0010110  US128H    0100110  US128     0110110  US128L
0000111  SH128B    0010111  SH128H    0100111  SH128     0110111  SH128L


1000000  BRL16M    1001000  BRL16F    1010000  BRL16D    1011000  BRL16Q

1000010  BRL32M    1001010  BRL32F    1010010  BRL32D    1011010  BRL32Q
1000011  SH32M     1001011  SH32M     1010011  SH32D     1011011  SH32Q
1000100  BRL64M    1001100  BRL64F    1010100  BRL64D    1011100  BRL64Q
1000101  SH64M     1001101  SH64F     1010101  SH64D     1011101  SH64Q
1000110  US128M    1001110  US128F    1010110  US128D    1011110  US128Q
1000111  SH128M    1001111  SH128F    1010111  SH128D    1011111  SH128Q

These are the various Bit-Reversed Load instructions and the various Shuffle instructions.

For the BRL64 instructions, the range must be the range of locations within a vector:

(0,63)

and the instruction loads register abcdef (in binary) of the destination from register fedcba of the source. This operation has some use with the Fast Fourier Transform algorithm, as we will see below.

For the BRL32 instructions, the range must be one or both of the ranges:

(0,31)(32,63)

and within each range, register xabcde of the destination is loaded from register xedcba of the source.

For the BRL16 instructions, the range must be any contiguous combination of the following subranges:

(0,15)(16,31)(32,47)(48,63)

and within each range, register xxabcd of the destination is loaded from register xxdcba of the source.

Thus, a BRL16 instruction takes elements 0 through 16 of the source, and places them in the destination in the order:

 0  8  4 12  2 10  6 14  1  9  5 13  3 11  7 15

The SH32 and SH64 instructions have the same ranges as the BRL32 and BRL64 instructions. A Shuffle instruction combines elements from the first and second halves of each subrange in the source by taking one element from each half in turn alternately.

Thus, an SH32 instruction takes the elements 0 through 31 of the source, and places them in the destination in the order:

 0 16  1 17  2 18  3 19  4 20  5 21  6 22  7 23
 8 24  9 25 10 26 11 27 12 28 13 29 14 30 15 31

The range given for an SH128 instruction must also be from 0 to 63, but its operands must be even-numbered long vector registers or long vector scratchpad locations, as the source and destination are considered to be the entire addressed register and the entire register following.

The shuffle instructions are also intended for use in performing Fast Fourier Transform calculations. One long vector register would normally contain the real parts of the numbers involved, and another one the complex parts: the diagram below, showing the classic Cooley-Tukey Fast Fourier Transform algorithm in its original form, followed by the reversed, or Sande-Tukey form of the algorithm, shows why the shuffle operation is highly useful to an efficient fast Fourier transform using vector arithmetic.

All three formulations are equivalent, but the third performs all its operations with vectors of the maximum length. Since the operations, in this eight point FFT, use vectors of four items, it is also clear why, given the ability to perform vector operations on vectors with 64 elements, the SH128 instruction needed to be defined.

Note that while the operation in the last column of the FFT using a shuffle after each stage appears the same as that for the classic Cooley-Tukey algorithm, the elements of the transformed vector are not in natural order, but are in bit-reversed order within each half, which makes bit-reversed operations having half the length of the shuffle used still relevant. Thus, the algorithm illustrated in the third part of the diagram is the Pease framework for the Fast Fourier Transform.

It is intended that a 128-point FFT would make use of the SH128 and BRL64 instructions, where the real parts of the first 64 points, the imaginary parts of the first 64 points, the real parts of the second 64 points, and the imaginary parts of the second 64 points would each occupy a vector.

The US128 instructions perform the inverse operation of the SH128 instructions, and are used in converting arrays of complex numbers into separate vectors of their real and imaginary parts.

It should be noted that a more modern form of the Fast Fourier Transform, the Stockham framework, is currently more popular than the Pease framework:

This form of the FFT corrects the flaw of the Pease framework, and presents its result with elements in order. However, a different transposition of vector elements is required at each stage of the algorithm, first a shuffle of individual elements, then a shuffle of pairs of elements, then a shuffle of groups of four elements, and so on. For hardware acceleration with 64-element vectors, therefore, the Stockham framework requires that five special operations be defined, while the Pease framework requires only two: SH128 and LBR64. In the case of short vector operations, where the length of the vector, rather than the number of its elements, is fixed, it is the Stockham framework rather than the Pease framework which is simpler to implement, and thus it is the framework for which hardware assist instructions are provided there.

When the op2 field equals 2, another set of useful operations involving rearranging the items within a vector of 64 elements is provided.

Once again, the first four bits of the main opcode indicate the type of the operands:

0000 byte
0010 halfword
0100 integer
0110 long
1000 medium
1001 floating
1010 double
1011 quad

and this time the last three bits indicate displacements:

      X    Y
000  -1   -1
001   0   -1
010  +1   -1
011  -1    0
100  +1    0
101  -1   +1
110   0   +1
111  +1   +1

where the 64 elements of a long vector are considered to be arranged in a square array in the following order:

 56 57 58 59 60 61 62 63
 48 49 50 51 52 53 54 55
 40 41 42 43 44 45 46 47
 32 33 34 35 36 37 38 39
 24 25 26 27 28 29 30 31
 16 17 18 19 20 21 22 23
  8  9 10 11 12 13 14 15
  0  1  2  3  4  5  6  7

and a displacement of (+1,0) means that element 18 is loaded from element 19, increased by one in the X direction; a displacement of (0,+1) means that element 18 is loaded from element 26, an increase of one in the Y direction.

The instruction is maskable, and the rows and columns are both considered to wrap around, so that if 7 comes after 6, 0 comes after 7. These instructions allow values in a long vector to interact with their nearest neighbors where a long vector is considered to be acting as part of a two-dimensional array of numbers.

Multi-Way Vector Operations

In order to keep the 64 arithmetic-logic units of the long vector unit as busy as possible, while stopping short of having 64 separate instruction streams, instruction modes are defined in which one to three mask registers can be designated in an instruction.

If one mask register is designated, instead of merely indicating whether or not an operation is performed, it indicates which of two operations are performed.

Similarly, two mask registers indicate, by means of their corresponding bits, which of four operations are performed on each of the 64 values accessed in parallel in the supplementary registers, the long vector registers, or the long vector scratchpad.

And three mask registers indicate one of eight possible operations.

The type field in the instruction has the usual interpretation, and can indicate fixed-point as well as floating types.

The possible operations are:

000 no operation
001 subtract reversed
010 load
011 divide reversed
100 add
101 subtract
110 multiply
111 divide

There is a load instruction, causing the destination to be replaced by the source, but no store instruction, since that cannot easily be executed in parallel with the other operations.

Subtract reversed replaces the destination with the source minus the destination, and divide reversed replaces the destination with the source divided by the destination.

The bottom portion of the diagram shows the last part of the instruction, having the same form for two-way, four-way, and eight-way instructions, which gives the two operands to the instruction.

The instructions used for this feature have the following form:

Each instruction includes a beginning part, in the format shown.

The two-way vector operation instructions, if acting on fixed-point vectors, occupy the opcode space continuing from the vector register constant format; if acting on floating-point vectors, occupy the opcode space continuing from the short scratchpad format.

The opcode space continuing from the scratchpad memory reference and vector to vector scratchpad formats is what is used by both the four-way and eight-way vector operation instructions.

Each instruction also includes an end part, in the format shown in the diagram. Note that the end part of the instruction always begins with a 1.

When a halfword beginning with a 0 is found immediately after the end of the beginning part of the instruction, that means this halfword is the middle part of the instruction, and that the instruction is ranged; the low and high destination scratchpad fields of the instruction specify the start and end of the contiguous group of elements, from among the possible 64 elements of a vector, that are operated upon by the instruction.


[Next] [Up] [Previous]