]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/value-numbering/value-numbering-tests.factor
db configurations factored out through db.info
[factor.git] / basis / compiler / cfg / value-numbering / value-numbering-tests.factor
1 IN: compiler.cfg.value-numbering.tests
2 USING: compiler.cfg.value-numbering compiler.cfg.instructions
3 compiler.cfg.registers compiler.cfg.debugger compiler.cfg.comparisons
4 cpu.architecture tools.test kernel math combinators.short-circuit
5 accessors sequences compiler.cfg.predecessors locals
6 compiler.cfg.phi-elimination compiler.cfg.dce
7 compiler.cfg assocs vectors arrays layouts namespaces ;
8
9 : trim-temps ( insns -- insns )
10     [
11         dup {
12             [ ##compare? ]
13             [ ##compare-imm? ]
14             [ ##compare-float? ]
15         } 1|| [ f >>temp ] when
16     ] map ;
17
18 ! Folding constants together
19 [
20     {
21         T{ ##load-reference f V int-regs 0 0.0 }
22         T{ ##load-reference f V int-regs 1 -0.0 }
23         T{ ##replace f V int-regs 0 D 0 }
24         T{ ##replace f V int-regs 1 D 1 }
25     }
26 ] [
27     {
28         T{ ##load-reference f V int-regs 0 0.0 }
29         T{ ##load-reference f V int-regs 1 -0.0 }
30         T{ ##replace f V int-regs 0 D 0 }
31         T{ ##replace f V int-regs 1 D 1 }
32     } value-numbering-step
33 ] unit-test
34
35 [
36     {
37         T{ ##load-reference f V int-regs 0 0.0 }
38         T{ ##load-reference f V int-regs 1 0.0 }
39         T{ ##replace f V int-regs 0 D 0 }
40         T{ ##replace f V int-regs 0 D 1 }
41     }
42 ] [
43     {
44         T{ ##load-reference f V int-regs 0 0.0 }
45         T{ ##load-reference f V int-regs 1 0.0 }
46         T{ ##replace f V int-regs 0 D 0 }
47         T{ ##replace f V int-regs 1 D 1 }
48     } value-numbering-step
49 ] unit-test
50
51 [
52     {
53         T{ ##load-reference f V int-regs 0 t }
54         T{ ##load-reference f V int-regs 1 t }
55         T{ ##replace f V int-regs 0 D 0 }
56         T{ ##replace f V int-regs 0 D 1 }
57     }
58 ] [
59     {
60         T{ ##load-reference f V int-regs 0 t }
61         T{ ##load-reference f V int-regs 1 t }
62         T{ ##replace f V int-regs 0 D 0 }
63         T{ ##replace f V int-regs 1 D 1 }
64     } value-numbering-step
65 ] unit-test
66
67 ! Copy propagation
68 [
69     {
70         T{ ##peek f V int-regs 45 D 1 }
71         T{ ##copy f V int-regs 48 V int-regs 45 }
72         T{ ##compare-imm-branch f V int-regs 45 7 cc/= }
73     }
74 ] [
75     {
76         T{ ##peek f V int-regs 45 D 1 }
77         T{ ##copy f V int-regs 48 V int-regs 45 }
78         T{ ##compare-imm-branch f V int-regs 48 7 cc/= }
79     } value-numbering-step
80 ] unit-test
81
82 ! Compare propagation
83 [
84     {
85         T{ ##load-reference f V int-regs 1 + }
86         T{ ##peek f V int-regs 2 D 0 }
87         T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
88         T{ ##compare f V int-regs 6 V int-regs 2 V int-regs 1 cc> }
89         T{ ##replace f V int-regs 4 D 0 }
90     }
91 ] [
92     {
93         T{ ##load-reference f V int-regs 1 + }
94         T{ ##peek f V int-regs 2 D 0 }
95         T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
96         T{ ##compare-imm f V int-regs 6 V int-regs 4 5 cc/= }
97         T{ ##replace f V int-regs 6 D 0 }
98     } value-numbering-step trim-temps
99 ] unit-test
100
101 [
102     {
103         T{ ##load-reference f V int-regs 1 + }
104         T{ ##peek f V int-regs 2 D 0 }
105         T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
106         T{ ##compare f V int-regs 6 V int-regs 2 V int-regs 1 cc> }
107         T{ ##replace f V int-regs 6 D 0 }
108     }
109 ] [
110     {
111         T{ ##load-reference f V int-regs 1 + }
112         T{ ##peek f V int-regs 2 D 0 }
113         T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
114         T{ ##compare-imm f V int-regs 6 V int-regs 4 5 cc= }
115         T{ ##replace f V int-regs 6 D 0 }
116     } value-numbering-step trim-temps
117 ] unit-test
118
119 [
120     {
121         T{ ##peek f V int-regs 8 D 0 }
122         T{ ##peek f V int-regs 9 D -1 }
123         T{ ##unbox-float f V double-float-regs 10 V int-regs 8 }
124         T{ ##unbox-float f V double-float-regs 11 V int-regs 9 }
125         T{ ##compare-float f V int-regs 12 V double-float-regs 10 V double-float-regs 11 cc< }
126         T{ ##compare-float f V int-regs 14 V double-float-regs 10 V double-float-regs 11 cc>= }
127         T{ ##replace f V int-regs 14 D 0 }
128     }
129 ] [
130     {
131         T{ ##peek f V int-regs 8 D 0 }
132         T{ ##peek f V int-regs 9 D -1 }
133         T{ ##unbox-float f V double-float-regs 10 V int-regs 8 }
134         T{ ##unbox-float f V double-float-regs 11 V int-regs 9 }
135         T{ ##compare-float f V int-regs 12 V double-float-regs 10 V double-float-regs 11 cc< }
136         T{ ##compare-imm f V int-regs 14 V int-regs 12 5 cc= }
137         T{ ##replace f V int-regs 14 D 0 }
138     } value-numbering-step trim-temps
139 ] unit-test
140
141 [
142     {
143         T{ ##peek f V int-regs 29 D -1 }
144         T{ ##peek f V int-regs 30 D -2 }
145         T{ ##compare f V int-regs 33 V int-regs 29 V int-regs 30 cc<= }
146         T{ ##compare-branch f V int-regs 29 V int-regs 30 cc<= }
147     }
148 ] [
149     {
150         T{ ##peek f V int-regs 29 D -1 }
151         T{ ##peek f V int-regs 30 D -2 }
152         T{ ##compare f V int-regs 33 V int-regs 29 V int-regs 30 cc<= }
153         T{ ##compare-imm-branch f V int-regs 33 5 cc/= }
154     } value-numbering-step trim-temps
155 ] unit-test
156
157 ! Immediate operand conversion
158 [
159     {
160         T{ ##peek f V int-regs 0 D 0 }
161         T{ ##load-immediate f V int-regs 1 100 }
162         T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
163     }
164 ] [
165     {
166         T{ ##peek f V int-regs 0 D 0 }
167         T{ ##load-immediate f V int-regs 1 100 }
168         T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
169     } value-numbering-step
170 ] unit-test
171
172 [
173     {
174         T{ ##peek f V int-regs 0 D 0 }
175         T{ ##load-immediate f V int-regs 1 100 }
176         T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
177     }
178 ] [
179     {
180         T{ ##peek f V int-regs 0 D 0 }
181         T{ ##load-immediate f V int-regs 1 100 }
182         T{ ##add f V int-regs 2 V int-regs 1 V int-regs 0 }
183     } value-numbering-step
184 ] unit-test
185
186 [
187     {
188         T{ ##peek f V int-regs 0 D 0 }
189         T{ ##load-immediate f V int-regs 1 100 }
190         T{ ##add-imm f V int-regs 2 V int-regs 0 -100 }
191     }
192 ] [
193     {
194         T{ ##peek f V int-regs 0 D 0 }
195         T{ ##load-immediate f V int-regs 1 100 }
196         T{ ##sub f V int-regs 2 V int-regs 0 V int-regs 1 }
197     } value-numbering-step
198 ] unit-test
199
200 [
201     {
202         T{ ##peek f V int-regs 0 D 0 }
203         T{ ##load-immediate f V int-regs 1 0 }
204     }
205 ] [
206     {
207         T{ ##peek f V int-regs 0 D 0 }
208         T{ ##sub f V int-regs 1 V int-regs 0 V int-regs 0 }
209     } value-numbering-step
210 ] unit-test
211
212 [
213     {
214         T{ ##peek f V int-regs 0 D 0 }
215         T{ ##load-immediate f V int-regs 1 100 }
216         T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
217     }
218 ] [
219     {
220         T{ ##peek f V int-regs 0 D 0 }
221         T{ ##load-immediate f V int-regs 1 100 }
222         T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
223     } value-numbering-step
224 ] unit-test
225
226 [
227     {
228         T{ ##peek f V int-regs 0 D 0 }
229         T{ ##load-immediate f V int-regs 1 100 }
230         T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
231     }
232 ] [
233     {
234         T{ ##peek f V int-regs 0 D 0 }
235         T{ ##load-immediate f V int-regs 1 100 }
236         T{ ##mul f V int-regs 2 V int-regs 1 V int-regs 0 }
237     } value-numbering-step
238 ] unit-test
239
240 [
241     {
242         T{ ##peek f V int-regs 1 D 0 }
243         T{ ##shl-imm f V int-regs 2 V int-regs 1 3 }
244     }
245 ] [
246     {
247         T{ ##peek f V int-regs 1 D 0 }
248         T{ ##mul-imm f V int-regs 2 V int-regs 1 8 }
249     } value-numbering-step
250 ] unit-test
251
252 [
253     {
254         T{ ##peek f V int-regs 0 D 0 }
255         T{ ##load-immediate f V int-regs 1 100 }
256         T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
257     }
258 ] [
259     {
260         T{ ##peek f V int-regs 0 D 0 }
261         T{ ##load-immediate f V int-regs 1 100 }
262         T{ ##and f V int-regs 2 V int-regs 0 V int-regs 1 }
263     } value-numbering-step
264 ] unit-test
265
266 [
267     {
268         T{ ##peek f V int-regs 0 D 0 }
269         T{ ##load-immediate f V int-regs 1 100 }
270         T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
271     }
272 ] [
273     {
274         T{ ##peek f V int-regs 0 D 0 }
275         T{ ##load-immediate f V int-regs 1 100 }
276         T{ ##and f V int-regs 2 V int-regs 1 V int-regs 0 }
277     } value-numbering-step
278 ] unit-test
279
280 [
281     {
282         T{ ##peek f V int-regs 0 D 0 }
283         T{ ##load-immediate f V int-regs 1 100 }
284         T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
285     }
286 ] [
287     {
288         T{ ##peek f V int-regs 0 D 0 }
289         T{ ##load-immediate f V int-regs 1 100 }
290         T{ ##or f V int-regs 2 V int-regs 0 V int-regs 1 }
291     } value-numbering-step
292 ] unit-test
293
294 [
295     {
296         T{ ##peek f V int-regs 0 D 0 }
297         T{ ##load-immediate f V int-regs 1 100 }
298         T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
299     }
300 ] [
301     {
302         T{ ##peek f V int-regs 0 D 0 }
303         T{ ##load-immediate f V int-regs 1 100 }
304         T{ ##or f V int-regs 2 V int-regs 1 V int-regs 0 }
305     } value-numbering-step
306 ] unit-test
307
308 [
309     {
310         T{ ##peek f V int-regs 0 D 0 }
311         T{ ##load-immediate f V int-regs 1 100 }
312         T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
313     }
314 ] [
315     {
316         T{ ##peek f V int-regs 0 D 0 }
317         T{ ##load-immediate f V int-regs 1 100 }
318         T{ ##xor f V int-regs 2 V int-regs 0 V int-regs 1 }
319     } value-numbering-step
320 ] unit-test
321
322 [
323     {
324         T{ ##peek f V int-regs 0 D 0 }
325         T{ ##load-immediate f V int-regs 1 100 }
326         T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
327     }
328 ] [
329     {
330         T{ ##peek f V int-regs 0 D 0 }
331         T{ ##load-immediate f V int-regs 1 100 }
332         T{ ##xor f V int-regs 2 V int-regs 1 V int-regs 0 }
333     } value-numbering-step
334 ] unit-test
335
336 [
337     {
338         T{ ##peek f V int-regs 0 D 0 }
339         T{ ##load-immediate f V int-regs 1 100 }
340         T{ ##compare-imm f V int-regs 2 V int-regs 0 100 cc<= }
341     }
342 ] [
343     {
344         T{ ##peek f V int-regs 0 D 0 }
345         T{ ##load-immediate f V int-regs 1 100 }
346         T{ ##compare f V int-regs 2 V int-regs 0 V int-regs 1 cc<= }
347     } value-numbering-step trim-temps
348 ] unit-test
349
350 [
351     {
352         T{ ##peek f V int-regs 0 D 0 }
353         T{ ##load-immediate f V int-regs 1 100 }
354         T{ ##compare-imm f V int-regs 2 V int-regs 0 100 cc>= }
355     }
356 ] [
357     {
358         T{ ##peek f V int-regs 0 D 0 }
359         T{ ##load-immediate f V int-regs 1 100 }
360         T{ ##compare f V int-regs 2 V int-regs 1 V int-regs 0 cc<= }
361     } value-numbering-step trim-temps
362 ] unit-test
363
364 [
365     {
366         T{ ##peek f V int-regs 0 D 0 }
367         T{ ##load-immediate f V int-regs 1 100 }
368         T{ ##compare-imm-branch f V int-regs 0 100 cc<= }
369     }
370 ] [
371     {
372         T{ ##peek f V int-regs 0 D 0 }
373         T{ ##load-immediate f V int-regs 1 100 }
374         T{ ##compare-branch f V int-regs 0 V int-regs 1 cc<= }
375     } value-numbering-step
376 ] unit-test
377
378 [
379     {
380         T{ ##peek f V int-regs 0 D 0 }
381         T{ ##load-immediate f V int-regs 1 100 }
382         T{ ##compare-imm-branch f V int-regs 0 100 cc>= }
383     }
384 ] [
385     {
386         T{ ##peek f V int-regs 0 D 0 }
387         T{ ##load-immediate f V int-regs 1 100 }
388         T{ ##compare-branch f V int-regs 1 V int-regs 0 cc<= }
389     } value-numbering-step trim-temps
390 ] unit-test
391
392 ! Reassociation
393 [
394     {
395         T{ ##peek f V int-regs 0 D 0 }
396         T{ ##load-immediate f V int-regs 1 100 }
397         T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
398         T{ ##load-immediate f V int-regs 3 50 }
399         T{ ##add-imm f V int-regs 4 V int-regs 0 150 }
400     }
401 ] [
402     {
403         T{ ##peek f V int-regs 0 D 0 }
404         T{ ##load-immediate f V int-regs 1 100 }
405         T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
406         T{ ##load-immediate f V int-regs 3 50 }
407         T{ ##add f V int-regs 4 V int-regs 2 V int-regs 3 }
408     } value-numbering-step
409 ] unit-test
410
411 [
412     {
413         T{ ##peek f V int-regs 0 D 0 }
414         T{ ##load-immediate f V int-regs 1 100 }
415         T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
416         T{ ##load-immediate f V int-regs 3 50 }
417         T{ ##add-imm f V int-regs 4 V int-regs 0 150 }
418     }
419 ] [
420     {
421         T{ ##peek f V int-regs 0 D 0 }
422         T{ ##load-immediate f V int-regs 1 100 }
423         T{ ##add f V int-regs 2 V int-regs 1 V int-regs 0 }
424         T{ ##load-immediate f V int-regs 3 50 }
425         T{ ##add f V int-regs 4 V int-regs 3 V int-regs 2 }
426     } value-numbering-step
427 ] unit-test
428
429 [
430     {
431         T{ ##peek f V int-regs 0 D 0 }
432         T{ ##load-immediate f V int-regs 1 100 }
433         T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
434         T{ ##load-immediate f V int-regs 3 50 }
435         T{ ##add-imm f V int-regs 4 V int-regs 0 50 }
436     }
437 ] [
438     {
439         T{ ##peek f V int-regs 0 D 0 }
440         T{ ##load-immediate f V int-regs 1 100 }
441         T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
442         T{ ##load-immediate f V int-regs 3 50 }
443         T{ ##sub f V int-regs 4 V int-regs 2 V int-regs 3 }
444     } value-numbering-step
445 ] unit-test
446
447 [
448     {
449         T{ ##peek f V int-regs 0 D 0 }
450         T{ ##load-immediate f V int-regs 1 100 }
451         T{ ##add-imm f V int-regs 2 V int-regs 0 -100 }
452         T{ ##load-immediate f V int-regs 3 50 }
453         T{ ##add-imm f V int-regs 4 V int-regs 0 -150 }
454     }
455 ] [
456     {
457         T{ ##peek f V int-regs 0 D 0 }
458         T{ ##load-immediate f V int-regs 1 100 }
459         T{ ##sub f V int-regs 2 V int-regs 0 V int-regs 1 }
460         T{ ##load-immediate f V int-regs 3 50 }
461         T{ ##sub f V int-regs 4 V int-regs 2 V int-regs 3 }
462     } value-numbering-step
463 ] unit-test
464
465 [
466     {
467         T{ ##peek f V int-regs 0 D 0 }
468         T{ ##load-immediate f V int-regs 1 100 }
469         T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
470         T{ ##load-immediate f V int-regs 3 50 }
471         T{ ##mul-imm f V int-regs 4 V int-regs 0 5000 }
472     }
473 ] [
474     {
475         T{ ##peek f V int-regs 0 D 0 }
476         T{ ##load-immediate f V int-regs 1 100 }
477         T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
478         T{ ##load-immediate f V int-regs 3 50 }
479         T{ ##mul f V int-regs 4 V int-regs 2 V int-regs 3 }
480     } value-numbering-step
481 ] unit-test
482
483 [
484     {
485         T{ ##peek f V int-regs 0 D 0 }
486         T{ ##load-immediate f V int-regs 1 100 }
487         T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
488         T{ ##load-immediate f V int-regs 3 50 }
489         T{ ##mul-imm f V int-regs 4 V int-regs 0 5000 }
490     }
491 ] [
492     {
493         T{ ##peek f V int-regs 0 D 0 }
494         T{ ##load-immediate f V int-regs 1 100 }
495         T{ ##mul f V int-regs 2 V int-regs 1 V int-regs 0 }
496         T{ ##load-immediate f V int-regs 3 50 }
497         T{ ##mul f V int-regs 4 V int-regs 3 V int-regs 2 }
498     } value-numbering-step
499 ] unit-test
500
501 [
502     {
503         T{ ##peek f V int-regs 0 D 0 }
504         T{ ##load-immediate f V int-regs 1 100 }
505         T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
506         T{ ##load-immediate f V int-regs 3 50 }
507         T{ ##and-imm f V int-regs 4 V int-regs 0 32 }
508     }
509 ] [
510     {
511         T{ ##peek f V int-regs 0 D 0 }
512         T{ ##load-immediate f V int-regs 1 100 }
513         T{ ##and f V int-regs 2 V int-regs 0 V int-regs 1 }
514         T{ ##load-immediate f V int-regs 3 50 }
515         T{ ##and f V int-regs 4 V int-regs 2 V int-regs 3 }
516     } value-numbering-step
517 ] unit-test
518
519 [
520     {
521         T{ ##peek f V int-regs 0 D 0 }
522         T{ ##load-immediate f V int-regs 1 100 }
523         T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
524         T{ ##load-immediate f V int-regs 3 50 }
525         T{ ##and-imm f V int-regs 4 V int-regs 0 32 }
526     }
527 ] [
528     {
529         T{ ##peek f V int-regs 0 D 0 }
530         T{ ##load-immediate f V int-regs 1 100 }
531         T{ ##and f V int-regs 2 V int-regs 1 V int-regs 0 }
532         T{ ##load-immediate f V int-regs 3 50 }
533         T{ ##and f V int-regs 4 V int-regs 3 V int-regs 2 }
534     } value-numbering-step
535 ] unit-test
536
537 [
538     {
539         T{ ##peek f V int-regs 0 D 0 }
540         T{ ##load-immediate f V int-regs 1 100 }
541         T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
542         T{ ##load-immediate f V int-regs 3 50 }
543         T{ ##or-imm f V int-regs 4 V int-regs 0 118 }
544     }
545 ] [
546     {
547         T{ ##peek f V int-regs 0 D 0 }
548         T{ ##load-immediate f V int-regs 1 100 }
549         T{ ##or f V int-regs 2 V int-regs 0 V int-regs 1 }
550         T{ ##load-immediate f V int-regs 3 50 }
551         T{ ##or f V int-regs 4 V int-regs 2 V int-regs 3 }
552     } value-numbering-step
553 ] unit-test
554
555 [
556     {
557         T{ ##peek f V int-regs 0 D 0 }
558         T{ ##load-immediate f V int-regs 1 100 }
559         T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
560         T{ ##load-immediate f V int-regs 3 50 }
561         T{ ##or-imm f V int-regs 4 V int-regs 0 118 }
562     }
563 ] [
564     {
565         T{ ##peek f V int-regs 0 D 0 }
566         T{ ##load-immediate f V int-regs 1 100 }
567         T{ ##or f V int-regs 2 V int-regs 1 V int-regs 0 }
568         T{ ##load-immediate f V int-regs 3 50 }
569         T{ ##or f V int-regs 4 V int-regs 3 V int-regs 2 }
570     } value-numbering-step
571 ] unit-test
572
573 [
574     {
575         T{ ##peek f V int-regs 0 D 0 }
576         T{ ##load-immediate f V int-regs 1 100 }
577         T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
578         T{ ##load-immediate f V int-regs 3 50 }
579         T{ ##xor-imm f V int-regs 4 V int-regs 0 86 }
580     }
581 ] [
582     {
583         T{ ##peek f V int-regs 0 D 0 }
584         T{ ##load-immediate f V int-regs 1 100 }
585         T{ ##xor f V int-regs 2 V int-regs 0 V int-regs 1 }
586         T{ ##load-immediate f V int-regs 3 50 }
587         T{ ##xor f V int-regs 4 V int-regs 2 V int-regs 3 }
588     } value-numbering-step
589 ] unit-test
590
591 [
592     {
593         T{ ##peek f V int-regs 0 D 0 }
594         T{ ##load-immediate f V int-regs 1 100 }
595         T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
596         T{ ##load-immediate f V int-regs 3 50 }
597         T{ ##xor-imm f V int-regs 4 V int-regs 0 86 }
598     }
599 ] [
600     {
601         T{ ##peek f V int-regs 0 D 0 }
602         T{ ##load-immediate f V int-regs 1 100 }
603         T{ ##xor f V int-regs 2 V int-regs 1 V int-regs 0 }
604         T{ ##load-immediate f V int-regs 3 50 }
605         T{ ##xor f V int-regs 4 V int-regs 3 V int-regs 2 }
606     } value-numbering-step
607 ] unit-test
608
609 ! Simplification
610 [
611     {
612         T{ ##peek f V int-regs 0 D 0 }
613         T{ ##peek f V int-regs 1 D 1 }
614         T{ ##load-immediate f V int-regs 2 0 }
615         T{ ##add-imm f V int-regs 3 V int-regs 0 0 }
616         T{ ##replace f V int-regs 0 D 0 }
617     }
618 ] [
619     {
620         T{ ##peek f V int-regs 0 D 0 }
621         T{ ##peek f V int-regs 1 D 1 }
622         T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
623         T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
624         T{ ##replace f V int-regs 3 D 0 }
625     } value-numbering-step
626 ] unit-test
627
628 [
629     {
630         T{ ##peek f V int-regs 0 D 0 }
631         T{ ##peek f V int-regs 1 D 1 }
632         T{ ##load-immediate f V int-regs 2 0 }
633         T{ ##add-imm f V int-regs 3 V int-regs 0 0 }
634         T{ ##replace f V int-regs 0 D 0 }
635     }
636 ] [
637     {
638         T{ ##peek f V int-regs 0 D 0 }
639         T{ ##peek f V int-regs 1 D 1 }
640         T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
641         T{ ##sub f V int-regs 3 V int-regs 0 V int-regs 2 }
642         T{ ##replace f V int-regs 3 D 0 }
643     } value-numbering-step
644 ] unit-test
645
646 [
647     {
648         T{ ##peek f V int-regs 0 D 0 }
649         T{ ##peek f V int-regs 1 D 1 }
650         T{ ##load-immediate f V int-regs 2 0 }
651         T{ ##or-imm f V int-regs 3 V int-regs 0 0 }
652         T{ ##replace f V int-regs 0 D 0 }
653     }
654 ] [
655     {
656         T{ ##peek f V int-regs 0 D 0 }
657         T{ ##peek f V int-regs 1 D 1 }
658         T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
659         T{ ##or f V int-regs 3 V int-regs 0 V int-regs 2 }
660         T{ ##replace f V int-regs 3 D 0 }
661     } value-numbering-step
662 ] unit-test
663
664 [
665     {
666         T{ ##peek f V int-regs 0 D 0 }
667         T{ ##peek f V int-regs 1 D 1 }
668         T{ ##load-immediate f V int-regs 2 0 }
669         T{ ##xor-imm f V int-regs 3 V int-regs 0 0 }
670         T{ ##replace f V int-regs 0 D 0 }
671     }
672 ] [
673     {
674         T{ ##peek f V int-regs 0 D 0 }
675         T{ ##peek f V int-regs 1 D 1 }
676         T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
677         T{ ##xor f V int-regs 3 V int-regs 0 V int-regs 2 }
678         T{ ##replace f V int-regs 3 D 0 }
679     } value-numbering-step
680 ] unit-test
681
682 [
683     {
684         T{ ##peek f V int-regs 0 D 0 }
685         T{ ##load-immediate f V int-regs 1 1 }
686         T{ ##shl-imm f V int-regs 2 V int-regs 0 0 }
687         T{ ##replace f V int-regs 0 D 0 }
688     }
689 ] [
690     {
691         T{ ##peek f V int-regs 0 D 0 }
692         T{ ##load-immediate f V int-regs 1 1 }
693         T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
694         T{ ##replace f V int-regs 2 D 0 }
695     } value-numbering-step
696 ] unit-test
697
698 ! Constant folding
699 [
700     {
701         T{ ##peek f V int-regs 0 D 0 }
702         T{ ##load-immediate f V int-regs 1 1 }
703         T{ ##load-immediate f V int-regs 2 3 }
704         T{ ##load-immediate f V int-regs 3 4 }
705     }
706 ] [
707     {
708         T{ ##peek f V int-regs 0 D 0 }
709         T{ ##load-immediate f V int-regs 1 1 }
710         T{ ##load-immediate f V int-regs 2 3 }
711         T{ ##add f V int-regs 3 V int-regs 1 V int-regs 2 }
712     } value-numbering-step
713 ] unit-test
714
715 [
716     {
717         T{ ##peek f V int-regs 0 D 0 }
718         T{ ##load-immediate f V int-regs 1 1 }
719         T{ ##load-immediate f V int-regs 2 3 }
720         T{ ##load-immediate f V int-regs 3 -2 }
721     }
722 ] [
723     {
724         T{ ##peek f V int-regs 0 D 0 }
725         T{ ##load-immediate f V int-regs 1 1 }
726         T{ ##load-immediate f V int-regs 2 3 }
727         T{ ##sub f V int-regs 3 V int-regs 1 V int-regs 2 }
728     } value-numbering-step
729 ] unit-test
730
731 [
732     {
733         T{ ##peek f V int-regs 0 D 0 }
734         T{ ##load-immediate f V int-regs 1 2 }
735         T{ ##load-immediate f V int-regs 2 3 }
736         T{ ##load-immediate f V int-regs 3 6 }
737     }
738 ] [
739     {
740         T{ ##peek f V int-regs 0 D 0 }
741         T{ ##load-immediate f V int-regs 1 2 }
742         T{ ##load-immediate f V int-regs 2 3 }
743         T{ ##mul f V int-regs 3 V int-regs 1 V int-regs 2 }
744     } value-numbering-step
745 ] unit-test
746
747 [
748     {
749         T{ ##peek f V int-regs 0 D 0 }
750         T{ ##load-immediate f V int-regs 1 2 }
751         T{ ##load-immediate f V int-regs 2 1 }
752         T{ ##load-immediate f V int-regs 3 0 }
753     }
754 ] [
755     {
756         T{ ##peek f V int-regs 0 D 0 }
757         T{ ##load-immediate f V int-regs 1 2 }
758         T{ ##load-immediate f V int-regs 2 1 }
759         T{ ##and f V int-regs 3 V int-regs 1 V int-regs 2 }
760     } value-numbering-step
761 ] unit-test
762
763 [
764     {
765         T{ ##peek f V int-regs 0 D 0 }
766         T{ ##load-immediate f V int-regs 1 2 }
767         T{ ##load-immediate f V int-regs 2 1 }
768         T{ ##load-immediate f V int-regs 3 3 }
769     }
770 ] [
771     {
772         T{ ##peek f V int-regs 0 D 0 }
773         T{ ##load-immediate f V int-regs 1 2 }
774         T{ ##load-immediate f V int-regs 2 1 }
775         T{ ##or f V int-regs 3 V int-regs 1 V int-regs 2 }
776     } value-numbering-step
777 ] unit-test
778
779 [
780     {
781         T{ ##peek f V int-regs 0 D 0 }
782         T{ ##load-immediate f V int-regs 1 2 }
783         T{ ##load-immediate f V int-regs 2 3 }
784         T{ ##load-immediate f V int-regs 3 1 }
785     }
786 ] [
787     {
788         T{ ##peek f V int-regs 0 D 0 }
789         T{ ##load-immediate f V int-regs 1 2 }
790         T{ ##load-immediate f V int-regs 2 3 }
791         T{ ##xor f V int-regs 3 V int-regs 1 V int-regs 2 }
792     } value-numbering-step
793 ] unit-test
794
795 [
796     {
797         T{ ##peek f V int-regs 0 D 0 }
798         T{ ##load-immediate f V int-regs 1 1 }
799         T{ ##load-immediate f V int-regs 3 8 }
800     }
801 ] [
802     {
803         T{ ##peek f V int-regs 0 D 0 }
804         T{ ##load-immediate f V int-regs 1 1 }
805         T{ ##shl-imm f V int-regs 3 V int-regs 1 3 }
806     } value-numbering-step
807 ] unit-test
808
809 cell 8 = [
810     [
811         {
812             T{ ##peek f V int-regs 0 D 0 }
813             T{ ##load-immediate f V int-regs 1 -1 }
814             T{ ##load-immediate f V int-regs 3 HEX: ffffffffffff }
815         }
816     ] [
817         {
818             T{ ##peek f V int-regs 0 D 0 }
819             T{ ##load-immediate f V int-regs 1 -1 }
820             T{ ##shr-imm f V int-regs 3 V int-regs 1 16 }
821         } value-numbering-step
822     ] unit-test
823 ] when
824
825 [
826     {
827         T{ ##peek f V int-regs 0 D 0 }
828         T{ ##load-immediate f V int-regs 1 -8 }
829         T{ ##load-immediate f V int-regs 3 -4 }
830     }
831 ] [
832     {
833         T{ ##peek f V int-regs 0 D 0 }
834         T{ ##load-immediate f V int-regs 1 -8 }
835         T{ ##sar-imm f V int-regs 3 V int-regs 1 1 }
836     } value-numbering-step
837 ] unit-test
838
839 cell 8 = [
840     [
841         {
842             T{ ##peek f V int-regs 0 D 0 }
843             T{ ##load-immediate f V int-regs 1 65536 }
844             T{ ##load-immediate f V int-regs 2 140737488355328 }
845             T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
846         }
847     ] [
848         {
849             T{ ##peek f V int-regs 0 D 0 }
850             T{ ##load-immediate f V int-regs 1 65536 }
851             T{ ##shl-imm f V int-regs 2 V int-regs 1 31 }
852             T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
853         } value-numbering-step
854     ] unit-test
855
856     [
857         {
858             T{ ##peek f V int-regs 0 D 0 }
859             T{ ##load-immediate f V int-regs 2 140737488355328 }
860             T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
861         }
862     ] [
863         {
864             T{ ##peek f V int-regs 0 D 0 }
865             T{ ##load-immediate f V int-regs 2 140737488355328 }
866             T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
867         } value-numbering-step
868     ] unit-test
869
870     [
871         {
872             T{ ##peek f V int-regs 0 D 0 }
873             T{ ##load-immediate f V int-regs 2 2147483647 }
874             T{ ##add-imm f V int-regs 3 V int-regs 0 2147483647 }
875             T{ ##add-imm f V int-regs 4 V int-regs 3 2147483647 }
876         }
877     ] [
878         {
879             T{ ##peek f V int-regs 0 D 0 }
880             T{ ##load-immediate f V int-regs 2 2147483647 }
881             T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
882             T{ ##add f V int-regs 4 V int-regs 3 V int-regs 2 }
883         } value-numbering-step
884     ] unit-test
885 ] when
886
887 ! Branch folding
888 [
889     {
890         T{ ##load-immediate f V int-regs 1 1 }
891         T{ ##load-immediate f V int-regs 2 2 }
892         T{ ##load-immediate f V int-regs 3 5 }
893     }
894 ] [
895     {
896         T{ ##load-immediate f V int-regs 1 1 }
897         T{ ##load-immediate f V int-regs 2 2 }
898         T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc= }
899     } value-numbering-step
900 ] unit-test
901
902 [
903     {
904         T{ ##load-immediate f V int-regs 1 1 }
905         T{ ##load-immediate f V int-regs 2 2 }
906         T{ ##load-reference f V int-regs 3 t }
907     }
908 ] [
909     {
910         T{ ##load-immediate f V int-regs 1 1 }
911         T{ ##load-immediate f V int-regs 2 2 }
912         T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc/= }
913     } value-numbering-step
914 ] unit-test
915
916 [
917     {
918         T{ ##load-immediate f V int-regs 1 1 }
919         T{ ##load-immediate f V int-regs 2 2 }
920         T{ ##load-reference f V int-regs 3 t }
921     }
922 ] [
923     {
924         T{ ##load-immediate f V int-regs 1 1 }
925         T{ ##load-immediate f V int-regs 2 2 }
926         T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc< }
927     } value-numbering-step
928 ] unit-test
929
930 [
931     {
932         T{ ##load-immediate f V int-regs 1 1 }
933         T{ ##load-immediate f V int-regs 2 2 }
934         T{ ##load-immediate f V int-regs 3 5 }
935     }
936 ] [
937     {
938         T{ ##load-immediate f V int-regs 1 1 }
939         T{ ##load-immediate f V int-regs 2 2 }
940         T{ ##compare f V int-regs 3 V int-regs 2 V int-regs 1 cc< }
941     } value-numbering-step
942 ] unit-test
943
944 [
945     {
946         T{ ##peek f V int-regs 0 D 0 }
947         T{ ##load-immediate f V int-regs 1 5 }
948     }
949 ] [
950     {
951         T{ ##peek f V int-regs 0 D 0 }
952         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc< }
953     } value-numbering-step
954 ] unit-test
955
956 [
957     {
958         T{ ##peek f V int-regs 0 D 0 }
959         T{ ##load-reference f V int-regs 1 t }
960     }
961 ] [
962     {
963         T{ ##peek f V int-regs 0 D 0 }
964         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc<= }
965     } value-numbering-step
966 ] unit-test
967
968 [
969     {
970         T{ ##peek f V int-regs 0 D 0 }
971         T{ ##load-immediate f V int-regs 1 5 }
972     }
973 ] [
974     {
975         T{ ##peek f V int-regs 0 D 0 }
976         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc> }
977     } value-numbering-step
978 ] unit-test
979
980 [
981     {
982         T{ ##peek f V int-regs 0 D 0 }
983         T{ ##load-reference f V int-regs 1 t }
984     }
985 ] [
986     {
987         T{ ##peek f V int-regs 0 D 0 }
988         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc>= }
989     } value-numbering-step
990 ] unit-test
991
992 [
993     {
994         T{ ##peek f V int-regs 0 D 0 }
995         T{ ##load-immediate f V int-regs 1 5 }
996     }
997 ] [
998     {
999         T{ ##peek f V int-regs 0 D 0 }
1000         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc/= }
1001     } value-numbering-step
1002 ] unit-test
1003
1004 [
1005     {
1006         T{ ##peek f V int-regs 0 D 0 }
1007         T{ ##load-reference f V int-regs 1 t }
1008     }
1009 ] [
1010     {
1011         T{ ##peek f V int-regs 0 D 0 }
1012         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc= }
1013     } value-numbering-step
1014 ] unit-test
1015
1016 : test-branch-folding ( insns -- insns' n )
1017     <basic-block>
1018     [ V{ 0 1 } clone >>successors basic-block set value-numbering-step ] keep
1019     successors>> first ;
1020
1021 [
1022     {
1023         T{ ##load-immediate f V int-regs 1 1 }
1024         T{ ##load-immediate f V int-regs 2 2 }
1025         T{ ##branch }
1026     }
1027     1
1028 ] [
1029     {
1030         T{ ##load-immediate f V int-regs 1 1 }
1031         T{ ##load-immediate f V int-regs 2 2 }
1032         T{ ##compare-branch f V int-regs 1 V int-regs 2 cc= }
1033     } test-branch-folding
1034 ] unit-test
1035
1036 [
1037     {
1038         T{ ##load-immediate f V int-regs 1 1 }
1039         T{ ##load-immediate f V int-regs 2 2 }
1040         T{ ##branch }
1041     }
1042     0
1043 ] [
1044     {
1045         T{ ##load-immediate f V int-regs 1 1 }
1046         T{ ##load-immediate f V int-regs 2 2 }
1047         T{ ##compare-branch f V int-regs 1 V int-regs 2 cc/= }
1048     } test-branch-folding
1049 ] unit-test
1050
1051 [
1052     {
1053         T{ ##load-immediate f V int-regs 1 1 }
1054         T{ ##load-immediate f V int-regs 2 2 }
1055         T{ ##branch }
1056     }
1057     0
1058 ] [
1059     {
1060         T{ ##load-immediate f V int-regs 1 1 }
1061         T{ ##load-immediate f V int-regs 2 2 }
1062         T{ ##compare-branch f V int-regs 1 V int-regs 2 cc< }
1063     } test-branch-folding
1064 ] unit-test
1065
1066 [
1067     {
1068         T{ ##load-immediate f V int-regs 1 1 }
1069         T{ ##load-immediate f V int-regs 2 2 }
1070         T{ ##branch }
1071     }
1072     1
1073 ] [
1074     {
1075         T{ ##load-immediate f V int-regs 1 1 }
1076         T{ ##load-immediate f V int-regs 2 2 }
1077         T{ ##compare-branch f V int-regs 2 V int-regs 1 cc< }
1078     } test-branch-folding
1079 ] unit-test
1080
1081 [
1082     {
1083         T{ ##peek f V int-regs 0 D 0 }
1084         T{ ##branch }
1085     }
1086     1
1087 ] [
1088     {
1089         T{ ##peek f V int-regs 0 D 0 }
1090         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< }
1091     } test-branch-folding
1092 ] unit-test
1093
1094 [
1095     {
1096         T{ ##peek f V int-regs 0 D 0 }
1097         T{ ##branch }
1098     }
1099     0
1100 ] [
1101     {
1102         T{ ##peek f V int-regs 0 D 0 }
1103         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc<= }
1104     } test-branch-folding
1105 ] unit-test
1106
1107 [
1108     {
1109         T{ ##peek f V int-regs 0 D 0 }
1110         T{ ##branch }
1111     }
1112     1
1113 ] [
1114     {
1115         T{ ##peek f V int-regs 0 D 0 }
1116         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc> }
1117     } test-branch-folding
1118 ] unit-test
1119
1120 [
1121     {
1122         T{ ##peek f V int-regs 0 D 0 }
1123         T{ ##branch }
1124     }
1125     0
1126 ] [
1127     {
1128         T{ ##peek f V int-regs 0 D 0 }
1129         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc>= }
1130     } test-branch-folding
1131 ] unit-test
1132
1133 [
1134     {
1135         T{ ##peek f V int-regs 0 D 0 }
1136         T{ ##branch }
1137     }
1138     0
1139 ] [
1140     {
1141         T{ ##peek f V int-regs 0 D 0 }
1142         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc= }
1143     } test-branch-folding
1144 ] unit-test
1145
1146 [
1147     {
1148         T{ ##peek f V int-regs 0 D 0 }
1149         T{ ##branch }
1150     }
1151     1
1152 ] [
1153     {
1154         T{ ##peek f V int-regs 0 D 0 }
1155         T{ ##compare-branch f V int-regs 0 V int-regs 0 cc/= }
1156     } test-branch-folding
1157 ] unit-test
1158
1159 [
1160     {
1161         T{ ##peek f V int-regs 0 D 0 }
1162         T{ ##load-reference f V int-regs 1 t }
1163         T{ ##branch }
1164     }
1165     0
1166 ] [
1167     {
1168         T{ ##peek f V int-regs 0 D 0 }
1169         T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc<= }
1170         T{ ##compare-imm-branch f V int-regs 1 5 cc/= }
1171     } test-branch-folding
1172 ] unit-test
1173
1174 ! More branch folding tests
1175 V{ T{ ##branch } } 0 test-bb
1176
1177 V{
1178     T{ ##peek f V int-regs 0 D 0 }
1179     T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< }
1180 } 1 test-bb
1181
1182 V{
1183     T{ ##load-immediate f V int-regs 1 1 }
1184     T{ ##branch }
1185 } 2 test-bb
1186
1187 V{
1188     T{ ##load-immediate f V int-regs 2 2 }
1189     T{ ##branch }
1190 } 3 test-bb
1191
1192 V{
1193     T{ ##phi f V int-regs 3 { } }
1194     T{ ##replace f V int-regs 3 D 0 }
1195     T{ ##return }
1196 } 4 test-bb
1197
1198 4 get instructions>> first
1199 2 get V int-regs 1 2array
1200 3 get V int-regs 2 2array 2array
1201 >>inputs drop
1202
1203 test-diamond
1204
1205 [ ] [
1206     cfg new 0 get >>entry
1207     value-numbering
1208     compute-predecessors
1209     eliminate-phis drop
1210 ] unit-test
1211
1212 [ 1 ] [ 1 get successors>> length ] unit-test
1213
1214 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1215
1216 [ 3 ] [ 4 get instructions>> length ] unit-test
1217
1218 V{
1219     T{ ##peek f V int-regs 0 D 0 }
1220     T{ ##branch }
1221 } 0 test-bb
1222
1223 V{
1224     T{ ##peek f V int-regs 1 D 1 }
1225     T{ ##compare-branch f V int-regs 1 V int-regs 1 cc< }
1226 } 1 test-bb
1227
1228 V{
1229     T{ ##copy f V int-regs 2 V int-regs 0 }
1230     T{ ##branch }
1231 } 2 test-bb
1232
1233 V{
1234     T{ ##phi f V int-regs 3 V{ } }
1235     T{ ##branch }
1236 } 3 test-bb
1237
1238 V{
1239     T{ ##replace f V int-regs 3 D 0 }
1240     T{ ##return }
1241 } 4 test-bb
1242
1243 1 get V int-regs 1 2array
1244 2 get V int-regs 0 2array 2array 3 get instructions>> first (>>inputs)
1245
1246 test-diamond
1247
1248 [ ] [
1249     cfg new 0 get >>entry
1250     compute-predecessors
1251     value-numbering
1252     compute-predecessors
1253     eliminate-dead-code
1254     drop
1255 ] unit-test
1256
1257 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1258
1259 [ 1 ] [ 3 get instructions>> first inputs>> assoc-size ] unit-test
1260
1261 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
1262
1263 V{
1264     T{ ##peek { dst V int-regs 15 } { loc D 0 } }
1265     T{ ##copy { dst V int-regs 16 } { src V int-regs 15 } }
1266     T{ ##copy { dst V int-regs 17 } { src V int-regs 15 } }
1267     T{ ##copy { dst V int-regs 18 } { src V int-regs 15 } }
1268     T{ ##copy { dst V int-regs 19 } { src V int-regs 15 } }
1269     T{ ##compare
1270         { dst V int-regs 20 }
1271         { src1 V int-regs 18 }
1272         { src2 V int-regs 19 }
1273         { cc cc= }
1274         { temp V int-regs 22 }
1275     }
1276     T{ ##copy { dst V int-regs 21 } { src V int-regs 20 } }
1277     T{ ##compare-imm-branch
1278         { src1 V int-regs 21 }
1279         { src2 5 }
1280         { cc cc/= }
1281     }
1282 } 1 test-bb
1283
1284 V{
1285     T{ ##copy { dst V int-regs 23 } { src V int-regs 15 } }
1286     T{ ##copy { dst V int-regs 24 } { src V int-regs 15 } }
1287     T{ ##load-reference { dst V int-regs 25 } { obj t } }
1288     T{ ##branch }
1289 } 2 test-bb
1290
1291 V{
1292     T{ ##replace { src V int-regs 25 } { loc D 0 } }
1293     T{ ##epilogue }
1294     T{ ##return }
1295 } 3 test-bb
1296
1297 V{
1298     T{ ##copy { dst V int-regs 26 } { src V int-regs 15 } }
1299     T{ ##copy { dst V int-regs 27 } { src V int-regs 15 } }
1300     T{ ##add
1301         { dst V int-regs 28 }
1302         { src1 V int-regs 26 }
1303         { src2 V int-regs 27 }
1304     }
1305     T{ ##branch }
1306 } 4 test-bb
1307
1308 V{
1309     T{ ##replace { src V int-regs 28 } { loc D 0 } }
1310     T{ ##epilogue }
1311     T{ ##return }
1312 } 5 test-bb
1313
1314 0 get 1 get 1vector >>successors drop
1315 1 get 2 get 4 get V{ } 2sequence >>successors drop
1316 2 get 3 get 1vector >>successors drop
1317 4 get 5 get 1vector >>successors drop
1318
1319 [ ] [
1320     cfg new 0 get >>entry
1321     value-numbering eliminate-dead-code drop
1322 ] unit-test
1323
1324 [ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test