diff options
author | Ben Shi <powerman1st@163.com> | 2019-08-07 05:20:32 +0000 |
---|---|---|
committer | Ben Shi <powerman1st@163.com> | 2019-08-28 02:29:54 +0000 |
commit | 22355d6cd2421f13e560f90e77ca04ef816456da (patch) | |
tree | 3ed677893926c8f3bbc21e2962d23ac517a31c70 /src/cmd/compile/internal/ssa/gen/386.rules | |
parent | e1e4c499f0849af4fca353163e4ffabbda6f9089 (diff) | |
download | go-git-22355d6cd2421f13e560f90e77ca04ef816456da.tar.gz |
cmd/compile: optimize 386's math.bits.TrailingZeros16
This CL optimizes math.bits.TrailingZeros16 on 386 with
a pair of BSFL and ORL instrcutions.
The case TrailingZeros16-4 of the benchmark test in
math/bits shows big improvement.
name old time/op new time/op delta
TrailingZeros16-4 1.55ns ± 1% 0.87ns ± 1% -43.87% (p=0.000 n=50+49)
Change-Id: Ia899975b0e46f45dcd20223b713ed632bc32740b
Reviewed-on: https://go-review.googlesource.com/c/go/+/189277
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen/386.rules')
-rw-r--r-- | src/cmd/compile/internal/ssa/gen/386.rules | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/386.rules b/src/cmd/compile/internal/ssa/gen/386.rules index d7cbba1718..395ebb085d 100644 --- a/src/cmd/compile/internal/ssa/gen/386.rules +++ b/src/cmd/compile/internal/ssa/gen/386.rules @@ -66,6 +66,8 @@ (Sqrt x) -> (SQRTSD x) +(Ctz16 x) -> (BSFL (ORLconst <typ.UInt32> [0x10000] x)) + // Lowering extension (SignExt8to16 x) -> (MOVBLSX x) (SignExt8to32 x) -> (MOVBLSX x) |