ldr x0,[x1]// load 64-bit from the address in x1 and put it to x0ldr w0,[x1]// load 32-bitldrb w0,[x1]// load bytestr x0,[x1]// store 64-bit value in x0 to the address in x1str w0,[x1]// store 32-bitstrb w0,[x1]// store byte
offset and increment
ldr x0,[x1,#16]// load from the address in x1 +16ldr x0,[x1],#16// load from the address in x1; x1 += 16 (post-increment)ldr x0,[x1,#16]!// x1 +=16; load from the address in x1 (pre-increment)
cmp x0, x1 // compare x0 and x1 and put the result into the condition flags registerb.eq label // branch if equalb.ne label //not equalb.gt, b.lt, b.ge, b.leb label // unconditionalbl func // branch and linkret// return
conditional branch instructions look at the flags set in the
condition flags register
in other words, they refer to the result of the last
compare instruction
bl func puts the address of the instruction immediately
following bl func instruction (i.e., the address of
bl func + 4) to x30 register
ret jumps to the address in x30
register
6 Function Prologue/Epilogue
Any function that calls another function
// Prologue (grows stack and saves x29 and x30; set x29 (fp))stp x29, x30,[sp,#-16]!mov x29,sp// Epilogue (restores x29 and x30; shrink stack; jump to x30)ldp x29, x30,[sp],#16ret
7 Floating-Point Registers
sN = 32-bit float, dN = 64-bit float
fadd s0, s1, s2 // float addfmul d0, d1, d2 // double mulscvtf s0, w0 // int to floatfcvtzs w0, s0 // float to intldr s0,[x0]// load floatstr d0,[x0]// store double