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 /test/codegen/mathbits.go | |
| parent | e1e4c499f0849af4fca353163e4ffabbda6f9089 (diff) | |
| download | go-22355d6cd2421f13e560f90e77ca04ef816456da.tar.xz | |
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 'test/codegen/mathbits.go')
| -rw-r--r-- | test/codegen/mathbits.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 0d94bd1bc8..779ea6e322 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -296,6 +296,7 @@ func TrailingZeros32(n uint32) int { func TrailingZeros16(n uint16) int { // amd64:"BSFL","BTSL\\t\\$16" + // 386:"BSFL\t" // arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR" // arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t" // s390x:"FLOGR","OR\t\\$65536" |
