feat(asm): extend arm64 encoder with atomics, bitfield, SIMD and more test kernels

Assisted-by: MiMo V2.5 Pro
This commit is contained in:
2026-08-20 14:31:15 +02:00
parent 6e73f59e78
commit 97951cbeb6
9 changed files with 429 additions and 40 deletions
+8 -5
View File
@@ -132,15 +132,18 @@ func arm64Prologue(fi arm64FrameInfo) []byte {
func arm64Return(fi arm64FrameInfo) []byte {
var ws []uint32
if fi.autosize != 0 {
if fi.autosize <= 0xf0 {
// Small frame (leaf or non-leaf): ADD $autosize-8, SP, FP; ADD $autosize, SP, SP
// The Go toolchain uses this simpler epilogue for small frames even for
// non-leaf functions — LR is not explicitly restored; the return address
// is already in LR from the caller's BL instruction.
if fi.leaf {
// Leaf with frame: ADD $autosize-8, SP, FP; ADD $autosize, SP, SP
ws = append(ws,
a64AddSub(1, 0, 0, 0, uint32(fi.autosize-8), 31, 29), // ADD $autosize-8, SP, FP
a64AddSub(1, 0, 0, 0, uint32(fi.autosize), 31, 31), // ADD $autosize, SP, SP
)
} else if fi.autosize <= 0xf0 {
// Non-leaf small frame: LDR FP, [SP, #-8]; LDR.P LR, [SP], #autosize
ws = append(ws,
arm64UnscaledLoad(3, 0, -8, 31, 29), // LDR FP, [SP, #-8]
arm64PostLoad(3, 0, int32(fi.autosize), 31, 30), // LDR.P LR, [SP], #autosize
)
} else {
// Large frame: LDP -8(SP), (FP, LR); ADD $autosize, SP, SP
ws = append(ws,