From ee7bfbdbcc75c17c9f6f357f7950cfae0d63811c Mon Sep 17 00:00:00 2001 From: Paul Murphy Date: Wed, 4 Jun 2025 08:51:11 -0500 Subject: cmd/compile/internal/ssa: fix PPC64 merging of (AND (S[RL]Dconst ...) CL 622236 forgot to check the mask was also a 32 bit rotate mask. Add a modified version of isPPC64WordRotateMask which valids the mask is contiguous and fits inside a uint32. I don't this is possible when merging SRDconst, the first check should always reject such combines. But, be extra careful and do it there too. Fixes #73153 Change-Id: Ie95f74ec5e7d89dc761511126db814f886a7a435 Reviewed-on: https://go-review.googlesource.com/c/go/+/679775 Auto-Submit: Keith Randall Reviewed-by: Jayanth Krishnamurthy Reviewed-by: Keith Randall Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- test/codegen/shift.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/codegen') diff --git a/test/codegen/shift.go b/test/codegen/shift.go index 56e8d354e6..0e4cf1ed8d 100644 --- a/test/codegen/shift.go +++ b/test/codegen/shift.go @@ -529,6 +529,16 @@ func checkMergedShifts64(a [256]uint32, b [256]uint64, c [256]byte, v uint64) { b[1] = b[(v>>20)&0xFF] // ppc64x: "RLWNM", -"SLD" b[2] = b[((uint64((uint32(v) >> 21)) & 0x3f) << 4)] + // ppc64x: -"RLWNM" + b[3] = (b[3] << 24) & 0xFFFFFF000000 + // ppc64x: "RLWNM\t[$]24, R[0-9]+, [$]0, [$]7," + b[4] = (b[4] << 24) & 0xFF000000 + // ppc64x: "RLWNM\t[$]24, R[0-9]+, [$]0, [$]7," + b[5] = (b[5] << 24) & 0xFF00000F + // ppc64x: -"RLWNM" + b[6] = (b[6] << 0) & 0xFF00000F + // ppc64x: "RLWNM\t[$]4, R[0-9]+, [$]28, [$]31," + b[7] = (b[7] >> 28) & 0xF // ppc64x: "RLWNM\t[$]11, R[0-9]+, [$]10, [$]15" c[0] = c[((v>>5)&0x3F)<<16] // ppc64x: "ANDCC\t[$]8064," -- cgit v1.3