Skip to content

Commit 53ad68d

Browse files
committed
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 <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 12ec09f commit 53ad68d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/cmd/compile/internal/ssa/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
356356
c.hasGReg = true
357357
c.useAvg = false
358358
c.useHmul = false
359+
c.unalignedOK = true
359360
default:
360361
ctxt.Diag("arch %s not implemented", arch)
361362
}

0 commit comments

Comments
 (0)