diff options
| author | Keith Randall <khr@golang.org> | 2022-08-18 14:13:33 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-08-31 22:10:52 +0000 |
| commit | 33a7e5a4b49fa04ce6f65b5b0645a44a0c93eaad (patch) | |
| tree | 4d18ba4a26deeffa151ed9e0ef32f310f863d608 /test/codegen | |
| parent | 5f5c018ca46b6634da9372f5af759cb36fcaed5f (diff) | |
| download | go-33a7e5a4b49fa04ce6f65b5b0645a44a0c93eaad.tar.xz | |
cmd/compile: combine multiple rotate instructions
Rotating by c, then by d, is the same as rotating by c+d.
Change-Id: I36df82261460ff80f7c6d39bcdf0e840cef1c91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424894
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ruinan Sun <Ruinan.Sun@arm.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/rotate.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/codegen/rotate.go b/test/codegen/rotate.go index f42993532d..b22288f82a 100644 --- a/test/codegen/rotate.go +++ b/test/codegen/rotate.go @@ -204,6 +204,14 @@ func f32(x uint32) uint32 { return rot32nc(x, 7) } +func doubleRotate(x uint64) uint64 { + x = (x << 5) | (x >> 59) + // amd64:"ROLQ\t[$]15" + // arm64:"ROR\t[$]49" + x = (x << 10) | (x >> 54) + return x +} + // --------------------------------------- // // Combined Rotate + Masking operations // // --------------------------------------- // @@ -234,16 +242,16 @@ func checkMaskedRotate32(a []uint32, r int) { i++ // ppc64le: "RLWNM\tR[0-9]+, R[0-9]+, [$]16, [$]23, R[0-9]+" // ppc64: "RLWNM\tR[0-9]+, R[0-9]+, [$]16, [$]23, R[0-9]+" - a[i] = bits.RotateLeft32(a[3], r) & 0xFF00 + a[i] = bits.RotateLeft32(a[i], r) & 0xFF00 i++ // ppc64le: "RLWNM\tR[0-9]+, R[0-9]+, [$]20, [$]11, R[0-9]+" // ppc64: "RLWNM\tR[0-9]+, R[0-9]+, [$]20, [$]11, R[0-9]+" - a[i] = bits.RotateLeft32(a[3], r) & 0xFFF00FFF + a[i] = bits.RotateLeft32(a[i], r) & 0xFFF00FFF i++ // ppc64le: "RLWNM\t[$]4, R[0-9]+, [$]20, [$]11, R[0-9]+" // ppc64: "RLWNM\t[$]4, R[0-9]+, [$]20, [$]11, R[0-9]+" - a[i] = bits.RotateLeft32(a[3], 4) & 0xFFF00FFF + a[i] = bits.RotateLeft32(a[i], 4) & 0xFFF00FFF i++ } |
