diff options
author | Wayne Zuo <wdvxdr@golangcn.org> | 2022-05-07 13:58:24 +0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-05-08 20:10:06 +0000 |
commit | 1efe38750a1f29c946fde694738c4ba2ed48ff98 (patch) | |
tree | 65a33c95f91d5faa65fe1eb7696ca2d229ec8a81 /test/prove.go | |
parent | 3391517c0e4695a87cdb806cbf7b9760e7c9fa73 (diff) | |
download | go-git-1efe38750a1f29c946fde694738c4ba2ed48ff98.tar.gz |
cmd/compile: teach prove about and operation
For this code:
z &= 63
_ = x<<z | x>>(64-z)
Now can prove 'x<<z' in bound. In ppc64 lowering pass, it will not
produce an extra '(ANDconst <typ.Int64> [63] z)' causing
codegen/rotate.go failed. Just remove the type check in rewrite rules
as the workaround.
Removes 32 bounds checks during make.bat.
Fixes #52563.
Change-Id: I14ed2c093ff5638dfea7de9bc7649c0f756dd71a
Reviewed-on: https://go-review.googlesource.com/c/go/+/404315
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/prove.go')
-rw-r--r-- | test/prove.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/prove.go b/test/prove.go index 83b0380838..b7cc511f53 100644 --- a/test/prove.go +++ b/test/prove.go @@ -1036,6 +1036,14 @@ func divShiftClean32(n int32) int32 { return n / int32(16) // ERROR "Proved Rsh32x64 shifts to zero" } +func and(p []byte) ([]byte, []byte) { // issue #52563 + const blocksize = 16 + fullBlocks := len(p) &^ (blocksize - 1) + blk := p[:fullBlocks] // ERROR "Proved IsSliceInBounds$" + rem := p[fullBlocks:] // ERROR "Proved IsSliceInBounds$" + return blk, rem +} + //go:noinline func useInt(a int) { } |