detached 7618415

all: cherry-pick assembly optimizations from #397 (#423)

Whilst we are debating the pros and cons of #397 I figured it made sense for my
to cherry-pick the actual assembly optimizations over in a separate PR. I also
ran asmfmt which made some small changes to two other assembly files that have
recently been changed.
commit
7618415b05edb090c4c7128ec75a03d1805004c4
author
George Adams · · 2026-02-25 14:53 UTC
committer
GitHub · · 2026-02-25 14:53 UTC
parent
585a4c5
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
refs
tag: v0.11.0-alpha
4 files · +6 -14
M internal/fakecgo/trampolines_loong64.s +0 -5
@@ -11,29 +11,24 @@
1111 // R23 is used as temporary register.
1212
1313 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16
14- MOVV R4, 8(R3)
15- MOVV R5, 16(R3)
1614 MOVV ·x_cgo_init_call(SB), R23
1715 MOVV (R23), R23
1816 CALL (R23)
1917 RET
2018
2119 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8
22- MOVV R4, 8(R3)
2320 MOVV ·x_cgo_thread_start_call(SB), R23
2421 MOVV (R23), R23
2522 CALL (R23)
2623 RET
2724
2825 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8
29- MOVV R4, 8(R3)
3026 MOVV ·x_cgo_setenv_call(SB), R23
3127 MOVV (R23), R23
3228 CALL (R23)
3329 RET
3430
3531 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8
36- MOVV R4, 8(R3)
3732 MOVV ·x_cgo_unsetenv_call(SB), R23
3833 MOVV (R23), R23
3934 CALL (R23)
@@ -11,29 +11,24 @@
11 // R23 is used as temporary register.11 // R23 is used as temporary register.
12 12
13 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $1613 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16
14- MOVV R4, 8(R3)
15- MOVV R5, 16(R3)
16 MOVV ·x_cgo_init_call(SB), R2314 MOVV ·x_cgo_init_call(SB), R23
17 MOVV (R23), R2315 MOVV (R23), R23
18 CALL (R23)16 CALL (R23)
19 RET17 RET
20 18
21 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $819 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8
22- MOVV R4, 8(R3)
23 MOVV ·x_cgo_thread_start_call(SB), R2320 MOVV ·x_cgo_thread_start_call(SB), R23
24 MOVV (R23), R2321 MOVV (R23), R23
25 CALL (R23)22 CALL (R23)
26 RET23 RET
27 24
28 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $825 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8
29- MOVV R4, 8(R3)
30 MOVV ·x_cgo_setenv_call(SB), R2326 MOVV ·x_cgo_setenv_call(SB), R23
31 MOVV (R23), R2327 MOVV (R23), R23
32 CALL (R23)28 CALL (R23)
33 RET29 RET
34 30
35 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $831 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8
36- MOVV R4, 8(R3)
37 MOVV ·x_cgo_unsetenv_call(SB), R2332 MOVV ·x_cgo_unsetenv_call(SB), R23
38 MOVV (R23), R2333 MOVV (R23), R23
39 CALL (R23)34 CALL (R23)
M internal/fakecgo/trampolines_riscv64.s +0 -5
@@ -10,29 +10,24 @@
1010 // X5 is used as temporary register.
1111
1212 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16
13- MOV X10, 8(SP)
14- MOV X11, 16(SP)
1513 MOV ·x_cgo_init_call(SB), X5
1614 MOV (X5), X5
1715 CALL X5
1816 RET
1917
2018 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8
21- MOV X10, 8(SP)
2219 MOV ·x_cgo_thread_start_call(SB), X5
2320 MOV (X5), X5
2421 CALL X5
2522 RET
2623
2724 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8
28- MOV X10, 8(SP)
2925 MOV ·x_cgo_setenv_call(SB), X5
3026 MOV (X5), X5
3127 CALL X5
3228 RET
3329
3430 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8
35- MOV X10, 8(SP)
3631 MOV ·x_cgo_unsetenv_call(SB), X5
3732 MOV (X5), X5
3833 CALL X5
@@ -10,29 +10,24 @@
10 // X5 is used as temporary register.10 // X5 is used as temporary register.
11 11
12 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $1612 TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16
13- MOV X10, 8(SP)
14- MOV X11, 16(SP)
15 MOV ·x_cgo_init_call(SB), X513 MOV ·x_cgo_init_call(SB), X5
16 MOV (X5), X514 MOV (X5), X5
17 CALL X515 CALL X5
18 RET16 RET
19 17
20 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $818 TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8
21- MOV X10, 8(SP)
22 MOV ·x_cgo_thread_start_call(SB), X519 MOV ·x_cgo_thread_start_call(SB), X5
23 MOV (X5), X520 MOV (X5), X5
24 CALL X521 CALL X5
25 RET22 RET
26 23
27 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $824 TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8
28- MOV X10, 8(SP)
29 MOV ·x_cgo_setenv_call(SB), X525 MOV ·x_cgo_setenv_call(SB), X5
30 MOV (X5), X526 MOV (X5), X5
31 CALL X527 CALL X5
32 RET28 RET
33 29
34 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $830 TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8
35- MOV X10, 8(SP)
36 MOV ·x_cgo_unsetenv_call(SB), X531 MOV ·x_cgo_unsetenv_call(SB), X5
37 MOV (X5), X532 MOV (X5), X5
38 CALL X533 CALL X5
M sys_amd64.s +4 -3
@@ -92,9 +92,10 @@ TEXT syscall15X(SB), NOSPLIT|NOFRAME, $0
9292 MOVQ X1, syscall15Args_f2(DI) // f2
9393
9494 #ifdef GOOS_darwin
95- CALL purego_error(SB)
96- MOVD (AX), AX
97- MOVD AX, syscall15Args_a3(DI) // save errno
95+ CALL purego_error(SB)
96+ MOVD (AX), AX
97+ MOVD AX, syscall15Args_a3(DI) // save errno
98+
9899 #endif
99100
100101 XORL AX, AX // no error (it's ignored anyway)
@@ -92,9 +92,10 @@ TEXT syscall15X(SB), NOSPLIT|NOFRAME, $0
92 MOVQ X1, syscall15Args_f2(DI) // f292 MOVQ X1, syscall15Args_f2(DI) // f2
93 93
94 #ifdef GOOS_darwin94 #ifdef GOOS_darwin
95- CALL purego_error(SB)95+ CALL purego_error(SB)
96- MOVD (AX), AX96+ MOVD (AX), AX
97- MOVD AX, syscall15Args_a3(DI) // save errno97+ MOVD AX, syscall15Args_a3(DI) // save errno
98+
98 #endif99 #endif
99 100
100 XORL AX, AX // no error (it's ignored anyway)101 XORL AX, AX // no error (it's ignored anyway)
M sys_arm64.s +2 -1
@@ -90,8 +90,9 @@ TEXT syscall15X(SB), NOSPLIT, $0
9090 FMOVD F3, syscall15Args_f4(R2) // save f3
9191
9292 #ifdef GOOS_darwin
93- BL purego_error(SB)
93+ BL purego_error(SB)
9494 MOVD (R0), R0
9595 MOVD R0, syscall15Args_a3(R2) // save errno
96+
9697 #endif
9798 RET
@@ -90,8 +90,9 @@ TEXT syscall15X(SB), NOSPLIT, $0
90 FMOVD F3, syscall15Args_f4(R2) // save f390 FMOVD F3, syscall15Args_f4(R2) // save f3
91 91
92 #ifdef GOOS_darwin92 #ifdef GOOS_darwin
93- BL purego_error(SB)93+ BL purego_error(SB)
94 MOVD (R0), R094 MOVD (R0), R0
95 MOVD R0, syscall15Args_a3(R2) // save errno95 MOVD R0, syscall15Args_a3(R2) // save errno
96+
96 #endif97 #endif
97 RET98 RET

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close