376 THE PDP-11 FAMILY
Notice that no push routines are needed for any of the variables.
All subscripting operations resulted in the address of the array element being left in R0 at execution time. Only one-dimensional arrays were handled. Two- and three-dimensional arrays continued to be handled as in the more general Phase 1 implementation.
These forms can occur on both left- and right-handed sides of assignment statements.
The arithmetic instructions are three address instructions, taking two arguments and putting the result in a designated place. These instructions are limited to +, -, *, / on integer, real, and double-precision data.
Ad Hoc Special Cases
Within this general framework, a number of additional ad hoc addressing modes were incorporated.
For each of the arithmetic operators and each of the three data-types, the first operand addressing mode could be given as D to designate that it was the same as the destination core address and the destination parameter was eliminated. This was not done for the second operand based on the simple observation that programmers will almost always write assignments as:
A =A +...
instead of:
A = . . . + A
This added 12 more service routines.
For the integer operators only, the second operand could be given as K to designate that it was a constant given as the parameter instead of the address of the value. This was not done for the first operand for reasons similar to the case above.
For integer add and subtract operators only, the second operand could be given as 1 to designate that it is the constant value 1 and no parameter is present. This is simply a frequent special case of the previous use of K.
By combining the above, the FORTRAN statement:
K = K + l
is compiled to:
$DICAI,K
where the service routine is simply:
This code occupies two words and requires five memory cycles to execute. This is not quite as good as the two words and three cycles needed for direct PDP-l 1 code, but far better than the five words and 18 cycles required by the earlier implementation.
General Results
Execution improvement varied, of course, with the particular programs used. Over a large set of programs, the following guidelines were obtained.
.
Programs that were floating-point intensive increased in speed by factors of 1.1 to 1.6, with 1.3 being representative..
Programs that were integer intensive increased in speed by factors of 1.4 to 2.4, with 2.0 being representative. (One particularly simple benchmark increased in speed by a factor of 4!)Moreover, because of the reduced need for push routines, most programs increased in size by less than 10 percent.