Hardware Reference
In-Depth Information
In all four cases the target address is not known at compile time, and hence is usually loaded
from memory into a register before the register indirect jump.
As branches generally use PC-relative addressing to specify their targets, an important
question concerns how far branch targets are from branches. Knowing the distribution of these
displacements will help in choosing what branch offsets to support, and thus will affect the
instruction length and encoding. Figure A.15 shows the distribution of displacements for PC-
relative branches in instructions. About 75% of the branches are in the forward direction.
FIGURE A.15 Branch distances in terms of number of instructions between the target
and the branch instruction . The most frequent branches in the integer programs are to tar-
gets that can be encoded in 4 to 8 bits. This result tells us that short displacement fields often
suffice for branches and that the designer can gain some encoding density by having a short-
er instruction with a smaller branch displacement. These measurements were taken on a
load-store computer (Alpha architecture) with all instructions aligned on word boundaries. An
architecture that requires fewer instructions for the same program, such as a VAX, would have
shorter branch distances. However, the number of bits needed for the displacement may in-
crease if the computer has variable-length instructions to be aligned on any byte boundary.
The programs and computer used to collect these statistics are the same as those in Figure
A.8 .
Conditional Branch Options
Since most changes in control flow are branches, deciding how to specify the branch condition
is important. Figure A.16 shows the three primary techniques in use today and their advant-
ages and disadvantages.
 
Search WWH ::




Custom Search