Page 85 - ARM 64 Bit Assembly Language
P. 85
70 Chapter 3
16
17 ldp x29, x30, [sp], #16 // Restore x29 and x30
18 ldp x27, x28, [sp], #16 // Restore x27 and x28
19 ldp x25, x26, [sp], #16 // Restore x25 and x26
20 ldp x23, x24, [sp], #16 // Restore x23 and x24
21 ldp x21, x22, [sp], #16 // Restore x21 and x22
22 ldp x19, x20, [sp], #16 // Restore x19 and x20
23 ret
24 .size exmpl, (. - exmpl)
3.5 Branch instructions
Branch instructions allow the programmer to change the address of the next instruction to be
executed. They are used to implement loops, if-then structures, subroutines, and other flow
control structures. There are five instructions related to branching:
• Branch,
• Branch to Register,
• Branch and Link (subroutine call),
• Compare and Branch, and
• Form program-counter-relative Address.
3.5.1 Branch
This instruction is used to perform conditional and unconditional branches in program execu-
tion:
b Branch.
It is used for creating loops and if-then-else constructs. This is the only instruction that may
have a conditional suffix attached to the mnemonic.
3.5.1.1 Syntax
b{<cond>} <target_label>
• The optional <cond> can be any of the codes from Table 3.2 specifying conditional exe-
cution.
• The <target_label> can be any label in the current file, or any label that is defined as
.global or .globl in any file that is linked in (within a certain range).