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.dce compiler.cfg.ssa.destruction
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{ ##copy f V int-regs 1 V int-regs 0 }
39 T{ ##replace f V int-regs 0 D 0 }
40 T{ ##replace f V int-regs 1 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{ ##copy f V int-regs 1 V int-regs 0 }
55 T{ ##replace f V int-regs 0 D 0 }
56 T{ ##replace f V int-regs 1 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{ ##load-reference f V int-regs 1 + }
71 T{ ##peek f V int-regs 2 D 0 }
72 T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
73 T{ ##copy f V int-regs 6 V int-regs 4 }
74 T{ ##replace f V int-regs 6 D 0 }
78 T{ ##load-reference f V int-regs 1 + }
79 T{ ##peek f V int-regs 2 D 0 }
80 T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
81 T{ ##compare-imm f V int-regs 6 V int-regs 4 5 cc/= }
82 T{ ##replace f V int-regs 6 D 0 }
83 } value-numbering-step trim-temps
88 T{ ##load-reference f V int-regs 1 + }
89 T{ ##peek f V int-regs 2 D 0 }
90 T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
91 T{ ##compare f V int-regs 6 V int-regs 2 V int-regs 1 cc> }
92 T{ ##replace f V int-regs 6 D 0 }
96 T{ ##load-reference f V int-regs 1 + }
97 T{ ##peek f V int-regs 2 D 0 }
98 T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
99 T{ ##compare-imm f V int-regs 6 V int-regs 4 5 cc= }
100 T{ ##replace f V int-regs 6 D 0 }
101 } value-numbering-step trim-temps
106 T{ ##peek f V int-regs 8 D 0 }
107 T{ ##peek f V int-regs 9 D -1 }
108 T{ ##unbox-float f V double-float-regs 10 V int-regs 8 }
109 T{ ##unbox-float f V double-float-regs 11 V int-regs 9 }
110 T{ ##compare-float f V int-regs 12 V double-float-regs 10 V double-float-regs 11 cc< }
111 T{ ##compare-float f V int-regs 14 V double-float-regs 10 V double-float-regs 11 cc>= }
112 T{ ##replace f V int-regs 14 D 0 }
116 T{ ##peek f V int-regs 8 D 0 }
117 T{ ##peek f V int-regs 9 D -1 }
118 T{ ##unbox-float f V double-float-regs 10 V int-regs 8 }
119 T{ ##unbox-float f V double-float-regs 11 V int-regs 9 }
120 T{ ##compare-float f V int-regs 12 V double-float-regs 10 V double-float-regs 11 cc< }
121 T{ ##compare-imm f V int-regs 14 V int-regs 12 5 cc= }
122 T{ ##replace f V int-regs 14 D 0 }
123 } value-numbering-step trim-temps
128 T{ ##peek f V int-regs 29 D -1 }
129 T{ ##peek f V int-regs 30 D -2 }
130 T{ ##compare f V int-regs 33 V int-regs 29 V int-regs 30 cc<= }
131 T{ ##compare-branch f V int-regs 29 V int-regs 30 cc<= }
135 T{ ##peek f V int-regs 29 D -1 }
136 T{ ##peek f V int-regs 30 D -2 }
137 T{ ##compare f V int-regs 33 V int-regs 29 V int-regs 30 cc<= }
138 T{ ##compare-imm-branch f V int-regs 33 5 cc/= }
139 } value-numbering-step trim-temps
142 ! Immediate operand conversion
145 T{ ##peek f V int-regs 0 D 0 }
146 T{ ##load-immediate f V int-regs 1 100 }
147 T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
151 T{ ##peek f V int-regs 0 D 0 }
152 T{ ##load-immediate f V int-regs 1 100 }
153 T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
154 } value-numbering-step
159 T{ ##peek f V int-regs 0 D 0 }
160 T{ ##load-immediate f V int-regs 1 100 }
161 T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
165 T{ ##peek f V int-regs 0 D 0 }
166 T{ ##load-immediate f V int-regs 1 100 }
167 T{ ##add f V int-regs 2 V int-regs 1 V int-regs 0 }
168 } value-numbering-step
173 T{ ##peek f V int-regs 0 D 0 }
174 T{ ##load-immediate f V int-regs 1 100 }
175 T{ ##add-imm f V int-regs 2 V int-regs 0 -100 }
179 T{ ##peek f V int-regs 0 D 0 }
180 T{ ##load-immediate f V int-regs 1 100 }
181 T{ ##sub f V int-regs 2 V int-regs 0 V int-regs 1 }
182 } value-numbering-step
187 T{ ##peek f V int-regs 0 D 0 }
188 T{ ##load-immediate f V int-regs 1 0 }
192 T{ ##peek f V int-regs 0 D 0 }
193 T{ ##sub f V int-regs 1 V int-regs 0 V int-regs 0 }
194 } value-numbering-step
199 T{ ##peek f V int-regs 0 D 0 }
200 T{ ##load-immediate f V int-regs 1 100 }
201 T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
205 T{ ##peek f V int-regs 0 D 0 }
206 T{ ##load-immediate f V int-regs 1 100 }
207 T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
208 } value-numbering-step
213 T{ ##peek f V int-regs 0 D 0 }
214 T{ ##load-immediate f V int-regs 1 100 }
215 T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
219 T{ ##peek f V int-regs 0 D 0 }
220 T{ ##load-immediate f V int-regs 1 100 }
221 T{ ##mul f V int-regs 2 V int-regs 1 V int-regs 0 }
222 } value-numbering-step
227 T{ ##peek f V int-regs 1 D 0 }
228 T{ ##shl-imm f V int-regs 2 V int-regs 1 3 }
232 T{ ##peek f V int-regs 1 D 0 }
233 T{ ##mul-imm f V int-regs 2 V int-regs 1 8 }
234 } value-numbering-step
239 T{ ##peek f V int-regs 0 D 0 }
240 T{ ##load-immediate f V int-regs 1 100 }
241 T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
245 T{ ##peek f V int-regs 0 D 0 }
246 T{ ##load-immediate f V int-regs 1 100 }
247 T{ ##and f V int-regs 2 V int-regs 0 V int-regs 1 }
248 } value-numbering-step
253 T{ ##peek f V int-regs 0 D 0 }
254 T{ ##load-immediate f V int-regs 1 100 }
255 T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
259 T{ ##peek f V int-regs 0 D 0 }
260 T{ ##load-immediate f V int-regs 1 100 }
261 T{ ##and f V int-regs 2 V int-regs 1 V int-regs 0 }
262 } value-numbering-step
267 T{ ##peek f V int-regs 0 D 0 }
268 T{ ##load-immediate f V int-regs 1 100 }
269 T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
273 T{ ##peek f V int-regs 0 D 0 }
274 T{ ##load-immediate f V int-regs 1 100 }
275 T{ ##or f V int-regs 2 V int-regs 0 V int-regs 1 }
276 } value-numbering-step
281 T{ ##peek f V int-regs 0 D 0 }
282 T{ ##load-immediate f V int-regs 1 100 }
283 T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
287 T{ ##peek f V int-regs 0 D 0 }
288 T{ ##load-immediate f V int-regs 1 100 }
289 T{ ##or f V int-regs 2 V int-regs 1 V int-regs 0 }
290 } value-numbering-step
295 T{ ##peek f V int-regs 0 D 0 }
296 T{ ##load-immediate f V int-regs 1 100 }
297 T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
301 T{ ##peek f V int-regs 0 D 0 }
302 T{ ##load-immediate f V int-regs 1 100 }
303 T{ ##xor f V int-regs 2 V int-regs 0 V int-regs 1 }
304 } value-numbering-step
309 T{ ##peek f V int-regs 0 D 0 }
310 T{ ##load-immediate f V int-regs 1 100 }
311 T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
315 T{ ##peek f V int-regs 0 D 0 }
316 T{ ##load-immediate f V int-regs 1 100 }
317 T{ ##xor f V int-regs 2 V int-regs 1 V int-regs 0 }
318 } value-numbering-step
323 T{ ##peek f V int-regs 0 D 0 }
324 T{ ##load-immediate f V int-regs 1 100 }
325 T{ ##compare-imm f V int-regs 2 V int-regs 0 100 cc<= }
329 T{ ##peek f V int-regs 0 D 0 }
330 T{ ##load-immediate f V int-regs 1 100 }
331 T{ ##compare f V int-regs 2 V int-regs 0 V int-regs 1 cc<= }
332 } value-numbering-step trim-temps
337 T{ ##peek f V int-regs 0 D 0 }
338 T{ ##load-immediate f V int-regs 1 100 }
339 T{ ##compare-imm f V int-regs 2 V int-regs 0 100 cc>= }
343 T{ ##peek f V int-regs 0 D 0 }
344 T{ ##load-immediate f V int-regs 1 100 }
345 T{ ##compare f V int-regs 2 V int-regs 1 V int-regs 0 cc<= }
346 } value-numbering-step trim-temps
351 T{ ##peek f V int-regs 0 D 0 }
352 T{ ##load-immediate f V int-regs 1 100 }
353 T{ ##compare-imm-branch f V int-regs 0 100 cc<= }
357 T{ ##peek f V int-regs 0 D 0 }
358 T{ ##load-immediate f V int-regs 1 100 }
359 T{ ##compare-branch f V int-regs 0 V int-regs 1 cc<= }
360 } value-numbering-step
365 T{ ##peek f V int-regs 0 D 0 }
366 T{ ##load-immediate f V int-regs 1 100 }
367 T{ ##compare-imm-branch f V int-regs 0 100 cc>= }
371 T{ ##peek f V int-regs 0 D 0 }
372 T{ ##load-immediate f V int-regs 1 100 }
373 T{ ##compare-branch f V int-regs 1 V int-regs 0 cc<= }
374 } value-numbering-step trim-temps
380 T{ ##peek f V int-regs 0 D 0 }
381 T{ ##load-immediate f V int-regs 1 100 }
382 T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
383 T{ ##load-immediate f V int-regs 3 50 }
384 T{ ##add-imm f V int-regs 4 V int-regs 0 150 }
388 T{ ##peek f V int-regs 0 D 0 }
389 T{ ##load-immediate f V int-regs 1 100 }
390 T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
391 T{ ##load-immediate f V int-regs 3 50 }
392 T{ ##add f V int-regs 4 V int-regs 2 V int-regs 3 }
393 } value-numbering-step
398 T{ ##peek f V int-regs 0 D 0 }
399 T{ ##load-immediate f V int-regs 1 100 }
400 T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
401 T{ ##load-immediate f V int-regs 3 50 }
402 T{ ##add-imm f V int-regs 4 V int-regs 0 150 }
406 T{ ##peek f V int-regs 0 D 0 }
407 T{ ##load-immediate f V int-regs 1 100 }
408 T{ ##add f V int-regs 2 V int-regs 1 V int-regs 0 }
409 T{ ##load-immediate f V int-regs 3 50 }
410 T{ ##add f V int-regs 4 V int-regs 3 V int-regs 2 }
411 } value-numbering-step
416 T{ ##peek f V int-regs 0 D 0 }
417 T{ ##load-immediate f V int-regs 1 100 }
418 T{ ##add-imm f V int-regs 2 V int-regs 0 100 }
419 T{ ##load-immediate f V int-regs 3 50 }
420 T{ ##add-imm f V int-regs 4 V int-regs 0 50 }
424 T{ ##peek f V int-regs 0 D 0 }
425 T{ ##load-immediate f V int-regs 1 100 }
426 T{ ##add f V int-regs 2 V int-regs 0 V int-regs 1 }
427 T{ ##load-immediate f V int-regs 3 50 }
428 T{ ##sub f V int-regs 4 V int-regs 2 V int-regs 3 }
429 } value-numbering-step
434 T{ ##peek f V int-regs 0 D 0 }
435 T{ ##load-immediate f V int-regs 1 100 }
436 T{ ##add-imm f V int-regs 2 V int-regs 0 -100 }
437 T{ ##load-immediate f V int-regs 3 50 }
438 T{ ##add-imm f V int-regs 4 V int-regs 0 -150 }
442 T{ ##peek f V int-regs 0 D 0 }
443 T{ ##load-immediate f V int-regs 1 100 }
444 T{ ##sub f V int-regs 2 V int-regs 0 V int-regs 1 }
445 T{ ##load-immediate f V int-regs 3 50 }
446 T{ ##sub f V int-regs 4 V int-regs 2 V int-regs 3 }
447 } value-numbering-step
452 T{ ##peek f V int-regs 0 D 0 }
453 T{ ##load-immediate f V int-regs 1 100 }
454 T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
455 T{ ##load-immediate f V int-regs 3 50 }
456 T{ ##mul-imm f V int-regs 4 V int-regs 0 5000 }
460 T{ ##peek f V int-regs 0 D 0 }
461 T{ ##load-immediate f V int-regs 1 100 }
462 T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
463 T{ ##load-immediate f V int-regs 3 50 }
464 T{ ##mul f V int-regs 4 V int-regs 2 V int-regs 3 }
465 } value-numbering-step
470 T{ ##peek f V int-regs 0 D 0 }
471 T{ ##load-immediate f V int-regs 1 100 }
472 T{ ##mul-imm f V int-regs 2 V int-regs 0 100 }
473 T{ ##load-immediate f V int-regs 3 50 }
474 T{ ##mul-imm f V int-regs 4 V int-regs 0 5000 }
478 T{ ##peek f V int-regs 0 D 0 }
479 T{ ##load-immediate f V int-regs 1 100 }
480 T{ ##mul f V int-regs 2 V int-regs 1 V int-regs 0 }
481 T{ ##load-immediate f V int-regs 3 50 }
482 T{ ##mul f V int-regs 4 V int-regs 3 V int-regs 2 }
483 } value-numbering-step
488 T{ ##peek f V int-regs 0 D 0 }
489 T{ ##load-immediate f V int-regs 1 100 }
490 T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
491 T{ ##load-immediate f V int-regs 3 50 }
492 T{ ##and-imm f V int-regs 4 V int-regs 0 32 }
496 T{ ##peek f V int-regs 0 D 0 }
497 T{ ##load-immediate f V int-regs 1 100 }
498 T{ ##and f V int-regs 2 V int-regs 0 V int-regs 1 }
499 T{ ##load-immediate f V int-regs 3 50 }
500 T{ ##and f V int-regs 4 V int-regs 2 V int-regs 3 }
501 } value-numbering-step
506 T{ ##peek f V int-regs 0 D 0 }
507 T{ ##load-immediate f V int-regs 1 100 }
508 T{ ##and-imm f V int-regs 2 V int-regs 0 100 }
509 T{ ##load-immediate f V int-regs 3 50 }
510 T{ ##and-imm f V int-regs 4 V int-regs 0 32 }
514 T{ ##peek f V int-regs 0 D 0 }
515 T{ ##load-immediate f V int-regs 1 100 }
516 T{ ##and f V int-regs 2 V int-regs 1 V int-regs 0 }
517 T{ ##load-immediate f V int-regs 3 50 }
518 T{ ##and f V int-regs 4 V int-regs 3 V int-regs 2 }
519 } value-numbering-step
524 T{ ##peek f V int-regs 0 D 0 }
525 T{ ##load-immediate f V int-regs 1 100 }
526 T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
527 T{ ##load-immediate f V int-regs 3 50 }
528 T{ ##or-imm f V int-regs 4 V int-regs 0 118 }
532 T{ ##peek f V int-regs 0 D 0 }
533 T{ ##load-immediate f V int-regs 1 100 }
534 T{ ##or f V int-regs 2 V int-regs 0 V int-regs 1 }
535 T{ ##load-immediate f V int-regs 3 50 }
536 T{ ##or f V int-regs 4 V int-regs 2 V int-regs 3 }
537 } value-numbering-step
542 T{ ##peek f V int-regs 0 D 0 }
543 T{ ##load-immediate f V int-regs 1 100 }
544 T{ ##or-imm f V int-regs 2 V int-regs 0 100 }
545 T{ ##load-immediate f V int-regs 3 50 }
546 T{ ##or-imm f V int-regs 4 V int-regs 0 118 }
550 T{ ##peek f V int-regs 0 D 0 }
551 T{ ##load-immediate f V int-regs 1 100 }
552 T{ ##or f V int-regs 2 V int-regs 1 V int-regs 0 }
553 T{ ##load-immediate f V int-regs 3 50 }
554 T{ ##or f V int-regs 4 V int-regs 3 V int-regs 2 }
555 } value-numbering-step
560 T{ ##peek f V int-regs 0 D 0 }
561 T{ ##load-immediate f V int-regs 1 100 }
562 T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
563 T{ ##load-immediate f V int-regs 3 50 }
564 T{ ##xor-imm f V int-regs 4 V int-regs 0 86 }
568 T{ ##peek f V int-regs 0 D 0 }
569 T{ ##load-immediate f V int-regs 1 100 }
570 T{ ##xor f V int-regs 2 V int-regs 0 V int-regs 1 }
571 T{ ##load-immediate f V int-regs 3 50 }
572 T{ ##xor f V int-regs 4 V int-regs 2 V int-regs 3 }
573 } value-numbering-step
578 T{ ##peek f V int-regs 0 D 0 }
579 T{ ##load-immediate f V int-regs 1 100 }
580 T{ ##xor-imm f V int-regs 2 V int-regs 0 100 }
581 T{ ##load-immediate f V int-regs 3 50 }
582 T{ ##xor-imm f V int-regs 4 V int-regs 0 86 }
586 T{ ##peek f V int-regs 0 D 0 }
587 T{ ##load-immediate f V int-regs 1 100 }
588 T{ ##xor f V int-regs 2 V int-regs 1 V int-regs 0 }
589 T{ ##load-immediate f V int-regs 3 50 }
590 T{ ##xor f V int-regs 4 V int-regs 3 V int-regs 2 }
591 } value-numbering-step
597 T{ ##peek f V int-regs 0 D 0 }
598 T{ ##peek f V int-regs 1 D 1 }
599 T{ ##load-immediate f V int-regs 2 0 }
600 T{ ##copy f V int-regs 3 V int-regs 0 }
601 T{ ##replace f V int-regs 3 D 0 }
605 T{ ##peek f V int-regs 0 D 0 }
606 T{ ##peek f V int-regs 1 D 1 }
607 T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
608 T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
609 T{ ##replace f V int-regs 3 D 0 }
610 } value-numbering-step
615 T{ ##peek f V int-regs 0 D 0 }
616 T{ ##peek f V int-regs 1 D 1 }
617 T{ ##load-immediate f V int-regs 2 0 }
618 T{ ##copy f V int-regs 3 V int-regs 0 }
619 T{ ##replace f V int-regs 3 D 0 }
623 T{ ##peek f V int-regs 0 D 0 }
624 T{ ##peek f V int-regs 1 D 1 }
625 T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
626 T{ ##sub f V int-regs 3 V int-regs 0 V int-regs 2 }
627 T{ ##replace f V int-regs 3 D 0 }
628 } value-numbering-step
633 T{ ##peek f V int-regs 0 D 0 }
634 T{ ##peek f V int-regs 1 D 1 }
635 T{ ##load-immediate f V int-regs 2 0 }
636 T{ ##copy f V int-regs 3 V int-regs 0 }
637 T{ ##replace f V int-regs 3 D 0 }
641 T{ ##peek f V int-regs 0 D 0 }
642 T{ ##peek f V int-regs 1 D 1 }
643 T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
644 T{ ##or f V int-regs 3 V int-regs 0 V int-regs 2 }
645 T{ ##replace f V int-regs 3 D 0 }
646 } value-numbering-step
651 T{ ##peek f V int-regs 0 D 0 }
652 T{ ##peek f V int-regs 1 D 1 }
653 T{ ##load-immediate f V int-regs 2 0 }
654 T{ ##copy f V int-regs 3 V int-regs 0 }
655 T{ ##replace f V int-regs 3 D 0 }
659 T{ ##peek f V int-regs 0 D 0 }
660 T{ ##peek f V int-regs 1 D 1 }
661 T{ ##sub f V int-regs 2 V int-regs 1 V int-regs 1 }
662 T{ ##xor f V int-regs 3 V int-regs 0 V int-regs 2 }
663 T{ ##replace f V int-regs 3 D 0 }
664 } value-numbering-step
669 T{ ##peek f V int-regs 0 D 0 }
670 T{ ##load-immediate f V int-regs 1 1 }
671 T{ ##copy f V int-regs 2 V int-regs 0 }
672 T{ ##replace f V int-regs 2 D 0 }
676 T{ ##peek f V int-regs 0 D 0 }
677 T{ ##load-immediate f V int-regs 1 1 }
678 T{ ##mul f V int-regs 2 V int-regs 0 V int-regs 1 }
679 T{ ##replace f V int-regs 2 D 0 }
680 } value-numbering-step
686 T{ ##peek f V int-regs 0 D 0 }
687 T{ ##load-immediate f V int-regs 1 1 }
688 T{ ##load-immediate f V int-regs 2 3 }
689 T{ ##load-immediate f V int-regs 3 4 }
693 T{ ##peek f V int-regs 0 D 0 }
694 T{ ##load-immediate f V int-regs 1 1 }
695 T{ ##load-immediate f V int-regs 2 3 }
696 T{ ##add f V int-regs 3 V int-regs 1 V int-regs 2 }
697 } value-numbering-step
702 T{ ##peek f V int-regs 0 D 0 }
703 T{ ##load-immediate f V int-regs 1 1 }
704 T{ ##load-immediate f V int-regs 2 3 }
705 T{ ##load-immediate f V int-regs 3 -2 }
709 T{ ##peek f V int-regs 0 D 0 }
710 T{ ##load-immediate f V int-regs 1 1 }
711 T{ ##load-immediate f V int-regs 2 3 }
712 T{ ##sub f V int-regs 3 V int-regs 1 V int-regs 2 }
713 } value-numbering-step
718 T{ ##peek f V int-regs 0 D 0 }
719 T{ ##load-immediate f V int-regs 1 2 }
720 T{ ##load-immediate f V int-regs 2 3 }
721 T{ ##load-immediate f V int-regs 3 6 }
725 T{ ##peek f V int-regs 0 D 0 }
726 T{ ##load-immediate f V int-regs 1 2 }
727 T{ ##load-immediate f V int-regs 2 3 }
728 T{ ##mul f V int-regs 3 V int-regs 1 V int-regs 2 }
729 } value-numbering-step
734 T{ ##peek f V int-regs 0 D 0 }
735 T{ ##load-immediate f V int-regs 1 2 }
736 T{ ##load-immediate f V int-regs 2 1 }
737 T{ ##load-immediate f V int-regs 3 0 }
741 T{ ##peek f V int-regs 0 D 0 }
742 T{ ##load-immediate f V int-regs 1 2 }
743 T{ ##load-immediate f V int-regs 2 1 }
744 T{ ##and f V int-regs 3 V int-regs 1 V int-regs 2 }
745 } value-numbering-step
750 T{ ##peek f V int-regs 0 D 0 }
751 T{ ##load-immediate f V int-regs 1 2 }
752 T{ ##load-immediate f V int-regs 2 1 }
753 T{ ##load-immediate f V int-regs 3 3 }
757 T{ ##peek f V int-regs 0 D 0 }
758 T{ ##load-immediate f V int-regs 1 2 }
759 T{ ##load-immediate f V int-regs 2 1 }
760 T{ ##or f V int-regs 3 V int-regs 1 V int-regs 2 }
761 } value-numbering-step
766 T{ ##peek f V int-regs 0 D 0 }
767 T{ ##load-immediate f V int-regs 1 2 }
768 T{ ##load-immediate f V int-regs 2 3 }
769 T{ ##load-immediate f V int-regs 3 1 }
773 T{ ##peek f V int-regs 0 D 0 }
774 T{ ##load-immediate f V int-regs 1 2 }
775 T{ ##load-immediate f V int-regs 2 3 }
776 T{ ##xor f V int-regs 3 V int-regs 1 V int-regs 2 }
777 } value-numbering-step
782 T{ ##peek f V int-regs 0 D 0 }
783 T{ ##load-immediate f V int-regs 1 1 }
784 T{ ##load-immediate f V int-regs 3 8 }
788 T{ ##peek f V int-regs 0 D 0 }
789 T{ ##load-immediate f V int-regs 1 1 }
790 T{ ##shl-imm f V int-regs 3 V int-regs 1 3 }
791 } 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 HEX: ffffffffffff }
803 T{ ##peek f V int-regs 0 D 0 }
804 T{ ##load-immediate f V int-regs 1 -1 }
805 T{ ##shr-imm f V int-regs 3 V int-regs 1 16 }
806 } value-numbering-step
812 T{ ##peek f V int-regs 0 D 0 }
813 T{ ##load-immediate f V int-regs 1 -8 }
814 T{ ##load-immediate f V int-regs 3 -4 }
818 T{ ##peek f V int-regs 0 D 0 }
819 T{ ##load-immediate f V int-regs 1 -8 }
820 T{ ##sar-imm f V int-regs 3 V int-regs 1 1 }
821 } value-numbering-step
827 T{ ##peek f V int-regs 0 D 0 }
828 T{ ##load-immediate f V int-regs 1 65536 }
829 T{ ##load-immediate f V int-regs 2 140737488355328 }
830 T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
834 T{ ##peek f V int-regs 0 D 0 }
835 T{ ##load-immediate f V int-regs 1 65536 }
836 T{ ##shl-imm f V int-regs 2 V int-regs 1 31 }
837 T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
838 } value-numbering-step
843 T{ ##peek f V int-regs 0 D 0 }
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 2 140737488355328 }
851 T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
852 } value-numbering-step
857 T{ ##peek f V int-regs 0 D 0 }
858 T{ ##load-immediate f V int-regs 2 2147483647 }
859 T{ ##add-imm f V int-regs 3 V int-regs 0 2147483647 }
860 T{ ##add-imm f V int-regs 4 V int-regs 3 2147483647 }
864 T{ ##peek f V int-regs 0 D 0 }
865 T{ ##load-immediate f V int-regs 2 2147483647 }
866 T{ ##add f V int-regs 3 V int-regs 0 V int-regs 2 }
867 T{ ##add f V int-regs 4 V int-regs 3 V int-regs 2 }
868 } value-numbering-step
875 T{ ##load-immediate f V int-regs 1 1 }
876 T{ ##load-immediate f V int-regs 2 2 }
877 T{ ##load-immediate f V int-regs 3 5 }
881 T{ ##load-immediate f V int-regs 1 1 }
882 T{ ##load-immediate f V int-regs 2 2 }
883 T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc= }
884 } value-numbering-step
889 T{ ##load-immediate f V int-regs 1 1 }
890 T{ ##load-immediate f V int-regs 2 2 }
891 T{ ##load-reference f V int-regs 3 t }
895 T{ ##load-immediate f V int-regs 1 1 }
896 T{ ##load-immediate f V int-regs 2 2 }
897 T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc/= }
898 } value-numbering-step
903 T{ ##load-immediate f V int-regs 1 1 }
904 T{ ##load-immediate f V int-regs 2 2 }
905 T{ ##load-reference f V int-regs 3 t }
909 T{ ##load-immediate f V int-regs 1 1 }
910 T{ ##load-immediate f V int-regs 2 2 }
911 T{ ##compare f V int-regs 3 V int-regs 1 V int-regs 2 cc< }
912 } value-numbering-step
917 T{ ##load-immediate f V int-regs 1 1 }
918 T{ ##load-immediate f V int-regs 2 2 }
919 T{ ##load-immediate f V int-regs 3 5 }
923 T{ ##load-immediate f V int-regs 1 1 }
924 T{ ##load-immediate f V int-regs 2 2 }
925 T{ ##compare f V int-regs 3 V int-regs 2 V int-regs 1 cc< }
926 } value-numbering-step
931 T{ ##peek f V int-regs 0 D 0 }
932 T{ ##load-immediate f V int-regs 1 5 }
936 T{ ##peek f V int-regs 0 D 0 }
937 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc< }
938 } value-numbering-step
943 T{ ##peek f V int-regs 0 D 0 }
944 T{ ##load-reference f V int-regs 1 t }
948 T{ ##peek f V int-regs 0 D 0 }
949 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc<= }
950 } value-numbering-step
955 T{ ##peek f V int-regs 0 D 0 }
956 T{ ##load-immediate f V int-regs 1 5 }
960 T{ ##peek f V int-regs 0 D 0 }
961 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc> }
962 } value-numbering-step
967 T{ ##peek f V int-regs 0 D 0 }
968 T{ ##load-reference f V int-regs 1 t }
972 T{ ##peek f V int-regs 0 D 0 }
973 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc>= }
974 } value-numbering-step
979 T{ ##peek f V int-regs 0 D 0 }
980 T{ ##load-immediate f V int-regs 1 5 }
984 T{ ##peek f V int-regs 0 D 0 }
985 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc/= }
986 } value-numbering-step
991 T{ ##peek f V int-regs 0 D 0 }
992 T{ ##load-reference f V int-regs 1 t }
996 T{ ##peek f V int-regs 0 D 0 }
997 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc= }
998 } value-numbering-step
1001 : test-branch-folding ( insns -- insns' n )
1003 [ V{ 0 1 } clone >>successors basic-block set value-numbering-step ] keep
1004 successors>> first ;
1008 T{ ##load-immediate f V int-regs 1 1 }
1009 T{ ##load-immediate f V int-regs 2 2 }
1015 T{ ##load-immediate f V int-regs 1 1 }
1016 T{ ##load-immediate f V int-regs 2 2 }
1017 T{ ##compare-branch f V int-regs 1 V int-regs 2 cc= }
1018 } test-branch-folding
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 2 V int-regs 1 cc< }
1063 } test-branch-folding
1068 T{ ##peek f V int-regs 0 D 0 }
1074 T{ ##peek f V int-regs 0 D 0 }
1075 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< }
1076 } test-branch-folding
1081 T{ ##peek f V int-regs 0 D 0 }
1087 T{ ##peek f V int-regs 0 D 0 }
1088 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc<= }
1089 } test-branch-folding
1094 T{ ##peek f V int-regs 0 D 0 }
1100 T{ ##peek f V int-regs 0 D 0 }
1101 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc> }
1102 } test-branch-folding
1107 T{ ##peek f V int-regs 0 D 0 }
1113 T{ ##peek f V int-regs 0 D 0 }
1114 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc>= }
1115 } test-branch-folding
1120 T{ ##peek f V int-regs 0 D 0 }
1126 T{ ##peek f V int-regs 0 D 0 }
1127 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc= }
1128 } test-branch-folding
1133 T{ ##peek f V int-regs 0 D 0 }
1139 T{ ##peek f V int-regs 0 D 0 }
1140 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc/= }
1141 } test-branch-folding
1146 T{ ##peek f V int-regs 0 D 0 }
1147 T{ ##load-reference f V int-regs 1 t }
1153 T{ ##peek f V int-regs 0 D 0 }
1154 T{ ##compare f V int-regs 1 V int-regs 0 V int-regs 0 cc<= }
1155 T{ ##compare-imm-branch f V int-regs 1 5 cc/= }
1156 } test-branch-folding
1159 ! More branch folding tests
1160 V{ T{ ##branch } } 0 test-bb
1163 T{ ##peek f V int-regs 0 D 0 }
1164 T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< }
1168 T{ ##load-immediate f V int-regs 1 1 }
1173 T{ ##load-immediate f V int-regs 2 2 }
1178 T{ ##phi f V int-regs 3 { } }
1179 T{ ##replace f V int-regs 3 D 0 }
1183 4 get instructions>> first
1184 2 get V int-regs 1 2array
1185 3 get V int-regs 2 2array 2array
1191 cfg new 0 get >>entry
1193 compute-predecessors
1197 [ 1 ] [ 1 get successors>> length ] unit-test
1199 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1201 [ 2 ] [ 4 get instructions>> length ] unit-test
1204 T{ ##peek f V int-regs 0 D 0 }
1209 T{ ##peek f V int-regs 1 D 1 }
1210 T{ ##compare-branch f V int-regs 1 V int-regs 1 cc< }
1214 T{ ##copy f V int-regs 2 V int-regs 0 }
1219 T{ ##phi f V int-regs 3 V{ } }
1224 T{ ##replace f V int-regs 3 D 0 }
1228 1 get V int-regs 1 2array
1229 2 get V int-regs 0 2array 2array 3 get instructions>> first (>>inputs)
1234 cfg new 0 get >>entry
1235 compute-predecessors
1237 compute-predecessors
1242 [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
1244 [ 1 ] [ 3 get instructions>> first inputs>> assoc-size ] unit-test
1246 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
1249 T{ ##peek { dst V int-regs 15 } { loc D 0 } }
1250 T{ ##copy { dst V int-regs 16 } { src V int-regs 15 } }
1251 T{ ##copy { dst V int-regs 17 } { src V int-regs 15 } }
1252 T{ ##copy { dst V int-regs 18 } { src V int-regs 15 } }
1253 T{ ##copy { dst V int-regs 19 } { src V int-regs 15 } }
1255 { dst V int-regs 20 }
1256 { src1 V int-regs 18 }
1257 { src2 V int-regs 19 }
1259 { temp V int-regs 22 }
1261 T{ ##copy { dst V int-regs 21 } { src V int-regs 20 } }
1262 T{ ##compare-imm-branch
1263 { src1 V int-regs 21 }
1270 T{ ##copy { dst V int-regs 23 } { src V int-regs 15 } }
1271 T{ ##copy { dst V int-regs 24 } { src V int-regs 15 } }
1272 T{ ##load-reference { dst V int-regs 25 } { obj t } }
1277 T{ ##replace { src V int-regs 25 } { loc D 0 } }
1283 T{ ##copy { dst V int-regs 26 } { src V int-regs 15 } }
1284 T{ ##copy { dst V int-regs 27 } { src V int-regs 15 } }
1286 { dst V int-regs 28 }
1287 { src1 V int-regs 26 }
1288 { src2 V int-regs 27 }
1294 T{ ##replace { src V int-regs 28 } { loc D 0 } }
1299 0 get 1 get 1vector >>successors drop
1300 1 get 2 get 4 get V{ } 2sequence >>successors drop
1301 2 get 3 get 1vector >>successors drop
1302 4 get 5 get 1vector >>successors drop
1305 cfg new 0 get >>entry
1306 value-numbering eliminate-dead-code drop
1309 [ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test