Page 105 - ARM 64 Bit Assembly Language
P. 105
Data processing and other instructions 91
Name Effect Description
mov Rd ← imm16 or pattern Move an immediate to the destination
register.
movz Rd ← imm16 << shift Set register to immediate shifted.
movn Rd ←¬(imm16 << shift) Sets the register to the 1’s comple-
ment of the shifted immediate.
movk Rd[shift + 15 : shift]← Sets only four bits and keeps the rest
(imm16 << shift) of the number.
4.2.3.3 Examples
1 mov x0, x1 // x0 = x1
2 mov sp, x3 // sp = x3
3 mov x0, 0xffffffff // x0 = 0xffffffff
4 movz x0, 0xfedc, lsl #48 // x0 = 0xfedc000000000000
5 movk x0, 0xba09, lsl #32 // x0 = 0xfedcba0900000000
6 movk x0, 0x8765, lsl #16 // x0 = 0xfedcba0987650000
7 movk x0, 0x4321 // x0 = 0xfedcba0987654321
4.2.4 Shift operations
The shift operations allow the programmer to shift or rotate the contents of Rn by the number
of bits given by the contents of Rm. There are four operations in this group:
asr Arithmetic shift right,
lsr Logical shift right, and
lsl Logical shift left,
ror Rotate right.
4.2.4.1 Syntax
<op> Rd, Rn, Rm
• <op> is one of asr, lsl, lsr,and ror.
• When shifting right, the programmer must decide what to do with the most significant bit.
An arithmetic right shift means that the sign bit is extended to fill the upper bits, whereas
a logical right shift uses zeroes to fill the upper bits.
• The register Rm’s value, modulus the register size (32 or 64), is used as the shift amount.
• The ror operation rotates n bits to the right. Those bits “wrap around” and are shifted
into the upper bits.