cmd/compile: set bits.OnesCount's limits to [0, 64]

Change-Id: I2f60de836f58ef91baae856f44d8f73c190326f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/656158
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
This commit is contained in:
Jorropo 2025-03-09 14:38:44 +01:00
parent 554a3c51dc
commit c00647b49b
2 changed files with 41 additions and 4 deletions

View file

@ -1645,13 +1645,13 @@ func initLimit(v *Value) limit {
lim = lim.signedMinMax(math.MinInt32, math.MaxInt32)
// math/bits intrinsics
case OpCtz64, OpBitLen64:
case OpCtz64, OpBitLen64, OpPopCount64:
lim = lim.unsignedMax(64)
case OpCtz32, OpBitLen32:
case OpCtz32, OpBitLen32, OpPopCount32:
lim = lim.unsignedMax(32)
case OpCtz16, OpBitLen16:
case OpCtz16, OpBitLen16, OpPopCount16:
lim = lim.unsignedMax(16)
case OpCtz8, OpBitLen8:
case OpCtz8, OpBitLen8, OpPopCount8:
lim = lim.unsignedMax(8)
// bool to uint8 conversion