From: Cherry Mui Date: Fri, 24 Oct 2025 19:06:41 +0000 (-0400) Subject: cmd/compile: allow unaligned load/store on Wasm X-Git-Tag: go1.26rc1~482 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=53ad68de4b124fc441d859c9b123a8aedf626aec;p=gostls13.git cmd/compile: allow unaligned load/store on Wasm Wasm supports unaligned load/store instructions. Use them. This speeds up map hashing slightly (among others): goos: js goarch: wasm pkg: runtime │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ Hash5 14.06n ± 2% 13.83n ± 5% ~ (p=0.186 n=10) Hash16 17.52n ± 1% 17.04n ± 1% -2.71% (p=0.000 n=10) Hash64 28.68n ± 1% 26.61n ± 1% -7.18% (p=0.000 n=10) Hash1024 271.4n ± 0% 243.6n ± 1% -10.21% (p=0.000 n=10) Hash65536 16.66µ ± 0% 15.74µ ± 1% -5.49% (p=0.000 n=10) HashStringSpeed 29.23n ± 1% 28.70n ± 1% -1.83% (p=0.000 n=10) HashBytesSpeed 46.11n ± 4% 45.17n ± 5% -2.04% (p=0.008 n=10) HashInt32Speed 20.39n ± 1% 20.24n ± 5% ~ (p=0.239 n=10) HashInt64Speed 20.81n ± 7% 20.58n ± 7% ~ (p=0.238 n=10) HashStringArraySpeed 76.65n ± 2% 73.72n ± 1% -3.83% (p=0.000 n=10) FastrandHashiter 87.65n ± 1% 87.58n ± 1% ~ (p=0.725 n=10) geomean 67.03n 64.75n -3.40% Change-Id: I7fd1817c74323f628f310393b0330a0a51ffa3a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/714720 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 0f41bdea8b..7cc16ce26d 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -356,6 +356,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo c.hasGReg = true c.useAvg = false c.useHmul = false + c.unalignedOK = true default: ctxt.Diag("arch %s not implemented", arch) }