aboutsummaryrefslogtreecommitdiff
path: root/test/prove.go
diff options
context:
space:
mode:
authorMichael Munday <mike.munday@ibm.com>2020-02-20 17:46:08 +0000
committerMichael Munday <mike.munday@ibm.com>2020-02-26 13:11:53 +0000
commitcb74dcc172de2779a2f65ea830f687156c98ad50 (patch)
treef94450c829e15288289bcf99f27b91ede70954eb /test/prove.go
parent44fe355694798b5e1c55fc087e697886e93e633e (diff)
downloadgo-cb74dcc172de2779a2f65ea830f687156c98ad50.tar.gz
go-cb74dcc172de2779a2f65ea830f687156c98ad50.zip
cmd/compile: remove Greater* and Geq* generic integer ops
The generic Greater and Geq ops can always be replaced with the Less and Leq ops. This CL therefore removes them. This simplifies the compiler since it reduces the number of operations that need handling in both code and in rewrite rules. This will be especially true when adding control flow optimizations such as the integer-in-range optimizations in CL 165998. Change-Id: If0648b2b19998ac1bddccbf251283f3be4ec3040 Reviewed-on: https://go-review.googlesource.com/c/go/+/220417 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/prove.go')
-rw-r--r--test/prove.go52
1 files changed, 26 insertions, 26 deletions
diff --git a/test/prove.go b/test/prove.go
index eba0f79af2..e5636a452e 100644
--- a/test/prove.go
+++ b/test/prove.go
@@ -81,7 +81,7 @@ func f4a(a, b, c int) int {
if a == b { // ERROR "Disproved Eq64$"
return 47
}
- if a > b { // ERROR "Disproved Greater64$"
+ if a > b { // ERROR "Disproved Less64$"
return 50
}
if a < b { // ERROR "Proved Less64$"
@@ -141,7 +141,7 @@ func f4d(a, b, c int) int {
func f4e(a, b, c int) int {
if a < b {
- if b > a { // ERROR "Proved Greater64$"
+ if b > a { // ERROR "Proved Less64$"
return 101
}
return 103
@@ -157,7 +157,7 @@ func f4f(a, b, c int) int {
}
return 114
}
- if b >= a { // ERROR "Proved Geq64$"
+ if b >= a { // ERROR "Proved Leq64$"
if b == a { // ERROR "Proved Eq64$"
return 118
}
@@ -194,7 +194,7 @@ func f6b(a uint8) int {
}
func f6x(a uint8) int {
- if a > a { // ERROR "Disproved Greater8U$"
+ if a > a { // ERROR "Disproved Less8U$"
return 143
}
return 151
@@ -208,7 +208,7 @@ func f6d(a uint8) int {
}
func f6e(a uint8) int {
- if a >= a { // ERROR "Proved Geq8U$"
+ if a >= a { // ERROR "Proved Leq8U$"
return 149
}
return 151
@@ -299,12 +299,12 @@ func f13a(a, b, c int, x bool) int {
}
}
if x {
- if a >= 12 { // ERROR "Proved Geq64$"
+ if a >= 12 { // ERROR "Proved Leq64$"
return 4
}
}
if x {
- if a > 12 { // ERROR "Proved Greater64$"
+ if a > 12 { // ERROR "Proved Less64$"
return 5
}
}
@@ -331,12 +331,12 @@ func f13b(a int, x bool) int {
}
}
if x {
- if a >= -9 { // ERROR "Proved Geq64$"
+ if a >= -9 { // ERROR "Proved Leq64$"
return 10
}
}
if x {
- if a > -9 { // ERROR "Disproved Greater64$"
+ if a > -9 { // ERROR "Disproved Less64$"
return 11
}
}
@@ -363,12 +363,12 @@ func f13c(a int, x bool) int {
}
}
if x {
- if a >= 90 { // ERROR "Disproved Geq64$"
+ if a >= 90 { // ERROR "Disproved Leq64$"
return 16
}
}
if x {
- if a > 90 { // ERROR "Disproved Greater64$"
+ if a > 90 { // ERROR "Disproved Less64$"
return 17
}
}
@@ -388,7 +388,7 @@ func f13d(a int) int {
func f13e(a int) int {
if a > 9 {
- if a > 5 { // ERROR "Proved Greater64$"
+ if a > 5 { // ERROR "Proved Less64$"
return 1
}
}
@@ -432,7 +432,7 @@ func f13i(a uint) int {
if a == 0 {
return 1
}
- if a > 0 { // ERROR "Proved Greater64U$"
+ if a > 0 { // ERROR "Proved Less64U$"
return 2
}
return 3
@@ -477,13 +477,13 @@ func f18(b []int, x int, y uint) {
_ = b[x]
_ = b[y]
- if x > len(b) { // ERROR "Disproved Greater64$"
+ if x > len(b) { // ERROR "Disproved Less64$"
return
}
- if y > uint(len(b)) { // ERROR "Disproved Greater64U$"
+ if y > uint(len(b)) { // ERROR "Disproved Less64U$"
return
}
- if int(y) > len(b) { // ERROR "Disproved Greater64$"
+ if int(y) > len(b) { // ERROR "Disproved Less64$"
return
}
}
@@ -497,7 +497,7 @@ func f19() (e int64, err error) {
}
last := len(stack) - 1
e = stack[last]
- // Buggy compiler prints "Disproved Geq64" for the next line.
+ // Buggy compiler prints "Disproved Leq64" for the next line.
stack = stack[:last] // ERROR "Proved IsSliceInBounds"
return e, nil
}
@@ -514,12 +514,12 @@ func sm1(b []int, x int) {
func lim1(x, y, z int) {
// Test relations between signed and unsigned limits.
if x > 5 {
- if uint(x) > 5 { // ERROR "Proved Greater64U$"
+ if uint(x) > 5 { // ERROR "Proved Less64U$"
return
}
}
if y >= 0 && y < 4 {
- if uint(y) > 4 { // ERROR "Disproved Greater64U$"
+ if uint(y) > 4 { // ERROR "Disproved Less64U$"
return
}
if uint(y) < 5 { // ERROR "Proved Less64U$"
@@ -544,13 +544,13 @@ func fence1(b []int, x, y int) {
}
if len(b) < cap(b) {
// This eliminates the growslice path.
- b = append(b, 1) // ERROR "Disproved Greater64U$"
+ b = append(b, 1) // ERROR "Disproved Less64U$"
}
}
func fence2(x, y int) {
if x-1 < y {
- if x > y { // ERROR "Disproved Greater64$"
+ if x > y { // ERROR "Disproved Less64$"
return
}
}
@@ -593,18 +593,18 @@ func fence4(x, y int64) {
func trans1(x, y int64) {
if x > 5 {
if y > x {
- if y > 2 { // ERROR "Proved Greater64$"
+ if y > 2 { // ERROR "Proved Less64$"
return
}
} else if y == x {
- if y > 5 { // ERROR "Proved Greater64$"
+ if y > 5 { // ERROR "Proved Less64$"
return
}
}
}
if x >= 10 {
if y > x {
- if y > 10 { // ERROR "Proved Greater64$"
+ if y > 10 { // ERROR "Proved Less64$"
return
}
}
@@ -711,7 +711,7 @@ func range1(b []int) {
if i < len(b) { // ERROR "Proved Less64$"
println("x")
}
- if i >= 0 { // ERROR "Proved Geq64$"
+ if i >= 0 { // ERROR "Proved Leq64$"
println("x")
}
}
@@ -724,7 +724,7 @@ func range2(b [][32]int) {
if i < len(b) { // ERROR "Proved Less64$"
println("x")
}
- if i >= 0 { // ERROR "Proved Geq64$"
+ if i >= 0 { // ERROR "Proved Leq64$"
println("x")
}
}