User`s guide

MACRO Compiler Directives
.BRANCH_LIKELY
Example
MOVL (R0),R1
.BRANCH_LIKELY
BNEQ 10$
.
.
.
10$
The compiler will move the code between the BNEQ instruction and label 10$ to
the end of the module, and change the BNEQ 10$ to a BEQL to the moved code.
It will then continue immediately following the BEQL instruction with generation
of the code starting at label 10$.
.BRANCH_UNLIKELY
Instructs the compiler that the following branch will likely not be taken.
Therefore, the compiler generates code that incorporates that assumption.
Format
.BRANCH_UNLIKELY
There are no parameters for this directive.
Description
See the description of the .BRANCH_LIKELY directive for the assumptions used
by the compiler when predicting branches.
On OpenVMS Alpha systems, when .BRANCH_UNLIKELY precedes a conditional
backwards branch, the compiler will change the conditional branch and the code
such that the branch is a forward branch to an unconditional backwards branch.
.BRANCH_UNLIKELY should only be used in cases where the branch is very
unlikely, not just less frequent than the fall-through case.
On OpenVMS I64 systems, when .BRANCH_UNLIKELY precedes a conditional
backwards branch, the compiler will use the appropriate branch prediction flags
on the generated Itanium instruction.
.BRANCH_UNLIKELY has no effect if it precedes a conditional forwards branch.
Example
MOVL #QUEUE,R0 ;Get queue header
10$: MOVL (R0),R0 ;Get entry from queue
BEQL 20$ ;Forward branch assumed unlikely
.
. ;Process queue entry
.
TSTL (R0) ;More than one entry (known to be unlikely)
.BRANCH_UNLIKELY
BNEQ 10$ ;This branch made into forward
20$: ;conditional branch
The .BRANCH_UNLIKELY directive is used here because the Alpha hardware
would predict a backward branch to 10$ as likely to be taken. The programmer
Specialized Directives B–3