]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile/internal/ssagen: set BitLen32 as intrinsic on PPC64
authorLynn Boger <laboger@linux.vnet.ibm.com>
Thu, 14 Oct 2021 15:48:08 +0000 (10:48 -0500)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Mon, 18 Oct 2021 21:33:08 +0000 (21:33 +0000)
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>
src/cmd/compile/internal/ssagen/ssa.go
test/codegen/mathbits.go

index 08114b78282d0a09f3131e164afed7a1eba903a0..5a958a569d24eba24606b5a7897a6ae87610fb24 100644 (file)
@@ -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 {
index 2d8790c1def46d05500001d55153c62f2c839200..859490c363c306a49bb8a760cc392f2f6cbbb4d7 100644 (file)
@@ -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)
 }