aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJorropo <jorropo.pgm@gmail.com>2024-08-09 16:35:46 +0200
committerKeith Randall <khr@golang.org>2024-09-03 17:12:58 +0000
commit57df33814afc02bda314abea28ee8a3dc997505c (patch)
tree738255f5f8eb76ff5df24ba5f7ce2e4f95fcdc6d /test
parent49621cc311a41b71f60f03202f3872c0633cac59 (diff)
downloadgo-57df33814afc02bda314abea28ee8a3dc997505c.tar.xz
cmd/compile: compute OR's maximum limits from argument's limits
Change-Id: I6902c405cab7bd573f6a721a6ca7c783713ea39a Reviewed-on: https://go-review.googlesource.com/c/go/+/604456 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test')
-rw-r--r--test/prove.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/prove.go b/test/prove.go
index 2d5d181aa9..8e65404431 100644
--- a/test/prove.go
+++ b/test/prove.go
@@ -1408,6 +1408,24 @@ func xor64(a, b uint64, ensureBothBranchesCouldHappen bool) int {
return int(z)
}
+func or64(a, b uint64, ensureBothBranchesCouldHappen bool) int {
+ a &= 0xff
+ b &= 0xfff
+
+ z := a | b
+
+ if ensureBothBranchesCouldHappen {
+ if z > 0xfff { // ERROR "Disproved Less64U$"
+ return 42
+ }
+ } else {
+ if z <= 0xfff { // ERROR "Proved Leq64U$"
+ return 1337
+ }
+ }
+ return int(z)
+}
+
//go:noinline
func useInt(a int) {
}