summaryrefslogtreecommitdiffstats
path: root/test/fuse.go
blob: ea908bfd4d4aead13466d440327b724811ae4187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// +build amd64,!gcflags_noopt arm64,!gcflags_noopt
// errorcheck -0 -d=ssa/late_fuse/debug=1

// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import "strings"

const Cf2 = 2.0

func fEqEq(a int, f float64) bool {
	return a == 0 && f > Cf2 || a == 0 && f < -Cf2 // ERROR "Redirect Eq64 based on Eq64$"
}

func fEqNeq(a int32, f float64) bool {
	return a == 0 && f > Cf2 || a != 0 && f < -Cf2 // ERROR "Redirect Neq32 based on Eq32$"
}

func fEqLess(a int8, f float64) bool {
	return a == 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fEqLeq(a float64, f float64) bool {
	return a == 0 && f > Cf2 || a <= 0 && f < -Cf2
}

func fEqLessU(a uint, f float64) bool {
	return a == 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fEqLeqU(a uint64, f float64) bool {
	return a == 0 && f > Cf2 || a <= 0 && f < -Cf2 // ERROR "Redirect Leq64U based on Eq64$"
}

func fNeqEq(a int, f float64) bool {
	return a != 0 && f > Cf2 || a == 0 && f < -Cf2 // ERROR "Redirect Eq64 based on Neq64$"
}

func fNeqNeq(a int32, f float64) bool {
	return a != 0 && f > Cf2 || a != 0 && f < -Cf2 // ERROR "Redirect Neq32 based on Neq32$"
}

func fNeqLess(a float32, f float64) bool {
	// TODO: Add support for floating point numbers in prove
	return a != 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fNeqLeq(a int16, f float64) bool {
	return a != 0 && f > Cf2 || a <= 0 && f < -Cf2 // ERROR "Redirect Leq16 based on Neq16$"
}

func fNeqLessU(a uint, f float64) bool {
	return a != 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fNeqLeqU(a uint32, f float64) bool {
	return a != 0 && f > Cf2 || a <= 0 && f < -Cf2 // ERROR "Redirect Leq32U based on Neq32$"
}

func fLessEq(a int, f float64) bool {
	return a < 0 && f > Cf2 || a == 0 && f < -Cf2
}

func fLessNeq(a int32, f float64) bool {
	return a < 0 && f > Cf2 || a != 0 && f < -Cf2
}

func fLessLess(a float32, f float64) bool {
	return a < 0 && f > Cf2 || a < 0 && f < -Cf2 // ERROR "Redirect Less32F based on Less32F$"
}

func fLessLeq(a float64, f float64) bool {
	return a < 0 && f > Cf2 || a <= 0 && f < -Cf2
}

func fLeqEq(a float64, f float64) bool {
	return a <= 0 && f > Cf2 || a == 0 && f < -Cf2
}

func fLeqNeq(a int16, f float64) bool {
	return a <= 0 && f > Cf2 || a != 0 && f < -Cf2 // ERROR "Redirect Neq16 based on Leq16$"
}

func fLeqLess(a float32, f float64) bool {
	return a <= 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fLeqLeq(a int8, f float64) bool {
	return a <= 0 && f > Cf2 || a <= 0 && f < -Cf2 // ERROR "Redirect Leq8 based on Leq8$"
}

func fLessUEq(a uint8, f float64) bool {
	return a < 0 && f > Cf2 || a == 0 && f < -Cf2
}

func fLessUNeq(a uint16, f float64) bool {
	return a < 0 && f > Cf2 || a != 0 && f < -Cf2
}

func fLessULessU(a uint32, f float64) bool {
	return a < 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fLessULeqU(a uint64, f float64) bool {
	return a < 0 && f > Cf2 || a <= 0 && f < -Cf2
}

func fLeqUEq(a uint8, f float64) bool {
	return a <= 0 && f > Cf2 || a == 0 && f < -Cf2 // ERROR "Redirect Eq8 based on Leq8U$"
}

func fLeqUNeq(a uint16, f float64) bool {
	return a <= 0 && f > Cf2 || a != 0 && f < -Cf2 // ERROR "Redirect Neq16 based on Leq16U$"
}

func fLeqLessU(a uint32, f float64) bool {
	return a <= 0 && f > Cf2 || a < 0 && f < -Cf2
}

func fLeqLeqU(a uint64, f float64) bool {
	return a <= 0 && f > Cf2 || a <= 0 && f < -Cf2 // ERROR "Redirect Leq64U based on Leq64U$"
}

// Arg tests are disabled because the op name is different on amd64 and arm64.

func fEqPtrEqPtr(a, b *int, f float64) bool {
	return a == b && f > Cf2 || a == b && f < -Cf2 // ERROR "Redirect EqPtr based on EqPtr$"
}

func fEqPtrNeqPtr(a, b *int, f float64) bool {
	return a == b && f > Cf2 || a != b && f < -Cf2 // ERROR "Redirect NeqPtr based on EqPtr$"
}

func fNeqPtrEqPtr(a, b *int, f float64) bool {
	return a != b && f > Cf2 || a == b && f < -Cf2 // ERROR "Redirect EqPtr based on NeqPtr$"
}

func fNeqPtrNeqPtr(a, b *int, f float64) bool {
	return a != b && f > Cf2 || a != b && f < -Cf2 // ERROR "Redirect NeqPtr based on NeqPtr$"
}

func fEqInterEqInter(a interface{}, f float64) bool {
	return a == nil && f > Cf2 || a == nil && f < -Cf2 // ERROR "Redirect IsNonNil based on IsNonNil$"
}

func fEqInterNeqInter(a interface{}, f float64) bool {
	return a == nil && f > Cf2 || a != nil && f < -Cf2
}

func fNeqInterEqInter(a interface{}, f float64) bool {
	return a != nil && f > Cf2 || a == nil && f < -Cf2
}

func fNeqInterNeqInter(a interface{}, f float64) bool {
	return a != nil && f > Cf2 || a != nil && f < -Cf2 // ERROR "Redirect IsNonNil based on IsNonNil$"
}

func fEqSliceEqSlice(a []int, f float64) bool {
	return a == nil && f > Cf2 || a == nil && f < -Cf2 // ERROR "Redirect IsNonNil based on IsNonNil$"
}

func fEqSliceNeqSlice(a []int, f float64) bool {
	return a == nil && f > Cf2 || a != nil && f < -Cf2
}

func fNeqSliceEqSlice(a []int, f float64) bool {
	return a != nil && f > Cf2 || a == nil && f < -Cf2
}

func fNeqSliceNeqSlice(a []int, f float64) bool {
	return a != nil && f > Cf2 || a != nil && f < -Cf2 // ERROR "Redirect IsNonNil based on IsNonNil$"
}

func fPhi(a, b string) string {
	aslash := strings.HasSuffix(a, "/") // ERROR "Redirect Phi based on Phi$"
	bslash := strings.HasPrefix(b, "/")
	switch {
	case aslash && bslash:
		return a + b[1:]
	case !aslash && !bslash:
		return a + "/" + b
	}
	return a + b
}

func main() {
}