Page 81 - ARM 64 Bit Assembly Language
P. 81
66 Chapter 3
3.4.1.1 Syntax
<op>{<size>} Rd, <addr>
• <op> is either ldr or str.
• The optional <size> is one of:
b unsigned byte
h unsigned half-word
sb signed byte
sh signed half-word
sw signed word
• <addr> is one of the address specifiers described in Section 3.3.3.
• str cannot use a signed <size>. It also cannot use the literal addressing mode.
3.4.1.2 Operations
Name Effect Description
ldr Rd ← Mem[addr] Load register from memory at addr
str Mem[addr] ← Rd Store register in memory at addr
3.4.1.3 Examples
Load the word (4 byte) value from Mem[x4] into w8, and set the upper four bytes of x8 to
zero.
1 ldr w8, [x4]
Store the least-significant byte from register x12 into Mem[x2].
1 strb x12, [x2]
Load the double-word (8 byte) value from Mem[x3 + 7] into x5.Thenset x3=x3+7:
1 ldr x5, [x3, #7]!
Store the half-word (2 byte) value in w9 to Mem[x6].Thenset x6=x6+7:
1 strh w9, [x6], #7
Load the half-word value from Mem[x0 + 8] into x5 and sign extend it: