# ARM64 Layer 1, target page. Verified against `go tool asm` of Go 1.27.1, against the toolchain's own arm64 assembler manual (`cmd/internal/obj/arm64/doc.go`) and against gasm's encoder, whose output is compared byte for byte with the toolchain's. The complete mnemonic inventory lives in the generated appendix [INSTRUCTIONS-ARM64.md](INSTRUCTIONS-ARM64.md). ## Registers - General purpose: `R0` to `R30`, plus `ZR`, the zero register, and `RSP`, the stack pointer. There is no R31: thirty-one names and ZR. - Floating-point and SIMD share one file written `Vn`; where an instruction is scalar floating point the operand may be written `Fn` (`F0` to `F31`). - SVE register names (`Z0` to `Z31`, `P0` to `P15`) exist in the assembler's tables. - Roles the convention fixes: `RSP` is the stack pointer, `R29` the frame pointer, `R30` the link register, `R26` the closure context and `R27` the assembler's scratch register. The goroutine pointer lives in `R28` and is written `g` in source, its fields as `g_m(g)`, `g_sched(g)`; `R18` is the platform-reserved register and the Go toolchain never addresses it. ## Loads, stores and the width suffixes The MOV series is the load and store interface, with the width in the mnemonic rather than the register name: | Mnemonic | Machine instruction | |---|---| | `MOVD` | ldr, str, stur, 64-bit | | `MOVW` | ldrsw, str, stur, 32-bit sign extending | | `MOVWU` | ldr, 32-bit zero extending | | `MOVH` | ldrsh, strh, sturh | | `MOVHU` | ldrh | | `MOVB` | ldrsb, strb, sturb | | `MOVBU` | ldrb | Post-index and pre-index addressing take the `.P` and `.W` suffixes on the mnemonic: `MOVD.P -8(R10), R8` is `ldr x8, [x10],#-8`, and `MOVB.W 16(R16), R10` is `ldrsb x10, [x16,#16]!`. ## Addressing ```text imm(Rn|RSP) 28(R17) (Rn|RSP) (R22) (Rn)(Rm) (R27)(R23) (Rn)(Rm<, , , `. - The scalar FMA family `FMADDD` and friends are `, , , `. - The bitfield family `BFI`, `BFXIL`, `SBFIZ`, `SBFX`, `UBFIZ`, `UBFX` is `$, , $, `. - The conditional compare and select families carry the condition as the **first** operand: `CSEL GT, R0, R19, R1`, `CCMP MI, R22, $12, $13`, `FCCMPD AL, F8, F26, $0`. - The exclusive stores are `, (), ` with the status register last: `STLXR ZR, (R15), R16`. - `TBZ` and `TBNZ` are `$, ,