mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
cmd/compile/internal/ssagen: set BitLen32 as intrinsic on PPC64
It was noticed through some other investigation that BitLen32 was not generating the best code and found that it wasn't recognized as an intrinsic. This corrects that and enables the test for PPC64. Change-Id: Iab496a8830c8552f507b7292649b1b660f3848b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/355872 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
6c0daa7331
commit
33b3260c1e
|
@ -4421,7 +4421,7 @@ func InitTables() {
|
|||
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
||||
return s.newValue1(ssa.OpBitLen32, types.Types[types.TINT], args[0])
|
||||
},
|
||||
sys.AMD64, sys.ARM64)
|
||||
sys.AMD64, sys.ARM64, sys.PPC64)
|
||||
addF("math/bits", "Len32",
|
||||
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
||||
if s.config.PtrSize == 4 {
|
||||
|
@ -4430,7 +4430,7 @@ func InitTables() {
|
|||
x := s.newValue1(ssa.OpZeroExt32to64, types.Types[types.TUINT64], args[0])
|
||||
return s.newValue1(ssa.OpBitLen64, types.Types[types.TINT], x)
|
||||
},
|
||||
sys.ARM, sys.S390X, sys.MIPS, sys.PPC64, sys.Wasm)
|
||||
sys.ARM, sys.S390X, sys.MIPS, sys.Wasm)
|
||||
addF("math/bits", "Len16",
|
||||
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
||||
if s.config.PtrSize == 4 {
|
||||
|
|
|
@ -93,6 +93,8 @@ func Len32(n uint32) int {
|
|||
// arm:"CLZ" arm64:"CLZ"
|
||||
// mips:"CLZ"
|
||||
// wasm:"I64Clz"
|
||||
// ppc64: "CNTLZW"
|
||||
// ppc64le: "CNTLZW"
|
||||
return bits.Len32(n)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue