Skip to content

Commit 33b3260

Browse files
committed
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 <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Lynn Boger <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 6c0daa7 commit 33b3260

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/cmd/compile/internal/ssagen/ssa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4421,7 +4421,7 @@ func InitTables() {
44214421
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
44224422
return s.newValue1(ssa.OpBitLen32, types.Types[types.TINT], args[0])
44234423
},
4424-
sys.AMD64, sys.ARM64)
4424+
sys.AMD64, sys.ARM64, sys.PPC64)
44254425
addF("math/bits", "Len32",
44264426
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
44274427
if s.config.PtrSize == 4 {
@@ -4430,7 +4430,7 @@ func InitTables() {
44304430
x := s.newValue1(ssa.OpZeroExt32to64, types.Types[types.TUINT64], args[0])
44314431
return s.newValue1(ssa.OpBitLen64, types.Types[types.TINT], x)
44324432
},
4433-
sys.ARM, sys.S390X, sys.MIPS, sys.PPC64, sys.Wasm)
4433+
sys.ARM, sys.S390X, sys.MIPS, sys.Wasm)
44344434
addF("math/bits", "Len16",
44354435
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
44364436
if s.config.PtrSize == 4 {

test/codegen/mathbits.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func Len32(n uint32) int {
9393
// arm:"CLZ" arm64:"CLZ"
9494
// mips:"CLZ"
9595
// wasm:"I64Clz"
96+
// ppc64: "CNTLZW"
97+
// ppc64le: "CNTLZW"
9698
return bits.Len32(n)
9799
}
98100

0 commit comments

Comments
 (0)