]> git.proxmox.com Git - rustc.git/blob - src/binaryen/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast
New upstream version 1.23.0+dfsg1
[rustc.git] / src / binaryen / test / passes / optimize-instructions_optimize-level=2_ignore-implicit-traps.wast
1 (module
2 (type $0 (func (param i32 i32) (result i32)))
3 (memory $0 0)
4 (func $conditionals (type $0) (param $0 i32) (param $1 i32) (result i32)
5 (local $2 i32)
6 (local $3 i32)
7 (local $4 i32)
8 (local $5 i32)
9 (local $6 i32)
10 (local $7 i32)
11 (set_local $0
12 (i32.const 0)
13 )
14 (loop $while-in
15 (set_local $3
16 (i32.const 0)
17 )
18 (loop $while-in6
19 (set_local $6
20 (i32.add
21 (get_local $0)
22 (i32.const 1)
23 )
24 )
25 (set_local $0
26 (if (result i32)
27 (i32.or ;; this or is very expensive. we should compute one side, then see if we even need the other
28 (i32.eqz
29 (i32.rem_s
30 (i32.add
31 (i32.mul
32 (tee_local $7 ;; side effect, so we can't do this one
33 (i32.add
34 (get_local $0)
35 (i32.const 2)
36 )
37 )
38 (get_local $0)
39 )
40 (i32.const 17)
41 )
42 (i32.const 5)
43 )
44 )
45 (i32.eqz
46 (i32.rem_u
47 (i32.add
48 (i32.mul
49 (get_local $0)
50 (get_local $0)
51 )
52 (i32.const 11)
53 )
54 (i32.const 3)
55 )
56 )
57 )
58 (get_local $7)
59 (get_local $6)
60 )
61 )
62 (br_if $while-in6
63 (i32.lt_s
64 (tee_local $3
65 (i32.add
66 (get_local $3)
67 (i32.const 1)
68 )
69 )
70 (get_local $4)
71 )
72 )
73 )
74 (br_if $while-in
75 (i32.ne
76 (tee_local $1
77 (i32.add
78 (get_local $1)
79 (i32.const 1)
80 )
81 )
82 (i32.const 27000)
83 )
84 )
85 )
86 (return
87 (get_local $5)
88 )
89 )
90 (func $side-effect (type $0) (param $0 i32) (param $1 i32) (result i32)
91 (local $2 i32)
92 (local $3 i32)
93 (local $4 i32)
94 (local $5 i32)
95 (local $6 i32)
96 (local $7 i32)
97 (set_local $0
98 (i32.const 0)
99 )
100 (loop $while-in
101 (set_local $3
102 (i32.const 0)
103 )
104 (loop $while-in6
105 (set_local $6
106 (i32.add
107 (get_local $0)
108 (i32.const 1)
109 )
110 )
111 (set_local $0
112 (if (result i32)
113 (i32.or ;; this or is very expensive, but has a side effect on both sides
114 (i32.eqz
115 (i32.rem_s
116 (i32.add
117 (i32.mul
118 (tee_local $7
119 (i32.add
120 (get_local $0)
121 (i32.const 0)
122 )
123 )
124 (get_local $0)
125 )
126 (i32.const 17)
127 )
128 (i32.const 5)
129 )
130 )
131 (i32.eqz
132 (i32.rem_u
133 (i32.add
134 (i32.mul
135 (get_local $0)
136 (get_local $0)
137 )
138 (unreachable)
139 )
140 (i32.const 3)
141 )
142 )
143 )
144 (get_local $7)
145 (get_local $6)
146 )
147 )
148 (br_if $while-in6
149 (i32.lt_s
150 (tee_local $3
151 (i32.add
152 (get_local $3)
153 (i32.const 1)
154 )
155 )
156 (get_local $4)
157 )
158 )
159 )
160 (br_if $while-in
161 (i32.ne
162 (tee_local $1
163 (i32.add
164 (get_local $1)
165 (i32.const 1)
166 )
167 )
168 (i32.const 27000)
169 )
170 )
171 )
172 (return
173 (get_local $5)
174 )
175 )
176 (func $flip (type $0) (param $0 i32) (param $1 i32) (result i32)
177 (local $2 i32)
178 (local $3 i32)
179 (local $4 i32)
180 (local $5 i32)
181 (local $6 i32)
182 (local $7 i32)
183 (set_local $0
184 (i32.const 0)
185 )
186 (loop $while-in
187 (set_local $3
188 (i32.const 0)
189 )
190 (loop $while-in6
191 (set_local $6
192 (i32.add
193 (get_local $0)
194 (i32.const 1)
195 )
196 )
197 (set_local $0
198 (if (result i32)
199 (i32.or ;; this or is very expensive, and the first side has no side effect
200 (i32.eqz
201 (i32.rem_s
202 (i32.add
203 (i32.mul
204 (i32.eqz
205 (i32.add
206 (get_local $0)
207 (i32.const 0)
208 )
209 )
210 (get_local $0)
211 )
212 (i32.const 17)
213 )
214 (i32.const 5)
215 )
216 )
217 (i32.eqz
218 (i32.rem_u
219 (i32.add
220 (i32.mul
221 (get_local $0)
222 (get_local $0)
223 )
224 (i32.const 100)
225 )
226 (i32.const 3)
227 )
228 )
229 )
230 (get_local $7)
231 (get_local $6)
232 )
233 )
234 (br_if $while-in6
235 (i32.lt_s
236 (tee_local $3
237 (i32.add
238 (get_local $3)
239 (i32.const 1)
240 )
241 )
242 (get_local $4)
243 )
244 )
245 )
246 (br_if $while-in
247 (i32.ne
248 (tee_local $1
249 (i32.add
250 (get_local $1)
251 (i32.const 1)
252 )
253 )
254 (i32.const 27000)
255 )
256 )
257 )
258 (return
259 (get_local $5)
260 )
261 )
262 (func $invalidate-conditionalizeExpensiveOnBitwise (param $0 i32) (param $1 i32) (result i32)
263 (if
264 (i32.eqz
265 (i32.and
266 (i32.lt_s
267 (i32.and
268 (i32.shr_s
269 (i32.shl
270 (i32.add
271 (get_local $1) ;; conflict with tee
272 (i32.const -1)
273 )
274 (i32.const 24)
275 )
276 (i32.const 24)
277 )
278 (i32.const 255)
279 )
280 (i32.const 3)
281 )
282 (i32.ne
283 (tee_local $1
284 (i32.const 0)
285 )
286 (i32.const 0)
287 )
288 )
289 )
290 (return (get_local $0))
291 )
292 (return (get_local $1))
293 )
294 (func $invalidate-conditionalizeExpensiveOnBitwise-ok (param $0 i32) (param $1 i32) (result i32)
295 (if
296 (i32.eqz
297 (i32.and
298 (i32.lt_s
299 (i32.and
300 (i32.shr_s
301 (i32.shl
302 (i32.add
303 (get_local $0) ;; no conflict
304 (i32.const -1)
305 )
306 (i32.const 24)
307 )
308 (i32.const 24)
309 )
310 (i32.const 255)
311 )
312 (i32.const 3)
313 )
314 (i32.ne
315 (tee_local $1
316 (i32.const 0)
317 )
318 (i32.const 0)
319 )
320 )
321 )
322 (return (get_local $0))
323 )
324 (return (get_local $1))
325 )
326
327 (func $conditionalize-if-type-change (result f64)
328 (local $0 i32)
329 (drop
330 (loop $label$1 (result f32)
331 (block $label$2 (result f32)
332 (drop
333 (block $label$3 (result f32)
334 (br_if $label$1
335 (i32.or ;; this turns into an if, but then the if might not be unreachable
336 (f32.gt
337 (br_if $label$3
338 (f32.const 1)
339 (get_local $0)
340 )
341 (br $label$2
342 (f32.const 71)
343 )
344 )
345 (i64.eqz
346 (select
347 (i64.const 58)
348 (i64.const -982757)
349 (i64.eqz
350 (i64.const 0)
351 )
352 )
353 )
354 )
355 )
356 )
357 )
358 (f32.const 1)
359 )
360 )
361 )
362 (f64.const -nan:0xfffffffffffff)
363 )
364 )
365