]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize Ctz64 on 386
authorYoulin Feng <fengyoulin@live.com>
Tue, 22 Oct 2024 09:18:11 +0000 (17:18 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 5 Nov 2024 15:30:57 +0000 (15:30 +0000)
commit0140aae6d0009372cb5b781df7079aa62c97ddff
treef58a37d706a132d71cb4eff7d48f324a0554ff60
parentbea9b91f0f4be730c880edbe496ab25c9b742cad
cmd/compile: optimize Ctz64 on 386

Compared with the version generated by dec64.rules based on Ctz32,
the number of assembly instructions is reduced by half.

SwissMap uses TrailingZeros64 to find the first match in its control
group and may benefit from this CL on 386 architectures.

goos: linux
goarch: 386
cpu: 13th Gen Intel(R) Core(TM) i7-13700H
                   │   old.txt    │               new.txt                │
                   │    sec/op    │    sec/op     vs base                │
TrailingZeros64-20   0.8828n ± 1%   0.6299n ± 1%  -28.65% (p=0.000 n=20)

Change-Id: Iba08a3f4e13efd3349715dfb7fcd5fd470286cd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/624376
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/_gen/386.rules
src/cmd/compile/internal/ssa/_gen/386Ops.go
src/cmd/compile/internal/ssa/_gen/genericOps.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewrite386.go
src/cmd/compile/internal/ssagen/intrinsics.go
src/cmd/compile/internal/x86/ssa.go