next up previous

3.5.1 Vector Processors

A vector processor is a processor that can operate on entire vectors with one instruction, i.e. the operands of some instructions specify complete vectors. For example, consider the following add instruction:

C = A + B

In both scalar and vector machines this means ``add the contents of A to the contents of B and put the sum in C.'' In a scalar machine the operands are numbers, but in vector processors the operands are vectors and the instruction directs the machine to compute the pairwise sum of each pair of vector elements. A processor register, usually called the vector length register, tells the processor how many individual additions to perform when it adds the vectors.

A vectorizing compiler is a compiler that will try to recognize when loops can be transformed into single vector instructions. For example, the following loop can be executed by a single instruction on a vector processor:

         DO 10 I=1,N
         A(I) = B(I) + C(I)
10       CONTINUE

This code would be translated into an instruction that would set the vector length to N followed by a vector add instruction.