Source file
test/codegen/compare_and_branch.go
1
2
3
4
5
6
7 package codegen
8
9
10 func dummy() {}
11
12
13 func si64(x, y chan int64) {
14
15 for <-x < <-y {
16 dummy()
17 }
18
19
20 for <-x == <-y {
21 dummy()
22 }
23 }
24
25
26 func si64x8(doNotOptimize int64) {
27
28
29 for i := doNotOptimize; i < 128; i++ {
30 dummy()
31 }
32
33
34 for i := doNotOptimize; i > -129; i-- {
35 dummy()
36 }
37
38
39 for i := doNotOptimize; i >= 128; i++ {
40 dummy()
41 }
42
43
44 for i := doNotOptimize; i <= -129; i-- {
45 dummy()
46 }
47 }
48
49
50 func ui64(x, y chan uint64) {
51
52 for <-x > <-y {
53 dummy()
54 }
55
56
57 for <-x != <-y {
58 dummy()
59 }
60 }
61
62
63 func ui64x8() {
64
65 for i := uint64(0); i < 128; i++ {
66 dummy()
67 }
68
69
70 for i := uint64(0); i < 256; i++ {
71 dummy()
72 }
73
74
75 for i := uint64(257); i >= 256; i-- {
76 dummy()
77 }
78
79
80 for i := uint64(1024); i > 0; i-- {
81 dummy()
82 }
83 }
84
85
86 func si32(x, y chan int32) {
87
88 for <-x < <-y {
89 dummy()
90 }
91
92
93 for <-x == <-y {
94 dummy()
95 }
96 }
97
98
99 func si32x8(doNotOptimize int32) {
100
101
102 for i := doNotOptimize; i < 128; i++ {
103 dummy()
104 }
105
106
107 for i := doNotOptimize; i > -129; i-- {
108 dummy()
109 }
110
111
112 for i := doNotOptimize; i >= 128; i++ {
113 dummy()
114 }
115
116
117 for i := doNotOptimize; i <= -129; i-- {
118 dummy()
119 }
120 }
121
122
123 func ui32(x, y chan uint32) {
124
125 for <-x > <-y {
126 dummy()
127 }
128
129
130 for <-x != <-y {
131 dummy()
132 }
133 }
134
135
136 func ui32x8() {
137
138 for i := uint32(0); i < 128; i++ {
139 dummy()
140 }
141
142
143 for i := uint32(0); i < 256; i++ {
144 dummy()
145 }
146
147
148 for i := uint32(257); i >= 256; i-- {
149 dummy()
150 }
151
152
153 for i := uint32(1024); i > 0; i-- {
154 dummy()
155 }
156 }
157
158
159 func si64xu8(x chan int64) {
160
161 for <-x == 128 {
162 dummy()
163 }
164
165
166 for <-x != 255 {
167 dummy()
168 }
169 }
170
171
172 func si32xu8(x chan int32) {
173
174 for <-x == 255 {
175 dummy()
176 }
177
178
179 for <-x != 128 {
180 dummy()
181 }
182 }
183
184
185 func ui64xu8(x chan uint64) {
186
187 for <-x == ^uint64(0) {
188 dummy()
189 }
190
191
192 for <-x != ^uint64(127) {
193 dummy()
194 }
195 }
196
197
198 func ui32xu8(x chan uint32) {
199
200 for <-x == ^uint32(127) {
201 dummy()
202 }
203
204
205 for <-x != ^uint32(0) {
206 dummy()
207 }
208 }
209
210
211 func si64x0(x chan int64) {
212
213 for <-x >= 1 {
214 dummy()
215 }
216
217
218 for <-x < 1 {
219 dummy()
220 }
221
222
223 for <-x <= -1 {
224 dummy()
225 }
226
227
228 for <-x > -1 {
229 dummy()
230 }
231 }
232
233
234 func ui64x0(x chan uint64) {
235
236 for <-x >= 1 {
237 dummy()
238 }
239
240
241 for <-x < 1 {
242 dummy()
243 }
244 }
245
View as plain text