1 "$Id: table,v 2.33 1994/06/24 13:11:49 ceriel Exp $"
2 /********************************************************
3 * Back end tables for pdp 11 *
4 * Authors : Ceriel J.H. Jacobs,Hans van Staveren *
6 * wordsize = 2 bytes, pointersize = 2 bytes. *
8 * Register r5 is used for the LB, the stack pointer *
9 * is used for SP. Also some global variables are used: *
10 * - reghp~ : the heap pointer *
11 * - trpim~ : trap ignore mask *
12 * - trppc~ : address of user defined trap handler *
13 * - retar : function return area for size>4 *
15 * Timing is based on the timing information available *
16 * for the 11/45. Hardware floating point processor is *
18 ********************************************************/
21 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
23 * This product is part of the Amsterdam Compiler Kit.
25 * Permission to use, sell, duplicate or disclose this software must be
26 * obtained in writing. Requests for such permissions may be sent to
28 * Dr. Andrew S. Tanenbaum
29 * Wiskundig Seminarium
37 /* #define REGPATCH \* save all registers in link block */
38 /* #define UNTESTED \* include untested rules */
48 #define NC nocoercions:
51 /* #define DORCK \* rck is expanded instead of thrown away */
52 #define REGVARS /* use register variables */
62 r1 = ("r1", 2), REG, ODD_REG.
64 r2 = ("r2", 2) regvar, RREG.
66 /* r2 = ("r2", 2), REG. */
68 r3 = ("r3", 2), REG, ODD_REG.
70 r4 = ("r4", 2) regvar, RREG.
72 /* r4 = ("r4", 2), REG. */
74 lb = ("r5", 2), localbase.
75 r01 = ("r0", 4, r0, r1), REG_PAIR.
77 /* r23 = ("r2", 4, r2, r3), REG_PAIR. */
79 fr0 = ("fr0", 4), FLT_REG.
80 fr1 = ("fr1", 4), FLT_REG.
81 fr2 = ("fr2", 4), FLT_REG.
82 fr3 = ("fr3", 4), FLT_REG.
83 fr01 = ("fr0", 8, fr0, fr1), FLT_REG_PAIR.
84 fr23 = ("fr2", 8, fr2, fr3), FLT_REG_PAIR.
85 dr0 = ("fr0", 8, fr0), DBL_REG.
86 dr1 = ("fr1", 8, fr1), DBL_REG.
87 dr2 = ("fr2", 8, fr2), DBL_REG.
88 dr3 = ("fr3", 8, fr3), DBL_REG.
89 dr01 = ("fr0", 16, dr0, dr1), DBL_REG_PAIR.
90 dr23 = ("fr2", 16, dr2, dr3), DBL_REG_PAIR.
94 /********************************
95 * Types on the EM-machine *
96 ********************************/
98 CONST2 = {INT num;} 2 cost=(2,30) "$%[num]"
99 LOCAL2 = {INT ind,size;} 2 cost=(2,60) "%[ind](r5)"
100 LOCAL4 = {INT ind,size;} 4 cost=(2,120) "%[ind](r5)"
101 ADDR_LOCAL = {INT ind;} 2
102 ADDR_EXTERNAL = {STRING ind;} 2 cost=(2,30) "$%[ind]"
104 /********************************************************
105 * Now mostly addressing modes of target machine *
106 ********************************************************/
108 regdef2 = {REGISTER reg;} 2 cost=(0,30) "(%[reg])"
109 regind2 = {REGISTER reg; STRING ind;} 2 cost=(2,60) "%[ind](%[reg])"
110 reginddef2 = {REGISTER reg; STRING ind;} 2 cost=(2,105) "*%[ind](%[reg])"
111 regconst2 = {REGISTER reg; STRING ind;} 2
112 /********************************************************
113 * This means : add "reg" and "ind" to get address. *
114 * Not really addressable on the PDP 11 *
115 ********************************************************/
116 relative2 = {STRING ind;} 2 cost=(2,60) "%[ind]"
117 reldef2 = {STRING ind;} 2 cost=(2,105) "*%[ind]"
118 regdef1 = {REGISTER reg;} 2 cost=(0,30) "(%[reg])"
119 regind1 = {REGISTER reg; STRING ind;} 2 cost=(2,60) "%[ind](%[reg])"
120 reginddef1 = {REGISTER reg; STRING ind;} 2 cost=(2,105) "*%[ind](%[reg])"
121 relative1 = {STRING ind;} 2 cost=(2,60) "%[ind]"
122 reldef1 = {STRING ind;} 2 cost=(2,105) "*%[ind]"
124 /************************************************************************
125 * fto* are floats converted to *, conversion is delayed to be combined *
127 ************************************************************************/
129 ftoint = {REGISTER reg;} 2
130 ftolong = {REGISTER reg;} 4
132 /************************************************************************
133 * ...4 and ...8 are only addressable by the floating point processor. *
134 ************************************************************************/
136 regind4 = {REGISTER reg; STRING ind; } 4 cost=(2,363) "%[ind](%[reg])"
137 relative4 = {STRING ind; } 4 cost=(2,363) "%[ind]"
138 regdef4 = {REGISTER reg;} 4 cost=(2,324) "(%[reg])"
139 regdef8 = {REGISTER reg;} 8 cost=(2,522) "(%[reg])"
140 relative8 = {STRING ind; } 8 cost=(2,561) "%[ind]"
141 regind8 = {REGISTER reg; STRING ind;} 8 cost=(2,561) "%[ind](%[reg])"
144 SCR_REG = REG * SCRATCH
145 SCR_FLT_REG = FLT_REG * SCRATCH
146 SCR_DBL_REG = DBL_REG * SCRATCH
147 SCR_ODD_REG = ODD_REG * SCRATCH
148 SCR_REG_PAIR = REG_PAIR * SCRATCH
150 source2 = RREG + REG + regdef2 + regind2 + reginddef2 + localbase +
151 relative2 + reldef2 + ADDR_EXTERNAL + CONST2 + LOCAL2
152 xsource2 = source2 + ftoint
153 source1 = regdef1 + regind1 + reginddef1 + relative1 +
155 source1or2 = source1 + source2
156 long4 = relative4 + regdef4 + LOCAL4 + regind4 + REG_PAIR
157 longf4 = long4 + FLT_REG - REG_PAIR
158 double8 = relative8 + regdef8 + regind8 + DBL_REG
159 indexed2 = regind2 + reginddef2
162 indexed = indexed2 + indexed4 + indexed8
163 regdeferred = regdef2 + regdef4 + regdef8
164 indordef = indexed + regdeferred
165 locals = LOCAL2 + LOCAL4
166 variable2 = relative2 + reldef2
167 variable4 = relative4
168 variable8 = relative8
169 variable = variable2 + variable4 + variable8
170 dadres2 = relative2 + RREG + REG + regind2
171 regs = RREG + REG + REG_PAIR + FLT_REG + FLT_REG_PAIR +
172 DBL_REG + DBL_REG_PAIR
173 noconst2 = source2 - CONST2 - ADDR_EXTERNAL
174 allexeptcon = all - regs - CONST2 - ADDR_LOCAL - ADDR_EXTERNAL
175 externals = relative1 + relative2 + relative4 + relative8
176 posextern = variable + regdeferred + indexed + externals
177 diradr2 = regconst2 + ADDR_EXTERNAL
180 register = RREG + REG
181 #define INDSTORE remove(allexeptcon-locals) remove(locals, inreg(%[ind])==0)
184 #define INDSTORE remove(allexeptcon)
189 /********************************************************
190 * Group 1 : load instructions. *
192 * For most load instructions no code is generated. *
193 * Action : put something on the fake-stack. *
194 ********************************************************/
196 loc | | | {CONST2, $1} | |
197 ldc | | | {CONST2, loww(1)} {CONST2, highw(1)} | |
199 lol inreg($1)==2| | | regvar($1) | |
201 lol | | | {LOCAL2, $1,2} | |
202 loe | | | {relative2, $1} | |
204 lil inreg($1)==2| | | {regdef2, regvar($1)} | |
206 lil | | | {reginddef2, lb, tostring($1)} | |
207 lof | register | | {regind2,%[1],tostring($1)} | |
209 | {regind2,%[1.reg],tostring($1)+"+"+%[1.ind]} | |
210 ... | NC ADDR_EXTERNAL |
211 | {relative2,tostring($1)+"+"+%[1.ind]} | |
212 ... | NC ADDR_LOCAL | | {LOCAL2, %[1.ind] + $1,2} | |
214 lol lof inreg($1)!=2 | |
215 allocate(REG={LOCAL2, $1,2})
216 | {regind2,%[a],tostring($2)} | |
218 lal | | | {ADDR_LOCAL, $1} | |
219 lae | | | {ADDR_EXTERNAL, $1} | |
221 lxl $1==0 | | | lb | |
222 lxl $1==1 | | | {LOCAL2 ,SL,2} | |
223 lxl $1==2 | | allocate(REG={LOCAL2, SL, 2})
224 | {regind2,%[a], SSL} | |
225 lxl $1==3 | | allocate(REG={LOCAL2, SL, 2})
226 move({regind2,%[a], SSL},%[a])
227 | {regind2,%[a], SSL} | |
228 lxl $1>3 | | allocate(REG={LOCAL2, SL, 2}, REG={CONST2,$1-1})
230 move({regind2,%[a], SSL},%[a])
232 setcc(%[a]) erase(%[a]) erase(%[b])
234 lxa $1==0 | | | {ADDR_LOCAL, SL} | |
235 lxa $1==1 | | allocate(REG={LOCAL2, SL, 2 })
236 | {regconst2, %[a], SSL } | |
237 lxa $1==2 | | allocate(REG={LOCAL2, SL, 2 })
238 move({regind2, %[a], SSL }, %[a])
239 | {regconst2, %[a], SSL } | |
240 lxa $1==3 | | allocate(REG={LOCAL2, SL, 2 })
241 move({regind2, %[a], SSL }, %[a])
242 move({regind2, %[a], SSL }, %[a])
243 | {regconst2, %[a], SSL } | |
244 lxa $1 > 3 | | allocate(REG={LOCAL2, SL, 2}, REG={CONST2,$1-1})
246 move({regind2,%[a], SSL},%[a])
248 setcc(%[a]) erase(%[a]) erase(%[b])
249 | {regconst2, %[a], SSL } | |
251 loi $1==2 | register | | {regdef2, %[1]} | |
252 ... | NC regconst2 | | {regind2, %[1.reg], %[1.ind]} | |
253 ... | NC relative2 | | {reldef2, %[1.ind]} | |
254 ... | NC regind2 | | {reginddef2, %[1.reg], %[1.ind]} | |
255 ... | NC regdef2 | | {reginddef2, %[1.reg], "0"}| |
256 ... | NC ADDR_LOCAL | | {LOCAL2, %[1.ind],2} | |
257 ... | NC ADDR_EXTERNAL | | {relative2, %[1.ind]} | |
259 |{reginddef2, lb, tostring(%[1.ind])}| |
260 loi $1==1 | register | | {regdef1, %[1]} | |
261 ... | NC regconst2 | | {regind1, %[1.reg], %[1.ind]} | |
262 ... | NC ADDR_EXTERNAL | | {relative1, %[1.ind]} | |
263 ... | NC ADDR_LOCAL| |{regind1, lb, tostring(%[1.ind])} | |
264 ... | NC relative2 | | {reldef1, %[1.ind]} | |
265 ... | NC regind2 | | {reginddef1, %[1.reg], %[1.ind]} | |
266 ... | NC regdef2 | | {reginddef1, %[1.reg], "0"}| |
267 ... | NC LOCAL2 | |{reginddef1, lb, tostring(%[1.ind])} | |
268 loi $1==4 | register | | {regdef4, %[1]} | |
269 ... | NC regconst2 | | {regind4, %[1.reg], %[1.ind]} | |
270 ... | NC ADDR_LOCAL | | {LOCAL4,%[1.ind],4} | |
271 ... | NC ADDR_EXTERNAL | | {relative4, %[1.ind]} | |
272 loi $1==8 | register | | {regdef8, %[1]} | |
273 ... | NC regconst2 | | {regind8, %[1.reg], %[1.ind]} | |
274 ... | NC ADDR_LOCAL |
275 | {regind8, lb , tostring(%[1.ind])} | |
276 ... | NC ADDR_EXTERNAL | | {relative8, %[1.ind]} | |
277 loi | NC ADDR_LOCAL |
279 allocate(REG={CONST2,$1/2},REG)
281 "add $$%(%[1.ind]+$1%),%[b]"
282 "1:\tmov -(%[b]),-(sp)"
284 erase(%[a]) erase(%[b]) | | |
285 ... | NC ADDR_EXTERNAL |
287 allocate(REG={CONST2,$1/2},REG)
288 "mov $$%[1.ind]+$1,%[b]"
289 "1:\tmov -(%[b]),-(sp)"
291 erase(%[a]) erase(%[b]) | | |
294 allocate(REG={CONST2,$1})
297 "1:\tmov -(%[1]),-(sp)"
299 erase(%[1]) erase(%[a]) | | |
306 los !defined($1)| source2 |
309 "beq 1f;jmp unknown~;1:"
315 ldl | | | {LOCAL4, $1,4} | |
316 lde | | | {relative4, $1} | |
318 | {regind4,%[1.reg], tostring($1)+"+"+%[1.ind]} | |
319 ... | NC ADDR_EXTERNAL |
320 | {relative4, tostring($1)+"+"+%[1.ind]} | |
321 ... | NC ADDR_LOCAL | | {LOCAL4, %[1.ind]+$1,4} | |
322 lpi | | | {ADDR_EXTERNAL, $1} | |
324 /****************************************************************
325 * Group 2 : Store instructions. *
327 * These instructions are likely to ruin the fake-stack. *
328 * We don't expect many items on the fake-stack anyway *
329 * because we seem to have evaluated an expression just now. *
330 ****************************************************************/
333 stl inreg($1)==2| xsource2 |
335 move(%[1],regvar($1)) | | |
339 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
340 move(%[1],{LOCAL2,$1,2}) | | |
343 move(%[1], {relative2, $1 }) | | |
345 sil inreg($1)==2| xsource2 |
347 move(%[1], {regdef2,regvar($1)}) | | |
351 move(%[1], {reginddef2,lb,tostring($1)}) | | |
352 stf | regconst2 xsource2 |
354 move(%[2],{regind2,%[1.reg],tostring($1)+"+"+%[1.ind]}) | | |
355 ... | ADDR_EXTERNAL xsource2 |
357 move(%[2],{relative2,tostring($1)+"+"+%[1.ind]})| | |
359 lol stf inreg($1)!=2 | xsource2 |
361 allocate(REG={LOCAL2, $1,2})
362 move(%[1],{regind2,%[a],tostring($2)}) | | |
363 lae lol ads sti $3==2 && inreg($2)==2 | |
364 | {regconst2, regvar($2), $1} | sti $4 |
365 lae lol ads loi $3==2 && inreg($2)==2 | |
366 | {regconst2, regvar($2), $1} | loi $4 |
368 sti $1==2 | register xsource2 |
370 move(%[2],{regdef2,%[1]}) | | |
371 ... | regconst2 xsource2 |
373 move(%[2],{regind2,%[1.reg],%[1.ind]}) | | |
374 ... | ADDR_EXTERNAL xsource2 |
376 move(%[2],{relative2,%[1.ind]}) | | |
377 ... | ADDR_LOCAL xsource2 |
379 move(%[2],{LOCAL2, %[1.ind], 2}) | | |
380 ... | relative2 xsource2 |
382 move(%[2],{reldef2,%[1.ind]}) | | |
383 ... | regind2 xsource2 |
385 move(%[2],{reginddef2,%[1.reg],%[1.ind]}) | | |
386 sti $1==1 | register source1or2 |
388 move(%[2],{regdef1,%[1]}) | | |
389 ... | regconst2 source1or2 |
391 move(%[2],{regind1,%[1.reg],%[1.ind]}) | | |
392 ... | ADDR_EXTERNAL source1or2 |
394 move(%[2],{relative1,%[1.ind]}) | | |
395 ... | ADDR_LOCAL source1or2 |
397 move(%[2],{regind1, lb, tostring(%[1.ind])}) | | |
398 ... | relative2 source1or2 |
400 move(%[2],{reldef1,%[1.ind]}) | | |
401 ... | regind2 source1or2 |
403 move(%[2],{reginddef1,%[1.reg],%[1.ind]}) | | |
404 sti $1==4 | NC dadres2 FLT_REG |
408 ... | NC dadres2 ftolong |
410 "setl\nmovfi %[2.reg],*%[1]\nseti"
412 ... | NC regconst2 FLT_REG |
414 "movfo %[2],%[1.ind](%[1.reg])"
416 ... | NC regconst2 ftolong |
418 "setl\nmovfi %[2.reg],%[1.ind](%[1.reg])\nseti"
420 ... | NC ADDR_LOCAL FLT_REG |
422 "movfo %[2],%[1.ind](r5)"
424 ... | NC ADDR_LOCAL ftolong |
426 "setl\nmovfi %[2.reg],%[1.ind](r5)\nseti"
428 ... | NC ADDR_EXTERNAL FLT_REG |
430 "movfo %[2],%[1.ind]"
432 ... | NC ADDR_EXTERNAL ftolong |
434 "setl\nmovfi %[2.reg],%[1.ind]\nseti"
436 ... | register source2 source2 |
438 move(%[2],{regdef2,%[1]})
439 move(%[3],{regind2,%[1],"2"}) | | |
440 ... | SCR_REG STACK |
443 erase(%[1]) | | | (4,204)
444 sti $1==8 | NC dadres2 DBL_REG |
448 ... | NC regconst2 DBL_REG |
450 "movf %[2],%[1.ind](%[1.reg])"
452 ... | NC ADDR_LOCAL DBL_REG |
454 "movf %[2],%[1.ind](r5)"
456 ... | NC ADDR_EXTERNAL DBL_REG |
460 ... | SCR_REG regdef8 |
462 "mov (%[2.reg]),(%[1])+"
463 "mov 2(%[2.reg]),(%[1])+"
464 "mov 4(%[2.reg]),(%[1])+"
465 "mov 6(%[2.reg]),(%[1])"
467 ... | SCR_REG regind8 |
469 "mov %[2.ind](%[2.reg]),(%[1])+"
470 "mov 2+%[2.ind](%[2.reg]),(%[1])+"
471 "mov 4+%[2.ind](%[2.reg]),(%[1])+"
472 "mov 6+%[2.ind](%[2.reg]),(%[1])"
474 ... | SCR_REG relative8 |
476 allocate(REG={ADDR_EXTERNAL,%[2.ind]})
477 "mov (%[a])+,(%[1])+"
478 "mov (%[a])+,(%[1])+"
479 "mov (%[a])+,(%[1])+"
481 erase(%[1]) erase(%[a]) | | |
488 erase(%[1]) | | | (8,408)
491 allocate(REG={CONST2,$1/2})
492 "1:\tmov (sp)+,(%[1])+"
494 erase(%[1]) erase(%[a]) | | | (8,150+$1*82)
495 lal sti $2>2 && $2<=8 | NC xsource2 | | %[1] | stl $1 lal $1+2 sti $2-2 |
496 ... | | | {ADDR_LOCAL,$1} | sti $2 |
505 remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
506 move(%[1],{LOCAL4,$1,4}) | | |
509 remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
510 "setl\nmovfi %[1.reg],$1(r5)\nseti"
512 ... | source2 source2 |
514 remove(locals, %[ind] <= $1+2 && %[ind]+%[size] > $1)
515 move(%[1],{LOCAL2,$1,2})
516 move(%[2],{LOCAL2,$1+2,2}) | | |
519 move(%[1],{relative4,$1}) | | |
522 "setl\nmovfi %[1.reg],$1\nseti"
524 ... | source2 source2 |
526 move(%[1], {relative2, $1 })
527 move(%[2], {relative2, $1+"+2" }) | | |
528 sdf | NC regconst2 FLT_REG |
530 move(%[2],{regind4,%[1.reg],tostring($1)+"+"+%[1.ind]}) | | |
531 ... | NC regconst2 ftolong |
533 "setl\nmovfi %[2.reg],$1+%[1.ind](%[1.reg])\nseti"
535 ... | NC ADDR_EXTERNAL FLT_REG |
537 move(%[2],{relative4,tostring($1)+"+"+%[1.ind]})| | |
538 ... | NC ADDR_EXTERNAL ftolong |
540 "setl\nmovfi %[2.reg],$1+%[1.ind]\nseti"
542 ... | regconst2 source2 source2 |
544 move(%[2],{regind2,%[1.reg],tostring($1)+"+"+%[1.ind]})
545 move(%[3],{regind2,%[1.reg],tostring($1+2)+"+"+%[1.ind]}) | | |
546 ... | ADDR_EXTERNAL source2 source2 |
548 move(%[2],{relative2,tostring($1)+"+"+%[1.ind]})
549 move(%[3],{relative2,tostring($1+2)+"+"+%[1.ind]}) | | |
551 /****************************************************************
552 * Group 3 : Integer arithmetic. *
554 * Implemented (sometimes with the use of subroutines) : *
555 * all 2 and 4 byte arithmetic. *
556 ****************************************************************/
558 adi $1==2 | NC SCR_REG CONST2 | | {regconst2,%[1],tostring(%[2.num])} | |
559 ... | NC SCR_REG ADDR_EXTERNAL | | {regconst2,%[1],%[2.ind]} | |
560 ... | NC SCR_REG ADDR_LOCAL |
561 "add r5,%[1]" erase(%[1]) |
562 {regconst2,%[1],tostring(%[2.ind])} | | (2,45)
563 ... | NC register ADDR_LOCAL |
567 erase(%[a]) | {regconst2,%[a],tostring(%[2.ind])} | | (4,90)
568 ... | NC SCR_REG regconst2 |
569 "add %[2.reg],%[1]" erase(%[1]) |
570 {regconst2,%[1],%[2.ind]} | | (2,45)
571 ... | NC CONST2+ADDR_EXTERNAL+ADDR_LOCAL+regconst2 SCR_REG |
572 | %[1] %[2] | adi 2 |
573 ... | NC source2-register CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
574 allocate(%[1],REG=%[1]) | %[2] %[a] | adi 2 |
575 ... | NC source1 CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
576 allocate(REG={CONST2, 0})
578 erase(%[a]) | %[2] %[a] | adi 2 |
579 ... | NC regconst2 CONST2 | |
581 tostring(%[2.num])+"+"+%[1.ind]} | |
582 ... | NC regconst2 ADDR_EXTERNAL | |
584 %[2.ind]+"+"+%[1.ind]} | |
585 ... | NC regconst2 ADDR_LOCAL |
586 "add r5,%[1.reg]" erase(%[1.reg]) |
588 tostring(%[2.ind])+"+"+%[1.ind]} | | (2,45)
589 ... | NC regconst2 regconst2 |
590 "add %[2.reg],%[1.reg]" erase(%[1.reg]) |
591 {regconst2,%[1.reg],%[2.ind]+"+"+%[1.ind]} | | (2,45)
592 ... | NC regconst2 noconst2 |
593 "add %[2],%[1.reg]" erase(%[1.reg]) | %[1] | | (2,45)+%[2]
594 ... | NC SCR_REG noconst2 |
596 setcc(%[1]) erase(%[1]) | %[1] | | (2,45)+%[2]
597 ... | NC source2 regconst2 |
599 erase(%[2.reg]) | %[2] | | (2,45)+%[1]
600 ... | NC regconst2 source2 |
602 erase(%[1.reg]) | %[1] | | (2,45)+%[2]
603 ... | source2 SCR_REG |
605 setcc(%[2]) erase(%[2]) | %[2] | | (2,45)+%[1]
607 ldc adi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
608 "add $$%(loww(1)%),%[2]"
610 erase(%[1]) erase(%[2]) | %[2] %[1] | |
611 ldc adi $2==4 | SCR_REG SCR_REG |
612 "add $$%(loww(1)%),%[2]"
614 "add $$%(highw(1)%),%[1]"
615 erase(%[1]) erase(%[2]) | %[2] %[1] | |
616 adi $1==4 | SCR_REG SCR_REG source2 source2 |
620 setcc(%[1]) erase(%[1]) erase(%[2])
621 | %[2] %[1] | | (6,120)+%[4]+%[3]
622 ... | SCR_REG SCR_REG source2 STACK |
626 setcc(%[1]) erase(%[1]) erase(%[2])
627 | %[2] %[1] | | (6,190)+%[3]
628 ... | SCR_REG SCR_REG STACK |
632 setcc(%[1]) erase(%[1]) erase(%[2])
633 | %[2] %[1] | | (6,280)
634 ... | source2 source2 SCR_REG SCR_REG |
638 setcc(%[3]) erase(%[3]) erase(%[4])
639 | %[4] %[3] | | (6,120)+%[1]+%[2]
641 adi !defined($1)| source2 |
646 loc sbi $2==2 | | | | loc 0-$1 adi 2 |
647 sbi $1==2 | source2 SCR_REG |
649 setcc(%[2]) erase(%[2]) | %[2] | | (2,45)+%[1]
650 ... | NC SCR_REG source2-register |
653 setcc(%[1]) erase(%[1]) | %[1] | | (4,75)+%[2]
654 ldc sbi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
655 "sub $$%(loww(1)%),%[2]"
657 erase(%[1]) erase(%[2]) | %[2] %[1] | |
658 ldc sbi $2==4 | SCR_REG SCR_REG |
659 "sub $$%(loww(1)%),%[2]"
661 "sub $$%(highw(1)%),%[1]"
662 erase(%[1]) erase(%[2]) | %[2] %[1] | |
663 sbi $1==4 | source2-register source2-register SCR_REG SCR_REG |
667 setcc(%[3]) erase(%[3]) erase(%[4])
668 | %[4] %[3] | | (6,120)+%[1]+%[2]
669 ... | source2 source2 STACK |
672 "sub %[1],(sp)" | | | (10,280)+%[1]+%[2]
674 sbi !defined($1)| source2 |
679 mli $1==2 | SCR_ODD_REG source2 |
681 setcc(%[1]) erase(%[1]) | %[1] | |(2,330)+%[2]
682 ... | source2 SCR_ODD_REG |
684 setcc(%[2]) erase(%[2]) | %[2] | |(2,330)+%[1]
685 mli $1==4 | | remove(all)
689 mli !defined($1)| source2 |
694 dvi $1==2 | source2 source2 |
695 allocate(%[2],REG_PAIR)
698 "div %[1],%[a.1]" | %[a.1] | |
699 ... | source2 source2 |
704 "div (sp)+,r0" | r0 | |(100,1000)
705 dvi $1==4 | | remove(all)
706 "jsr pc,dvi4~" | r1 r0 | |
708 dvi !defined($1)| source2 |
713 rmi $1==2 | source2 source2 |
714 allocate(%[2],REG_PAIR)
717 "div %[1],%[a.1]" | %[a.2] | |
718 ... | source2 source2 |
723 "div (sp)+,r0" | r1 | |(100,1000)
724 rmi $1==4 | | remove(all)
725 "jsr pc,rmi4~" | r1 r0 | |
727 rmi !defined($1)| source2 |
732 ngi $1==2 | SCR_REG |
734 setcc(%[1]) erase(%[1]) | %[1] | | (2,75)
735 ngi $1==4 | SCR_REG SCR_REG |
739 setcc(%[1]) erase(%[1]) erase(%[2])
740 | %[2] %[1] | | (6,180)
742 ngi !defined($1)| source2 |
747 loc sli $1==1 && $2==2 | SCR_REG |
749 setcc(%[1]) erase(%[1]) | %[1]| |
750 sli $1==2 | source2 SCR_REG |
752 setcc(%[2]) erase(%[2]) | %[2] | |
753 sli $1==4 | source2 SCR_REG_PAIR |
755 setcc(%[2]) erase(%[2]) | %[2] | |
757 sli !defined($1)| source2 |
762 loc sri $1==1 && $2==2 | SCR_REG |
764 setcc(%[1]) erase(%[1]) | %[1]| |
765 loc sri $2==2 | SCR_REG |
766 "ash $$%(0-$1%),%[1]"
767 setcc(%[1]) erase(%[1]) | %[1]| |
768 sri $1==2 | SCR_REG SCR_REG |
771 setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
772 loc sri $2==4 | SCR_REG_PAIR |
773 "ashc $$%(0-$1%),%[1]"
774 setcc(%[1]) erase(%[1]) | %[1] | |
775 sri $1==4 | SCR_REG SCR_REG_PAIR |
778 setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
780 sri !defined($1)| source2 |
786 /************************************************
787 * Group 4 : unsigned arithmetic *
793 * Supported : 2- and 4 byte arithmetic. *
794 ************************************************/
798 mlu $1==2 | | | | mli $1 |
799 mlu $1==4 | | remove(all)
800 "jsr pc,mlu4~" | r1 r0 | |
802 mlu !defined($1)| source2 |
807 loc dvu $1>0 && $1<=32767 && $2==2 | source2 |
808 allocate(%[1],REG_PAIR)
811 "div $$$1,%[a.1]" | %[a.1] | |
812 dvu $1==2 | | remove(all)
813 "jsr pc,dvu2~" | r0 | |
814 dvu $1==4 | | remove(all)
815 "jsr pc,dvu4~" | r1 r0 | |
817 dvu !defined($1)| source2 |
822 loc rmu $1>0 && $1<=32767 && $2==2 | source2 |
823 allocate(%[1],REG_PAIR)
826 "div $$$1,%[a.1]" | %[a.2] | |
827 rmu $1==2 | | remove(all)
828 "jsr pc,rmu2~" | r1 | |
829 rmu $1==4 | | remove(all)
830 "jsr pc,rmu4~" | r1 r0 | |
832 rmu !defined($1)| source2 |
838 loc slu | | | | loc $1 sli $2 |
839 sru $1==2 | source2 xsource2 |
840 allocate(%[1],%[2],REG=%[1],REG_PAIR)
842 move({CONST2,0},%[b.1])
845 erase(%[b]) | %[b.2] | |
846 loc sru $2==2 | xsource2 |
847 allocate(%[1],REG_PAIR)
849 move({CONST2,0},%[a.1])
850 "ashc $$%(0-$1%),%[a]"
851 erase(%[a]) | %[a.2] | |
852 sru $1==4 | | remove(all)
857 sru !defined($1)| source2 |
863 /************************************************
864 * Group 5 : Floating point arithmetic *
866 * Supported : 4- and 8 byte arithmetic. *
867 ************************************************/
869 adf $1==4 | FLT_REG SCR_FLT_REG |
871 samecc erase(%[2]) | %[2] | | (2,500)+%[1]
872 ... | SCR_FLT_REG FLT_REG |
874 samecc erase(%[1]) | %[1] | | (2,500)+%[2]
875 adf $1==8 | double8 SCR_DBL_REG |
877 samecc erase(%[2]) | %[2] | | (2,600)+%[1]
878 ... | SCR_DBL_REG double8 |
880 samecc erase(%[1]) | %[1] | | (2,600)+%[2]
882 adf !defined($1)| source2 |
887 sbf $1==4 | FLT_REG SCR_FLT_REG |
889 samecc erase(%[2]) | %[2] | | (2,500)+%[1]
890 sbf $1==8 | double8 SCR_DBL_REG |
892 samecc erase(%[2]) | %[2] | | (2,600)+%[1]
894 sbf !defined($1)| source2 |
899 mlf $1==4 | FLT_REG SCR_FLT_REG |
901 samecc erase(%[2]) | %[2] | | (2,700)+%[1]
902 ... | SCR_FLT_REG FLT_REG |
904 samecc erase(%[1]) | %[1] | | (2,700)+%[2]
905 mlf $1==8 | double8 SCR_DBL_REG |
907 samecc erase(%[2]) | %[2] | | (2,1000)+%[1]
908 ... | SCR_DBL_REG double8 |
910 samecc erase(%[1]) | %[1] | | (2,1000)+%[2]
912 mlf !defined($1)| source2 |
917 dvf $1==4 | FLT_REG SCR_FLT_REG |
919 samecc erase(%[2]) | %[2] | | (2,800)+%[1]
920 dvf $1==8 | double8 SCR_DBL_REG |
922 samecc erase(%[2]) | %[2] | | (2,1200)+%[1]
924 dvf !defined($1)| source2 |
929 ngf $1==4 | SCR_FLT_REG |
931 samecc erase(%[1]) | %[1] | |(2,270)
932 ngf $1==8 | SCR_DBL_REG |
934 samecc erase(%[1]) | %[1] | |(2,270)
936 ngf !defined($1)| source2 |
941 fif $1==4 | longf4 FLT_REG |
942 allocate(FLT_REG_PAIR)
945 samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,750)+%[2]
946 fif $1==8 | double8 double8 |
947 allocate(DBL_REG_PAIR)
950 samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,1500)+%[2]
952 fif !defined($1)| source2 |
957 fef $1==4 | FLT_REG |
962 erase(%[1]) |%[1] %[a] | | (4,500)
963 fef $1==8 | DBL_REG |
968 erase(%[1]) |%[1] %[a] | | (4,500)
970 fef !defined($1)| source2 |
976 /****************************************
977 * Group 6 : pointer arithmetic. *
979 * Pointers have size 2 bytes. *
980 ****************************************/
982 adp | SCR_REG | | {regconst2, %[1], tostring($1)} | |
983 ... | NC regconst2 | | {regconst2, %[1.reg], tostring($1)+"+"+%[1.ind]} | |
984 ... | NC ADDR_EXTERNAL | | {ADDR_EXTERNAL, tostring($1)+"+"+%[1.ind]} | |
985 ... | NC ADDR_LOCAL | | {ADDR_LOCAL,%[1.ind]+$1} | |
986 ads $1==2 | | | | adi $1 |
987 sbs $1==2 | | | | sbi $1 |
989 /****************************************
990 * Group 7 : increment/decrement/zero *
991 ****************************************/
995 setcc(%[1]) erase(%[1]) | %[1] | |
997 inl inreg($1)==2| | remove(regvar($1))
999 erase(regvar($1)) | | |
1001 inl | | remove(indordef)
1002 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1004 setcc({LOCAL2,$1,2}) | | |
1005 ldl ldc adi sdl $1==$4 && $3==4 && highw(2)==0 | |
1007 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1008 "add $$%(loww(2)%),2+$1(r5)"
1010 ldl ldc adi sdl $1==$4 && $3==4 | |
1012 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1013 "add $$%(loww(2)%),2+$1(r5)"
1015 "add $$%(highw(2)%),$1(r5)" | | |
1016 ine | | remove(posextern)
1018 setcc({relative2,$1}) | | |
1019 lde ldc adi sde $1==$4 && $3==4 && highw(2)==0 | |
1021 "add $$%(loww(2)%),2+$1"
1023 lde ldc adi sde $1==$4 && $3==4 | |
1025 "add $$%(loww(2)%),2+$1"
1027 "add $$%(highw(2)%),$1" | | |
1030 setcc(%[1]) erase(%[1]) | %[1] | |
1032 del inreg($1)==2| | remove(regvar($1))
1033 "dec %(regvar($1)%)"
1034 erase(regvar($1)) | | |
1036 del | | remove(indordef)
1037 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1039 setcc({LOCAL2,$1,2}) | | |
1040 dee | | remove(posextern)
1042 setcc({relative2,$1}) | | | (4,90)
1045 lol loc sbi stl $1==$4 && $3==2 && inreg($1)==2 | |
1047 "sub $$$2,%(regvar($1)%)"
1048 erase(regvar($1)) | | |
1049 lol ngi stl $1==$3 && $2==2 && inreg($1)==2 | |
1051 "neg %(regvar($1)%)"
1052 erase(regvar($1)) | | |
1053 lil ngi sil $1==$3 && $2==2 && inreg($1)==2 | |
1055 "neg *%(regvar($1)%)" | | |
1056 lil inc sil $1==$3 && inreg($1)==2 | | INDSTORE
1057 "inc *%(regvar($1)%)"
1058 setcc({regdef2, regvar($1)}) | | |
1059 lil dec sil $1==$3 && inreg($1)==2 | | INDSTORE
1060 "dec *%(regvar($1)%)"
1061 setcc({regdef2, regvar($1)}) | | |
1062 lol adi stl $2==2 && $1==$3 && inreg($1)==2 | source2 |
1064 "add %[1],%(regvar($1)%)"
1065 erase(regvar($1)) | | |
1066 lol dup adp stl loi $1==$4 && $2==2 && inreg($1)==2 && $3==1 && $5==1 | |
1067 allocate(REG={CONST2, 0})
1069 "bisb (%(regvar($1)%))+,%[a]"
1070 erase(%[a]) | %[a] | |
1071 lol dup adp stl loi loc loc cii $1==$4 && $2==2 && inreg($1)==2 && $3==1 && $5==1 && $6==1 && $7==2 | |
1074 "movb (%(regvar($1)%))+,%[a]"
1075 erase(%[a]) | %[a] | |
1076 lol dup adp stl loi $1==$4 && $2==2 && inreg($1)==2 && $3==2 && $5==2 | |
1079 "mov (%(regvar($1)%))+,%[a]" | %[a] | |
1080 lol sti lol adp stl $1==$3 && $3==$5 && inreg($1)==2 && $2==1 && $4==1 | source1or2|
1082 "movb %[1],(%(regvar($1)%))+" | | |
1083 sil lol adp stl $1==$2 && $2==$4 && inreg($1)==2 && $3==2 | source2 |
1085 "mov %[1],(%(regvar($1)%))+" | | |
1086 lol dup adp stl $1==$4 && $2==2 && inreg($1)==2 | |
1087 allocate(REG=regvar($1)) | %[a]
1088 | lol $1 adp $3 stl $1 |
1089 lol dup adp stl $1==$4 && $2==2 | |
1090 allocate(REG={LOCAL2, $1, 2}) | %[a]
1091 | lol $1 adp $3 stl $1 |
1092 lol inl $1==$2 && inreg($1)==2 | |
1093 allocate(REG=regvar($1)) | %[a]
1096 allocate(REG={LOCAL2, $1, 2}) | %[a]
1098 lol del $1==$2 && inreg($1)==2 | |
1099 allocate(REG=regvar($1)) | %[a]
1102 allocate(REG={LOCAL2, $1, 2}) | %[a]
1104 lol adp stl $1==$3 && $2==1 && inreg($1)==2 | |
1106 "inc %(regvar($1)%)"
1107 erase(regvar($1)) | | |
1108 lol adp stl $1==$3 && $2==0-1 && inreg($1)==2 | |
1110 "dec %(regvar($1)%)"
1111 erase(regvar($1)) | | |
1112 lol adp stl $1==$3 && inreg($1)==2 | |
1114 "add $$$2,%(regvar($1)%)"
1115 erase(regvar($1)) | | |
1116 lil lil adp sil $2==$4 && inreg($1)==2 | |
1117 allocate(REG={regdef2, regvar($1)})
1118 | %[a] | lil $2 adp $3 sil $2 |
1119 lil adp sil $1==$3 && $2==1 && inreg($1)==2 | |
1121 "inc *%(regvar($1)%)" | | |
1122 lil adp sil $1==$3 && $2==0-1 && inreg($1)==2 | |
1124 "dec *%(regvar($1)%)" | | |
1125 lil adp sil $1==$3 && inreg($1)==2 | |
1127 "add $$$2,*%(regvar($1)%)" | | |
1128 lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
1130 "inc $2(%(regvar($1)%))"
1131 setcc({regind2, regvar($1), tostring($2)}) | | |
1132 lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
1134 "dec $2(%(regvar($1)%))"
1135 setcc({regind2, regvar($1), tostring($2)}) | | |
1136 lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 && $3==1 | |
1138 "inc $2(%(regvar($1)%))"
1139 setcc({regind2, regvar($1), tostring($2)}) | | |
1140 lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 && $3==0-1 | |
1142 "dec $2(%(regvar($1)%))"
1143 setcc({regind2, regvar($1), tostring($2)}) | | |
1144 lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==2 | |
1146 "add $3,$2(%(regvar($1)%))"
1147 setcc({regind2, regvar($1), tostring($2)}) | | |
1149 lol loc sbi stl $1==$4 && $3==2 | |
1151 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1153 setcc({LOCAL2,$1,2}) | | |
1154 lol ngi stl $1==$3 && $2==2 | |
1156 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1158 setcc({LOCAL2,$1,2}) | | |
1159 lil ngi sil $1==$3 && $2==2 | | INDSTORE
1161 lil inc sil $1==$3 | | INDSTORE
1163 setcc({reginddef2, lb, tostring($1)}) | | |
1164 lil dec sil $1==$3 | | INDSTORE
1166 setcc({reginddef2, lb, tostring($1)}) | | |
1167 lol adi stl $2==2 && $1==$3 | source2 |
1169 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1171 setcc({LOCAL2,$1,2}) | | |
1172 lol adp stl $1==$3 && $2==1 | |
1174 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1176 setcc({LOCAL2,$1,2}) | | |
1177 lol adp stl $1==$3 && $2==0-1 | |
1179 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1181 setcc({LOCAL2,$1,2}) | | |
1182 lol adp stl $1==$3 | |
1184 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1186 setcc({LOCAL2,$1,2}) | | |
1187 lil lil adp sil $2==$4 | |
1188 allocate(REG={reginddef2, lb, tostring($1)})
1189 | %[a] | lil $2 adp $3 sil $2 |
1190 lil adp sil $1==$3 && $2==1 | |
1193 setcc({LOCAL2,$1,2}) | | |
1194 lil adp sil $1==$3 && $2==0-1 | |
1197 setcc({LOCAL2,$1,2}) | | |
1198 lil adp sil $1==$3 | |
1201 setcc({LOCAL2,$1,2}) | | |
1202 loe adi ste $2==2 && $1==$3 | source2 |
1205 setcc({relative2,$1}) | | |
1206 loe adp ste $1==$3 && $2==1 | |
1209 setcc({relative2,$1}) | | |
1210 loe adp ste $1==$3 && $2==0-1 | |
1213 setcc({relative2,$1}) | | |
1214 loe adp ste $1==$3 | |
1217 setcc({relative2,$1}) | | |
1218 loe loi loe loi adp loe sti $3==$6 && $2==2 && $4==2 && $7==2 | |
1219 allocate(REG={reldef2, $1})
1220 | %[a] | loe $3 loi $4 adp $5 loe $6 sti $7 |
1221 loe loi adp loe sti $1==$4 && $2==2 && $5==2 && $3==1 | |
1224 setcc({reldef2,$1}) | | |
1225 loe loi adp loe sti $1==$4 && $2==2 && $5==2 && $3==0-1 | |
1228 setcc({reldef2,$1}) | | |
1229 loe loi adp loe sti $1==$4 && $2==2 && $5==2 | |
1232 setcc({reldef2,$1}) | | |
1233 lol lof inc lol stf $1==$4 && $2==$5 | |
1235 allocate(REG={LOCAL2, $1, 2})
1237 setcc({regind2, %[a], tostring($2)}) | | |
1238 lol lof dec lol stf $1==$4 && $2==$5 | |
1240 allocate(REG={LOCAL2, $1, 2})
1242 setcc({regind2, %[a], tostring($2)}) | | |
1243 lol lof adp lol stf $1==$4 && $2==$5 && $3==1 | |
1245 allocate(REG={LOCAL2, $1, 2})
1247 setcc({regind2, %[a], tostring($2)}) | | |
1248 lol lof adp lol stf $1==$4 && $2==$5 && $3==0-1 | |
1250 allocate(REG={LOCAL2, $1, 2})
1252 setcc({regind2, %[a], tostring($2)}) | | |
1253 lol lof adp lol stf $1==$4 && $2==$5 | |
1255 allocate(REG={LOCAL2, $1, 2})
1257 setcc({regind2, %[a], tostring($2)}) | | |
1258 loe lof inc loe stf $1==$4 && $2==$5 | |
1260 allocate(REG={relative2, $1})
1262 setcc({regind2, %[a], tostring($2)}) | | |
1263 loe lof dec loe stf $1==$4 && $2==$5 | |
1265 allocate(REG={relative2, $1})
1267 setcc({regind2, %[a], tostring($2)}) | | |
1268 loe lof adp loe stf $1==$4 && $2==$5 && $3==1 | |
1270 allocate(REG={relative2, $1})
1272 setcc({regind2, %[a], tostring($2)}) | | |
1273 loe lof adp loe stf $1==$4 && $2==$5 && $3==0-1 | |
1275 allocate(REG={relative2, $1})
1277 setcc({regind2, %[a], tostring($2)}) | | |
1278 loe lof adp loe stf $1==$4 && $2==$5 | |
1280 allocate(REG={relative2, $1})
1282 setcc({regind2, %[a], tostring($2)}) | | |
1284 allocate(REG={relative2, $1}) | %[a]
1287 allocate(REG={relative2, $1}) | %[a]
1289 loe dup adp ste $1==$4 && $2==2 | |
1290 allocate(REG={relative2, $1}) | %[a]
1291 | loe $1 adp $3 ste $1 |
1293 lol ior stl $2==2 && $1==$3 && inreg($1)==2 | source2 |
1295 "bis %[1],%(regvar($1)%)"
1296 erase(regvar($1)) | | |
1298 lol ior stl $2==2 && $1==$3 | source2 |
1300 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1302 setcc({LOCAL2,$1,2}) | | |
1303 loe ior ste $2==2 && $1==$3 | source2 |
1306 setcc({relative2,$1}) | | |
1308 lol and stl $2==2 && $1==$3 && inreg($1)==2 | SCR_REG |
1311 "bic %[1],%(regvar($1)%)"
1313 erase(regvar($1)) | | |
1315 lol and stl $2==2 && $1==$3 | SCR_REG |
1317 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1321 setcc({LOCAL2,$1,2}) | | |
1322 loe and ste $2==2 && $1==$3 | SCR_REG |
1327 setcc({relative2,$1}) | | |
1329 loc lol and stl $3==2 && $2==$4 && inreg($2)==2 | |
1331 "bic $$%(~$1%),%(regvar($2)%)"
1332 erase(regvar($2)) | | |
1334 loc lol and stl $3==2 && $2==$4 | |
1336 remove(locals, %[ind] <= $2 && %[ind]+%[size] > $2)
1337 "bic $$%(~$1%),$2(r5)"
1338 setcc({LOCAL2,$2,2}) | | |
1339 loc loe and ste $3==2 && $2==$4 | |
1342 setcc({relative2,$2}) | | |
1344 zrl inreg($1)==2| | remove(regvar($1))
1345 "clr %(regvar($1)%)"
1346 erase(regvar($1)) | | | (4,90)
1348 zrl | | remove(indordef)
1349 remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
1351 setcc({LOCAL2,$1,2}) | | | (4,90)
1352 zre | | remove(posextern)
1354 setcc({relative2,$1}) | | | (4,90)
1355 zrf $1==4 | | allocate(FLT_REG)
1356 "clrf %[a]" | %[a] | | (2,220)
1357 zrf $1==8 | | allocate(DBL_REG)
1358 "clrf %[a]" | %[a] | | (2,240)
1359 zrf !defined($1)| | | | zer |
1360 zrf defined($1) | | | | zer $1 |
1361 zer $1==2 | | | {CONST2, 0} | |
1362 zer $1==4 | | | {CONST2,0} {CONST2,0} | |
1363 zer $1==6 | | | {CONST2,0} {CONST2,0}
1365 zer $1==8 | | | {CONST2,0} {CONST2,0}
1366 {CONST2, 0} {CONST2,0} | |
1367 zer defined($1) | | remove(all)
1368 move({CONST2,$1/2},r0)
1371 erase(r0) | | |(8,150+$1*37)
1372 zer !defined($1)| SCR_REG |
1379 /****************************************
1380 * Group 8 : Convert instructions *
1381 ****************************************/
1401 loc loc cii $1==1 && $2==2 | source1or2 |
1404 /* movb does sign extend if dest is register */
1406 loc loc cii $1==1 && $2==4 | source1or2 |
1407 allocate(%[1],REG,REG)
1411 loc loc cii $1==2 && $2==4 | source2 |
1412 allocate(%[1],REG,REG)
1417 loc loc loc cii $1>=0 && $2==2 && $3==4 | | | | loc $1 loc 0 |
1418 loc loc loc cii $1< 0 && $2==2 && $3==4 | | | | loc $1 loc 0-1 |
1419 loc loc cii $1==4 && $2==2 | source2 source2 | | %[2] | |
1420 loc loc ciu | | | | loc $1 loc $2 cuu |
1421 loc loc cui | | | | loc $1 loc $2 cuu |
1422 loc loc cuu $1==2 && $2==4 | | | {CONST2,0} | |
1423 loc loc cuu $1==4 && $2==2 | source2 | | | |
1424 loc loc cuu $1==$2 | | | | |
1425 loc loc cfu $1==4 | FLT_REG | | {ftolong,%[1]} | loc 4 loc $2 cuu |
1426 loc loc cfu $1==8 | DBL_REG | | {ftolong,%[1]} | loc 4 loc $2 cuu |
1427 loc loc cfi $1==4 && $2==2 | FLT_REG | | {ftoint,%[1]} | |
1428 loc loc cfi $1==4 && $2==4 | FLT_REG | | {ftolong,%[1]} | |
1429 loc loc cfi $1==8 && $2==2 | DBL_REG | | {ftoint,%[1]} | |
1430 loc loc cfi $1==8 && $2==4 | DBL_REG | | {ftolong,%[1]} | |
1431 loc loc cif $1==2 && $2==4 | source2 |
1436 loc loc cif $1==2 && $2==8 | source2 |
1441 loc loc cif $1==4 && $2==4 | NC long4-REG_PAIR |
1455 loc loc cif $1==4 && $2==8 | NC long4-REG_PAIR |
1469 loc loc cuf $1==2 && $2==4 | |
1477 loc loc cuf $1==2 && $2==8 | |
1485 loc loc cuf $1==4 && ($2==8 || $2==4) | | | | loc $1 loc $2 cif |
1486 loc loc cff $1==4 && $2==8 | longf4 - FLT_REG |
1495 loc loc cff $1==8 && $2==4 | DBL_REG | | %[1.1] | |
1497 /****************************************
1498 * Group 9 : Logical instructions *
1499 ****************************************/
1501 and $1==2 | CONST2 SCR_REG |
1502 "bic $$%(~%[1.num]%),%[2]"
1504 erase(%[2]) | %[2] | | (4,75)
1505 ... | SCR_REG CONST2 |
1506 "bic $$%(~%[2.num]%),%[1]"
1508 erase(%[1]) | %[1] | | (4,75)
1509 ... | SCR_REG SCR_REG |
1513 erase(%[1]) erase(%[2]) | %[2] | | (4,60)
1514 ldc and $2==4 && highw(1)==0 | source2 SCR_REG |
1515 "bic $$%(~loww(1)%),%[2]"
1516 erase(%[2]) | %[2] {CONST2, 0} | |
1517 ldc and $2==4 && highw(1)==0-1 | source2 SCR_REG |
1518 "bic $$%(~loww(1)%),%[2]"
1519 erase(%[2]) | %[2] %[1] | |
1520 ldc and $2==4 | SCR_REG SCR_REG |
1521 "bic $$%(~highw(1)%),%[1]"
1522 "bic $$%(~loww(1)%),%[2]"
1523 erase(%[1]) erase(%[2]) | %[2] %[1] | |
1524 and defined($1) | | remove(all)
1525 move({CONST2,$1}, r0)
1528 and !defined($1)| source2 |
1533 ior $1==2 | SCR_REG source2 |
1536 erase(%[1]) | %[1] | | (2,45)+%[2]
1537 ... | source2 SCR_REG |
1540 erase(%[2]) | %[2] | | (2,45)+%[1]
1541 ldc ior $2==4 && highw(1)==0 | source2 SCR_REG |
1542 "bis $$%(loww(1)%),%[2]"
1543 erase(%[2]) | %[2] %[1] | |
1544 ldc ior $2==4 && highw(1)==0-1 | source2 SCR_REG |
1545 "bis $$%(loww(1)%),%[2]"
1546 erase(%[2]) | {CONST2, 0-1} %[1] | |
1547 ldc ior $2==4 | SCR_REG SCR_REG |
1548 "bis $$%(highw(1)%),%[1]"
1549 "bis $$%(loww(1)%),%[2]"
1550 erase(%[1]) erase(%[2]) | %[2] %[1] | |
1551 ior $1==8 | NC source2 source2 source2 source2 |
1556 "bis %[4],6(sp)" | | |
1558 allocate(REG={CONST2,$1})
1565 ior defined($1) | | remove(all)
1566 allocate(REG={CONST2,$1},REG={CONST2,$1/2})
1568 "1:\tbis (sp)+,(%[a])+"
1570 erase(%[a]) erase(%[b]) | | | (12,210+$1*97)
1571 ior !defined($1)| SCR_REG |
1576 "1:\tbis (sp)+,(%[a])+"
1578 erase(%[1]) erase(%[a]) | | |
1579 xor $1==2 | register SCR_REG |
1582 erase(%[2]) | %[2] | | (2,30)
1583 ... | SCR_REG register |
1586 erase(%[1]) | %[1] | | (2,30)
1587 xor defined($1) | | remove(all)
1588 move({CONST2,$1},r0)
1591 xor !defined($1)| source2 |
1596 com $1==2 | SCR_REG |
1599 erase(%[1]) | %[1] | | (2,30)
1600 com defined($1) | | remove(all)
1601 allocate(REG={CONST2,$1/2},REG)
1605 erase(%[a]) | | | (10,180+$1*82)
1606 com !defined($1)| SCR_REG |
1614 rol $1==2 | CONST2 SCR_ODD_REG |
1615 "ashc $$%(%[1.num]-16%),%[2]"
1617 erase(%[2]) | %[2] | |
1618 ... | SCR_REG SCR_ODD_REG |
1622 erase(%[1]) erase(%[2]) | %[2] | |
1623 rol defined($1) | | remove(all)
1624 move({CONST2,$1},r0)
1628 rol !defined($1)| source2 |
1634 ror $1==2 | CONST2 SCR_ODD_REG |
1635 "ashc $$%(0-%[1.num]%),%[2]"
1637 erase(%[2]) | %[2] | |
1638 ... | SCR_REG SCR_ODD_REG |
1641 setcc(%[2]) erase(%[1]) erase(%[2]) | %[2] | |
1642 ror defined($1) | | remove(all)
1643 move({CONST2,$1},r0)
1647 ror !defined($1)| source2 |
1653 com and $1==2 && $2==2 | source2 SCR_REG |
1656 erase(%[2]) | %[2] | | (2,45)+%[1]
1657 com and $1==$2 | | remove(all)
1658 allocate(REG={CONST2,$1},REG)
1662 "1:\tbic (sp)+,(%[b])+"
1664 erase(%[a]) | | | (12,210+$1*97)
1666 /********************************
1667 * Group 10 : Set instructions *
1668 ********************************/
1670 inn $1==2 | SCR_REG SCR_REG |
1673 "bic $$0177776,%[2]"
1674 erase(%[1]) erase(%[2]) | %[2] | |
1675 loc inn $2==2 && $1==0 | SCR_REG |
1676 "bic $$0177776,%[1]"
1677 erase(%[1]) | %[1] | |
1678 loc inn $2==2 && $1==1 | SCR_REG |
1680 "bic $$0177776,%[1]"
1681 erase(%[1]) | %[1] | |
1682 loc inn $2==2 | SCR_REG |
1683 "ash $$%(0-$1%),%[1]"
1684 "bic $$0177776,%[1]"
1685 erase(%[1]) | %[1] | |
1687 loc inn zeq $2==2 | | | {CONST2, 1<<$1} | and 2 zeq $3 |
1688 inn zeq $1==2 | source2 |
1689 allocate(REG={CONST2,1})
1690 "ash %[1],%[a]" | %[a] | and 2 zeq $2 |
1691 loc inn zne $2==2 | | | {CONST2, 1<<$1} | and 2 zne $3 |
1692 inn zne $1==2 | source2 |
1693 allocate(REG={CONST2,1})
1694 "ash %[1],%[a]" | %[a] | and 2 zne $2 |
1695 inn defined($1) | source2 |
1698 move({CONST2,$1},r0)
1702 inn !defined($1)| source2 |
1709 set $1==2 | register |
1710 allocate(REG={CONST2,1})
1712 erase(%[a]) | %[a] | |
1713 set defined($1) | source2 |
1716 move({CONST2,$1},r0)
1719 set !defined($1)| source2 |
1726 /****************************************
1727 * Group 11 : Array instructions *
1728 ****************************************/
1730 lae aar $2==2 && rom(1,3)==1 && rom(1,1)==0 | | | | adi 2 |
1731 lae aar $2==2 && rom(1,3)==1 && rom(1,1)!=0 | | | | adi 2 adp 0-rom(1,1) |
1733 lae aar $2==2 && rom(1,3)==2 && rom(1,1)==0 | SCR_REG |
1735 erase(%[1]) | %[1] | adi 2 |
1736 lae aar $2==2 && rom(1,3)==2 && rom(1,1)!=0 | SCR_REG |
1739 {regconst2,%[1],tostring((0-2)*rom(1,1))} |
1741 lae aar $2==2 && rom(1,3)==4 && rom(1,1)==0 | SCR_REG |
1746 lae aar $2==2 && rom(1,3)==4 && rom(1,1)!=0 | SCR_REG |
1749 {regconst2,%[1],tostring((0-4)*rom(1,1))} |
1751 lae aar $2==2 && rom(1,3)==8 && rom(1,1)==0 | SCR_REG |
1756 lae aar $2==2 && rom(1,3)==8 && rom(1,1)!=0 | SCR_REG |
1759 {regconst2,%[1],tostring((0-8)*rom(1,1))} |
1761 lae aar $2==2 && rom(1,1)==0 && defined(rom(1,3)) | SCR_ODD_REG |
1762 "mul $$%(rom(1,3)%),%[1]"
1766 lae aar $2==2 && defined(rom(1,3)) | SCR_ODD_REG |
1767 "mul $$%(rom(1,3)%),%[1]"
1769 {regconst2,%[1],tostring((0-rom(1,3))*rom(1,1))} |
1778 aar !defined($1) | | remove(all)
1779 "jsr pc,iaar~" | | |
1781 lae sar defined(rom(1,3)) | | | | lae $1 aar $2 sti rom(1,3) |
1782 lae lar defined(rom(1,3)) | | | | lae $1 aar $2 loi rom(1,3) |
1790 sar !defined($1) | | remove(all)
1791 "jsr pc,isar~" | | |
1800 lar !defined($1) | | remove(all)
1801 "jsr pc,ilar~" | | |
1804 /****************************************
1805 * group 12 : Compare instructions *
1806 ****************************************/
1808 cmi $1==2 | source2 source2 |
1809 allocate(REG = {CONST2,0})
1817 erase(%[a]) | %[a] | |
1818 ldc cmi zlt highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 |
1820 ldc cmi zge highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 |
1822 cmi $1==4 | | remove(all)
1823 "jsr pc,cmi4~" | r0 | |
1825 cmi !defined($1) | source2 |
1831 cmf defined($1) | | remove(ALL)
1832 move({CONST2,$1},r0)
1836 cmf !defined($1)| source2 |
1842 cmu $1==2 | | | | cmp |
1843 cmu $1==4 | | remove(all)
1844 "jsr pc,cmu4~" | r0 | |
1845 cmu defined($1) | | remove(all)
1846 move({CONST2,$1},r0)
1847 "jsr pc,cmu~" | r0 | |
1849 cmu !defined($1)| source2 |
1855 cms $1==2 | | | | cmi $1 |
1856 ldc cms zeq $2==4 && loww(1)==0 && highw(1)==0 | source2 SCR_REG |
1860 ldc cms zne $2==4 && loww(1)==0 && highw(1)==0 | source2 SCR_REG |
1864 ldc cms zeq $2==4 | source2 source2 |
1866 "cmp $$%(loww(1)%),%[2]"
1868 "cmp $$%(highw(1)%),%[1]"
1871 ldc cms zne $2==4 | source2 source2 |
1873 "cmp $$%(loww(1)%),%[2]"
1875 "cmp $$%(highw(1)%),%[1]"
1877 cms defined($1) | | remove(all)
1878 move({CONST2,$1},r0)
1882 cms !defined($1)| source2 |
1888 cmp | source2 source2 |
1889 allocate(REG = {CONST2,0})
1897 erase(%[a]) | %[a] | |
1898 tlt and $2==2 | source2 SCR_REG |
1902 erase(%[2]) | %[2] | |
1903 tlt ior $2==2 | source2 SCR_REG |
1907 erase(%[2]) | %[2] | |
1909 allocate(REG={CONST2,0})
1913 erase(%[a]) | %[a] | |
1914 tle and $2==2 | source2 SCR_REG |
1918 erase(%[2]) | %[2] | |
1919 tle ior $2==2 | source2 SCR_REG |
1923 erase(%[2]) | %[2] | |
1925 allocate(REG={CONST2,0})
1929 erase(%[a]) | %[a] | |
1930 teq and $2==2 | source1or2 SCR_REG |
1934 erase(%[2]) | %[2] | |
1935 teq ior $2==2 | source1or2 SCR_REG |
1939 erase(%[2]) | %[2] | |
1941 allocate(REG={CONST2,0})
1945 erase(%[a]) | %[a] | |
1946 tne and $2==2 | source1or2 SCR_REG |
1950 erase(%[2]) | %[2] | |
1951 tne ior $2==2 | source1or2 SCR_REG |
1955 erase(%[2]) | %[2] | |
1957 allocate(REG={CONST2,0})
1961 erase(%[a]) | %[a] | |
1962 tgt and $2==2 | source2 SCR_REG |
1966 erase(%[2]) | %[2] | |
1967 tgt ior $2==2 | source2 SCR_REG |
1971 erase(%[2]) | %[2] | |
1973 allocate(REG={CONST2,0})
1977 erase(%[a]) | %[a] | |
1978 tge and $2==2 | source2 SCR_REG |
1982 erase(%[2]) | %[2] | |
1983 tge ior $2==2 | source2 SCR_REG |
1987 erase(%[2]) | %[2] | |
1989 allocate(REG={CONST2,0})
1993 erase(%[a]) | %[a] | |
1994 and tne $1==2 | source2 source2 |
1995 allocate(REG={CONST2,0})
1999 erase(%[a]) | %[a] | |
2000 and teq $1==2 | source2 source2 |
2001 allocate(REG={CONST2,0})
2005 erase(%[a]) | %[a] | |
2007 cmi tlt and $1==2 && $3==2 | source2 source2 SCR_REG |
2011 erase(%[3]) | %[3] | |
2012 cmi tlt ior $1==2 && $3==2 | source2 source2 SCR_REG |
2016 erase(%[3]) | %[3] | |
2017 cmi tlt $1==2 | source2 source2 |
2018 allocate(REG={CONST2,0})
2022 erase(%[a]) | %[a] | |
2023 cmi tle and $1==2 && $3==2 | source2 source2 SCR_REG |
2027 erase(%[3]) | %[3] | |
2028 cmi tle ior $1==2 && $3==2 | source2 source2 SCR_REG |
2032 erase(%[3]) | %[3] | |
2033 cmi tle $1==2 | source2 source2 |
2034 allocate(REG={CONST2,0})
2038 erase(%[a]) | %[a] | |
2039 cmi teq and $1==2 && $3==2 | source2 source2 SCR_REG |
2043 erase(%[3]) | %[3] | |
2044 cmi teq ior $1==2 && $3==2 | source2 source2 SCR_REG |
2048 erase(%[3]) | %[3] | |
2049 cmi teq $1==2 | source2 source2 |
2050 allocate(REG={CONST2,0})
2054 erase(%[a]) | %[a] | |
2055 loc cmi teq and $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
2059 erase(%[2]) | %[2] | |
2060 ... | | | {CONST2, $1} | cmi 2 teq and 2 |
2061 loc cmi teq ior $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
2065 erase(%[2]) | %[2] | |
2066 ... | | | {CONST2, $1} | cmi 2 teq ior 2 |
2067 loc cmi teq $1>=0 && $1<=127 && $2==2 | NC source1 |
2068 allocate(REG={CONST2,0})
2072 erase(%[a]) | %[a] | |
2073 ... | | | {CONST2, $1} | cmi 2 teq |
2074 cmi tne and $1==2 && $3==2 | source2 source2 SCR_REG |
2078 erase(%[3]) | %[3] | |
2079 cmi tne ior $1==2 && $3==2 | source2 source2 SCR_REG |
2083 erase(%[3]) | %[3] | |
2084 cmi tne $1==2 | source2 source2 |
2085 allocate(REG={CONST2,0})
2089 erase(%[a]) | %[a] | |
2090 loc cmi tne and $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
2094 erase(%[2]) | %[2] | |
2095 ... | | | {CONST2, $1} | cmi 2 tne and 2 |
2096 loc cmi tne ior $1>=0 && $1<=127 && $2==2 && $4==2 | NC source1 SCR_REG |
2100 erase(%[2]) | %[2] | |
2101 ... | | | {CONST2, $1} | cmi 2 tne ior 2 |
2102 loc cmi tne $1>=0 && $1<=127 && $2==2 | NC source1 |
2103 allocate(REG={CONST2,0})
2107 erase(%[a]) | %[a] | |
2108 ... | | | {CONST2, $1} | cmi 2 tne |
2109 cmi tge and $1==2 && $3==2 | source2 source2 SCR_REG |
2113 erase(%[3]) | %[3] | |
2114 cmi tge ior $1==2 && $3==2 | source2 source2 SCR_REG |
2118 erase(%[3]) | %[3] | |
2119 cmi tge $1==2 | source2 source2 |
2120 allocate(REG={CONST2,0})
2124 erase(%[a]) | %[a] | |
2125 cmi tgt and $1==2 && $3==2 | source2 source2 SCR_REG |
2129 erase(%[3]) | %[3] | |
2130 cmi tgt ior $1==2 && $3==2 | source2 source2 SCR_REG |
2134 erase(%[3]) | %[3] | |
2135 cmi tgt $1==2 | source2 source2 |
2136 allocate(REG={CONST2,0})
2140 erase(%[a]) | %[a] | |
2141 cmp tlt | source2 source2 |
2142 allocate(REG={CONST2,0})
2146 erase(%[a]) | %[a] | |
2147 cmp tle | source2 source2 |
2148 allocate(REG={CONST2,0})
2152 erase(%[a]) | %[a] | |
2153 cmp teq | source2 source2 |
2154 allocate(REG={CONST2,0})
2158 erase(%[a]) | %[a] | |
2159 cmp tne | source2 source2 |
2160 allocate(REG={CONST2,0})
2164 erase(%[a]) | %[a] | |
2165 cmp tge | source2 source2 |
2166 allocate(REG={CONST2,0})
2170 erase(%[a]) | %[a] | |
2171 cmp tgt | source2 source2 |
2172 allocate(REG={CONST2,0})
2176 erase(%[a]) | %[a] | |
2177 cmf tlt $1==4 | FLT_REG FLT_REG |
2178 allocate(REG={CONST2,0})
2179 "cmpf %[2],%[1]\ncfcc"
2182 erase(%[a]) | %[a] | |
2183 cmf tle $1==4 | FLT_REG FLT_REG |
2184 allocate(REG={CONST2,0})
2185 "cmpf %[2],%[1]\ncfcc"
2188 erase(%[a]) | %[a] | |
2189 cmf teq $1==4 | FLT_REG FLT_REG |
2190 allocate(REG={CONST2,0})
2191 "cmpf %[2],%[1]\ncfcc"
2194 erase(%[a]) | %[a] | |
2195 cmf tne $1==4 | FLT_REG FLT_REG |
2196 allocate(REG={CONST2,0})
2197 "cmpf %[2],%[1]\ncfcc"
2200 erase(%[a]) | %[a] | |
2201 cmf tgt $1==4 | FLT_REG FLT_REG |
2202 allocate(REG={CONST2,0})
2203 "cmpf %[2],%[1]\ncfcc"
2206 erase(%[a]) | %[a] | |
2207 cmf tge $1==4 | FLT_REG FLT_REG |
2208 allocate(REG={CONST2,0})
2209 "cmpf %[2],%[1]\ncfcc"
2212 erase(%[a]) | %[a] | |
2213 cmf tlt $1==8 | DBL_REG double8 |
2214 allocate(REG={CONST2,0})
2215 "cmpf %[2],%[1]\ncfcc"
2218 erase(%[a]) | %[a] | |
2219 ... | double8 DBL_REG |
2220 allocate(REG={CONST2,0})
2221 "cmpf %[1],%[2]\ncfcc"
2224 erase(%[a]) | %[a] | |
2225 cmf tle $1==8 | DBL_REG double8 |
2226 allocate(REG={CONST2,0})
2227 "cmpf %[2],%[1]\ncfcc"
2230 erase(%[a]) | %[a] | |
2231 ... | double8 DBL_REG |
2232 allocate(REG={CONST2,0})
2233 "cmpf %[1],%[2]\ncfcc"
2236 erase(%[a]) | %[a] | |
2237 cmf teq $1==8 | DBL_REG double8 |
2238 allocate(REG={CONST2,0})
2239 "cmpf %[2],%[1]\ncfcc"
2242 erase(%[a]) | %[a] | |
2243 ... | double8 DBL_REG |
2244 allocate(REG={CONST2,0})
2245 "cmpf %[1],%[2]\ncfcc"
2248 erase(%[a]) | %[a] | |
2249 cmf tne $1==8 | DBL_REG double8 |
2250 allocate(REG={CONST2,0})
2251 "cmpf %[2],%[1]\ncfcc"
2254 erase(%[a]) | %[a] | |
2255 ... | double8 DBL_REG |
2256 allocate(REG={CONST2,0})
2257 "cmpf %[1],%[2]\ncfcc"
2260 erase(%[a]) | %[a] | |
2261 cmf tgt $1==8 | DBL_REG double8 |
2262 allocate(REG={CONST2,0})
2263 "cmpf %[2],%[1]\ncfcc"
2266 erase(%[a]) | %[a] | |
2267 ... | double8 DBL_REG |
2268 allocate(REG={CONST2,0})
2269 "cmpf %[1],%[2]\ncfcc"
2272 erase(%[a]) | %[a] | |
2273 cmf tge $1==8 | DBL_REG double8 |
2274 allocate(REG={CONST2,0})
2275 "cmpf %[2],%[1]\ncfcc"
2278 erase(%[a]) | %[a] | |
2279 ... | double8 DBL_REG |
2280 allocate(REG={CONST2,0})
2281 "cmpf %[1],%[2]\ncfcc"
2284 erase(%[a]) | %[a] | |
2286 /****************************************
2287 * Group 13 : Branch instructions *
2288 ****************************************/
2293 blt | source2 source2 |
2297 ble | source2 source2 |
2301 beq | NC source1 source1 |
2305 ... | source2 source2 |
2309 bne | NC source1 source1 |
2313 ... | source2 source2 |
2317 bge | source2 source2 |
2321 bgt | source2 source2 |
2325 loc beq $1>=0 && $1<=127 | NC source1 |
2329 ... | | | {CONST2, $1} | beq $2 |
2330 loc bne $1>=0 && $1<=127 | NC source1 |
2334 ... | | | {CONST2, $1} | bne $2 |
2365 cmp zlt | source2 source2 |
2369 cmp zle | source2 source2 |
2373 cmp zeq | source2 source2 |
2377 cmp zne | source2 source2 |
2381 cmp zgt | source2 source2 |
2385 cmp zge | source2 source2 |
2389 cmf zlt $1==4 | FLT_REG FLT_REG |
2391 "cmpf %[2],%[1]\ncfcc"
2393 cmf zle $1==4 | FLT_REG FLT_REG |
2395 "cmpf %[2],%[1]\ncfcc"
2397 cmf zeq $1==4 | FLT_REG FLT_REG |
2399 "cmpf %[2],%[1]\ncfcc"
2401 cmf zne $1==4 | FLT_REG FLT_REG |
2403 "cmpf %[2],%[1]\ncfcc"
2405 cmf zgt $1==4 | FLT_REG FLT_REG |
2407 "cmpf %[2],%[1]\ncfcc"
2409 cmf zge $1==4 | FLT_REG FLT_REG |
2411 "cmpf %[2],%[1]\ncfcc"
2413 cmf zlt $1==8 | DBL_REG double8 |
2415 "cmpf %[2],%[1]\ncfcc"
2417 ... | double8 DBL_REG |
2419 "cmpf %[1],%[2]\ncfcc"
2421 cmf zle $1==8 | DBL_REG double8 |
2423 "cmpf %[2],%[1]\ncfcc"
2425 ... | double8 DBL_REG |
2427 "cmpf %[1],%[2]\ncfcc"
2429 cmf zeq $1==8 | DBL_REG double8 |
2431 "cmpf %[2],%[1]\ncfcc"
2433 ... | double8 DBL_REG |
2435 "cmpf %[1],%[2]\ncfcc"
2437 cmf zne $1==8 | DBL_REG double8 |
2439 "cmpf %[2],%[1]\ncfcc"
2441 ... | double8 DBL_REG |
2443 "cmpf %[1],%[2]\ncfcc"
2445 cmf zgt $1==8 | DBL_REG double8 |
2447 "cmpf %[2],%[1]\ncfcc"
2449 ... | double8 DBL_REG |
2451 "cmpf %[1],%[2]\ncfcc"
2453 cmf zge $1==8 | DBL_REG double8 |
2455 "cmpf %[2],%[1]\ncfcc"
2457 ... | double8 DBL_REG |
2459 "cmpf %[1],%[2]\ncfcc"
2462 and zeq $1==2 | source1 source1or2 |
2466 ... | source1or2 source1 |
2470 ... | source2 source2 |
2474 and zne $1==2 | source1 source1or2 |
2478 ... | source1or2 source1 |
2482 ... | source2 source2 |
2487 /************************************************
2488 * group 14 : Procedure call instructions *
2489 ************************************************/
2493 cai | register | remove(ALL)
2494 "jsr pc,(%[1])" | | |
2495 lfr $1==2 | | | r0 | |
2496 lfr $1==4 | | | r1 r0 | |
2497 lfr $1==8 | | | {relative8,"retar"} | |
2499 move({CONST2,$1},r0)
2503 lfr ret $1==$2 | | | | ret 0 |
2506 asp lfr ret $2==$3 | | | | ret 0 |
2507 asp ret $2==0 | | | | ret 0 |
2510 ret $1==0 | | remove(all)
2514 "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
2516 ret $1==2 | source2 |
2522 "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
2531 "mov r5,sp\nmov (sp)+,r5\nrts pc" | | |
2533 ret $1==8 | | | {ADDR_EXTERNAL, "retar"} | sti 8 ret 0 |
2535 move({CONST2,$1},r0)
2538 /************************************************
2539 * Group 15 : Miscellaneous instructions *
2540 ************************************************/
2542 asp $1==2 | NC xsource2 | | | |
2545 asp $1==4 | | remove(all)
2546 "cmp (sp)+,(sp)+" | | |
2547 asp $1==0-2 | | remove(all)
2551 ass $1==2 | | remove(all)
2552 "add (sp)+,sp" | | |
2554 ass !defined($1)| source2 |
2557 "beq 1f;jmp unknown~;1:"
2558 "add (sp)+,sp" | | |
2561 blm $1==4 | SCR_REG SCR_REG |
2562 "mov (%[2])+,(%[1])+"
2564 erase(%[1]) erase(%[2]) | | |
2565 blm $1==6 | SCR_REG SCR_REG |
2566 "mov (%[2])+,(%[1])+"
2567 "mov (%[2])+,(%[1])+"
2569 erase(%[1]) erase(%[2]) | | |
2570 blm $1==8 | SCR_REG SCR_REG |
2571 "mov (%[2])+,(%[1])+"
2572 "mov (%[2])+,(%[1])+"
2573 "mov (%[2])+,(%[1])+"
2575 erase(%[1]) erase(%[2]) | | |
2576 blm | SCR_REG SCR_REG |
2577 allocate(REG={CONST2,$1/2})
2578 "1:mov (%[2])+,(%[1])+\nsob %[a],1b"
2579 erase(%[1]) erase (%[2]) erase(%[a]) | | |
2580 bls $1==2 | SCR_REG SCR_REG SCR_REG |
2582 "1:mov (%[3])+,(%[2])+\nsob %[1],1b\n2:"
2583 erase(%[1]) erase (%[2]) erase(%[3]) | | |
2585 bls !defined($1)| source2 SCR_REG SCR_REG SCR_REG |
2588 "beq 1f;jmp unknown~;1:"
2590 "1:mov (%[4])+,(%[3])+\nsob %[2],1b\n2:"
2591 erase(%[2]) erase (%[3]) erase(%[4]) | | |
2593 lae csa $2==2 | source2 |
2596 move({ADDR_EXTERNAL,$1},r0)
2604 csa !defined($1)| source2 |
2607 "beq 1f;jmp unknown~;1:"
2612 lae csb $2==2 | NC source2 |
2615 move({ADDR_EXTERNAL,$1},r0)
2619 move({ADDR_EXTERNAL,$1},r0)
2629 csb !defined($1)| source2 |
2632 "beq 1f;jmp unknown~;1:"
2637 dup $1==2 | register | | %[1] %[1] | |
2638 dup $1==4 | NC longf4 | | %[1] %[1] | |
2639 ... | source2 source2 | | %[2] %[1] %[2] %[1] | |
2640 dup $1==8 | NC double8| | %[1] %[1] | |
2642 move({CONST2, $1}, r0)
2646 move({CONST2, $1}, r0)
2649 dus $1==2 | source2 |
2655 dus !defined($1)| source2 |
2658 "beq 1f;jmp unknown~;1:"
2666 fil | | "mov $$$1,hol0+4" | | |
2667 lim | | | { relative2, "trpim~"} | |
2668 lin | | "mov $$$1,hol0" | | |
2669 lni | | "inc hol0" | | |
2670 lor $1==0 | | | lb | |
2671 lor $1==1 | | remove(all)
2673 "mov sp,%[a]" | %[a] | |
2674 lor $1==2 | | | {relative2,"reghp~"} | |
2683 rck $1==2 | source2 |
2688 rck !defined($1)| source2 source2 |
2691 "beq 1f;jmp unknown~;1:"
2696 rck $1==2 | source2 | | | |
2697 rck !defined($1)| source2 source2 | | | |
2702 move({relative2,"trppc~"},%[a])
2703 "mov %[1],trppc~" | %[a] | |
2706 str $1==0 | source2 |
2708 str $1==1 | source2 |
2711 str $1==2 | | remove(all)
2712 "jsr pc,strhp~" | | |
2715 exg $1==2 | source2 source2 | | %[1] %[2] | |
2716 exg defined($1) | | remove(all)
2717 move({CONST2,$1},r0)
2719 exg | source2 | remove(all)
2723 lol lal sti $1==$2 && $3==1| | | | | /* throw away funny C-proc-prolog */
2725 /********************************
2728 * From EM-tokens to PDP-tokens *
2729 ********************************/
2731 | LOCAL2 | | {regind2,lb,tostring(%[1.ind])} | |
2732 | LOCAL4 | | {regind4,lb,tostring(%[1.ind])} | |
2734 /********************************
2735 * From source to register *
2736 ********************************/
2738 | regconst2 | allocate(%[1],REG=%[1.reg])
2739 "add $$%[1.ind],%[a]"
2740 setcc(%[a]) | %[a] | |(6,105)
2741 | ADDR_LOCAL | allocate(REG)
2743 "add $$%[1.ind],%[a]"
2744 setcc(%[a]) | %[a] | |(6,105)
2745 | register | | {regconst2, %[1], "0"} | | (2,60)
2746 | xsource2 | allocate(%[1], REG=%[1]) | %[a] | |
2747 | xsource2 | allocate(%[1], REG=%[1]) | {regconst2, %[a], "0"} | |
2748 | longf4 | allocate(FLT_REG)
2749 move( %[1],%[a]) | %[a] | | (20,2000) + %[1]
2750 | double8 | allocate(DBL_REG)
2751 move(%[1],%[a]) | %[a] | | (20,3000) + %[1]
2753 /********************************
2754 * From source1 to source2 *
2755 ********************************/
2757 | source1 | allocate(REG={CONST2,0})
2759 erase(%[a]) setcc(%[a]) | %[a] | | (6,105)+%[1]
2761 /********************************
2762 * From long4 to source2 *
2763 ********************************/
2765 | REG_PAIR | | %[1.2] %[1.1] | |
2766 | regind4 | | {regind2,%[1.reg],"2+"+%[1.ind]} {regind2,%[1.reg],%[1.ind]} | |
2767 | relative4 | | {relative2,"2+"+%[1.ind]} {relative2,%[1.ind]} | |
2768 | regdef4 | | {regind2,%[1.reg],"2"} {regdef2,%[1.reg]} | |
2769 | LOCAL4 | | {LOCAL2, %[1.ind]+2, 2} {LOCAL2, %[1.ind], 2} | |
2771 /********************************
2772 * from double8 to long4 *
2773 ********************************/
2775 | regind8 | | {regind4,%[1.reg],"4+"+%[1.ind]} {regind4,%[1.reg],%[1.ind]} | |
2776 | relative8 | | {relative4,"4+"+%[1.ind]} {relative4,%[1.ind]} | |
2777 | regdef8 | | {regdef4,%[1.reg]} {regind4,%[1.reg],"4"} | |
2781 /************************
2782 * From STACK coercions *
2783 ************************/
2785 | STACK | allocate(REG)
2787 setcc(%[a]) | %[a] | | (2,75)
2788 | STACK | allocate(REG)
2790 setcc(%[a]) | {regconst2, %[a], "0"} | | (2,75)
2791 | STACK | allocate(FLT_REG)
2793 samecc | %[a] | | (20,4740) /* /10 */
2794 | STACK | allocate(DBL_REG)
2796 samecc | %[a] | | (20,6920) /* /10 */
2797 | STACK | allocate(REG_PAIR)
2800 setcc(%[a.2]) | %[a] | | (4,150)
2803 (CONST2 %[num] == 0, source2, "clr %[2]" setcc(%[2]),(2,30))
2804 (source2, source2, "mov %[1],%[2]" setcc(%[2]),(2,30)+%[1]+%[2])
2805 (FLT_REG, longf4-FLT_REG,"movfo %[1],%[2]" samecc, (2,88) + %[2])
2806 (longf4-FLT_REG,FLT_REG, "movof %[1],%[2]" samecc, (2,150) + %[2])
2807 (FLT_REG, FLT_REG, "movf %[1],%[2]" samecc,(2,88))
2808 (DBL_REG,double8, "movf %[1],%[2]" samecc,(2,88) + %[2])
2809 (double8,DBL_REG, "movf %[1],%[2]" samecc,(2,170) + %[1])
2810 (CONST2 %[num] == 0,source1, "clrb %[2]" setcc(%[2]),(2,45)+%[2])
2811 (source1or2,source1, "movb %[1],%[2]" setcc(%[2]),(2,30)+%[1]+%[2])
2812 (ftoint,source2, "movfi %[1.reg],%[2]" samecc)
2815 (source2, "tst %[1]" ,(2,30) + %[1])
2816 (source1, "tstb %[1]",(2,40) + %[1])
2817 (FLT_REG+DBL_REG, "tstf %[1]\ncfcc" ,(4,260))
2818 /* (DBL_REG, "tstf %[1]\ncfcc" ,(4,260)) */
2821 ( CONST2 %[num]==0 ,, "clr -(sp)" )
2822 ( source2 ,, "mov %[1],-(sp)" setcc(%[1]), (2,90)+%[1])
2823 ( regconst2 ,, "mov %[1.reg],-(sp)\nadd $$%[1.ind],(sp)" , (6,225))
2824 ( ADDR_LOCAL,, "mov r5,-(sp)" "add $$%[1.ind],(sp)", (6,225))
2825 ( DBL_REG ,, "movf %[1],-(sp)" samecc , (2,610))
2826 ( FLT_REG ,, "movfo %[1],-(sp)" samecc , (2,412))
2827 ( REG_PAIR ,, "mov %[1.2],-(sp)" "mov %[1.1],-(sp)" , (4,180))
2828 ( regind4 ,, "mov 2+%[1.ind](%[1.reg]),-(sp)"
2829 "mov %[1.ind](%[1.reg]),-(sp)" , (8,300))
2830 ( relative4 ,, "mov 2+%[1.ind],-(sp)"
2831 "mov %[1.ind],-(sp)" , (8,300))
2832 ( regdef4 ,, "mov 2(%[1.reg]),-(sp)"
2833 "mov (%[1.reg]),-(sp)" , (6,270))
2834 ( regind8 ,REG, move(%[1.reg],%[a])
2835 "add $$%(8%)+%[1.ind],%[a]"
2840 erase(%[a]) , (14,600))
2841 ( regind8 ,, "mov 6+%[1.ind](%[1.reg]),-(sp)"
2842 "mov 4+%[1.ind](%[1.reg]),-(sp)"
2843 "mov 2+%[1.ind](%[1.reg]),-(sp)"
2844 "mov %[1.ind](%[1.reg]),-(sp)" , (16,600))
2845 ( relative8 ,REG,"mov $$%(8%)+%[1.ind],%[a]"
2849 "mov -(%[a]),-(sp)" , (12,500))
2850 ( relative8 ,, "mov 6+%[1.ind],-(sp)"
2851 "mov 4+%[1.ind],-(sp)"
2852 "mov 2+%[1.ind],-(sp)"
2853 "mov %[1.ind],-(sp)" , (16,600))
2854 ( regdef8 ,, "mov 6(%[1.reg]),-(sp)"
2855 "mov 4(%[1.reg]),-(sp)"
2856 "mov 2(%[1.reg]),-(sp)"
2857 "mov (%[1.reg]),-(sp)" , (14,570))
2858 ( LOCAL4 ,, "mov 2+%[1.ind](r5),-(sp)"
2859 "mov %[1.ind](r5),-(sp)" , (8,300))
2860 ( source1 ,, "clr -(sp)"
2861 "movb %[1],(sp)" , (4,180)+%[1])
2862 ( ftoint ,, "movfi %[1.reg],-(sp)" )
2863 ( ftolong ,, "setl\nmovfi %[1.reg],-(sp)\nseti" )