The new System z’s have included new instructions regarding vectors.
Vectors are just fields with the same definition, - like integers etc. – located in a row in a general vector register. There are special registers for vectors that contains 16 bytes. Such a vector register can contain 8 halfwords, 4 fullwords, or 2 doublewords. A Vector instruction will do the same work on all fields in the Vector Register in parallel. For example, a Vector Add (VA) will add two Vector Registers together and save the result in a third Vector register.
VA 3,1,2,WORD
Add Vector Register 1 and Vector Register 2 and save the result in Vector Register 3. The values are contained in 4 fullwords.
Add Vector Register 1 and Vector Register 2 and save the result in Vector Register 3. The values are contained in 4 fullwords.
The machine instructions are somewhat different from instructions that we are used to.
The first byte is always X’E7’ for Vector Instructions. The last byte in the instruction will
indicate the actual Vector Instruction. In this case X’F3’ tells that it is an add instruction.
The assembler instruction VA is ended with a number, here 2, that tells the instruction
that the vector register storage is divided in words, 4 bytes.
The following two instructions (VL) load contents into Vector Registers 1 and 2.
The VA adds them together.
The last (VST) stores Vector Register 3 into storage called “VECTOR_RESULT”
It will be best practice to define the alignment of storage fields when you access real storage.
That will speed up execution of the instructions.
The result of the VST instruction is
The full program looks like this:
Denne kommentar er fjernet af en blogadministrator.
SvarSlet