]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: allow equal functions to perform unaligned load on loong64
authorGuoqi Chen <chenguoqi@loongson.cn>
Wed, 4 Feb 2026 07:25:07 +0000 (15:25 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 6 Feb 2026 19:29:38 +0000 (11:29 -0800)
commit045ceb72406ee725fd0ea9b8267e8bcd4d2afd5b
treea3186bf023b54c6880d0c897d29a45d7af101d2e
parentdb5882ea9bf63849d554910f486c4c5cfea08852
cmd/compile: allow equal functions to perform unaligned load on loong64

The Go compiler always generates Loong64 binaries, which can execute any
processor of LA364, LA464, LA664 or higher core. And these processors
support unaligned memory access [1].

goos: linux
goarch: loong64
pkg: strings
cpu: Loongson-3A6000 @ 2500.00MHz
              |   old.txt    |               new.txt                |
              |    sec/op    |    sec/op     vs base                |
StringPrefix3   4.0040n ± 0%   0.4003n ± 0%  -90.00% (p=0.000 n=10)
StringPrefix5   4.0040n ± 0%   0.4003n ± 0%  -90.00% (p=0.000 n=10)
StringPrefix6   3.6030n ± 0%   0.4002n ± 0%  -88.89% (p=0.000 n=10)
StringPrefix7   4.0040n ± 0%   0.4002n ± 0%  -90.00% (p=0.000 n=10)
geomean          3.900n        0.4003n       -89.74%

goos: linux
goarch: loong64
pkg: strings
cpu: Loongson-3A5000-HV @ 2500.00MHz
              |   old.txt    │               new.txt                |
              |    sec/op    │    sec/op     vs base                |
StringPrefix3   5.6160n ± 0%   0.4011n ± 0%  -92.86% (p=0.000 n=10)
StringPrefix5   5.6180n ± 0%   0.4011n ± 0%  -92.86% (p=0.000 n=10)
StringPrefix6   5.2170n ± 0%   0.4011n ± 0%  -92.31% (p=0.000 n=10)
StringPrefix7   5.6170n ± 0%   0.4009n ± 0%  -92.86% (p=0.000 n=10)
geomean          5.514n        0.4010n       -92.73%

goos: linux
goarch: loong64
pkg: strings
cpu: Loongson-3B6000M @ 2400.00MHz
              |   old.txt    │               new.txt                |
              |    sec/op    │    sec/op     vs base                |
StringPrefix3   5.0060n ± 0%   0.4223n ± 1%  -91.56% (p=0.000 n=10)
StringPrefix5   4.5890n ± 0%   0.4214n ± 0%  -90.82% (p=0.000 n=10)
StringPrefix6   4.5890n ± 0%   0.4190n ± 1%  -90.87% (p=0.000 n=10)
StringPrefix7   4.5890n ± 0%   0.4226n ± 1%  -90.79% (p=0.000 n=10)
geomean          4.690n        0.4213n       -91.02%

[1]: https://go.dev/wiki/MinimumRequirements#loong64

Change-Id: I1870080e0122a7d136685e3045699d0cf1e4194d
Reviewed-on: https://go-review.googlesource.com/c/go/+/742260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
src/cmd/internal/sys/arch.go
test/codegen/comparisons.go