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 ;
9 : trim-temps ( insns -- insns )
15 } 1|| [ f >>temp ] when
18 ! Folding constants together
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 }
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
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 }
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
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 }
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
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/= }
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
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 }
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
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 }
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
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 }
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
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<= }
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
157 ! Immediate operand conversion
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 }
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
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 }
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
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 }
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
202 T{ ##peek f V int-regs 0 D 0 }
203 T{ ##load-immediate f V int-regs 1 0 }
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
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 }
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
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 }
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
242 T{ ##peek f V int-regs 1 D 0 }
243 T{ ##shl-imm f V int-regs 2 V int-regs 1 3 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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<= }
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
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>= }
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
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<= }
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
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>= }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
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 }
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
946 T{ ##peek f V int-regs 0 D 0 }
947 T{ ##load-immediate f V int-regs 1 5 }
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
958 T{ ##peek f V int-regs 0 D 0 }
959 T{ ##load-reference f V int-regs 1 t }
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
970 T{ ##peek f V int-regs 0 D 0 }
971 T{ ##load-immediate f V int-regs 1 5 }
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
982 T{ ##peek f V int-regs 0 D 0 }
983 T{ ##load-reference f V int-regs 1 t }
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
994 T{ ##peek f V int-regs 0 D 0 }
995 T{ ##load-immediate f V int-regs 1 5 }
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
1006 T{ ##peek f V int-regs 0 D 0 }
1007 T{ ##load-reference f V int-regs 1 t }
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
1016 : test-branch-folding ( insns -- insns' n )
1018 [ V{ 0 1 } clone >>successors basic-block set value-numbering-step ] keep
1019 successors>> first ;
1023 T{ ##load-immediate f V int-regs 1 1 }
1024 T{ ##load-immediate f V int-regs 2 2 }
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
1038 T{ ##load-immediate f V int-regs 1 1 }
1039 T{ ##load-immediate f V int-regs 2 2 }
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
1053 T{ ##load-immediate f V int-regs 1 1 }
1054 T{ ##load-immediate f V int-regs 2 2 }
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
1068 T{ ##load-immediate f V int-regs 1 1 }
1069 T{ ##load-immediate f V int-regs 2 2 }
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
1083 T{ ##peek f V int-regs 0 D 0 }
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
1096 T{ ##peek f V int-regs 0 D 0 }
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
1109 T{ ##peek f V int-regs 0 D 0 }
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
1122 T{ ##peek f V int-regs 0 D 0 }
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
1135 T{ ##peek f V int-regs 0 D 0 }
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
1148 T{ ##peek f V int-regs 0 D 0 }
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
1161 T{ ##peek f V int-regs 0 D 0 }
1162 T{ ##load-reference f V int-regs 1 t }
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
1174 ! More branch folding tests
1175 V{ T{ ##branch } } 0 test-bb
1178 T{ ##peek f V int-regs 0 D 0 }
1179 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< }
1183 T{ ##load-immediate f V int-regs 1 1 }
1188 T{ ##load-immediate f V int-regs 2 2 }
1193 T{ ##phi f V int-regs 3 { } }
1194 T{ ##replace f V int-regs 3 D 0 }
1198 4 get instructions>> first
1199 2 get V int-regs 1 2array
1200 3 get V int-regs 2 2array 2array
1206 cfg new 0 get >>entry
1208 compute-predecessors
1212 [ 1 ] [ 1 get successors>> length ] unit-test
1214 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1216 [ 3 ] [ 4 get instructions>> length ] unit-test
1219 T{ ##peek f V int-regs 0 D 0 }
1224 T{ ##peek f V int-regs 1 D 1 }
1225 T{ ##compare-branch f V int-regs 1 V int-regs 1 cc< }
1229 T{ ##copy f V int-regs 2 V int-regs 0 }
1234 T{ ##phi f V int-regs 3 V{ } }
1239 T{ ##replace f V int-regs 3 D 0 }
1243 1 get V int-regs 1 2array
1244 2 get V int-regs 0 2array 2array 3 get instructions>> first (>>inputs)
1249 cfg new 0 get >>entry
1250 compute-predecessors
1252 compute-predecessors
1257 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1259 [ 1 ] [ 3 get instructions>> first inputs>> assoc-size ] unit-test
1261 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
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 } }
1270 { dst V int-regs 20 }
1271 { src1 V int-regs 18 }
1272 { src2 V int-regs 19 }
1274 { temp V int-regs 22 }
1276 T{ ##copy { dst V int-regs 21 } { src V int-regs 20 } }
1277 T{ ##compare-imm-branch
1278 { src1 V int-regs 21 }
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 } }
1292 T{ ##replace { src V int-regs 25 } { loc D 0 } }
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 } }
1301 { dst V int-regs 28 }
1302 { src1 V int-regs 26 }
1303 { src2 V int-regs 27 }
1309 T{ ##replace { src V int-regs 28 } { loc D 0 } }
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
1320 cfg new 0 get >>entry
1321 value-numbering eliminate-dead-code drop
1324 [ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test