Page 98 - ARM 64 Bit Assembly Language
P. 98
84 Chapter 4
Table 4.1: Formats for Operand2.
Operand2 Meaning
#<immediate|symbol> A 12 bit immediate value
#<pattern> A 13 bit pattern immediate used only for logical instructions.
Rm Any of the 31 registers R0-R30
Rm, <shift_op> #<shift_imm> The contents of a register shifted or rotated by an immediate
amount between 0 and 64
Rm, <extend_op> #<shift_imm> The contents of a register are extended and then are shifted left by
0-4 bits. Note that this mode cannot be used with logical instruc-
tions.
operand will enter the ALU through the B Bus and will either be the contents of a regis-
ter, or an immediate value which is encoded in the instruction currently being executed.
This second operand entering the ALU is referred to as Operand2, and can be one of four
things:
• a register (R0-R30),
• a register (R0-R30)and a shift operation to modify it, or
• a register (R0-R30)and a sign extend operation that also shifts the register left by zero to
four bits, or
• a 12-bit immediate value.
The options for Operand2 allow a great deal of flexibility. Many operations that would require
two instructions on most processors can be performed using a single AArch64 instruction.
Table 4.1 shows all of the possible forms for Operand2.
4.1.1 Shift and rotate operations
Table 4.2 shows the mnemonics used for specifying shift operations, which we refer to as
<shift_op>. All of the shift operations require the programmer to specify a shift amount,
which we will refer to as n.The lsl operation shifts each bit left. Zero is shifted into the n
least significant bits, and the most significant n bits are lost. The lsr operation shifts each bit
right. Zero is shifted into the n most significant bits, and the least significant n bits are lost.
The asr operation shifts each bit right. The n most significant bits become copies of the sign
bit (bit 63), and the least significant n bits are lost. The ror operation rotates the bits to the