diff options
| author | Keith Randall <khr@golang.org> | 2022-08-17 13:09:12 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-09-02 18:51:37 +0000 |
| commit | 5b1fbfba1c00be5f2e9fd9e75fb7530f218fca40 (patch) | |
| tree | 78de0accc9385cad68071d32abfe2e2b24bddd3f /test/codegen | |
| parent | 34f0029a85af054787b279761e89db410621f1d7 (diff) | |
| download | go-5b1fbfba1c00be5f2e9fd9e75fb7530f218fca40.tar.xz | |
cmd/compile: rewrite >>c<<c to &^(1<<c-1)
Fixes #54496
Change-Id: I3c2ed8cd55836d5b07c8cdec00d3b584885aca79
Reviewed-on: https://go-review.googlesource.com/c/go/+/424856
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <martin@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/shift.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/codegen/shift.go b/test/codegen/shift.go index f4cfea3f82..f09a531dcb 100644 --- a/test/codegen/shift.go +++ b/test/codegen/shift.go @@ -392,3 +392,12 @@ func check128bitShifts(x, y uint64, bits uint) (uint64, uint64) { shl := x<<s | y>>ŝ return shr, shl } + +func checkShiftToMask(u []uint64, s []int64) { + // amd64:-"SHR",-"SHL","ANDQ" + u[0] = u[0] >> 5 << 5 + // amd64:-"SAR",-"SHL","ANDQ" + s[0] = s[0] >> 5 << 5 + // amd64:-"SHR",-"SHL","ANDQ" + u[1] = u[1] << 5 >> 5 +} |
