cmd/compile/internal/ssa: optimize (AND (MOVDconst [-1] x)) on PPC64

This sequence can show up in the lowering pass on PPC64. If it
makes it to the latelower pass, it will cause an error because
it looks like it can be turned into RLDICL, but -1 isn't an
accepted mask.

Also, print more debug info if panic is called from
encodePPC64RotateMask.

Fixes #62698

Change-Id: I0f3322e2205357abe7fc28f96e05e3f7ad65567c
Reviewed-on: https://go-review.googlesource.com/c/go/+/529195
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Paul E. Murphy 2023-09-18 11:29:20 -05:00 committed by Paul Murphy
parent 795414d1c6
commit c8caad423c
4 changed files with 21 additions and 1 deletions

View file

@ -151,3 +151,9 @@ func ptrBothOffset() {
// s390x:-"BEQ",-"BNE"
copy(x[1:], x[2:])
}
// Verify #62698 on PPC64.
func noMaskOnCopy(a []int, s string, x int) int {
// ppc64x:-"MOVD\t$-1", -"AND"
return a[x&^copy([]byte{}, s)]
}