The Branch and Link Instruction



High Level Assembler(HLASM) for MVS & VM & VSE

The Branch and Link Instruction

Postby steve-myers » Fri Aug 31, 2018 12:12 pm

The Branch and Link Instruction (BAL) instruction, though it is heavily used, is sort of an odd duck instruction. The following quote is from the Principles of Operation manual. A similar quote has appeared in every Principles of Operation manual since Extended Architecture.

The BRANCH AND LINK instruction (BAL and BALR) is provided for compatibility reasons. It is recommended that, where possible, the BRANCH AND SAVE instruction (BAS and BASR), BRANCH RELATIVE AND SAVE, or BRANCH RELATIVE AND SAVE LONG be used and BRANCH AND LINK avoided, since the latter places nonzero information in bit positions in the 24-bit addressing mode, which may lead to problems. Additionally, in the 24-bit addressing mode, BRANCH AND LINK may be slower than the other instructions because BRANCH AND LINK must construct the ILC, condition code and program mask to be placed in bit positions 32-39 of the link register.

In other words, don't use BRANCH AND LINK.

Some history. Branch and Link was the sole linking instruction in System/360. Branch and Save initially appeared in the System/360 Model 20 and the System/360 Model 67. It was an RPQ instruction in the System/370 Model 168 to support TSS/370. Branch and Save does not store 8 bits of non linking data since there was no room for it in the 16-bit registers used in the Model 20, or the 32-bit registers in Model 67 when the machine was run in the 32-bit addressing mode. It became a mainline instruction with System/370 Extended Architecture.

The quote talks about "constructing" the 8 bits of other information in the link register. In System/360 this data was in bits 32 to 39 of the System/360 PSW; BAL transferred bits 32 through 63 from the PSW to the link register; it didn't have to "construct" anything.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post