style: put the repository assembly in gasm fmt canonical form

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-17 20:33:18 +02:00
parent 0b42ce7952
commit 03d6d4da54
26 changed files with 583 additions and 542 deletions
+1
View File
@@ -16,6 +16,7 @@ cas_retry:
ADDI X0, $1, X15 ADDI X0, $1, X15
MOV X15, ret+24(FP) MOV X15, ret+24(FP)
RET RET
cas_fail: cas_fail:
MOV X0, ret+24(FP) MOV X0, ret+24(FP)
RET RET
+1
View File
@@ -35,6 +35,7 @@ vec1:
VPSUBD Y1, Y2, Y3 VPSUBD Y1, Y2, Y3
ADDQ $32, SI ADDQ $32, SI
JMP vec1 JMP vec1
vec1done: vec1done:
MOVQ AX, partSum+56(FP) MOVQ AX, partSum+56(FP)
+1 -1
View File
@@ -47,7 +47,7 @@ wc_have_n:
VMOVDQU (SI), Y0 VMOVDQU (SI), Y0
VMOVDQU Y0, (DI) VMOVDQU Y0, (DI)
VMOVDQU -32(SI)(BX*1), Y0 VMOVDQU -32(SI)(BX*1), Y0
VMOVDQU Y0, -32(DI)(BX*1) VMOVDQU Y0,-32(DI)(BX*1)
VZEROUPPER VZEROUPPER
RET RET
+3
View File
@@ -31,11 +31,14 @@ TEXT ·branch(SB), NOSPLIT, $0-0
BLT done BLT done
BGT done BGT done
BLE done BLE done
skip: skip:
B loop B loop
loop: loop:
ADD R4, R5 ADD R4, R5
RET RET
done: done:
RET RET
+3
View File
@@ -45,10 +45,13 @@ TEXT ·branch(SB), NOSPLIT, $0-0
BGE R10, R11, done BGE R10, R11, done
BLTU R12, R13, done BLTU R12, R13, done
BGEU R14, R15, done BGEU R14, R15, done
skip: skip:
JMP loop JMP loop
loop: loop:
JAL skip JAL skip
RET RET
done: done:
RET RET
+3
View File
@@ -19,9 +19,12 @@ TEXT ·branch(SB), NOSPLIT, $0-0
BVC done BVC done
BHI done BHI done
BLS done BLS done
skip: skip:
B loop B loop
loop: loop:
ADD R4, R5 ADD R4, R5
done: done:
RET RET
+8
View File
@@ -7,29 +7,37 @@ TEXT ·branches(SB), NOSPLIT, $0
ADDI $1, X10, X10 ADDI $1, X10, X10
BEQ X10, X11, beq_done BEQ X10, X11, beq_done
ADDI $2, X10, X10 ADDI $2, X10, X10
beq_done: beq_done:
BNE X10, X11, bne_done BNE X10, X11, bne_done
ADDI $3, X10, X10 ADDI $3, X10, X10
bne_done: bne_done:
BLT X10, X11, blt_done BLT X10, X11, blt_done
ADDI $4, X10, X10 ADDI $4, X10, X10
blt_done: blt_done:
BGE X10, X11, bge_done BGE X10, X11, bge_done
ADDI $5, X10, X10 ADDI $5, X10, X10
bge_done: bge_done:
BLTU X10, X11, bltu_done BLTU X10, X11, bltu_done
ADDI $6, X10, X10 ADDI $6, X10, X10
bltu_done: bltu_done:
BGEU X10, X11, bgeu_done BGEU X10, X11, bgeu_done
ADDI $7, X10, X10 ADDI $7, X10, X10
bgeu_done: bgeu_done:
RET RET
TEXT ·jumps(SB), NOSPLIT, $0 TEXT ·jumps(SB), NOSPLIT, $0
JMP done JMP done
ADDI $1, X10, X10 ADDI $1, X10, X10
done: done:
JAL X11, skip JAL X11, skip
ADDI $2, X10, X10 ADDI $2, X10, X10
skip: skip:
RET RET
+16
View File
@@ -78,24 +78,34 @@ TEXT ·branches21(SB), NOSPLIT, $0-0
BLEZ R10, l7 BLEZ R10, l7
BGTZ R11, l8 BGTZ R11, l8
JMP l9 JMP l9
l1: l1:
JMP l10 JMP l10
l2: l2:
JMP l11 JMP l11
l3: l3:
JMP l12 JMP l12
l4: l4:
JMP l13 JMP l13
l5: l5:
JMP l14 JMP l14
l6: l6:
JMP l15 JMP l15
l7: l7:
JMP l16 JMP l16
l8: l8:
JMP l16 JMP l16
l9: l9:
MOVV R1, R2 MOVV R1, R2
l10: l10:
LL (R12), R13 LL (R12), R13
LLV (R14), R15 LLV (R14), R15
@@ -105,26 +115,32 @@ l10:
SYSCALL SYSCALL
DBAR DBAR
RET RET
l11: l11:
JAL (R30) JAL (R30)
RET RET
l12: l12:
BSTRINSV $7, R4, $0, R5 BSTRINSV $7, R4, $0, R5
BSTRPICKV $63, R6, $32, R7 BSTRPICKV $63, R6, $32, R7
ALSLV $2, R8, R9, R10 ALSLV $2, R8, R9, R10
ADDV16 $65536, R11, R12 ADDV16 $65536, R11, R12
RET RET
l13: l13:
MOVV $0xffffffffffffffff, R13 MOVV $0xffffffffffffffff, R13
RET RET
l14: l14:
CPUCFG R14, R14 CPUCFG R14, R14
RET RET
l15: l15:
NOR R15, R16, R17 NOR R15, R16, R17
ORN R18, R19, R20 ORN R18, R19, R20
ANDN R21, R24, R25 ANDN R21, R24, R25
RET RET
l16: l16:
MOVB R26, (R27) MOVB R26, (R27)
MOVB (R28), R29 MOVB (R28), R29
+5 -5
View File
@@ -38,11 +38,11 @@ TEXT ·enterJITChecked(SB), NOSPLIT, $0-16
MOVQ stack+8(FP), SP // switch to prepared stack MOVQ stack+8(FP), SP // switch to prepared stack
JMP AX JMP AX
// leaveJITCheckedRaw is the raw return trampoline. It has NO Go function // leaveJITCheckedRaw is the raw return trampoline. It has NO Go function
// declaration, so no ABIInternal wrapper is generated; the JIT function's // declaration, so no ABIInternal wrapper is generated; the JIT function's
// RET lands here directly, seeing BP and R14 exactly as the function left // RET lands here directly, seeing BP and R14 exactly as the function left
// them. It checks the sentinels, records violations in abiResult, then // them. It checks the sentinels, records violations in abiResult, then
// restores the Go stack and returns. // restores the Go stack and returns.
TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0 TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0
// Check BP against the sentinel. // Check BP against the sentinel.
MOVQ $SENTINEL_BP, CX MOVQ $SENTINEL_BP, CX
+8 -5
View File
@@ -47,11 +47,11 @@ TEXT ·enterJITChecked(SB), NOSPLIT, $0-16
// reads its first argument at SP+8 // reads its first argument at SP+8
JMP (R0) // branch to JIT function JMP (R0) // branch to JIT function
// leaveJITCheckedRaw is the raw return trampoline. It has NO Go function // leaveJITCheckedRaw is the raw return trampoline. It has NO Go function
// declaration, so no ABIInternal wrapper is generated; the JIT function's // declaration, so no ABIInternal wrapper is generated; the JIT function's
// RET lands here directly, seeing R29 and g exactly as the function left // RET lands here directly, seeing R29 and g exactly as the function left
// them. It checks the sentinels, records violations in abiResult, then // them. It checks the sentinels, records violations in abiResult, then
// restores the Go stack and returns. // restores the Go stack and returns.
TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0 TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0
MOVD $0, R4 // accumulated violation bits MOVD $0, R4 // accumulated violation bits
@@ -61,6 +61,7 @@ TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0
BEQ fp_ok BEQ fp_ok
MOVD $1, R5 MOVD $1, R5
ORR R5, R4, R4 ORR R5, R4, R4
fp_ok: fp_ok:
// Check g against the sentinel. // Check g against the sentinel.
MOVD $SENTINEL_G, R3 MOVD $SENTINEL_G, R3
@@ -68,6 +69,7 @@ fp_ok:
BEQ g_ok BEQ g_ok
MOVD $2, R5 MOVD $2, R5
ORR R5, R4, R4 ORR R5, R4, R4
g_ok: g_ok:
CBZ R4, restore CBZ R4, restore
MOVD R4, ·abiResult(SB) MOVD R4, ·abiResult(SB)
@@ -86,4 +88,5 @@ restore:
// checked trampoline saves the caller's frame pointer for vet's sake and // checked trampoline saves the caller's frame pointer for vet's sake and
// never restores it, and this file mirrors that. // never restores it, and this file mirrors that.
GLOBL savedFP(SB), NOPTR, $8 GLOBL savedFP(SB), NOPTR, $8
GLOBL savedG(SB), NOPTR, $8 GLOBL savedG(SB), NOPTR, $8
+5 -5
View File
@@ -41,11 +41,11 @@ TEXT ·enterJITChecked(SB), NOSPLIT, $0-16
// reads its first argument at SP+8 // reads its first argument at SP+8
JIRL R0, R4, 0 // jump to JIT function JIRL R0, R4, 0 // jump to JIT function
// leaveJITCheckedRaw is the raw return trampoline. It has NO Go function // leaveJITCheckedRaw is the raw return trampoline. It has NO Go function
// declaration, so no ABIInternal wrapper is generated; the JIT function's // declaration, so no ABIInternal wrapper is generated; the JIT function's
// RET lands here directly, seeing g exactly as the function left it. It // RET lands here directly, seeing g exactly as the function left it. It
// checks the sentinel, records violations in abiResult, then restores the // checks the sentinel, records violations in abiResult, then restores the
// Go stack and returns. // Go stack and returns.
TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0 TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0
// Check g against the sentinel. // Check g against the sentinel.
MOVV $SENTINEL_G, R5 MOVV $SENTINEL_G, R5
+5 -5
View File
@@ -41,11 +41,11 @@ TEXT ·enterJITChecked(SB), NOSPLIT, $0-16
// reads its first argument at SP+8 // reads its first argument at SP+8
JALR X0, 0(X5) // jump to JIT function JALR X0, 0(X5) // jump to JIT function
// leaveJITCheckedRaw is the raw return trampoline. It has NO Go function // leaveJITCheckedRaw is the raw return trampoline. It has NO Go function
// declaration, so no ABIInternal wrapper is generated; the JIT function's // declaration, so no ABIInternal wrapper is generated; the JIT function's
// RET lands here directly, seeing g exactly as the function left it. It // RET lands here directly, seeing g exactly as the function left it. It
// checks the sentinel, records violations in abiResult, then restores the // checks the sentinel, records violations in abiResult, then restores the
// Go stack and returns. // Go stack and returns.
TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0 TEXT ·leaveJITCheckedRaw(SB), NOSPLIT, $0-0
// Check g against the sentinel. // Check g against the sentinel.
MOV $SENTINEL_G, X6 MOV $SENTINEL_G, X6
+2 -2
View File
@@ -23,8 +23,8 @@ TEXT ·enterJIT(SB), NOSPLIT, $0-16
MOVQ stack+8(FP), SP // switch to the prepared stack MOVQ stack+8(FP), SP // switch to the prepared stack
JMP AX JMP AX
// func leaveJIT() // func leaveJIT()
// Restores the Go stack pointer and returns to enterJIT's caller. // Restores the Go stack pointer and returns to enterJIT's caller.
TEXT ·leaveJIT(SB), NOSPLIT, $0-0 TEXT ·leaveJIT(SB), NOSPLIT, $0-0
MOVQ ·savedSP(SB), SP MOVQ ·savedSP(SB), SP
RET RET
+2 -1
View File
@@ -27,7 +27,7 @@ TEXT ·enterJIT(SB), NOSPLIT, $0-16
// same way) // same way)
JMP (R0) // branch to JIT function JMP (R0) // branch to JIT function
// func leaveJIT() // func leaveJIT()
TEXT ·leaveJIT(SB), NOSPLIT, $0-0 TEXT ·leaveJIT(SB), NOSPLIT, $0-0
MOVD savedSP(SB), R3 // restore Go stack pointer MOVD savedSP(SB), R3 // restore Go stack pointer
MOVD R3, RSP MOVD R3, RSP
@@ -43,4 +43,5 @@ DATA ·leaveRawAddr(SB)/8, $·leaveJIT(SB)
// Package-level storage for saved registers. // Package-level storage for saved registers.
GLOBL savedLR(SB), NOPTR, $8 GLOBL savedLR(SB), NOPTR, $8
GLOBL savedSP(SB), NOPTR, $8 GLOBL savedSP(SB), NOPTR, $8
+2 -1
View File
@@ -21,7 +21,7 @@ TEXT ·enterJIT(SB), NOSPLIT, $0-16
// first argument at SP+8 // first argument at SP+8
JIRL R0, R4, 0 // jump to JIT function JIRL R0, R4, 0 // jump to JIT function
// func leaveJIT() // func leaveJIT()
TEXT ·leaveJIT(SB), NOSPLIT, $0-0 TEXT ·leaveJIT(SB), NOSPLIT, $0-0
MOVV savedSP(SB), R5 // restore Go stack pointer MOVV savedSP(SB), R5 // restore Go stack pointer
MOVV R5, R3 // restore SP MOVV R5, R3 // restore SP
@@ -29,4 +29,5 @@ TEXT ·leaveJIT(SB), NOSPLIT, $0-0
JIRL R0, R1, 0 // return to Go caller JIRL R0, R1, 0 // return to Go caller
GLOBL savedRA(SB), NOPTR, $8 GLOBL savedRA(SB), NOPTR, $8
GLOBL savedSP(SB), NOPTR, $8 GLOBL savedSP(SB), NOPTR, $8
+2 -1
View File
@@ -21,7 +21,7 @@ TEXT ·enterJIT(SB), NOSPLIT, $0-16
// first argument at SP+8 // first argument at SP+8
JALR X0, 0(X5) // jump to JIT function JALR X0, 0(X5) // jump to JIT function
// func leaveJIT() // func leaveJIT()
TEXT ·leaveJIT(SB), NOSPLIT, $0-0 TEXT ·leaveJIT(SB), NOSPLIT, $0-0
MOV savedSP(SB), X6 // restore Go stack pointer MOV savedSP(SB), X6 // restore Go stack pointer
MOV X6, X2 // restore SP MOV X6, X2 // restore SP
@@ -29,4 +29,5 @@ TEXT ·leaveJIT(SB), NOSPLIT, $0-0
JALR X0, 0(X1) // return to Go caller JALR X0, 0(X1) // return to Go caller
GLOBL savedRA(SB), NOPTR, $8 GLOBL savedRA(SB), NOPTR, $8
GLOBL savedSP(SB), NOPTR, $8 GLOBL savedSP(SB), NOPTR, $8