From: Lynn Boger Date: Thu, 14 Oct 2021 15:48:08 +0000 (-0500) Subject: cmd/compile/internal/ssagen: set BitLen32 as intrinsic on PPC64 X-Git-Tag: go1.18beta1~862 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=33b3260c1e765ef66500ce155c6d5a526d8852e9;p=gostls13.git 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 TryBot-Result: Go Bot Trust: Lynn Boger Reviewed-by: Cherry Mui --- diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 08114b7828..5a958a569d 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -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 { diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 2d8790c1de..859490c363 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -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) }