mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: intrinsify math/bits/ReverseBytes{32|64} for 386
The BSWAPL instruction is supported in i486 and newer. https://github.com/golang/go/wiki/MinimumRequirements#386 says we support "All Pentium MMX or later". The Pentium is also referred to as i586, so that we are safe with these instructions. Change-Id: I6dea1f9d864a45bb07c8f8f35a81cfe16cca216c Reviewed-on: https://go-review.googlesource.com/c/go/+/465515 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
parent
abd55d8483
commit
d7ac5d1480
2 changed files with 6 additions and 3 deletions
|
|
@ -189,6 +189,7 @@ func OnesCount8(n uint8) int {
|
|||
|
||||
func ReverseBytes(n uint) uint {
|
||||
// amd64:"BSWAPQ"
|
||||
// 386:"BSWAPL"
|
||||
// s390x:"MOVDBR"
|
||||
// arm64:"REV"
|
||||
return bits.ReverseBytes(n)
|
||||
|
|
@ -196,6 +197,7 @@ func ReverseBytes(n uint) uint {
|
|||
|
||||
func ReverseBytes64(n uint64) uint64 {
|
||||
// amd64:"BSWAPQ"
|
||||
// 386:"BSWAPL"
|
||||
// s390x:"MOVDBR"
|
||||
// arm64:"REV"
|
||||
// ppc64x/power10: "BRD"
|
||||
|
|
@ -204,6 +206,7 @@ func ReverseBytes64(n uint64) uint64 {
|
|||
|
||||
func ReverseBytes32(n uint32) uint32 {
|
||||
// amd64:"BSWAPL"
|
||||
// 386:"BSWAPL"
|
||||
// s390x:"MOVWBR"
|
||||
// arm64:"REVW"
|
||||
// ppc64x/power10: "BRW"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue