diff options
author | Paul E. Murphy <murp@ibm.com> | 2024-05-01 15:03:34 -0500 |
---|---|---|
committer | Paul Murphy <murp@ibm.com> | 2024-05-15 13:27:41 +0000 |
commit | 0222a028f19d9f497cf407bcf07f3ec56a032bdb (patch) | |
tree | 9c4667ad6b01f76f22d71e7a5558bf58e3cefb45 /test | |
parent | bbdad50c0909134ab474bdb4b0c3741f85b28ecd (diff) | |
download | go-0222a028f19d9f497cf407bcf07f3ec56a032bdb.tar.gz go-0222a028f19d9f497cf407bcf07f3ec56a032bdb.zip |
cmd/compile/internal/ssa: combine more shift and masking on PPC64
Investigating binaries, these patterns seem to show up frequently.
Change-Id: I987251e4070e35c25e98da321e444ccaa1526912
Reviewed-on: https://go-review.googlesource.com/c/go/+/583302
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/codegen/shift.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/codegen/shift.go b/test/codegen/shift.go index 5bd7acc063..dd91a1db98 100644 --- a/test/codegen/shift.go +++ b/test/codegen/shift.go @@ -467,11 +467,32 @@ func checkMergedShifts64(a [256]uint32, b [256]uint64, v uint64) { // ppc64x: "SRD", "CLRLSLDI", -"RLWNM" a[5] = a[(v>>32)&0x01] // ppc64x: "SRD", "CLRLSLDI", -"RLWNM" - a[5] = a[(v>>34)&0x03] + a[6] = a[(v>>34)&0x03] // ppc64x: -"CLRLSLDI", "RLWNM\t[$]12, R[0-9]+, [$]21, [$]28, R[0-9]+" b[0] = b[uint8(v>>23)] // ppc64x: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+" b[1] = b[(v>>20)&0xFF] + // ppc64x: "RLWNM", -"SLD" + b[2] = b[((uint64((uint32(v) >> 21)) & 0x3f) << 4)] +} + +func checkShiftMask(a uint32, b uint64, z []uint32, y []uint64) { + _ = y[128] + _ = z[128] + // ppc64x: -"MOVBZ", -"SRW", "RLWNM" + z[0] = uint32(uint8(a >> 5)) + // ppc64x: -"MOVBZ", -"SRW", "RLWNM" + z[1] = uint32(uint8((a >> 4) & 0x7e)) + // ppc64x: "RLWNM\t[$]25, R[0-9]+, [$]27, [$]29, R[0-9]+" + z[2] = uint32(uint8(a>>7)) & 0x1c + // ppc64x: -"MOVWZ" + y[0] = uint64((a >> 6) & 0x1c) + // ppc64x: -"MOVWZ" + y[1] = uint64(uint32(b)<<6) + 1 + // ppc64x: -"MOVHZ", -"MOVWZ" + y[2] = uint64((uint16(a) >> 9) & 0x1F) + // ppc64x: -"MOVHZ", -"MOVWZ", -"ANDCC" + y[3] = uint64(((uint16(a) & 0xFF0) >> 9) & 0x1F) } // 128 bit shifts |