mirror of
https://github.com/golang/go.git
synced 2025-11-01 01:00:56 +00:00
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>
This commit is contained in:
parent
e1e4c499f0
commit
22355d6cd2
4 changed files with 22 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue