VMS Help
MACRO, /MIGRATION, Compiler Directives, .BRANCH UNLIKELY

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    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.

  1 - Description

    The .BRANCH_UNLIKELY directive instructs the compiler that
    the following conditional branch will likely not be taken. The
    compiler then generates code that incorporates that assumption.

    Alpha system hardware predicts that forward conditional branches
    are not taken. Therefore, if a .BRANCH_UNLIKELY directive
    precedes a branch that will be in the forward direction, it
    has no effect. However, if it precedes a branch that would be
    backward, code is generated to force the branch to be forward, to
    an out-of-line branch back to the actual branch destination.

    .BRANCH_UNLIKELY should be used only in cases where the branch is
    very unlikely, not just less frequent than the fall-through case.

  2 - 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 (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 knows it is a rare case, so the directive
      is used to change the branch to a forward branch, which is
      predicted not taken.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.