diff options
author | Keith Randall <khr@golang.org> | 2021-09-19 09:23:37 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-09-19 23:50:45 +0000 |
commit | 315dbd10c90db3b41af2c975a5fbfa2ec7615c1b (patch) | |
tree | abeeee7d13f3d084e9b027edd4b48cedeb1bb7ab /test/codegen/bits.go | |
parent | 83b36ffb108cc6e6cc3282b94c090f70100b5ef0 (diff) | |
download | go-315dbd10c90db3b41af2c975a5fbfa2ec7615c1b.tar.gz go-315dbd10c90db3b41af2c975a5fbfa2ec7615c1b.zip |
cmd/compile: fold double negate on arm64
Fixes #48467
Change-Id: I52305dbf561ee3eee6c1f053e555a3a6ec1ab892
Reviewed-on: https://go-review.googlesource.com/c/go/+/350910
Trust: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'test/codegen/bits.go')
-rw-r--r-- | test/codegen/bits.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go index 8117a62307..8e973d5726 100644 --- a/test/codegen/bits.go +++ b/test/codegen/bits.go @@ -6,6 +6,8 @@ package codegen +import "math/bits" + /************************************ * 64-bit instructions ************************************/ @@ -355,3 +357,9 @@ func issue44228b(a []int32, i int) bool { // amd64: "BTL", -"SHL" return a[i>>5]&(1<<(i&31)) != 0 } + +func issue48467(x, y uint64) uint64 { + // arm64: -"NEG" + d, borrow := bits.Sub64(x, y, 0) + return x - d&(-borrow) +} |