cpu/
[deliverable/binutils-gdb.git] / cpu / frv.cpu
1 ; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*-
2 ;
3 ; Copyright 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
4 ;
5 ; Contributed by Red Hat Inc; developed under contract from Fujitsu.
6 ;
7 ; This file is part of the GNU Binutils.
8 ;
9 ; This program is free software; you can redistribute it and/or modify
10 ; it under the terms of the GNU General Public License as published by
11 ; the Free Software Foundation; either version 2 of the License, or
12 ; (at your option) any later version.
13 ;
14 ; This program is distributed in the hope that it will be useful,
15 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ; GNU General Public License for more details.
18 ;
19 ; You should have received a copy of the GNU General Public License
20 ; along with this program; if not, write to the Free Software
21 ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 (include "simplify.inc")
24
25 ; define-arch must appear first
26
27 (define-arch
28 (name frv) ; name of cpu architecture
29 (comment "Fujitsu FRV")
30 (insn-lsb0? #t)
31 (machs frv fr550 fr500 fr400 tomcat simple)
32 (isas frv)
33 )
34
35 (define-isa
36 (name frv)
37 (base-insn-bitsize 32)
38 ; Initial bitnumbers to decode insns by.
39 (decode-assist (24 23 22 21 20 19 18))
40 (liw-insns 1) ; The frv fetches up to 1 insns at a time.
41 (parallel-insns 8) ; The frv executes up to 8 insns at a time.
42 )
43
44 ; Cpu family definitions.
45 ;
46 (define-cpu
47 ; cpu names must be distinct from the architecture name and machine names.
48 ; The "b" suffix stands for "base" and is the convention.
49 ; The "f" suffix stands for "family" and is the convention.
50 (name frvbf)
51 (comment "Fujitsu FRV base family")
52 (endian big)
53 (word-bitsize 32)
54 )
55 \f
56 ; Generic FR-V machine. Supports the entire architecture
57 (define-mach
58 (name frv)
59 (comment "Generic FRV cpu")
60 (cpu frvbf)
61 )
62 (define-model
63 (name frv) (comment "Generic FRV model") (attrs)
64 (mach frv)
65
66 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
67
68 ; `state' is a list of variables for recording model state
69 ; (state)
70
71 (unit u-exec "Execution Unit" ()
72 1 1 ; issue done
73 () ; state
74 () ; inputs
75 () ; outputs
76 () ; profile action (default)
77 )
78 )
79 \f
80 ; FR550 machine
81 (define-mach
82 (name fr550)
83 (comment "FR550 cpu")
84 (cpu frvbf)
85 )
86 (define-model
87 (name fr550) (comment "FR550 model") (attrs)
88 (mach fr550)
89
90 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
91
92 ; `state' is a list of variables for recording model state
93 (state
94 ; State items
95 ; These are all masks with each bit representing one register.
96 (prev-fr-load DI) ; Previous use of FR register was target of a load
97 (prev-fr-complex-1 DI) ; Previous use of FR register has variable latency
98 (prev-fr-complex-2 DI) ; Previous use of FR register has variable latency
99 (prev-ccr-complex DI) ; Previous use of CCR register has variable latency
100 (prev-acc-mmac DI) ; Previous use of ACC register was a MMAC category
101 (cur-fr-load DI) ; Current use of FR register was target of a load
102 (cur-fr-complex-1 DI) ; Current use of FR register has variable latency
103 (cur-fr-complex-2 DI) ; Current use of FR register has variable latency
104 (cur-ccr-complex SI) ; Current use of CCR register has variable latency
105 (cur-acc-mmac DI) ; Current use of ACC register was a MMAC category
106 )
107 ; Basic unit for instructions with no latency penalties
108 (unit u-exec "Execution Unit" ()
109 1 1 ; issue done
110 () ; state
111 () ; inputs
112 () ; outputs
113 () ; profile action (default)
114 )
115 ; Basic integer insn unit
116 (unit u-integer "Integer Unit" ()
117 1 1 ; issue done
118 () ; state
119 ((GRi INT -1) (GRj INT -1)) ; inputs
120 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
121 () ; profile action (default)
122 )
123 ; Integer multiplication unit
124 (unit u-imul "Integer Multiplication Unit" ()
125 1 1 ; issue done
126 () ; state
127 ((GRi INT -1) (GRj INT -1)) ; inputs
128 ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
129 () ; profile action (default)
130 )
131 ; Integer division unit
132 (unit u-idiv "Integer Division Unit" ()
133 1 1 ; issue done
134 () ; state
135 ((GRi INT -1) (GRj INT -1)) ; inputs
136 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
137 () ; profile action (default)
138 )
139 ; Branch unit
140 (unit u-branch "Branch Unit" ()
141 1 1 ; issue done
142 () ; state
143 ((GRi INT -1) (GRj INT -1)
144 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
145 ((pc)) ; outputs
146 () ; profile action (default)
147 )
148 ; Trap unit
149 (unit u-trap "Trap Unit" ()
150 1 1 ; issue done
151 () ; state
152 ((GRi INT -1) (GRj INT -1)
153 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
154 () ; outputs
155 () ; profile action (default)
156 )
157 ; Condition code check unit
158 (unit u-check "Check Unit" ()
159 1 1 ; issue done
160 () ; state
161 ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
162 () ; outputs
163 () ; profile action (default)
164 )
165 ; Float Arithmetic unit
166 (unit u-float-arith "Float Arithmetic unit" ()
167 1 1 ; issue done
168 () ; state
169 ((FRi INT -1) (FRj INT -1) ; inputs
170 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
171 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
172 () ; profile action (default)
173 )
174 ; Float Dual Arithmetic unit
175 (unit u-float-dual-arith "Float Arithmetic unit" ()
176 ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI
177 1 3 ; issue done
178 () ; state
179 ((FRi INT -1) (FRj INT -1) ; inputs
180 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
181 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
182 () ; profile action (default)
183 )
184 ; Float Div unit
185 (unit u-float-div "Float Div unit" ()
186 1 1 ; issue done
187 () ; state
188 ((FRi INT -1) (FRj INT -1)) ; inputs
189 ((FRk INT -1)) ; outputs
190 () ; profile action (default)
191 )
192 ; Float Square Root unit
193 (unit u-float-sqrt "Float Square Root unit" ()
194 1 1 ; issue done
195 () ; state
196 ((FRj INT -1) (FRdoublej INT -1)) ; inputs
197 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
198 () ; profile action (default)
199 )
200 ; Float Compare unit
201 (unit u-float-compare "Float Compare unit" ()
202 1 1 ; issue done
203 () ; state
204 ((FRi INT -1) (FRj INT -1)
205 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
206 ((FCCi_2 INT -1)) ; outputs
207 () ; profile action (default)
208 )
209 ; Dual Float Compare unit
210 (unit u-float-dual-compare "Float Dual Compare unit" ()
211 ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI
212 1 3 ; issue done
213 () ; state
214 ((FRi INT -1) (FRj INT -1)) ; inputs
215 ((FCCi_2 INT -1)) ; outputs
216 () ; profile action (default)
217 )
218 ; FR Move to GR unit
219 (unit u-fr2gr "FR Move to GR Unit" ()
220 1 1 ; issue done
221 () ; state
222 ((FRintk INT -1)) ; inputs
223 ((GRj INT -1)) ; outputs
224 () ; profile action (default)
225 )
226 ; GR Move to FR unit
227 (unit u-gr2fr "GR Move to FR Unit" ()
228 1 1 ; issue done
229 () ; state
230 ((GRj INT -1)) ; inputs
231 ((FRintk INT -1)) ; outputs
232 () ; profile action (default)
233 )
234 ; SPR Move to GR unit
235 (unit u-spr2gr "SPR Move to GR Unit" ()
236 1 1 ; issue done
237 () ; state
238 ((spr INT -1)) ; inputs
239 ((GRj INT -1)) ; outputs
240 () ; profile action (default)
241 )
242 ; GR Move to SPR unit
243 (unit u-gr2spr "GR Move to SPR Unit" ()
244 1 1 ; issue done
245 () ; state
246 ((GRj INT -1)) ; inputs
247 ((spr INT -1)) ; outputs
248 () ; profile action (default)
249 )
250 ; GR set half unit
251 (unit u-set-hilo "GR Set Half" ()
252 1 1 ; issue done
253 () ; state
254 () ; inputs
255 ((GRkhi INT -1) (GRklo INT -1)) ; outputs
256 () ; profile action (default)
257 )
258 ; GR load unit
259 (unit u-gr-load "GR Load Unit" ()
260 1 1 ; issue done
261 () ; state
262 ((GRi INT -1) (GRj INT -1)) ; inputs
263 ((GRk INT -1) (GRdoublek INT -1)) ; outputs
264 () ; profile action (default)
265 )
266 ; GR store unit
267 (unit u-gr-store "GR Store Unit" ()
268 1 1 ; issue done
269 () ; state
270 ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
271 () ; outputs
272 () ; profile action (default)
273 )
274 ; FR load unit
275 (unit u-fr-load "FR Load Unit" ()
276 1 1 ; issue done
277 () ; state
278 ((GRi INT -1) (GRj INT -1)) ; inputs
279 ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
280 () ; profile action (default)
281 )
282 ; FR store unit
283 (unit u-fr-store "FR Store Unit" ()
284 1 1 ; issue done
285 () ; state
286 ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
287 () ; outputs
288 () ; profile action (default)
289 )
290 ; Swap unit
291 (unit u-swap "Swap Unit" ()
292 1 1 ; issue done
293 () ; state
294 ((GRi INT -1) (GRj INT -1)) ; inputs
295 ((GRk INT -1)) ; outputs
296 () ; profile action (default)
297 )
298 ; FR Move to FR unit
299 (unit u-fr2fr "FR Move to FR Unit" ()
300 1 1 ; issue done
301 () ; state
302 ((FRi INT -1)) ; inputs
303 ((FRk INT -1)) ; outputs
304 () ; profile action (default)
305 )
306 ; Clrgr unit
307 (unit u-clrgr "Clrgr Unit" ()
308 1 1 ; issue done
309 () ; state
310 ((GRk INT -1)) ; inputs
311 () ; outputs
312 () ; profile action (default)
313 )
314 ; Clrfr unit
315 (unit u-clrfr "Clrfr Unit" ()
316 1 1 ; issue done
317 () ; state
318 ((FRk INT -1)) ; inputs
319 () ; outputs
320 () ; profile action (default)
321 )
322 ; Insn cache invalidate unit
323 (unit u-ici "Insn cache invalidate unit" ()
324 1 1 ; issue done
325 () ; state
326 ((GRi INT -1) (GRj INT -1)) ; inputs
327 () ; outputs
328 () ; profile action (default)
329 )
330 ; Data cache invalidate unit
331 (unit u-dci "Data cache invalidate unit" ()
332 1 1 ; issue done
333 () ; state
334 ((GRi INT -1) (GRj INT -1)) ; inputs
335 () ; outputs
336 () ; profile action (default)
337 )
338 ; Data cache flush unit
339 (unit u-dcf "Data cache flush unit" ()
340 1 1 ; issue done
341 () ; state
342 ((GRi INT -1) (GRj INT -1)) ; inputs
343 () ; outputs
344 () ; profile action (default)
345 )
346 ; Insn cache preload unit
347 (unit u-icpl "Insn cache preload unit" ()
348 1 1 ; issue done
349 () ; state
350 ((GRi INT -1) (GRj INT -1)) ; inputs
351 () ; outputs
352 () ; profile action (default)
353 )
354 ; Data cache preload unit
355 (unit u-dcpl "Data cache preload unit" ()
356 1 1 ; issue done
357 () ; state
358 ((GRi INT -1) (GRj INT -1)) ; inputs
359 () ; outputs
360 () ; profile action (default)
361 )
362 ; Insn cache unlock unit
363 (unit u-icul "Insn cache unlock unit" ()
364 1 1 ; issue done
365 () ; state
366 ((GRi INT -1) (GRj INT -1)) ; inputs
367 () ; outputs
368 () ; profile action (default)
369 )
370 ; Data cache unlock unit
371 (unit u-dcul "Data cache unlock unit" ()
372 1 1 ; issue done
373 () ; state
374 ((GRi INT -1) (GRj INT -1)) ; inputs
375 () ; outputs
376 () ; profile action (default)
377 )
378 ; commit unit
379 (unit u-commit "Commit Unit" ()
380 1 1 ; issue done
381 () ; state
382 ((GRk INT -1) (FRk INT -1)) ; inputs
383 () ; outputs
384 () ; profile action (default)
385 )
386 ; Float Conversion unit
387 (unit u-float-convert "Float Conversion unit" ()
388 1 1 ; issue done
389 () ; state
390 ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs
391 ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs
392 () ; profile action (default)
393 )
394 ; Media units
395 (unit u-media "Media unit" ()
396 1 1 ; issue done
397 () ; state
398 ((FRinti INT -1) (FRintj INT -1)) ; inputs
399 ((FRintk INT -1)) ; outputs
400 () ; profile action (default)
401 )
402 (unit u-media-quad "Media-quad unit" ()
403 1 1 ; issue done
404 () ; state
405 ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs
406 ((FRintkeven INT -1)) ; outputs
407 () ; profile action (default)
408 )
409 (unit u-media-dual-expand "Media Dual Expand unit" ()
410 1 1 ; issue done
411 () ; state
412 ((FRinti INT -1)) ; inputs
413 ((FRintkeven INT -1)) ; outputs
414 () ; profile action (default)
415 )
416 (unit u-media-3-dual "Media-3-dual unit" ()
417 1 1 ; issue done
418 () ; state
419 ((FRinti INT -1)) ; inputs
420 ((FRintk INT -1)) ; outputs
421 () ; profile action (default)
422 )
423 (unit u-media-3-acc "Media unit for M-3 using ACC" ()
424 1 1 ; issue done
425 () ; state
426 ((FRintj INT -1) (ACC40Si INT -1)) ; inputs
427 ((FRintk INT -1)) ; outputs
428 () ; profile action (default)
429 )
430 (unit u-media-3-acc-dual "Media-3-acc-dual unit" ()
431 1 1 ; issue done
432 () ; state
433 ((ACC40Si INT -1)) ; inputs
434 ((FRintkeven INT -1)) ; outputs
435 () ; profile action (default)
436 )
437 (unit u-media-3-wtacc "Media-3-wtacc unit" ()
438 1 1 ; issue done
439 () ; state
440 ((FRinti INT -1) (ACC40Sk INT -1)) ; inputs
441 () ; outputs
442 () ; profile action (default)
443 )
444 (unit u-media-3-mclracc "Media-3-mclracc unit" ()
445 1 1 ; issue done
446 () ; state
447 () ; inputs
448 () ; outputs
449 () ; profile action (default)
450 )
451 (unit u-media-set "Media set" ()
452 1 1 ; issue done
453 () ; state
454 () ; inputs
455 ((FRintk INT -1)) ; outputs
456 () ; profile action (default)
457 )
458 (unit u-media-4 "Media-4 unit" ()
459 1 1 ; issue done
460 () ; state
461 ((FRinti INT -1) (FRintj INT -1)) ; inputs
462 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
463 () ; profile action (default)
464 )
465 (unit u-media-4-acc "Media-4-acc unit" ()
466 1 1 ; issue done
467 () ; state
468 ((ACC40Si INT -1)) ; inputs
469 ((ACC40Sk INT -1)) ; outputs
470 () ; profile action (default)
471 )
472 (unit u-media-4-acc-dual "Media-4-acc-dual unit" ()
473 1 1 ; issue done
474 () ; state
475 ((ACC40Si INT -1)) ; inputs
476 ((ACC40Sk INT -1)) ; outputs
477 () ; profile action (default)
478 )
479 (unit u-media-4-add-sub "Media-4-add-sub unit" ()
480 1 1 ; issue done
481 () ; state
482 ((ACC40Si INT -1)) ; inputs
483 ((ACC40Sk INT -1)) ; outputs
484 () ; profile action (default)
485 )
486 (unit u-media-4-add-sub-dual "Media-4-add-sub-dual unit" ()
487 1 1 ; issue done
488 () ; state
489 ((ACC40Si INT -1)) ; inputs
490 ((ACC40Sk INT -1)) ; outputs
491 () ; profile action (default)
492 )
493 (unit u-media-4-quad "Media-4-quad unit" ()
494 1 1 ; issue done
495 () ; state
496 ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs
497 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
498 () ; profile action (default)
499 )
500 )
501
502 ; FR500 machine.
503 (define-mach
504 (name fr500)
505 (comment "FR500 cpu")
506 (cpu frvbf)
507 )
508 (define-model
509 (name fr500) (comment "FR500 model") (attrs)
510 (mach fr500)
511
512 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
513
514 ; `state' is a list of variables for recording model state
515 (state
516 ; State items
517 ; These are all masks with each bit representing one register.
518 (prev-fpop DI) ; Previous use of FR register was floating point insn
519 (prev-media DI) ; Previous use of FR register was a media insn
520 (prev-cc-complex DI) ; Previous use of ICC register was not simple
521 (cur-fpop DI) ; Current use of FR register was floating point insn
522 (cur-media DI) ; Current use of FR register was a media insn
523 (cur-cc-complex DI) ; Current use of ICC register was not simple
524 )
525 ; Basic unit for instructions with no latency penalties
526 (unit u-exec "Execution Unit" ()
527 1 1 ; issue done
528 () ; state
529 () ; inputs
530 () ; outputs
531 () ; profile action (default)
532 )
533 ; Basic integer insn unit
534 (unit u-integer "Integer Unit" ()
535 1 1 ; issue done
536 () ; state
537 ((GRi INT -1) (GRj INT -1)) ; inputs
538 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
539 () ; profile action (default)
540 )
541 ; Integer multiplication unit
542 (unit u-imul "Integer Multiplication Unit" ()
543 1 1 ; issue done
544 () ; state
545 ((GRi INT -1) (GRj INT -1)) ; inputs
546 ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
547 () ; profile action (default)
548 )
549 ; Integer division unit
550 (unit u-idiv "Integer Division Unit" ()
551 1 1 ; issue done
552 () ; state
553 ((GRi INT -1) (GRj INT -1)) ; inputs
554 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
555 () ; profile action (default)
556 )
557 ; Branch unit
558 (unit u-branch "Branch Unit" ()
559 1 1 ; issue done
560 () ; state
561 ((GRi INT -1) (GRj INT -1)
562 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
563 ((pc)) ; outputs
564 () ; profile action (default)
565 )
566 ; Trap unit
567 (unit u-trap "Trap Unit" ()
568 1 1 ; issue done
569 () ; state
570 ((GRi INT -1) (GRj INT -1)
571 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
572 () ; outputs
573 () ; profile action (default)
574 )
575 ; Condition code check unit
576 (unit u-check "Check Unit" ()
577 1 1 ; issue done
578 () ; state
579 ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
580 () ; outputs
581 () ; profile action (default)
582 )
583 ; Clrgr unit
584 (unit u-clrgr "Clrgr Unit" ()
585 1 1 ; issue done
586 () ; state
587 ((GRk INT -1)) ; inputs
588 () ; outputs
589 () ; profile action (default)
590 )
591 ; Clrfr unit
592 (unit u-clrfr "Clrfr Unit" ()
593 1 1 ; issue done
594 () ; state
595 ((FRk INT -1)) ; inputs
596 () ; outputs
597 () ; profile action (default)
598 )
599 ; GR set half unit
600 (unit u-set-hilo "GR Set Half" ()
601 1 1 ; issue done
602 () ; state
603 () ; inputs
604 ((GRkhi INT -1) (GRklo INT -1)) ; outputs
605 () ; profile action (default)
606 )
607 ; GR load unit -- TODO doesn't handle quad
608 (unit u-gr-load "GR Load Unit" ()
609 1 1 ; issue done
610 () ; state
611 ((GRi INT -1) (GRj INT -1)) ; inputs
612 ((GRk INT -1) (GRdoublek INT -1)) ; outputs
613 () ; profile action (default)
614 )
615 ; GR store unit -- TODO doesn't handle quad
616 (unit u-gr-store "GR Store Unit" ()
617 1 1 ; issue done
618 () ; state
619 ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
620 () ; outputs
621 () ; profile action (default)
622 )
623 ; GR recovering store unit -- TODO doesn't handle quad
624 (unit u-gr-r-store "GR Recovering Store Unit" ()
625 1 1 ; issue done
626 () ; state
627 ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
628 () ; outputs
629 () ; profile action (default)
630 )
631 ; FR load unit -- TODO doesn't handle quad
632 (unit u-fr-load "FR Load Unit" ()
633 1 1 ; issue done
634 () ; state
635 ((GRi INT -1) (GRj INT -1)) ; inputs
636 ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
637 () ; profile action (default)
638 )
639 ; FR store unit -- TODO doesn't handle quad
640 (unit u-fr-store "FR Store Unit" ()
641 1 1 ; issue done
642 () ; state
643 ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
644 () ; outputs
645 () ; profile action (default)
646 )
647 ; FR recovering store unit -- TODO doesn't handle quad
648 (unit u-fr-r-store "FR Recovering Store Unit" ()
649 1 1 ; issue done
650 () ; state
651 ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
652 () ; outputs
653 () ; profile action (default)
654 )
655 ; Swap unit
656 (unit u-swap "Swap Unit" ()
657 1 1 ; issue done
658 () ; state
659 ((GRi INT -1) (GRj INT -1)) ; inputs
660 ((GRk INT -1)) ; outputs
661 () ; profile action (default)
662 )
663 ; FR Move to FR unit
664 (unit u-fr2fr "FR Move to FR Unit" ()
665 1 1 ; issue done
666 () ; state
667 ((FRi INT -1)) ; inputs
668 ((FRk INT -1)) ; outputs
669 () ; profile action (default)
670 )
671 ; FR Move to GR unit
672 (unit u-fr2gr "FR Move to GR Unit" ()
673 1 1 ; issue done
674 () ; state
675 ((FRintk INT -1)) ; inputs
676 ((GRj INT -1)) ; outputs
677 () ; profile action (default)
678 )
679 ; SPR Move to GR unit
680 (unit u-spr2gr "SPR Move to GR Unit" ()
681 1 1 ; issue done
682 () ; state
683 ((spr INT -1)) ; inputs
684 ((GRj INT -1)) ; outputs
685 () ; profile action (default)
686 )
687 ; GR Move to FR unit
688 (unit u-gr2fr "GR Move to FR Unit" ()
689 1 1 ; issue done
690 () ; state
691 ((GRj INT -1)) ; inputs
692 ((FRintk INT -1)) ; outputs
693 () ; profile action (default)
694 )
695 ; GR Move to SPR unit
696 (unit u-gr2spr "GR Move to SPR Unit" ()
697 1 1 ; issue done
698 () ; state
699 ((GRj INT -1)) ; inputs
700 ((spr INT -1)) ; outputs
701 () ; profile action (default)
702 )
703 ; Float Arithmetic unit
704 (unit u-float-arith "Float Arithmetic unit" ()
705 1 1 ; issue done
706 () ; state
707 ((FRi INT -1) (FRj INT -1) ; inputs
708 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
709 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
710 () ; profile action (default)
711 )
712 ; Float Dual Arithmetic unit
713 (unit u-float-dual-arith "Float Arithmetic unit" ()
714 1 1 ; issue done
715 () ; state
716 ((FRi INT -1) (FRj INT -1) ; inputs
717 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
718 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
719 () ; profile action (default)
720 )
721 ; Float Div unit
722 (unit u-float-div "Float Div unit" ()
723 1 1 ; issue done
724 () ; state
725 ((FRi INT -1) (FRj INT -1)) ; inputs
726 ((FRk INT -1)) ; outputs
727 () ; profile action (default)
728 )
729 ; Float Square Root unit
730 (unit u-float-sqrt "Float Square Root unit" ()
731 1 1 ; issue done
732 () ; state
733 ((FRj INT -1) (FRdoublej INT -1)) ; inputs
734 ((FRk INT -1) (FRdoublek INT -1)) ; outputs
735 () ; profile action (default)
736 )
737 ; Float Dual Square Root unit
738 (unit u-float-dual-sqrt "Float Dual Square Root unit" ()
739 1 1 ; issue done
740 () ; state
741 ((FRj INT -1)) ; inputs
742 ((FRk INT -1)) ; outputs
743 () ; profile action (default)
744 )
745 ; Float Compare unit
746 (unit u-float-compare "Float Compare unit" ()
747 1 1 ; issue done
748 () ; state
749 ((FRi INT -1) (FRj INT -1)
750 (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs
751 ((FCCi_2 INT -1)) ; outputs
752 () ; profile action (default)
753 )
754 ; Dual Float Compare unit
755 (unit u-float-dual-compare "Float Dual Compare unit" ()
756 1 1 ; issue done
757 () ; state
758 ((FRi INT -1) (FRj INT -1)) ; inputs
759 ((FCCi_2 INT -1)) ; outputs
760 () ; profile action (default)
761 )
762 ; Float Conversion unit
763 (unit u-float-convert "Float Conversion unit" ()
764 1 1 ; issue done
765 () ; state
766 ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs
767 ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs
768 () ; profile action (default)
769 )
770 ; Dual Float Conversion unit
771 (unit u-float-dual-convert "Float Dual Conversion unit" ()
772 1 1 ; issue done
773 () ; state
774 ((FRj INT -1) (FRintj INT -1)) ; inputs
775 ((FRk INT -1) (FRintk INT -1)) ; outputs
776 () ; profile action (default)
777 )
778 ; Media unit
779 (unit u-media "Media unit" ()
780 1 1 ; issue done
781 () ; state
782 ((FRinti INT -1) (FRintj INT -1) (ACC40Si INT -1) (ACCGi INT -1)) ; inputs
783 ((FRintk INT -1) (ACC40Sk INT -1) (ACC40Uk INT -1) (ACCGk INT -1)) ; outputs
784 () ; profile action (default)
785 )
786 ; Media Quad Arithmetic unit
787 (unit u-media-quad-arith "Media Quad Arithmetic unit" ()
788 1 1 ; issue done
789 () ; state
790 ((FRinti INT -1) (FRintj INT -1)) ; inputs
791 ((FRintk INT -1)) ; outputs
792 () ; profile action (default)
793 )
794 ; Media Dual Multiplication unit
795 (unit u-media-dual-mul "Media Dual Multiplication unit" ()
796 1 1 ; issue done
797 () ; state
798 ((FRinti INT -1) (FRintj INT -1)) ; inputs
799 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
800 () ; profile action (default)
801 )
802 ; Media Quad Multiplication unit
803 (unit u-media-quad-mul "Media Quad Multiplication unit" ()
804 1 1 ; issue done
805 () ; state
806 ((FRinti INT -1) (FRintj INT -1)) ; inputs
807 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
808 () ; profile action (default)
809 )
810 ; Media Quad Complex unit
811 (unit u-media-quad-complex "Media Quad Complex unit" ()
812 1 1 ; issue done
813 () ; state
814 ((FRinti INT -1) (FRintj INT -1)) ; inputs
815 ((ACC40Sk INT -1)) ; outputs
816 () ; profile action (default)
817 )
818 ; Media Dual Expand unit
819 (unit u-media-dual-expand "Media Dual Expand unit" ()
820 1 1 ; issue done
821 () ; state
822 ((FRinti INT -1)) ; inputs
823 ((FRintk INT -1)) ; outputs
824 () ; profile action (default)
825 )
826 ; Media Dual Unpack unit
827 (unit u-media-dual-unpack "Media Dual Unpack unit" ()
828 1 1 ; issue done
829 () ; state
830 ((FRinti INT -1)) ; inputs
831 ((FRintk INT -1)) ; outputs
832 () ; profile action (default)
833 )
834 ; Media Dual byte to half unit
835 (unit u-media-dual-btoh "Media Byte to byte" ()
836 1 1 ; issue done
837 () ; state
838 ((FRintj INT -1)) ; inputs
839 ((FRintk INT -1)) ; outputs
840 () ; profile action (default)
841 )
842 ; Media Dual half to byte unit
843 (unit u-media-dual-htob "Media Half to byte" ()
844 1 1 ; issue done
845 () ; state
846 ((FRintj INT -1)) ; inputs
847 ((FRintk INT -1)) ; outputs
848 () ; profile action (default)
849 )
850 ; Media Dual byte to half unit extended
851 (unit u-media-dual-btohe "Media Byte to byte extended" ()
852 1 1 ; issue done
853 () ; state
854 ((FRintj INT -1)) ; inputs
855 ((FRintk INT -1)) ; outputs
856 () ; profile action (default)
857 )
858 ; Barrier unit
859 (unit u-barrier "Barrier unit" ()
860 1 1 ; issue done
861 () ; state
862 () ; inputs
863 () ; outputs
864 () ; profile action (default)
865 )
866 ; Memory Barrier unit
867 (unit u-membar "Memory Barrier unit" ()
868 1 1 ; issue done
869 () ; state
870 () ; inputs
871 () ; outputs
872 () ; profile action (default)
873 )
874 ; Insn cache invalidate unit
875 (unit u-ici "Insn cache invalidate unit" ()
876 1 1 ; issue done
877 () ; state
878 ((GRi INT -1) (GRj INT -1)) ; inputs
879 () ; outputs
880 () ; profile action (default)
881 )
882 ; Data cache invalidate unit
883 (unit u-dci "Data cache invalidate unit" ()
884 1 1 ; issue done
885 () ; state
886 ((GRi INT -1) (GRj INT -1)) ; inputs
887 () ; outputs
888 () ; profile action (default)
889 )
890 ; Data cache flush unit
891 (unit u-dcf "Data cache flush unit" ()
892 1 1 ; issue done
893 () ; state
894 ((GRi INT -1) (GRj INT -1)) ; inputs
895 () ; outputs
896 () ; profile action (default)
897 )
898 ; Insn cache preload unit
899 (unit u-icpl "Insn cache preload unit" ()
900 1 1 ; issue done
901 () ; state
902 ((GRi INT -1) (GRj INT -1)) ; inputs
903 () ; outputs
904 () ; profile action (default)
905 )
906 ; Data cache preload unit
907 (unit u-dcpl "Data cache preload unit" ()
908 1 1 ; issue done
909 () ; state
910 ((GRi INT -1) (GRj INT -1)) ; inputs
911 () ; outputs
912 () ; profile action (default)
913 )
914 ; Insn cache unlock unit
915 (unit u-icul "Insn cache unlock unit" ()
916 1 1 ; issue done
917 () ; state
918 ((GRi INT -1) (GRj INT -1)) ; inputs
919 () ; outputs
920 () ; profile action (default)
921 )
922 ; Data cache unlock unit
923 (unit u-dcul "Data cache unlock unit" ()
924 1 1 ; issue done
925 () ; state
926 ((GRi INT -1) (GRj INT -1)) ; inputs
927 () ; outputs
928 () ; profile action (default)
929 )
930 ; commit unit
931 (unit u-commit "Commit Unit" ()
932 1 1 ; issue done
933 () ; state
934 ((GRk INT -1) (FRk INT -1)) ; inputs
935 () ; outputs
936 () ; profile action (default)
937 )
938 )
939 \f
940 ; Tomcat machine. Early version of fr500 machine
941 (define-mach
942 (name tomcat)
943 (comment "Tomcat -- early version of fr500")
944 (cpu frvbf)
945 )
946 (define-model
947 (name tomcat) (comment "Tomcat model") (attrs)
948 (mach tomcat)
949
950 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
951
952 ; `state' is a list of variables for recording model state
953 ; (state)
954
955 (unit u-exec "Execution Unit" ()
956 1 1 ; issue done
957 () ; state
958 () ; inputs
959 () ; outputs
960 () ; profile action (default)
961 )
962 )
963 \f
964 ; FR400 machine
965 (define-mach
966 (name fr400)
967 (comment "FR400 cpu")
968 (cpu frvbf)
969 )
970 (define-model
971 (name fr400) (comment "FR400 model") (attrs)
972 (mach fr400)
973 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
974 ; `state' is a list of variables for recording model state
975 (state
976 ; State items
977 ; These are all masks with each bit representing one register.
978 (prev-fp-load DI) ; Previous use of FR register was floating point load
979 (prev-fr-p4 DI) ; Previous use of FR register was media unit 4
980 (prev-fr-p6 DI) ; Previous use of FR register was media unit 6
981 (prev-acc-p2 DI) ; Previous use of ACC register was media unit 2
982 (prev-acc-p4 DI) ; Previous use of ACC register was media unit 4
983 (cur-fp-load DI) ; Current use of FR register is floating point load
984 (cur-fr-p4 DI) ; Current use of FR register is media unit 4
985 (cur-fr-p6 DI) ; Current use of FR register is media unit 6
986 (cur-acc-p2 DI) ; Current use of ACC register is media unit 2
987 (cur-acc-p4 DI) ; Current use of ACC register is media unit 4
988 )
989 (unit u-exec "Execution Unit" ()
990 1 1 ; issue done
991 () ; state
992 () ; inputs
993 () ; outputs
994 () ; profile action (default)
995 )
996 ; Basic integer insn unit
997 (unit u-integer "Integer Unit" ()
998 1 1 ; issue done
999 () ; state
1000 ((GRi INT -1) (GRj INT -1)) ; inputs
1001 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
1002 () ; profile action (default)
1003 )
1004 ; Integer multiplication unit
1005 (unit u-imul "Integer Multiplication Unit" ()
1006 1 1 ; issue done
1007 () ; state
1008 ((GRi INT -1) (GRj INT -1)) ; inputs
1009 ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs
1010 () ; profile action (default)
1011 )
1012 ; Integer division unit
1013 (unit u-idiv "Integer Division Unit" ()
1014 1 1 ; issue done
1015 () ; state
1016 ((GRi INT -1) (GRj INT -1)) ; inputs
1017 ((GRk INT -1) (ICCi_1 INT -1)) ; outputs
1018 () ; profile action (default)
1019 )
1020 ; Branch unit
1021 (unit u-branch "Branch Unit" ()
1022 1 1 ; issue done
1023 () ; state
1024 ((GRi INT -1) (GRj INT -1)
1025 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
1026 ((pc)) ; outputs
1027 () ; profile action (default)
1028 )
1029 ; Trap unit
1030 (unit u-trap "Trap Unit" ()
1031 1 1 ; issue done
1032 () ; state
1033 ((GRi INT -1) (GRj INT -1)
1034 (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs
1035 () ; outputs
1036 () ; profile action (default)
1037 )
1038 ; Condition code check unit
1039 (unit u-check "Check Unit" ()
1040 1 1 ; issue done
1041 () ; state
1042 ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs
1043 () ; outputs
1044 () ; profile action (default)
1045 )
1046 ; GR set half unit
1047 (unit u-set-hilo "GR Set Half" ()
1048 1 1 ; issue done
1049 () ; state
1050 () ; inputs
1051 ((GRkhi INT -1) (GRklo INT -1)) ; outputs
1052 () ; profile action (default)
1053 )
1054 ; GR load unit -- TODO doesn't handle quad
1055 (unit u-gr-load "GR Load Unit" ()
1056 1 1 ; issue done
1057 () ; state
1058 ((GRi INT -1) (GRj INT -1)) ; inputs
1059 ((GRk INT -1) (GRdoublek INT -1)) ; outputs
1060 () ; profile action (default)
1061 )
1062 ; GR store unit -- TODO doesn't handle quad
1063 (unit u-gr-store "GR Store Unit" ()
1064 1 1 ; issue done
1065 () ; state
1066 ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs
1067 () ; outputs
1068 () ; profile action (default)
1069 )
1070 ; FR load unit -- TODO doesn't handle quad
1071 (unit u-fr-load "FR Load Unit" ()
1072 1 1 ; issue done
1073 () ; state
1074 ((GRi INT -1) (GRj INT -1)) ; inputs
1075 ((FRintk INT -1) (FRdoublek INT -1)) ; outputs
1076 () ; profile action (default)
1077 )
1078 ; FR store unit -- TODO doesn't handle quad
1079 (unit u-fr-store "FR Store Unit" ()
1080 1 1 ; issue done
1081 () ; state
1082 ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs
1083 () ; outputs
1084 () ; profile action (default)
1085 )
1086 ; Swap unit
1087 (unit u-swap "Swap Unit" ()
1088 1 1 ; issue done
1089 () ; state
1090 ((GRi INT -1) (GRj INT -1)) ; inputs
1091 ((GRk INT -1)) ; outputs
1092 () ; profile action (default)
1093 )
1094 ; FR Move to GR unit
1095 (unit u-fr2gr "FR Move to GR Unit" ()
1096 1 1 ; issue done
1097 () ; state
1098 ((FRintk INT -1)) ; inputs
1099 ((GRj INT -1)) ; outputs
1100 () ; profile action (default)
1101 )
1102 ; SPR Move to GR unit
1103 (unit u-spr2gr "SPR Move to GR Unit" ()
1104 1 1 ; issue done
1105 () ; state
1106 ((spr INT -1)) ; inputs
1107 ((GRj INT -1)) ; outputs
1108 () ; profile action (default)
1109 )
1110 ; GR Move to FR unit
1111 (unit u-gr2fr "GR Move to FR Unit" ()
1112 1 1 ; issue done
1113 () ; state
1114 ((GRj INT -1)) ; inputs
1115 ((FRintk INT -1)) ; outputs
1116 () ; profile action (default)
1117 )
1118 ; GR Move to SPR unit
1119 (unit u-gr2spr "GR Move to SPR Unit" ()
1120 1 1 ; issue done
1121 () ; state
1122 ((GRj INT -1)) ; inputs
1123 ((spr INT -1)) ; outputs
1124 () ; profile action (default)
1125 )
1126 ; Media unit M1 -- see table 13-8 in the fr400 LSI
1127 (unit u-media-1 "Media-1 unit" ()
1128 1 1 ; issue done
1129 () ; state
1130 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1131 ((FRintk INT -1)) ; outputs
1132 () ; profile action (default)
1133 )
1134 (unit u-media-1-quad "Media-1-quad unit" ()
1135 1 1 ; issue done
1136 () ; state
1137 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1138 ((FRintk INT -1)) ; outputs
1139 () ; profile action (default)
1140 )
1141 (unit u-media-hilo "Media-hilo unit -- a variation of the Media-1 unit" ()
1142 1 1 ; issue done
1143 () ; state
1144 () ; inputs
1145 ((FRkhi INT -1) (FRklo INT -1)) ; outputs
1146 () ; profile action (default)
1147 )
1148 ; Media unit M2 -- see table 13-8 in the fr400 LSI
1149 (unit u-media-2 "Media-2 unit" ()
1150 1 1 ; issue done
1151 () ; state
1152 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1153 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
1154 () ; profile action (default)
1155 )
1156 (unit u-media-2-quad "Media-2-quad unit" ()
1157 1 1 ; issue done
1158 () ; state
1159 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1160 ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs
1161 () ; profile action (default)
1162 )
1163 (unit u-media-2-acc "Media-2-acc unit" ()
1164 1 1 ; issue done
1165 () ; state
1166 ((ACC40Si INT -1)) ; inputs
1167 ((ACC40Sk INT -1)) ; outputs
1168 () ; profile action (default)
1169 )
1170 (unit u-media-2-acc-dual "Media-2-acc-dual unit" ()
1171 1 1 ; issue done
1172 () ; state
1173 ((ACC40Si INT -1)) ; inputs
1174 ((ACC40Sk INT -1)) ; outputs
1175 () ; profile action (default)
1176 )
1177 (unit u-media-2-add-sub "Media-2-add-sub unit" ()
1178 1 1 ; issue done
1179 () ; state
1180 ((ACC40Si INT -1)) ; inputs
1181 ((ACC40Sk INT -1)) ; outputs
1182 () ; profile action (default)
1183 )
1184 (unit u-media-2-add-sub-dual "Media-2-add-sub-dual unit" ()
1185 1 1 ; issue done
1186 () ; state
1187 ((ACC40Si INT -1)) ; inputs
1188 ((ACC40Sk INT -1)) ; outputs
1189 () ; profile action (default)
1190 )
1191 ; Media unit M3 -- see table 13-8 in the fr400 LSI
1192 (unit u-media-3 "Media-3 unit" ()
1193 1 1 ; issue done
1194 () ; state
1195 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1196 ((FRintk INT -1)) ; outputs
1197 () ; profile action (default)
1198 )
1199 (unit u-media-3-dual "Media-3-dual unit" ()
1200 1 1 ; issue done
1201 () ; state
1202 ((FRinti INT -1)) ; inputs
1203 ((FRintk INT -1)) ; outputs
1204 () ; profile action (default)
1205 )
1206 (unit u-media-3-quad "Media-3-quad unit" ()
1207 1 1 ; issue done
1208 () ; state
1209 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1210 ((FRintk INT -1)) ; outputs
1211 () ; profile action (default)
1212 )
1213 ; Media unit M4 -- see table 13-8 in the fr400 LSI
1214 (unit u-media-4 "Media-4 unit" ()
1215 1 1 ; issue done
1216 () ; state
1217 ((ACC40Si INT -1) (FRintj INT -1)) ; inputs
1218 ((ACC40Sk INT -1) (FRintk INT -1)) ; outputs
1219 () ; profile action (default)
1220 )
1221 (unit u-media-4-accg "Media-4-accg unit" ()
1222 1 1 ; issue done
1223 () ; state
1224 ((ACCGi INT -1) (FRinti INT -1)) ; inputs
1225 ((ACCGk INT -1) (FRintk INT -1)) ; outputs
1226 () ; profile action (default)
1227 )
1228 (unit u-media-4-acc-dual "Media-4-acc-dual unit" ()
1229 1 1 ; issue done
1230 () ; state
1231 ((ACC40Si INT -1)) ; inputs
1232 ((FRintk INT -1)) ; outputs
1233 () ; profile action (default)
1234 )
1235 ; Media unit M6 -- see table 13-8 in the fr400 LSI
1236 (unit u-media-6 "Media-6 unit" ()
1237 1 1 ; issue done
1238 () ; state
1239 ((FRinti INT -1)) ; inputs
1240 ((FRintk INT -1)) ; outputs
1241 () ; profile action (default)
1242 )
1243 ; Media unit M7 -- see table 13-8 in the fr400 LSI
1244 (unit u-media-7 "Media-1 unit" ()
1245 1 1 ; issue done
1246 () ; state
1247 ((FRinti INT -1) (FRintj INT -1)) ; inputs
1248 ((FCCk INT -1)) ; outputs
1249 () ; profile action (default)
1250 )
1251 ; Media Dual Expand unit
1252 (unit u-media-dual-expand "Media Dual Expand unit" ()
1253 1 1 ; issue done
1254 () ; state
1255 ((FRinti INT -1)) ; inputs
1256 ((FRintk INT -1)) ; outputs
1257 () ; profile action (default)
1258 )
1259 ; Media Dual half to byte unit
1260 (unit u-media-dual-htob "Media Half to byte" ()
1261 1 1 ; issue done
1262 () ; state
1263 ((FRintj INT -1)) ; inputs
1264 ((FRintk INT -1)) ; outputs
1265 () ; profile action (default)
1266 )
1267 ; Barrier unit
1268 (unit u-barrier "Barrier unit" ()
1269 1 1 ; issue done
1270 () ; state
1271 () ; inputs
1272 () ; outputs
1273 () ; profile action (default)
1274 )
1275 ; Memory Barrier unit
1276 (unit u-membar "Memory Barrier unit" ()
1277 1 1 ; issue done
1278 () ; state
1279 () ; inputs
1280 () ; outputs
1281 () ; profile action (default)
1282 )
1283 ; Insn cache invalidate unit
1284 (unit u-ici "Insn cache invalidate unit" ()
1285 1 1 ; issue done
1286 () ; state
1287 ((GRi INT -1) (GRj INT -1)) ; inputs
1288 () ; outputs
1289 () ; profile action (default)
1290 )
1291 ; Data cache invalidate unit
1292 (unit u-dci "Data cache invalidate unit" ()
1293 1 1 ; issue done
1294 () ; state
1295 ((GRi INT -1) (GRj INT -1)) ; inputs
1296 () ; outputs
1297 () ; profile action (default)
1298 )
1299 ; Data cache flush unit
1300 (unit u-dcf "Data cache flush unit" ()
1301 1 1 ; issue done
1302 () ; state
1303 ((GRi INT -1) (GRj INT -1)) ; inputs
1304 () ; outputs
1305 () ; profile action (default)
1306 )
1307 ; Insn cache preload unit
1308 (unit u-icpl "Insn cache preload unit" ()
1309 1 1 ; issue done
1310 () ; state
1311 ((GRi INT -1) (GRj INT -1)) ; inputs
1312 () ; outputs
1313 () ; profile action (default)
1314 )
1315 ; Data cache preload unit
1316 (unit u-dcpl "Data cache preload unit" ()
1317 1 1 ; issue done
1318 () ; state
1319 ((GRi INT -1) (GRj INT -1)) ; inputs
1320 () ; outputs
1321 () ; profile action (default)
1322 )
1323 ; Insn cache unlock unit
1324 (unit u-icul "Insn cache unlock unit" ()
1325 1 1 ; issue done
1326 () ; state
1327 ((GRi INT -1) (GRj INT -1)) ; inputs
1328 () ; outputs
1329 () ; profile action (default)
1330 )
1331 ; Data cache unlock unit
1332 (unit u-dcul "Data cache unlock unit" ()
1333 1 1 ; issue done
1334 () ; state
1335 ((GRi INT -1) (GRj INT -1)) ; inputs
1336 () ; outputs
1337 () ; profile action (default)
1338 )
1339 )
1340 \f
1341 ; Simple machine - single issue integer machine
1342 (define-mach
1343 (name simple)
1344 (comment "Simple single issue integer cpu")
1345 (cpu frvbf)
1346 )
1347 (define-model
1348 (name simple) (comment "Simple model") (attrs)
1349 (mach simple)
1350 (pipeline all "" () ((fetch) (decode) (execute) (writeback)))
1351 ; `state' is a list of variables for recording model state
1352 (state)
1353 (unit u-exec "Execution Unit" ()
1354 1 1 ; issue done
1355 () ; state
1356 () ; inputs
1357 () ; outputs
1358 () ; profile action (default)
1359 )
1360 )
1361 \f
1362 ; The instruction fetch/execute cycle.
1363 ;
1364 ; This is how to fetch and decode an instruction.
1365 ; Leave it out for now
1366
1367 ; (define-extract (const SI 0))
1368
1369 ; This is how to execute a decoded instruction.
1370 ; Leave it out for now
1371
1372 ; (define-execute (const SI 0))
1373 \f
1374 ; An attribute to describe which unit an insn runs in.
1375 (define-attr
1376 (for insn)
1377 (type enum)
1378 (name UNIT)
1379 (comment "parallel execution pipeline selection")
1380 ; The order of declaration is significant.
1381 ; See the *_unit_mapping tables in frv.opc
1382 ; Keep variations on the same unit together.
1383 ; Keep the '01' variant immediately after the '1' variant in each unit.
1384 ; Keep the 'ALL' variations immediately after the last numbered variant in each unit.
1385 (values NIL
1386 I0 I1 I01 I2 I3 IALL
1387 FM0 FM1 FM01 FM2 FM3 FMALL FMLOW
1388 B0 B1 B01
1389 C
1390 MULT-DIV ; multiply/division slotted differently on different machines
1391 IACC ; iacc multiply slotted differently on different machines
1392 LOAD ; loads slotted differently on different machines
1393 STORE ; store slotted differently on different machines
1394 SCAN ; scan, scani slotted differently on different machines
1395 DCPL ; dcpl slotted differently on different machines
1396 MDUALACC ; media dual acc slotted differently on different machines
1397 MCLRACC-1; mclracc A==1 slotted differently on different machines
1398 NUM_UNITS
1399 )
1400 )
1401 ; Attributes to describe major categories of insns
1402 (define-attr
1403 (for insn)
1404 (type enum)
1405 (name FR400-MAJOR)
1406 (comment "fr400 major insn categories")
1407 ; The order of declaration is significant. Keep variations on the same major
1408 ; together.
1409 (values NONE
1410 I-1 I-2 I-3 I-4 I-5
1411 B-1 B-2 B-3 B-4 B-5 B-6
1412 C-1 C-2
1413 M-1 M-2
1414 )
1415 )
1416 (define-attr
1417 (for insn)
1418 (type enum)
1419 (name FR500-MAJOR)
1420 (comment "fr500 major insn categories")
1421 ; The order of declaration is significant. Keep variations on the same major
1422 ; together.
1423 (values NONE
1424 I-1 I-2 I-3 I-4 I-5 I-6
1425 B-1 B-2 B-3 B-4 B-5 B-6
1426 C-1 C-2
1427 F-1 F-2 F-3 F-4 F-5 F-6 F-7 F-8
1428 M-1 M-2 M-3 M-4 M-5 M-6 M-7 M-8
1429 )
1430 )
1431 (define-attr
1432 (for insn)
1433 (type enum)
1434 (name FR550-MAJOR)
1435 (comment "fr550 major insn categories")
1436 ; The order of declaration is significant. Keep variations on the same major
1437 ; together.
1438 (values NONE
1439 I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8
1440 B-1 B-2 B-3 B-4 B-5 B-6
1441 C-1 C-2
1442 F-1 F-2 F-3 F-4
1443 M-1 M-2 M-3 M-4 M-5
1444 )
1445 )
1446 ; Privileged insn
1447 (define-attr
1448 (for insn)
1449 (type boolean)
1450 (name PRIVILEGED)
1451 (comment "insn only allowed in supervisor mode")
1452 )
1453 ; Non-Excepting insn
1454 (define-attr
1455 (for insn)
1456 (type boolean)
1457 (name NON-EXCEPTING)
1458 (comment "non-excepting insn")
1459 )
1460 ; Conditional insn
1461 (define-attr
1462 (for insn)
1463 (type boolean)
1464 (name CONDITIONAL)
1465 (comment "conditional insn")
1466 )
1467 ; insn accesses FR registers
1468 (define-attr
1469 (for insn)
1470 (type boolean)
1471 (name FR-ACCESS)
1472 (comment "insn accesses FR registers")
1473 )
1474 ; insn preserves MSR.OVF
1475 (define-attr
1476 (for insn)
1477 (type boolean)
1478 (name PRESERVE-OVF)
1479 (comment "Preserve value of MSR.OVF")
1480 )
1481 ; null attribute -- used as a place holder for where an attribue is required.
1482 (define-attr
1483 (for insn)
1484 (type boolean)
1485 (name NA)
1486 (comment "placeholder attribute")
1487 (attrs META) ; do not define in any generated file for now
1488 )
1489
1490 ; IDOC attribute for instruction documentation.
1491
1492 (define-attr
1493 (for insn)
1494 (type enum)
1495 (name IDOC)
1496 (comment "insn kind for documentation")
1497 (attrs META)
1498 (values
1499 (MEM - () "Memory")
1500 (ALU - () "ALU")
1501 (FPU - () "FPU")
1502 (BR - () "Branch")
1503 (PRIV - () "Priviledged")
1504 (MISC - () "Miscellaneous")
1505 )
1506 )
1507 \f
1508 ; Instruction fields.
1509 ;
1510 ; Attributes:
1511 ; PCREL-ADDR: pc relative value (for reloc and disassembly purposes)
1512 ; ABS-ADDR: absolute address (for reloc and disassembly purposes?)
1513 ; RESERVED: bits are not used to decode insn, must be all 0
1514 (dnf f-pack "packing bit" () 31 1)
1515 (dnf f-op "primary opcode" () 24 7)
1516 (dnf f-ope1 "extended opcode" () 11 6)
1517 (dnf f-ope2 "extended opcode" () 9 4)
1518 (dnf f-ope3 "extended opcode" () 15 3)
1519 (dnf f-ope4 "extended opcode" () 7 2)
1520
1521 (dnf f-GRi "source register 1" () 17 6)
1522 (dnf f-GRj "source register 2" () 5 6)
1523 (dnf f-GRk "destination register" () 30 6)
1524
1525 (dnf f-FRi "source register 1" () 17 6)
1526 (dnf f-FRj "source register 2" () 5 6)
1527 (dnf f-FRk "destination register" () 30 6)
1528
1529 (dnf f-CPRi "source register 1" () 17 6)
1530 (dnf f-CPRj "source register 2" () 5 6)
1531 (dnf f-CPRk "destination register" () 30 6)
1532
1533 (dnf f-ACCGi "source register" () 17 6)
1534 (dnf f-ACCGk "destination register" () 30 6)
1535
1536 (dnf f-ACC40Si "40 bit signed accumulator" () 17 6)
1537 (dnf f-ACC40Ui "40 bit unsigned accumulator" () 17 6)
1538 (dnf f-ACC40Sk "40 bit accumulator" () 30 6)
1539 (dnf f-ACC40Uk "40 bit accumulator" () 30 6)
1540
1541 (dnf f-CRi "source register" () 14 3)
1542 (dnf f-CRj "source register" () 2 3)
1543 (dnf f-CRk "destination register" () 27 3)
1544 (dnf f-CCi "condition register" () 11 3)
1545
1546 (df f-CRj_int "target cr for ck insns" () 26 2 UINT
1547 ((value pc) (sub WI value 4))
1548 ((value pc) (add WI value 4))
1549 )
1550 (dnf f-CRj_float "target cr for fck insns" () 26 2)
1551
1552 (dnf f-ICCi_1 "condition register" () 11 2)
1553 (dnf f-ICCi_2 "condition register" () 26 2)
1554 (dnf f-ICCi_3 "condition register" () 1 2)
1555 (dnf f-FCCi_1 "condition register" () 11 2)
1556 (dnf f-FCCi_2 "condition register" () 26 2)
1557 (dnf f-FCCi_3 "condition register" () 1 2)
1558 (dnf f-FCCk "condition register" () 26 2)
1559 (dnf f-eir "exception insn register" () 17 6)
1560
1561 (df f-s10 "10 bit sign extended" () 9 10 INT #f #f)
1562 (df f-s12 "12 bit sign extended" () 11 12 INT #f #f)
1563 (df f-d12 "12 bit sign extended" () 11 12 INT #f #f)
1564 (df f-u16 "16 bit unsigned" () 15 16 UINT #f #f)
1565 (df f-s16 "16 bit sign extended" () 15 16 INT #f #f)
1566 (df f-s6 "6 bit signed" () 5 6 INT #f #f)
1567 (df f-s6_1 "6 bit signed" () 11 6 INT #f #f)
1568 (df f-u6 "6 bit unsigned" () 5 6 UINT #f #f)
1569 (df f-s5 "5 bit signed" () 4 5 INT #f #f)
1570
1571 (df f-u12-h "upper 6 bits of u12" () 17 6 INT #f #f)
1572 (df f-u12-l "lower 6 bits of u12" () 5 6 UINT #f #f)
1573 (dnmf f-u12 "12 bit signed immediate" () INT
1574 (f-u12-h f-u12-l)
1575 (sequence () ; insert
1576 (set (ifield f-u12-h) (sra SI (ifield f-u12) 6))
1577 (set (ifield f-u12-l) (and (ifield f-u12) #x3f))
1578 )
1579 (sequence () ; extract
1580 (set (ifield f-u12) (or (sll (ifield f-u12-h) 6)
1581 (ifield f-u12-l)))
1582 )
1583 )
1584
1585 (dnf f-int-cc "integer branch conditions" () 30 4)
1586 (dnf f-flt-cc "floating branch conditions" () 30 4)
1587 (df f-cond "conditional arithmetic" () 8 1 UINT #f #f)
1588 (df f-ccond "lr branch condition" () 12 1 UINT #f #f)
1589 (df f-hint "2 bit branch prediction hint" () 17 2 UINT #f #f)
1590 (df f-LI "link indicator" () 25 1 UINT #f #f)
1591 (df f-lock "cache lock indicator" () 25 1 UINT #f #f)
1592 (df f-debug "debug mode indicator" () 25 1 UINT #f #f)
1593 (df f-A "all accumulator bit" () 17 1 UINT #f #f)
1594 (df f-ae "cache all entries indicator" () 25 1 UINT #f #f)
1595
1596 (dnf f-spr-h "upper 6 bits of spr" () 30 6)
1597 (dnf f-spr-l "lower 6 bits of spr" () 17 6)
1598 (dnmf f-spr "special purpose register" () UINT
1599 (f-spr-h f-spr-l)
1600 (sequence () ; insert
1601 (set (ifield f-spr-h) (srl (ifield f-spr) (const 6)))
1602 (set (ifield f-spr-l) (and (ifield f-spr) (const #x3f)))
1603 )
1604 (sequence () ; extract
1605 (set (ifield f-spr) (or (sll (ifield f-spr-h) (const 6))
1606 (ifield f-spr-l)))
1607 )
1608 )
1609
1610 (df f-label16 "18 bit pc relative signed offset" (PCREL-ADDR) 15 16 INT
1611 ((value pc) (sra WI (sub WI value pc) (const 2)))
1612 ((value pc) (add WI (sll WI value (const 2)) pc))
1613 )
1614
1615 (df f-labelH6 "upper 6 bits of label24" () 30 6 INT #f #f)
1616 (dnf f-labelL18 "lower 18 bits of label24" () 17 18)
1617 (dnmf f-label24 "26 bit signed offset" (PCREL-ADDR) INT
1618 (f-labelH6 f-labelL18)
1619 ; insert
1620 (sequence ()
1621 (set (ifield f-labelH6)
1622 (sra WI (sub (ifield f-label24) pc) (const 20)))
1623 (set (ifield f-labelL18)
1624 (and (srl (sub (ifield f-label24) pc) (const 2))
1625 (const #x3ffff)))
1626 )
1627 ; extract
1628 (sequence ()
1629 (set (ifield f-label24)
1630 (add (sll (or (sll (ifield f-labelH6) (const 18))
1631 (ifield f-labelL18))
1632 (const 2))
1633 pc)))
1634 )
1635
1636 (dnf f-ICCi_1-null "null field" (RESERVED) 11 2)
1637 (dnf f-ICCi_2-null "null field" (RESERVED) 26 2)
1638 (dnf f-ICCi_3-null "null field" (RESERVED) 1 2)
1639 (dnf f-FCCi_1-null "null field" (RESERVED) 11 2)
1640 (dnf f-FCCi_2-null "null field" (RESERVED) 26 2)
1641 (dnf f-FCCi_3-null "null field" (RESERVED) 1 2)
1642 (dnf f-rs-null "null field" (RESERVED) 17 6)
1643 (dnf f-GRi-null "null field" (RESERVED) 17 6)
1644 (dnf f-GRj-null "null field" (RESERVED) 5 6)
1645 (dnf f-GRk-null "null field" (RESERVED) 30 6)
1646 (dnf f-FRi-null "null field" (RESERVED) 17 6)
1647 (dnf f-FRj-null "null field" (RESERVED) 5 6)
1648 (dnf f-ACCj-null "null field" (RESERVED) 5 6)
1649 (dnf f-rd-null "null field" (RESERVED) 30 6)
1650 (dnf f-cond-null "null field" (RESERVED) 30 4)
1651 (dnf f-ccond-null "null field" (RESERVED) 12 1)
1652 (dnf f-s12-null "null field" (RESERVED) 11 12)
1653 (dnf f-label16-null "null field" (RESERVED) 15 16)
1654 (dnf f-misc-null-1 "null field" (RESERVED) 30 5)
1655 (dnf f-misc-null-2 "null field" (RESERVED) 11 6)
1656 (dnf f-misc-null-3 "null field" (RESERVED) 11 4)
1657 (dnf f-misc-null-4 "null field" (RESERVED) 17 2)
1658 (dnf f-misc-null-5 "null field" (RESERVED) 17 16)
1659 (dnf f-misc-null-6 "null field" (RESERVED) 30 3)
1660 (dnf f-misc-null-7 "null field" (RESERVED) 17 3)
1661 (dnf f-misc-null-8 "null field" (RESERVED) 5 3)
1662 (dnf f-misc-null-9 "null field" (RESERVED) 5 4)
1663 (dnf f-misc-null-10 "null field" (RESERVED) 16 5)
1664 (dnf f-misc-null-11 "null field" (RESERVED) 5 1)
1665
1666 (dnf f-LI-off "null field" (RESERVED) 25 1)
1667 (dnf f-LI-on "null field" (RESERVED) 25 1)
1668 \f
1669 ; Enums.
1670
1671 ; insn-op:
1672 ; FIXME: should use die macro or some such
1673 (define-normal-insn-enum insn-op "insn op enums" () OP_ f-op
1674 (
1675 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1676 "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
1677 "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
1678 "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
1679 "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" "4D" "4E" "4F"
1680 "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "5A" "5B" "5C" "5D" "5E" "5F"
1681 "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "6A" "6B" "6C" "6D" "6E" "6F"
1682 "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "7A" "7B" "7C" "7D" "7E" "7F"
1683 )
1684 )
1685
1686 (define-normal-insn-enum insn-ope1 "insn ope enums" () OPE1_ f-ope1
1687 (
1688 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1689 "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
1690 "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
1691 "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
1692 )
1693 )
1694
1695 (define-normal-insn-enum insn-ope2 "insn ope enums" () OPE2_ f-ope2
1696 (
1697 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1698 )
1699 )
1700
1701 (define-normal-insn-enum insn-ope3 "insn ope enums" () OPE3_ f-ope3
1702 (
1703 "00" "01" "02" "03" "04" "05" "06" "07"
1704 )
1705 )
1706
1707 (define-normal-insn-enum insn-ope4 "insn ope enums" () OPE4_ f-ope4
1708 (
1709 "0" "1" "2" "3"
1710 )
1711 )
1712
1713 ; int-cc: integer branch conditions
1714 ; FIXME: should use die macro or some such
1715 (define-normal-insn-enum int-cc "integer branch cond enums" () ICC_ f-int-cc
1716 (
1717 "nev" "c" "v" "lt" "eq" "ls" "n" "le"
1718 "ra" "nc" "nv" "ge" "ne" "hi" "p" "gt"
1719 )
1720 )
1721
1722 ; flt-cc: floating-point/media branch conditions
1723 ; FIXME: should use die macro or some such
1724 (define-normal-insn-enum flt-cc "float branch cond enums" () FCC_ f-flt-cc
1725 ("nev" "u" "gt" "ug" "lt" "ul" "lg" "ne"
1726 "eq" "ue" "ge" "uge" "le" "ule" "o" "ra")
1727 )
1728 \f
1729 ; Hardware pieces.
1730 ; These entries list the elements of the raw hardware.
1731 ; They're also used to provide tables and other elements of the assembly
1732 ; language.
1733 (dnh h-pc "program counter" (PC PROFILE) (pc) () () ())
1734
1735 ; The PSR. The individual fields are referenced more than the entire
1736 ; register, so reference them directly. We can assemble the
1737 ; entire register contents when necessary.
1738 ;
1739 (dsh h-psr_imple "PSR.IMPLE" () (register UQI))
1740 (dsh h-psr_ver "PSR.VER" () (register UQI))
1741 (dsh h-psr_ice "PSR.ICE bit" () (register BI))
1742 (dsh h-psr_nem "PSR.NEM bit" () (register BI))
1743 (dsh h-psr_cm "PSR.CM bit" () (register BI))
1744 (dsh h-psr_be "PSR.BE bit" () (register BI))
1745 (dsh h-psr_esr "PSR.ESR bit" () (register BI))
1746 (dsh h-psr_ef "PSR.EF bit" () (register BI))
1747 (dsh h-psr_em "PSR.EM bit" () (register BI))
1748 (dsh h-psr_pil "PSR.PIL " () (register UQI))
1749 (dsh h-psr_ps "PSR.PS bit" () (register BI))
1750 (dsh h-psr_et "PSR.ET bit" () (register BI))
1751
1752 ; PSR.S requires special handling because the shadow registers (SR0-SR4) must
1753 ; be switched with GR4-GR7 when changing from user to supervisor mode or
1754 ; vice-versa.
1755 (define-hardware
1756 (name h-psr_s)
1757 (comment "PSR.S bit")
1758 (attrs)
1759 (type register BI)
1760 (get)
1761 (set (newval) (c-call VOID "@cpu@_h_psr_s_set_handler" newval))
1762 )
1763
1764 ; The TBR. The individual bits are referenced more than the entire
1765 ; register, so reference them directly. We can assemble the
1766 ; entire register contents when necessary.
1767 ;
1768 (dsh h-tbr_tba "TBR.TBA" () (register UWI))
1769 (dsh h-tbr_tt "TBR.TT" () (register UQI))
1770
1771 ; The BPSR. The individual bits are referenced more than the entire
1772 ; register, so reference them directly. We can assemble the
1773 ; entire register contents when necessary.
1774 ;
1775 (dsh h-bpsr_bs "PSR.S bit" () (register BI))
1776 (dsh h-bpsr_bet "PSR.ET bit" () (register BI))
1777
1778 ; General registers
1779 ;
1780 (define-keyword
1781 (name gr-names)
1782 (print-name h-gr)
1783 (prefix "")
1784 (values
1785 (sp 1) (fp 2)
1786 (gr0 0)(gr1 1)(gr2 2)(gr3 3)(gr4 4)(gr5 5)(gr6 6)(gr7 7)
1787 (gr8 8)(gr9 9)(gr10 10)(gr11 11)(gr12 12)(gr13 13)(gr14 14)(gr15 15)
1788 (gr16 16)(gr17 17)(gr18 18)(gr19 19)(gr20 20)(gr21 21)(gr22 22)(gr23 23)
1789 (gr24 24)(gr25 25)(gr26 26)(gr27 27)(gr28 28)(gr29 29)(gr30 30)(gr31 31)
1790 (gr32 32)(gr33 33)(gr34 34)(gr35 35)(gr36 36)(gr37 37)(gr38 38)(gr39 39)
1791 (gr40 40)(gr41 41)(gr42 42)(gr43 43)(gr44 44)(gr45 45)(gr46 46)(gr47 47)
1792 (gr48 48)(gr49 49)(gr50 50)(gr51 51)(gr52 52)(gr53 53)(gr54 54)(gr55 55)
1793 (gr56 56)(gr57 57)(gr58 58)(gr59 59)(gr60 60)(gr61 61)(gr62 62)(gr63 63)
1794 )
1795 )
1796
1797 (define-hardware
1798 (name h-gr)
1799 (comment "general registers")
1800 (attrs PROFILE)
1801 (type register USI (64))
1802 (indices extern-keyword gr-names)
1803 (get (index) (c-call WI "@cpu@_h_gr_get_handler" index))
1804 (set (index newval) (c-call VOID "@cpu@_h_gr_set_handler" index newval))
1805 )
1806
1807 ; General Registers as double words
1808 ; These registers are shadowed onto h-gr
1809 (define-hardware
1810 (name h-gr_double)
1811 (comment "general registers as double words")
1812 (attrs PROFILE VIRTUAL)
1813 (type register DI (32))
1814 ; FIXME: Need constraint to prohibit odd numbers.
1815 (indices extern-keyword gr-names)
1816 (get (index)
1817 (c-call DI "@cpu@_h_gr_double_get_handler" index))
1818 (set (index newval)
1819 (c-call VOID "@cpu@_h_gr_double_set_handler" index newval))
1820 )
1821
1822 ; General Registers as high and low half words
1823 ; These registers are shadowed onto h-gr
1824 (define-hardware
1825 (name h-gr_hi)
1826 (comment "general registers as high half word")
1827 (attrs PROFILE VIRTUAL)
1828 (type register UHI (64))
1829 (indices extern-keyword gr-names)
1830 (get (index) (c-call UHI "@cpu@_h_gr_hi_get_handler" index))
1831 (set (index newval) (c-call VOID "@cpu@_h_gr_hi_set_handler" index newval))
1832 )
1833 (define-hardware
1834 (name h-gr_lo)
1835 (comment "general registers as low half word")
1836 (attrs PROFILE VIRTUAL)
1837 (type register UHI (64))
1838 (indices extern-keyword gr-names)
1839 (get (index) (c-call UHI "@cpu@_h_gr_lo_get_handler" index))
1840 (set (index newval) (c-call VOID "@cpu@_h_gr_lo_set_handler" index newval))
1841 )
1842
1843 ; Floating Point Registers
1844 (define-keyword
1845 (name fr-names)
1846 (print-name h-fr)
1847 (prefix "")
1848 (values
1849 (fr0 0)(fr1 1)(fr2 2)(fr3 3)(fr4 4)(fr5 5)(fr6 6)(fr7 7)
1850 (fr8 8)(fr9 9)(fr10 10)(fr11 11)(fr12 12)(fr13 13)(fr14 14)(fr15 15)
1851 (fr16 16)(fr17 17)(fr18 18)(fr19 19)(fr20 20)(fr21 21)(fr22 22)(fr23 23)
1852 (fr24 24)(fr25 25)(fr26 26)(fr27 27)(fr28 28)(fr29 29)(fr30 30)(fr31 31)
1853 (fr32 32)(fr33 33)(fr34 34)(fr35 35)(fr36 36)(fr37 37)(fr38 38)(fr39 39)
1854 (fr40 40)(fr41 41)(fr42 42)(fr43 43)(fr44 44)(fr45 45)(fr46 46)(fr47 47)
1855 (fr48 48)(fr49 49)(fr50 50)(fr51 51)(fr52 52)(fr53 53)(fr54 54)(fr55 55)
1856 (fr56 56)(fr57 57)(fr58 58)(fr59 59)(fr60 60)(fr61 61)(fr62 62)(fr63 63)
1857 )
1858 )
1859
1860 (define-hardware
1861 (name h-fr)
1862 (comment "floating point registers")
1863 (attrs PROFILE)
1864 (type register SF (64))
1865 (indices extern-keyword fr-names)
1866 (get (index) (c-call SF "@cpu@_h_fr_get_handler" index))
1867 (set (index newval) (c-call VOID "@cpu@_h_fr_set_handler" index newval))
1868 )
1869
1870 ; Floating Point Registers as double precision
1871 ; These registers are shadowed onto h-fr
1872
1873 (define-hardware
1874 (name h-fr_double)
1875 (comment "floating point registers as double precision")
1876 (attrs PROFILE VIRTUAL)
1877 (type register DF (32))
1878 ; FIXME: Need constraint to prohibit odd numbers.
1879 (indices extern-keyword fr-names)
1880 (get (index)
1881 (c-call DF "@cpu@_h_fr_double_get_handler" index))
1882 (set (index newval)
1883 (c-call VOID "@cpu@_h_fr_double_set_handler" index newval))
1884 )
1885
1886 ; Floating Point Registers as integer words.
1887 ; These registers are shadowed onto h-fr
1888
1889 (define-hardware
1890 (name h-fr_int)
1891 (comment "floating point registers as integers")
1892 (attrs PROFILE VIRTUAL)
1893 (type register USI (64))
1894 (indices extern-keyword fr-names)
1895 (get (index)
1896 (c-call USI "@cpu@_h_fr_int_get_handler" index))
1897 (set (index newval)
1898 (c-call VOID "@cpu@_h_fr_int_set_handler" index newval))
1899 )
1900
1901 ; Floating Point Registers as high and low half words
1902 ; These registers are shadowed onto h-fr
1903 (define-hardware
1904 (name h-fr_hi)
1905 (comment "floating point registers as unsigned high half word")
1906 (attrs PROFILE VIRTUAL)
1907 (type register UHI (64))
1908 (indices extern-keyword fr-names)
1909 (get (regno) (srl (reg h-fr_int regno) 16))
1910 (set (regno newval) (set (reg h-fr_int regno)
1911 (or (and (reg h-fr_int regno) #xffff)
1912 (sll newval 16))))
1913 )
1914 (define-hardware
1915 (name h-fr_lo)
1916 (comment "floating point registers as unsigned low half word")
1917 (attrs PROFILE VIRTUAL)
1918 (type register UHI (64))
1919 (indices extern-keyword fr-names)
1920 (get (regno) (and (reg h-fr_int regno) #xffff))
1921 (set (regno newval) (set (reg h-fr_int regno)
1922 (or (and (reg h-fr_int regno) #xffff0000)
1923 (and newval #xffff))))
1924 )
1925
1926 ; Floating Point Registers as unsigned bytes
1927 ; These registers are shadowed onto h-fr
1928 (define-hardware
1929 (name h-fr_0)
1930 (comment "floating point registers as unsigned byte 0")
1931 (attrs PROFILE VIRTUAL)
1932 (type register UHI (64))
1933 (indices extern-keyword fr-names)
1934 (get (regno) (and (reg h-fr_int regno) #xff))
1935 (set (regno newval)
1936 (sequence ()
1937 (if (gt USI newval #xff)
1938 (set newval #xff))
1939 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffffff00)
1940 newval))))
1941 )
1942 (define-hardware
1943 (name h-fr_1)
1944 (comment "floating point registers as unsigned byte 1")
1945 (attrs PROFILE VIRTUAL)
1946 (type register UHI (64))
1947 (indices extern-keyword fr-names)
1948 (get (regno) (and (srl (reg h-fr_int regno) 8) #xff))
1949 (set (regno newval)
1950 (sequence ()
1951 (if (gt USI newval #xff)
1952 (set newval #xff))
1953 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffff00ff)
1954 (sll newval 8)))))
1955 )
1956 (define-hardware
1957 (name h-fr_2)
1958 (comment "floating point registers as unsigned byte 2")
1959 (attrs PROFILE VIRTUAL)
1960 (type register UHI (64))
1961 (indices extern-keyword fr-names)
1962 (get (regno) (and (srl (reg h-fr_int regno) 16) #xff))
1963 (set (regno newval)
1964 (sequence ()
1965 (if (gt USI newval #xff)
1966 (set newval #xff))
1967 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xff00ffff)
1968 (sll newval 16)))))
1969 )
1970 (define-hardware
1971 (name h-fr_3)
1972 (comment "floating point registers as unsigned byte 3")
1973 (attrs PROFILE VIRTUAL)
1974 (type register UHI (64))
1975 (indices extern-keyword fr-names)
1976 (get (regno) (and (srl (reg h-fr_int regno) 24) #xff))
1977 (set (regno newval)
1978 (sequence ()
1979 (if (gt USI newval #xff)
1980 (set newval #xff))
1981 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #x00ffffff)
1982 (sll newval 24)))))
1983 )
1984 ; Coprocessor Registers
1985 ;
1986 (define-keyword
1987 (name cpr-names)
1988 (print-name h-cpr)
1989 (prefix "")
1990 (values
1991 (cpr0 0)(cpr1 1)(cpr2 2)(cpr3 3)(cpr4 4)(cpr5 5)(cpr6 6)(cpr7 7)
1992 (cpr8 8)(cpr9 9)(cpr10 10)(cpr11 11)(cpr12 12)(cpr13 13)(cpr14 14)(cpr15 15)
1993 (cpr16 16)(cpr17 17)(cpr18 18)(cpr19 19)(cpr20 20)(cpr21 21)(cpr22 22)(cpr23 23)
1994 (cpr24 24)(cpr25 25)(cpr26 26)(cpr27 27)(cpr28 28)(cpr29 29)(cpr30 30)(cpr31 31)
1995 (cpr32 32)(cpr33 33)(cpr34 34)(cpr35 35)(cpr36 36)(cpr37 37)(cpr38 38)(cpr39 39)
1996 (cpr40 40)(cpr41 41)(cpr42 42)(cpr43 43)(cpr44 44)(cpr45 45)(cpr46 46)(cpr47 47)
1997 (cpr48 48)(cpr49 49)(cpr50 50)(cpr51 51)(cpr52 52)(cpr53 53)(cpr54 54)(cpr55 55)
1998 (cpr56 56)(cpr57 57)(cpr58 58)(cpr59 59)(cpr60 60)(cpr61 61)(cpr62 62)(cpr63 63)
1999 )
2000 )
2001
2002 (define-hardware
2003 (name h-cpr)
2004 (comment "coprocessor registers")
2005 (attrs PROFILE (MACH frv))
2006 (type register WI (64))
2007 (indices extern-keyword cpr-names)
2008 )
2009
2010 ; Coprocessor Registers as double words
2011 ; These registers are shadowed onto h-cpr
2012 (define-hardware
2013 (name h-cpr_double)
2014 (comment "coprocessor registers as double words")
2015 (attrs PROFILE VIRTUAL (MACH frv))
2016 (type register DI (32))
2017 ; FIXME: Need constraint to prohibit odd numbers.
2018 (indices extern-keyword cpr-names)
2019 (get (index)
2020 (c-call DI "@cpu@_h_cpr_double_get_handler" index))
2021 (set (index newval)
2022 (c-call VOID "@cpu@_h_cpr_double_set_handler" index newval))
2023 )
2024
2025 ; Special Purpose Registers
2026 ;
2027 (define-keyword
2028 (name spr-names)
2029 (print-name h-spr)
2030 (prefix "")
2031 (values
2032 (psr 0) (pcsr 1) (bpcsr 2) (tbr 3) (bpsr 4)
2033
2034 (hsr0 16) (hsr1 17) (hsr2 18) (hsr3 19)
2035 (hsr4 20) (hsr5 21) (hsr6 22) (hsr7 23)
2036 (hsr8 24) (hsr9 25) (hsr10 26) (hsr11 27)
2037 (hsr12 28) (hsr13 29) (hsr14 30) (hsr15 31)
2038 (hsr16 32) (hsr17 33) (hsr18 34) (hsr19 35)
2039 (hsr20 36) (hsr21 37) (hsr22 38) (hsr23 39)
2040 (hsr24 40) (hsr25 41) (hsr26 42) (hsr27 43)
2041 (hsr28 44) (hsr29 45) (hsr30 46) (hsr31 47)
2042 (hsr32 48) (hsr33 49) (hsr34 50) (hsr35 51)
2043 (hsr36 52) (hsr37 53) (hsr38 54) (hsr39 55)
2044 (hsr40 56) (hsr41 57) (hsr42 58) (hsr43 59)
2045 (hsr44 60) (hsr45 61) (hsr46 62) (hsr47 63)
2046 (hsr48 64) (hsr49 65) (hsr50 66) (hsr51 67)
2047 (hsr52 68) (hsr53 69) (hsr54 70) (hsr55 71)
2048 (hsr56 72) (hsr57 73) (hsr58 74) (hsr59 75)
2049 (hsr60 76) (hsr61 77) (hsr62 78) (hsr63 79)
2050
2051 (ccr 256) (cccr 263) (lr 272) (lcr 273) (iacc0h 280) (iacc0l 281) (isr 288)
2052
2053 (neear0 352) (neear1 353) (neear2 354) (neear3 355)
2054 (neear4 356) (neear5 357) (neear6 358) (neear7 359)
2055 (neear8 360) (neear9 361) (neear10 362) (neear11 363)
2056 (neear12 364) (neear13 365) (neear14 366) (neear15 367)
2057 (neear16 368) (neear17 369) (neear18 370) (neear19 371)
2058 (neear20 372) (neear21 373) (neear22 374) (neear23 375)
2059 (neear24 376) (neear25 377) (neear26 378) (neear27 379)
2060 (neear28 380) (neear29 381) (neear30 382) (neear31 383)
2061
2062 (nesr0 384) (nesr1 385) (nesr2 386) (nesr3 387)
2063 (nesr4 388) (nesr5 389) (nesr6 390) (nesr7 391)
2064 (nesr8 392) (nesr9 393) (nesr10 394) (nesr11 395)
2065 (nesr12 396) (nesr13 397) (nesr14 398) (nesr15 399)
2066 (nesr16 400) (nesr17 401) (nesr18 402) (nesr19 403)
2067 (nesr20 404) (nesr21 405) (nesr22 406) (nesr23 407)
2068 (nesr24 408) (nesr25 409) (nesr26 410) (nesr27 411)
2069 (nesr28 412) (nesr29 413) (nesr30 414) (nesr31 415)
2070
2071 (necr 416)
2072
2073 (gner0 432) (gner1 433)
2074
2075 (fner0 434) (fner1 435)
2076
2077 (epcr0 512) (epcr1 513) (epcr2 514) (epcr3 515)
2078 (epcr4 516) (epcr5 517) (epcr6 518) (epcr7 519)
2079 (epcr8 520) (epcr9 521) (epcr10 522) (epcr11 523)
2080 (epcr12 524) (epcr13 525) (epcr14 526) (epcr15 527)
2081 (epcr16 528) (epcr17 529) (epcr18 530) (epcr19 531)
2082 (epcr20 532) (epcr21 533) (epcr22 534) (epcr23 535)
2083 (epcr24 536) (epcr25 537) (epcr26 538) (epcr27 539)
2084 (epcr28 540) (epcr29 541) (epcr30 542) (epcr31 543)
2085 (epcr32 544) (epcr33 545) (epcr34 546) (epcr35 547)
2086 (epcr36 548) (epcr37 549) (epcr38 550) (epcr39 551)
2087 (epcr40 552) (epcr41 553) (epcr42 554) (epcr43 555)
2088 (epcr44 556) (epcr45 557) (epcr46 558) (epcr47 559)
2089 (epcr48 560) (epcr49 561) (epcr50 562) (epcr51 563)
2090 (epcr52 564) (epcr53 565) (epcr54 566) (epcr55 567)
2091 (epcr56 568) (epcr57 569) (epcr58 570) (epcr59 571)
2092 (epcr60 572) (epcr61 573) (epcr62 574) (epcr63 575)
2093
2094 (esr0 576) (esr1 577) (esr2 578) (esr3 579)
2095 (esr4 580) (esr5 581) (esr6 582) (esr7 583)
2096 (esr8 584) (esr9 585) (esr10 586) (esr11 587)
2097 (esr12 588) (esr13 589) (esr14 590) (esr15 591)
2098 (esr16 592) (esr17 593) (esr18 594) (esr19 595)
2099 (esr20 596) (esr21 597) (esr22 598) (esr23 599)
2100 (esr24 600) (esr25 601) (esr26 602) (esr27 603)
2101 (esr28 604) (esr29 605) (esr30 606) (esr31 607)
2102 (esr32 608) (esr33 609) (esr34 610) (esr35 611)
2103 (esr36 612) (esr37 613) (esr38 614) (esr39 615)
2104 (esr40 616) (esr41 617) (esr42 618) (esr43 619)
2105 (esr44 620) (esr45 621) (esr46 622) (esr47 623)
2106 (esr48 624) (esr49 625) (esr50 626) (esr51 627)
2107 (esr52 628) (esr53 629) (esr54 630) (esr55 631)
2108 (esr56 632) (esr57 633) (esr58 634) (esr59 635)
2109 (esr60 636) (esr61 637) (esr62 638) (esr63 639)
2110
2111 (eir0 640) (eir1 641) (eir2 642) (eir3 643)
2112 (eir4 644) (eir5 645) (eir6 646) (eir7 647)
2113 (eir8 648) (eir9 649) (eir10 650) (eir11 651)
2114 (eir12 652) (eir13 653) (eir14 654) (eir15 655)
2115 (eir16 656) (eir17 657) (eir18 658) (eir19 659)
2116 (eir20 660) (eir21 661) (eir22 662) (eir23 663)
2117 (eir24 664) (eir25 665) (eir26 666) (eir27 667)
2118 (eir28 668) (eir29 669) (eir30 670) (eir31 671)
2119
2120 (esfr0 672) (esfr1 673)
2121
2122 (sr0 768) (sr1 769) (sr2 770) (sr3 771)
2123
2124 (fsr0 1024) (fsr1 1025) (fsr2 1026) (fsr3 1027)
2125 (fsr4 1028) (fsr5 1029) (fsr6 1030) (fsr7 1031)
2126 (fsr8 1032) (fsr9 1033) (fsr10 1034) (fsr11 1035)
2127 (fsr12 1036) (fsr13 1037) (fsr14 1038) (fsr15 1039)
2128 (fsr16 1040) (fsr17 1041) (fsr18 1042) (fsr19 1043)
2129 (fsr20 1044) (fsr21 1045) (fsr22 1046) (fsr23 1047)
2130 (fsr24 1048) (fsr25 1049) (fsr26 1050) (fsr27 1051)
2131 (fsr28 1052) (fsr29 1053) (fsr30 1054) (fsr31 1055)
2132 (fsr32 1056) (fsr33 1057) (fsr34 1058) (fsr35 1059)
2133 (fsr36 1060) (fsr37 1061) (fsr38 1062) (fsr39 1063)
2134 (fsr40 1064) (fsr41 1065) (fsr42 1066) (fsr43 1067)
2135 (fsr44 1068) (fsr45 1069) (fsr46 1070) (fsr47 1071)
2136 (fsr48 1072) (fsr49 1073) (fsr50 1074) (fsr51 1075)
2137 (fsr52 1076) (fsr53 1077) (fsr54 1078) (fsr55 1079)
2138 (fsr56 1080) (fsr57 1081) (fsr58 1082) (fsr59 1083)
2139 (fsr60 1084) (fsr61 1085) (fsr62 1086) (fsr63 1087)
2140
2141 ; FQ0-FQ31 are 64 bit registers.
2142 ; These names allow access to the upper 32 bits of the FQ registers.
2143 (fqop0 1088) (fqop1 1090) (fqop2 1092) (fqop3 1094)
2144 (fqop4 1096) (fqop5 1098) (fqop6 1100) (fqop7 1102)
2145 (fqop8 1104) (fqop9 1106) (fqop10 1108) (fqop11 1110)
2146 (fqop12 1112) (fqop13 1114) (fqop14 1116) (fqop15 1118)
2147 (fqop16 1120) (fqop17 1122) (fqop18 1124) (fqop19 1126)
2148 (fqop20 1128) (fqop21 1130) (fqop22 1132) (fqop23 1134)
2149 (fqop24 1136) (fqop25 1138) (fqop26 1140) (fqop27 1142)
2150 (fqop28 1144) (fqop29 1146) (fqop30 1148) (fqop31 1150)
2151 ; These names allow access to the lower 32 bits of the FQ registers.
2152 (fqst0 1089) (fqst1 1091) (fqst2 1093) (fqst3 1095)
2153 (fqst4 1097) (fqst5 1099) (fqst6 1101) (fqst7 1103)
2154 (fqst8 1105) (fqst9 1107) (fqst10 1109) (fqst11 1111)
2155 (fqst12 1113) (fqst13 1115) (fqst14 1117) (fqst15 1119)
2156 (fqst16 1121) (fqst17 1123) (fqst18 1125) (fqst19 1127)
2157 (fqst20 1129) (fqst21 1131) (fqst22 1133) (fqst23 1135)
2158 (fqst24 1137) (fqst25 1139) (fqst26 1141) (fqst27 1143)
2159 (fqst28 1145) (fqst29 1147) (fqst30 1149) (fqst31 1151)
2160 ; These also access the lower 32 bits of the FQ registers.
2161 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2162 ; (fq0 1089) (fq1 1091) (fq2 1093) (fq3 1095)
2163 ; (fq4 1097) (fq5 1099) (fq6 1101) (fq7 1103)
2164 ; (fq8 1105) (fq9 1107) (fq10 1109) (fq11 1111)
2165 ; (fq12 1113) (fq13 1115) (fq14 1117) (fq15 1119)
2166 ; (fq16 1121) (fq17 1123) (fq18 1125) (fq19 1127)
2167 ; (fq20 1129) (fq21 1131) (fq22 1133) (fq23 1135)
2168 ; (fq24 1137) (fq25 1139) (fq26 1141) (fq27 1143)
2169 ; (fq28 1145) (fq29 1147) (fq30 1149) (fq31 1151)
2170
2171 (mcilr0 1272) (mcilr1 1273)
2172
2173 (msr0 1280) (msr1 1281) (msr2 1282) (msr3 1283)
2174 (msr4 1284) (msr5 1285) (msr6 1286) (msr7 1287)
2175 (msr8 1288) (msr9 1289) (msr10 1290) (msr11 1291)
2176 (msr12 1292) (msr13 1293) (msr14 1294) (msr15 1295)
2177 (msr16 1296) (msr17 1297) (msr18 1298) (msr19 1299)
2178 (msr20 1300) (msr21 1301) (msr22 1302) (msr23 1303)
2179 (msr24 1304) (msr25 1305) (msr26 1306) (msr27 1307)
2180 (msr28 1308) (msr29 1309) (msr30 1310) (msr31 1311)
2181 (msr32 1312) (msr33 1313) (msr34 1314) (msr35 1315)
2182 (msr36 1316) (msr37 1317) (msr38 1318) (msr39 1319)
2183 (msr40 1320) (msr41 1321) (msr42 1322) (msr43 1323)
2184 (msr44 1324) (msr45 1325) (msr46 1326) (msr47 1327)
2185 (msr48 1328) (msr49 1329) (msr50 1330) (msr51 1331)
2186 (msr52 1332) (msr53 1333) (msr54 1334) (msr55 1335)
2187 (msr56 1336) (msr57 1337) (msr58 1338) (msr59 1339)
2188 (msr60 1340) (msr61 1341) (msr62 1342) (msr63 1343)
2189
2190 ; MQ0-MQ31 are 64 bit registers.
2191 ; These names allow access to the upper 32 bits of the MQ registers.
2192 (mqop0 1344) (mqop1 1346) (mqop2 1348) (mqop3 1350)
2193 (mqop4 1352) (mqop5 1354) (mqop6 1356) (mqop7 1358)
2194 (mqop8 1360) (mqop9 1362) (mqop10 1364) (mqop11 1366)
2195 (mqop12 1368) (mqop13 1370) (mqop14 1372) (mqop15 1374)
2196 (mqop16 1376) (mqop17 1378) (mqop18 1380) (mqop19 1382)
2197 (mqop20 1384) (mqop21 1386) (mqop22 1388) (mqop23 1390)
2198 (mqop24 1392) (mqop25 1394) (mqop26 1396) (mqop27 1398)
2199 (mqop28 1400) (mqop29 1402) (mqop30 1404) (mqop31 1406)
2200 ; These names allow access to the lower 32 bits of the MQ registers.
2201 (mqst0 1345) (mqst1 1347) (mqst2 1349) (mqst3 1351)
2202 (mqst4 1353) (mqst5 1355) (mqst6 1357) (mqst7 1359)
2203 (mqst8 1361) (mqst9 1363) (mqst10 1365) (mqst11 1367)
2204 (mqst12 1369) (mqst13 1371) (mqst14 1373) (mqst15 1375)
2205 (mqst16 1377) (mqst17 1379) (mqst18 1381) (mqst19 1383)
2206 (mqst20 1385) (mqst21 1387) (mqst22 1389) (mqst23 1391)
2207 (mqst24 1393) (mqst25 1395) (mqst26 1397) (mqst27 1399)
2208 (mqst28 1401) (mqst29 1403) (mqst30 1405) (mqst31 1407)
2209 ; These also access the lower 32 bits of the MQ registers.
2210 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2211 ; (mq0 1345) (mq1 1347) (mq2 1349) (mq3 1351)
2212 ; (mq4 1353) (mq5 1355) (mq6 1357) (mq7 1359)
2213 ; (mq8 1361) (mq9 1363) (mq10 1365) (mq11 1367)
2214 ; (mq12 1369) (mq13 1371) (mq14 1373) (mq15 1375)
2215 ; (mq16 1377) (mq17 1379) (mq18 1381) (mq19 1383)
2216 ; (mq20 1385) (mq21 1387) (mq22 1389) (mq23 1391)
2217 ; (mq24 1393) (mq25 1395) (mq26 1397) (mq27 1399)
2218 ; (mq28 1401) (mq29 1403) (mq30 1405) (mq31 1407)
2219
2220 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2221 ; (acc0 1408) (acc1 1409) (acc2 1410) (acc3 1411)
2222 ; (acc4 1412) (acc5 1413) (acc6 1414) (acc7 1415)
2223 ; (acc8 1416) (acc9 1417) (acc10 1418) (acc11 1419)
2224 ; (acc12 1420) (acc13 1421) (acc14 1422) (acc15 1423)
2225 ; (acc16 1424) (acc17 1425) (acc18 1426) (acc19 1427)
2226 ; (acc20 1428) (acc21 1429) (acc22 1430) (acc23 1431)
2227 ; (acc24 1432) (acc25 1433) (acc26 1434) (acc27 1435)
2228 ; (acc28 1436) (acc29 1437) (acc30 1438) (acc31 1439)
2229 ; (acc32 1440) (acc33 1441) (acc34 1442) (acc35 1443)
2230 ; (acc36 1444) (acc37 1445) (acc38 1446) (acc39 1447)
2231 ; (acc40 1448) (acc41 1449) (acc42 1450) (acc43 1451)
2232 ; (acc44 1452) (acc45 1453) (acc46 1454) (acc47 1455)
2233 ; (acc48 1456) (acc49 1457) (acc50 1458) (acc51 1459)
2234 ; (acc52 1460) (acc53 1461) (acc54 1462) (acc55 1463)
2235 ; (acc56 1464) (acc57 1465) (acc58 1466) (acc59 1467)
2236 ; (acc60 1468) (acc61 1469) (acc62 1470) (acc63 1471)
2237
2238 ; (accg0 1472) (accg1 1473) (accg2 1474) (accg3 1475)
2239 ; (accg4 1476) (accg5 1477) (accg6 1478) (accg7 1479)
2240 ; (accg8 1480) (accg9 1481) (accg10 1482) (accg11 1483)
2241 ; (accg12 1484) (accg13 1485) (accg14 1486) (accg15 1487)
2242 ; (accg16 1488) (accg17 1489) (accg18 1490) (accg19 1491)
2243 ; (accg20 1492) (accg21 1493) (accg22 1494) (accg23 1495)
2244 ; (accg24 1496) (accg25 1497) (accg26 1498) (accg27 1499)
2245 ; (accg28 1500) (accg29 1501) (accg30 1502) (accg31 1503)
2246 ; (accg32 1504) (accg33 1505) (accg34 1506) (accg35 1507)
2247 ; (accg36 1508) (accg37 1509) (accg38 1510) (accg39 1511)
2248 ; (accg40 1512) (accg41 1513) (accg42 1514) (accg43 1515)
2249 ; (accg44 1516) (accg45 1517) (accg46 1518) (accg47 1519)
2250 ; (accg48 1520) (accg49 1521) (accg50 1522) (accg51 1523)
2251 ; (accg52 1524) (accg53 1525) (accg54 1526) (accg55 1527)
2252 ; (accg56 1528) (accg57 1529) (accg58 1530) (accg59 1531)
2253 ; (accg60 1532) (accg61 1533) (accg62 1534) (accg63 1535)
2254
2255 (ear0 1536) (ear1 1537) (ear2 1538) (ear3 1539)
2256 (ear4 1540) (ear5 1541) (ear6 1542) (ear7 1543)
2257 (ear8 1544) (ear9 1545) (ear10 1546) (ear11 1547)
2258 (ear12 1548) (ear13 1549) (ear14 1550) (ear15 1551)
2259 (ear16 1552) (ear17 1553) (ear18 1554) (ear19 1555)
2260 (ear20 1556) (ear21 1557) (ear22 1558) (ear23 1559)
2261 (ear24 1560) (ear25 1561) (ear26 1562) (ear27 1563)
2262 (ear28 1564) (ear29 1565) (ear30 1566) (ear31 1567)
2263 (ear32 1568) (ear33 1569) (ear34 1570) (ear35 1571)
2264 (ear36 1572) (ear37 1573) (ear38 1574) (ear39 1575)
2265 (ear40 1576) (ear41 1577) (ear42 1578) (ear43 1579)
2266 (ear44 1580) (ear45 1581) (ear46 1582) (ear47 1583)
2267 (ear48 1584) (ear49 1585) (ear50 1586) (ear51 1587)
2268 (ear52 1588) (ear53 1589) (ear54 1590) (ear55 1591)
2269 (ear56 1592) (ear57 1593) (ear58 1594) (ear59 1595)
2270 (ear60 1596) (ear61 1597) (ear62 1598) (ear63 1599)
2271
2272 (edr0 1600) (edr1 1601) (edr2 1602) (edr3 1603)
2273 (edr4 1604) (edr5 1605) (edr6 1606) (edr7 1607)
2274 (edr8 1608) (edr9 1609) (edr10 1610) (edr11 1611)
2275 (edr12 1612) (edr13 1613) (edr14 1614) (edr15 1615)
2276 (edr16 1616) (edr17 1617) (edr18 1618) (edr19 1619)
2277 (edr20 1620) (edr21 1621) (edr22 1622) (edr23 1623)
2278 (edr24 1624) (edr25 1625) (edr26 1626) (edr27 1627)
2279 (edr28 1628) (edr29 1629) (edr30 1630) (edr31 1631)
2280 (edr32 1632) (edr33 1636) (edr34 1634) (edr35 1635)
2281 (edr36 1636) (edr37 1637) (edr38 1638) (edr39 1639)
2282 (edr40 1640) (edr41 1641) (edr42 1642) (edr43 1643)
2283 (edr44 1644) (edr45 1645) (edr46 1646) (edr47 1647)
2284 (edr48 1648) (edr49 1649) (edr50 1650) (edr51 1651)
2285 (edr52 1652) (edr53 1653) (edr54 1654) (edr55 1655)
2286 (edr56 1656) (edr57 1657) (edr58 1658) (edr59 1659)
2287 (edr60 1660) (edr61 1661) (edr62 1662) (edr63 1663)
2288
2289 (iamlr0 1664) (iamlr1 1665) (iamlr2 1666) (iamlr3 1667)
2290 (iamlr4 1668) (iamlr5 1669) (iamlr6 1670) (iamlr7 1671)
2291 (iamlr8 1672) (iamlr9 1673) (iamlr10 1674) (iamlr11 1675)
2292 (iamlr12 1676) (iamlr13 1677) (iamlr14 1678) (iamlr15 1679)
2293 (iamlr16 1680) (iamlr17 1681) (iamlr18 1682) (iamlr19 1683)
2294 (iamlr20 1684) (iamlr21 1685) (iamlr22 1686) (iamlr23 1687)
2295 (iamlr24 1688) (iamlr25 1689) (iamlr26 1690) (iamlr27 1691)
2296 (iamlr28 1692) (iamlr29 1693) (iamlr30 1694) (iamlr31 1695)
2297 (iamlr32 1696) (iamlr33 1697) (iamlr34 1698) (iamlr35 1699)
2298 (iamlr36 1700) (iamlr37 1701) (iamlr38 1702) (iamlr39 1703)
2299 (iamlr40 1704) (iamlr41 1705) (iamlr42 1706) (iamlr43 1707)
2300 (iamlr44 1708) (iamlr45 1709) (iamlr46 1710) (iamlr47 1711)
2301 (iamlr48 1712) (iamlr49 1713) (iamlr50 1714) (iamlr51 1715)
2302 (iamlr52 1716) (iamlr53 1717) (iamlr54 1718) (iamlr55 1719)
2303 (iamlr56 1720) (iamlr57 1721) (iamlr58 1722) (iamlr59 1723)
2304 (iamlr60 1724) (iamlr61 1725) (iamlr62 1726) (iamlr63 1727)
2305
2306 (iampr0 1728) (iampr1 1729) (iampr2 1730) (iampr3 1731)
2307 (iampr4 1732) (iampr5 1733) (iampr6 1734) (iampr7 1735)
2308 (iampr8 1736) (iampr9 1737) (iampr10 1738) (iampr11 1739)
2309 (iampr12 1740) (iampr13 1741) (iampr14 1742) (iampr15 1743)
2310 (iampr16 1744) (iampr17 1745) (iampr18 1746) (iampr19 1747)
2311 (iampr20 1748) (iampr21 1749) (iampr22 1750) (iampr23 1751)
2312 (iampr24 1752) (iampr25 1753) (iampr26 1754) (iampr27 1755)
2313 (iampr28 1756) (iampr29 1757) (iampr30 1758) (iampr31 1759)
2314 (iampr32 1760) (iampr33 1761) (iampr34 1762) (iampr35 1763)
2315 (iampr36 1764) (iampr37 1765) (iampr38 1766) (iampr39 1767)
2316 (iampr40 1768) (iampr41 1769) (iampr42 1770) (iampr43 1771)
2317 (iampr44 1772) (iampr45 1773) (iampr46 1774) (iampr47 1775)
2318 (iampr48 1776) (iampr49 1777) (iampr50 1778) (iampr51 1779)
2319 (iampr52 1780) (iampr53 1781) (iampr54 1782) (iampr55 1783)
2320 (iampr56 1784) (iampr57 1785) (iampr58 1786) (iampr59 1787)
2321 (iampr60 1788) (iampr61 1789) (iampr62 1790) (iampr63 1791)
2322
2323 (damlr0 1792) (damlr1 1793) (damlr2 1794) (damlr3 1795)
2324 (damlr4 1796) (damlr5 1797) (damlr6 1798) (damlr7 1799)
2325 (damlr8 1800) (damlr9 1801) (damlr10 1802) (damlr11 1803)
2326 (damlr12 1804) (damlr13 1805) (damlr14 1806) (damlr15 1807)
2327 (damlr16 1808) (damlr17 1809) (damlr18 1810) (damlr19 1811)
2328 (damlr20 1812) (damlr21 1813) (damlr22 1814) (damlr23 1815)
2329 (damlr24 1816) (damlr25 1817) (damlr26 1818) (damlr27 1819)
2330 (damlr28 1820) (damlr29 1821) (damlr30 1822) (damlr31 1823)
2331 (damlr32 1824) (damlr33 1825) (damlr34 1826) (damlr35 1827)
2332 (damlr36 1828) (damlr37 1829) (damlr38 1830) (damlr39 1831)
2333 (damlr40 1832) (damlr41 1833) (damlr42 1834) (damlr43 1835)
2334 (damlr44 1836) (damlr45 1837) (damlr46 1838) (damlr47 1839)
2335 (damlr48 1840) (damlr49 1841) (damlr50 1842) (damlr51 1843)
2336 (damlr52 1844) (damlr53 1845) (damlr54 1846) (damlr55 1847)
2337 (damlr56 1848) (damlr57 1849) (damlr58 1850) (damlr59 1851)
2338 (damlr60 1852) (damlr61 1853) (damlr62 1854) (damlr63 1855)
2339
2340 (dampr0 1856) (dampr1 1857) (dampr2 1858) (dampr3 1859)
2341 (dampr4 1860) (dampr5 1861) (dampr6 1862) (dampr7 1863)
2342 (dampr8 1864) (dampr9 1865) (dampr10 1866) (dampr11 1867)
2343 (dampr12 1868) (dampr13 1869) (dampr14 1870) (dampr15 1871)
2344 (dampr16 1872) (dampr17 1873) (dampr18 1874) (dampr19 1875)
2345 (dampr20 1876) (dampr21 1877) (dampr22 1878) (dampr23 1879)
2346 (dampr24 1880) (dampr25 1881) (dampr26 1882) (dampr27 1883)
2347 (dampr28 1884) (dampr29 1885) (dampr30 1886) (dampr31 1887)
2348 (dampr32 1888) (dampr33 1889) (dampr34 1890) (dampr35 1891)
2349 (dampr36 1892) (dampr37 1893) (dampr38 1894) (dampr39 1895)
2350 (dampr40 1896) (dampr41 1897) (dampr42 1898) (dampr43 1899)
2351 (dampr44 1900) (dampr45 1901) (dampr46 1902) (dampr47 1903)
2352 (dampr48 1904) (dampr49 1905) (dampr50 1906) (dampr51 1907)
2353 (dampr52 1908) (dampr53 1909) (dampr54 1910) (dampr55 1911)
2354 (dampr56 1912) (dampr57 1913) (dampr58 1914) (dampr59 1915)
2355 (dampr60 1916) (dampr61 1917) (dampr62 1918) (dampr63 1919)
2356
2357 (amcr 1920) (stbar 1921) (mmcr 1922)
2358 (dcr 2048) (brr 2049) (nmar 2050)
2359
2360 (ibar0 2052) (ibar1 2053) (ibar2 2054) (ibar3 2055)
2361 (dbar0 2056) (dbar1 2057) (dbar2 2058) (dbar3 2059)
2362
2363 (dbdr00 2060) (dbdr01 2061) (dbdr02 2062) (dbdr03 2063)
2364 (dbdr10 2064) (dbdr11 2065) (dbdr12 2066) (dbdr13 2067)
2365 (dbdr20 2068) (dbdr21 2069) (dbdr22 2070) (dbdr23 2071)
2366 (dbdr30 2072) (dbdr31 2073) (dbdr32 2074) (dbdr33 2075)
2367
2368 (dbmr00 2076) (dbmr01 2077) (dbmr02 2078) (dbmr03 2079)
2369 (dbmr10 2080) (dbmr11 2081) (dbmr12 2082) (dbmr13 2083)
2370 (dbmr20 2084) (dbmr21 2085) (dbmr22 2086) (dbmr23 2087)
2371 (dbmr30 2088) (dbmr31 2089) (dbmr32 2090) (dbmr33 2091)
2372
2373 (cpcfr 2092) (cpcr 2093) (cpsr 2094)
2374
2375 (cpesr0 2096) (cpesr1 2097)
2376 (cpemr0 2098) (cpemr1 2099)
2377
2378 (ihsr8 3848)
2379 )
2380 )
2381
2382 (define-hardware
2383 (name h-spr)
2384 (comment "special purpose registers")
2385 (attrs PROFILE)
2386 (type register UWI (4096))
2387 (indices extern-keyword spr-names)
2388 (get (index) (c-call UWI "@cpu@_h_spr_get_handler" index))
2389 (set (index newval) (c-call VOID "@cpu@_h_spr_set_handler" index newval))
2390 )
2391
2392 (define-pmacro (spr-pcsr) (reg h-spr 1))
2393 (define-pmacro (spr-bpcsr) (reg h-spr 2))
2394 (define-pmacro (spr-lr) (reg h-spr 272))
2395 (define-pmacro (spr-lcr) (reg h-spr 273))
2396 (define-pmacro (spr-iacc0h) (reg h-spr 280))
2397 (define-pmacro (spr-iacc0l) (reg h-spr 281))
2398 (define-pmacro (spr-sr0) (reg h-spr 768))
2399 (define-pmacro (spr-sr1) (reg h-spr 769))
2400 (define-pmacro (spr-sr2) (reg h-spr 770))
2401 (define-pmacro (spr-sr3) (reg h-spr 771))
2402
2403 ; Accumulator guard. Actually a subset of the SPR registers, but those SPRs
2404 ; are read-only in most insns. This hardware element is used by those insns
2405 ; which have direct access (mwtaccg, mrdaccg).
2406 (define-keyword
2407 (name accg-names)
2408 (print-name h-accg)
2409 (prefix "")
2410 (values
2411 (accg0 0)(accg1 1)(accg2 2)(accg3 3)
2412 (accg4 4)(accg5 5)(accg6 6)(accg7 7)
2413 (accg8 8)(accg9 9)(accg10 10)(accg11 11)
2414 (accg12 12)(accg13 13)(accg14 14)(accg15 15)
2415 (accg16 16)(accg17 17)(accg18 18)(accg19 19)
2416 (accg20 20)(accg21 21)(accg22 22)(accg23 23)
2417 (accg24 24)(accg25 25)(accg26 26)(accg27 27)
2418 (accg28 28)(accg29 29)(accg30 30)(accg31 31)
2419 (accg32 32)(accg33 33)(accg34 34)(accg35 35)
2420 (accg36 36)(accg37 37)(accg38 38)(accg39 39)
2421 (accg40 40)(accg41 41)(accg42 42)(accg43 43)
2422 (accg44 44)(accg45 45)(accg46 46)(accg47 47)
2423 (accg48 48)(accg49 49)(accg50 50)(accg51 51)
2424 (accg52 52)(accg53 53)(accg54 54)(accg55 55)
2425 (accg56 56)(accg57 57)(accg58 58)(accg59 59)
2426 (accg60 60)(accg61 61)(accg62 62)(accg63 63)
2427 )
2428 )
2429
2430 (define-hardware
2431 (name h-accg)
2432 (comment "accumulator guard")
2433 (attrs PROFILE VIRTUAL)
2434 (type register UWI (64))
2435 (indices extern-keyword accg-names)
2436 (get (index)
2437 (and (reg h-spr (add index 1472)) #xff))
2438 (set (index newval)
2439 (set (raw-reg UWI h-spr (add index 1472)) (and newval #xff)))
2440 )
2441
2442 ; 40 bit accumulator. Composed of ACCG and ACC registers concatenated, but
2443 ; referenced more often as the composed 40 bits.
2444 (define-keyword
2445 (name acc-names)
2446 (print-name h-acc40)
2447 (prefix "")
2448 (values
2449 (acc0 0)(acc1 1)(acc2 2)(acc3 3)(acc4 4)(acc5 5)(acc6 6)(acc7 7)
2450 (acc8 8)(acc9 9)(acc10 10)(acc11 11)(acc12 12)(acc13 13)(acc14 14)(acc15 15)
2451 (acc16 16)(acc17 17)(acc18 18)(acc19 19)(acc20 20)(acc21 21)(acc22 22)(acc23 23)
2452 (acc24 24)(acc25 25)(acc26 26)(acc27 27)(acc28 28)(acc29 29)(acc30 30)(acc31 31)
2453 (acc32 32)(acc33 33)(acc34 34)(acc35 35)(acc36 36)(acc37 37)(acc38 38)(acc39 39)
2454 (acc40 40)(acc41 41)(acc42 42)(acc43 43)(acc44 44)(acc45 45)(acc46 46)(acc47 47)
2455 (acc48 48)(acc49 49)(acc50 50)(acc51 51)(acc52 52)(acc53 53)(acc54 54)(acc55 55)
2456 (acc56 56)(acc57 57)(acc58 58)(acc59 59)(acc60 60)(acc61 61)(acc62 62)(acc63 63)
2457 )
2458 )
2459
2460 (define-hardware
2461 (name h-acc40S)
2462 (comment "40 bit signed accumulator")
2463 (attrs PROFILE VIRTUAL)
2464 (type register DI (64))
2465 (indices extern-keyword acc-names)
2466 ; The accumlator is made up of two 32 bit registers, accgi/acci.
2467 ; We want to extract this as a combined 40 signed bits
2468 (get (index)
2469 (or DI
2470 (sll DI (ext DI (trunc QI (reg h-spr (add index 1472))))
2471 32)
2472 (zext DI (reg h-spr (add index 1408)))))
2473 ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
2474 ; on ACC and ACCG registers
2475 (set (index newval)
2476 (sequence ()
2477 (c-call VOID "frv_check_spr_write_access" (add index 1408))
2478 (set (raw-reg UWI h-spr
2479 (add index 1472)) (and (srl newval 32) #xff))
2480 (set (raw-reg UWI h-spr
2481 (add index 1408)) (trunc USI newval))))
2482 )
2483
2484 (define-hardware
2485 (name h-acc40U)
2486 (comment "40 bit unsigned accumulator")
2487 (attrs PROFILE VIRTUAL)
2488 (type register UDI (64))
2489 (indices extern-keyword acc-names)
2490 ; The accumlator is made up of two 32 bit registers, accgi/acci.
2491 ; We want to extract this as a combined 40 unsigned bits
2492 (get (index)
2493 (or DI
2494 (sll DI (zext DI (reg h-spr (add index 1472))) 32)
2495 (zext DI (reg h-spr (add index 1408)))))
2496 ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
2497 ; on ACC and ACCG registers
2498 (set (index newval)
2499 (sequence ()
2500 (c-call VOID "frv_check_spr_write_access" (add index 1408))
2501 (set (raw-reg UWI h-spr
2502 (add index 1472)) (and (srl newval 32) #xff))
2503 (set (raw-reg UWI h-spr
2504 (add index 1408)) (trunc USI newval))))
2505 )
2506 ; 64-bit signed accumulator. Composed of iacc0h and iacc0l registers
2507 ; concatenated, but referenced more often as the composed 64 bits.
2508 (define-keyword
2509 ; This is totally hokey -- I have to have an index!
2510 (name iacc0-names)
2511 (print-name h-iacc0)
2512 (prefix "")
2513 (values (iacc0 0))
2514 )
2515
2516 (define-hardware
2517 (name h-iacc0)
2518 (comment "64 bit signed accumulator")
2519 (attrs PROFILE VIRTUAL (MACH fr400))
2520 (type register DI (1))
2521 (indices extern-keyword iacc0-names)
2522 ; The single 64-bit integer accumulator is made up of two 32 bit
2523 ; registers, iacc0h and iacc0l. We want to extract this as a
2524 ; combined 64 signed bits.
2525 (get (idx) (or DI (sll DI (ext DI (spr-iacc0h)) 32) (zext DI (spr-iacc0l))))
2526 (set (idx newval)
2527 (sequence ()
2528 (set (spr-iacc0h) (trunc SI (srl newval 32)))
2529 (set (spr-iacc0l) (trunc SI newval))))
2530 )
2531
2532 ; Integer condition code registers (CCR)
2533 ;
2534 ; The individual sub registers bits of the CCR are referenced more often than
2535 ; the entire register so set them directly. We can assemble the
2536 ; entire register when necessary.
2537 ;
2538 (define-keyword
2539 (name iccr-names)
2540 (print-name h-iccr)
2541 (prefix "")
2542 (values (icc0 0) (icc1 1) (icc2 2) (icc3 3))
2543 )
2544
2545 (define-hardware
2546 (name h-iccr)
2547 (comment "Integer condition code registers")
2548 (attrs PROFILE)
2549 (type register UQI (4))
2550 (indices extern-keyword iccr-names)
2551 )
2552
2553 ; Floating point condition code registers (CCR)
2554 ;
2555 ; The individual sub registers bits of the CCR are referenced more often than
2556 ; the entire register so set them directly. We can assemble the
2557 ; entire register when necessary.
2558 ;
2559 (define-keyword
2560 (name fccr-names)
2561 (print-name h-fccr)
2562 (prefix "")
2563 (values (fcc0 0) (fcc1 1) (fcc2 2) (fcc3 3))
2564 )
2565
2566 (define-hardware
2567 (name h-fccr)
2568 (comment "Floating point condition code registers")
2569 (attrs PROFILE)
2570 (type register UQI (4))
2571 (indices extern-keyword fccr-names)
2572 )
2573
2574 ; C condition code registers (CCCR)
2575 ;
2576 (define-keyword
2577 (name cccr-names)
2578 (print-name h-cccr)
2579 (prefix "")
2580 (values (cc0 0) (cc1 1) (cc2 2) (cc3 3) (cc4 4) (cc5 5) (cc6 6) (cc7 7))
2581 )
2582
2583 (define-hardware
2584 (name h-cccr)
2585 (comment "Condition code registers")
2586 (attrs PROFILE)
2587 (type register UQI (8))
2588 (indices extern-keyword cccr-names)
2589 )
2590 \f
2591 ; Dummy hardware used to define packing bit on insns
2592 ;
2593 (define-hardware
2594 (name h-pack)
2595 (comment "Packing bit dummy hardware")
2596 (type immediate (UINT 1))
2597 (values keyword "" (("" 1) (".p" 0) (".P" 0)))
2598 )
2599 ; Dummy hardware used to define hint field for branches always taken
2600 ;
2601 (define-hardware
2602 (name h-hint-taken)
2603 (comment "Branch taken hint dummy hardware")
2604 (type immediate (UINT 1))
2605 ; The order of these is important. We want '2' to get written by default,
2606 ; but we also want the docoder/disassembler to allow the values '0', '1' and
2607 ; '3'.
2608 (values keyword "" (("" 2) ("" 0) ("" 1) ("" 3)))
2609 )
2610 ; Dummy hardware used to define hint field for branches never taken
2611 ;
2612 (define-hardware
2613 (name h-hint-not-taken)
2614 (comment "Branch not taken hint dummy hardware")
2615 (type immediate (UINT 1))
2616 ; The order of these is important. We want '0' to get written by default,
2617 ; but we also want the docoder/disassembler to allow the values '1', '2' and
2618 ; '3'.
2619 (values keyword "" (("" 0) ("" 1) ("" 2) ("" 3)))
2620 )
2621 \f
2622 ; Instruction Operands.
2623 ; These entries provide a layer between the assembler and the raw hardware
2624 ; description, and are used to refer to hardware elements in the semantic
2625 ; code. Usually there's a bit of over-specification, but in more complicated
2626 ; instruction sets there isn't.
2627
2628 ; FRV specific operand attributes:
2629
2630 (define-attr
2631 (for operand)
2632 (type boolean)
2633 (name HASH-PREFIX)
2634 (comment "immediates have an optional '#' prefix")
2635 )
2636
2637 ; ??? Convention says this should be o-sr, but then the insn definitions
2638 ; should refer to o-sr which is clumsy. The "o-" could be implicit, but
2639 ; then it should be implicit for all the symbols here, but then there would
2640 ; be confusion between (f-)simm8 and (h-)simm8.
2641 ; So for now the rule is exactly as it appears here.
2642
2643 ; dnmop: define-normal-mode-operand: temporary, pending potential removal
2644 ; of modes from h/w.
2645 (define-pmacro (dnmop xname xcomment xattrs xtype xindex xmode)
2646 (define-operand
2647 (name xname)
2648 (comment xcomment)
2649 (.splice attrs (.unsplice xattrs))
2650 (type xtype)
2651 (index xindex)
2652 (mode xmode)
2653 )
2654 )
2655
2656 ; dnpmop: define-normal-parsed-mode-operand: Normal mode operand with parse handler
2657 (define-pmacro (dnpmop xname xcomment xattrs xtype xindex xmode xparse)
2658 (define-operand
2659 (name xname)
2660 (comment xcomment)
2661 (.splice attrs (.unsplice xattrs))
2662 (type xtype)
2663 (index xindex)
2664 (mode xmode)
2665 (handlers (parse xparse))
2666 )
2667 )
2668
2669 (dnop pack "packing bit" () h-pack f-pack)
2670
2671 (dnmop GRi "source register 1" () h-gr f-GRi SI)
2672 (dnmop GRj "source register 2" () h-gr f-GRj SI)
2673 (dnmop GRk "destination register" () h-gr f-GRk SI)
2674 (dnmop GRkhi "destination register" () h-gr_hi f-GRk UHI)
2675 (dnmop GRklo "destination register" () h-gr_lo f-GRk UHI)
2676 (dnpmop GRdoublek "destination register" () h-gr_double f-GRk DI "even_register")
2677 (dnmop ACC40Si "signed accumulator" () h-acc40S f-ACC40Si DI)
2678 (dnmop ACC40Ui "unsigned accumulator" () h-acc40U f-ACC40Ui UDI)
2679 (dnmop ACC40Sk "target accumulator" () h-acc40S f-ACC40Sk DI)
2680 (dnmop ACC40Uk "target accumulator" () h-acc40U f-ACC40Uk UDI)
2681 (dnmop ACCGi "source register" () h-accg f-ACCGi UWI)
2682 (dnmop ACCGk "target register" () h-accg f-ACCGk UWI)
2683
2684 (dnmop CPRi "source register" ((MACH frv)) h-cpr f-CPRi SI)
2685 (dnmop CPRj "source register" ((MACH frv)) h-cpr f-CPRj SI)
2686 (dnmop CPRk "destination register" ((MACH frv)) h-cpr f-CPRk SI)
2687 (dnpmop CPRdoublek "destination register" ((MACH frv)) h-cpr_double f-CPRk DI "even_register")
2688
2689 ; floating point operands
2690 (dnmop FRinti "source register 1" () h-fr_int f-FRi SI)
2691 (dnmop FRintj "source register 2" () h-fr_int f-FRj SI)
2692 (dnmop FRintk "target register" () h-fr_int f-FRk SI)
2693 (dnmop FRi "source register 1" () h-fr f-FRi SF)
2694 (dnmop FRj "source register 2" () h-fr f-FRj SF)
2695 (dnmop FRk "destination register" () h-fr f-FRk SF)
2696 (dnmop FRkhi "destination register" () h-fr_hi f-FRk UHI)
2697 (dnmop FRklo "destination register" () h-fr_lo f-FRk UHI)
2698 (dnpmop FRdoublei "source register 1" () h-fr_double f-FRi DF "even_register")
2699 (dnpmop FRdoublej "source register 2" () h-fr_double f-FRj DF "even_register")
2700 (dnpmop FRdoublek "target register" () h-fr_double f-FRk DF "even_register")
2701
2702 (dnop CRi "source register 1" () h-cccr f-CRi)
2703 (dnop CRj "source register 2" () h-cccr f-CRj)
2704 (dnop CRj_int "destination register" () h-cccr f-CRj_int)
2705 (dnop CRj_float "destination register" () h-cccr f-CRj_float)
2706 (dnop CRk "destination register" () h-cccr f-CRk)
2707 (dnop CCi "condition register" () h-cccr f-CCi)
2708
2709 (dnop ICCi_1 "condition register" () h-iccr f-ICCi_1)
2710 (dnop ICCi_2 "condition register" () h-iccr f-ICCi_2)
2711 (dnop ICCi_3 "condition register" () h-iccr f-ICCi_3)
2712 (dnop FCCi_1 "condition register" () h-fccr f-FCCi_1)
2713 (dnop FCCi_2 "condition register" () h-fccr f-FCCi_2)
2714 (dnop FCCi_3 "condition register" () h-fccr f-FCCi_3)
2715 (dnop FCCk "condition register" () h-fccr f-FCCk)
2716
2717 (dnop eir "exception insn reg" () h-uint f-eir)
2718 (dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10)
2719 (dnop u16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-u16)
2720 (dnop s16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-s16)
2721 (dnop s6 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6)
2722 (dnop s6_1 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6_1)
2723 (dnop u6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-u6)
2724 (dnop s5 "5 bit signed immediate" (HASH-PREFIX) h-sint f-s5)
2725 (dnop cond "conditional arithmetic" (HASH-PREFIX) h-uint f-cond)
2726 (dnop ccond "lr branch condition" (HASH-PREFIX) h-uint f-ccond)
2727 (dnop hint "2 bit branch predictor" (HASH-PREFIX) h-uint f-hint)
2728 (dnop hint_taken "2 bit branch predictor" () h-hint-taken f-hint)
2729 (dnop hint_not_taken "2 bit branch predictor" () h-hint-not-taken f-hint)
2730
2731 (dnop LI "link indicator" () h-uint f-LI)
2732 (dnop lock "cache lock indicator" (HASH-PREFIX) h-uint f-lock)
2733 (dnop debug "debug mode indicator" (HASH-PREFIX) h-uint f-debug)
2734 (dnop ae "all entries indicator" (HASH-PREFIX) h-uint f-ae)
2735
2736 (dnop label16 "18 bit pc relative address" () h-iaddr f-label16)
2737 (dnop label24 "26 bit pc relative address" () h-iaddr f-label24)
2738
2739 (define-operand
2740 (name A0)
2741 (comment "A==0 operand of mclracc")
2742 (attrs)
2743 (type h-uint)
2744 (index f-A)
2745 (mode USI)
2746 (handlers (parse "A0"))
2747 )
2748
2749 (define-operand
2750 (name A1)
2751 (comment "A==1 operand of mclracc")
2752 (attrs)
2753 (type h-uint)
2754 (index f-A)
2755 (mode USI)
2756 (handlers (parse "A1"))
2757 )
2758
2759 (define-operand
2760 (name FRintieven)
2761 (comment "(even) source register 1")
2762 (attrs)
2763 (type h-fr_int)
2764 (index f-FRi)
2765 (mode SI)
2766 (handlers (parse "even_register"))
2767 )
2768
2769 (define-operand
2770 (name FRintjeven)
2771 (comment "(even) source register 2")
2772 (attrs)
2773 (type h-fr_int)
2774 (index f-FRj)
2775 (mode SI)
2776 (handlers (parse "even_register"))
2777 )
2778
2779 (define-operand
2780 (name FRintkeven)
2781 (comment "(even) target register")
2782 (attrs)
2783 (type h-fr_int)
2784 (index f-FRk)
2785 (mode SI)
2786 (handlers (parse "even_register"))
2787 )
2788
2789 (define-operand
2790 (name d12)
2791 (comment "12 bit signed immediate")
2792 (attrs)
2793 (type h-sint)
2794 (index f-d12)
2795 (handlers (parse "d12"))
2796 )
2797
2798 (define-operand
2799 (name s12)
2800 (comment "12 bit signed immediate")
2801 (attrs HASH-PREFIX)
2802 (type h-sint)
2803 (index f-d12)
2804 (handlers (parse "s12"))
2805 )
2806
2807 (define-operand
2808 (name u12)
2809 (comment "12 bit signed immediate")
2810 (attrs HASH-PREFIX)
2811 (type h-sint)
2812 (index f-u12)
2813 (handlers (parse "u12"))
2814 )
2815
2816 (define-operand
2817 (name spr)
2818 (comment "special purpose register")
2819 (attrs)
2820 (type h-spr)
2821 (index f-spr)
2822 (handlers (parse "spr") (print "spr"))
2823 )
2824
2825 (define-operand
2826 (name ulo16)
2827 (comment "16 bit unsigned immediate, for #lo()")
2828 (attrs)
2829 (type h-uint)
2830 (index f-u16)
2831 (handlers (parse "ulo16") (print "lo"))
2832 )
2833
2834 (define-operand
2835 (name slo16)
2836 (comment "16 bit unsigned immediate, for #lo()")
2837 (attrs)
2838 (type h-sint)
2839 (index f-s16)
2840 (handlers (parse "uslo16") (print "lo"))
2841 )
2842
2843 (define-operand
2844 (name uhi16)
2845 (comment "16 bit unsigned immediate, for #hi()")
2846 (attrs)
2847 (type h-uint)
2848 (index f-u16)
2849 (handlers (parse "uhi16") (print "hi"))
2850 )
2851
2852 ; operands representing hardware
2853 ;
2854 (dnop psr_esr "PSR.ESR bit" (SEM-ONLY) h-psr_esr f-nil)
2855 (dnop psr_s "PSR.S bit" (SEM-ONLY) h-psr_s f-nil)
2856 (dnop psr_ps "PSR.PS bit" (SEM-ONLY) h-psr_ps f-nil)
2857 (dnop psr_et "PSR.ET bit" (SEM-ONLY) h-psr_et f-nil)
2858
2859 (dnop bpsr_bs "BPSR.BS bit" (SEM-ONLY) h-bpsr_bs f-nil)
2860 (dnop bpsr_bet "BPSR.BET bit" (SEM-ONLY) h-bpsr_bet f-nil)
2861
2862 (dnop tbr_tba "TBR.TBA" (SEM-ONLY) h-tbr_tba f-nil)
2863 (dnop tbr_tt "TBR.TT" (SEM-ONLY) h-tbr_tt f-nil)
2864
2865 ; Null operands
2866 ;
2867 (define-pmacro (ICCi_1-null) (f-ICCi_1-null 0))
2868 (define-pmacro (ICCi_2-null) (f-ICCi_2-null 0))
2869 (define-pmacro (ICCi_3-null) (f-ICCi_3-null 0))
2870 (define-pmacro (FCCi_1-null) (f-FCCi_1-null 0))
2871 (define-pmacro (FCCi_2-null) (f-FCCi_2-null 0))
2872 (define-pmacro (FCCi_3-null) (f-FCCi_3-null 0))
2873 (define-pmacro (rs-null) (f-rs-null 0))
2874 (define-pmacro (GRi-null) (f-GRi-null 0))
2875 (define-pmacro (GRj-null) (f-GRj-null 0))
2876 (define-pmacro (GRk-null) (f-GRk-null 0))
2877 (define-pmacro (FRi-null) (f-FRi-null 0))
2878 (define-pmacro (FRj-null) (f-FRj-null 0))
2879 (define-pmacro (ACCj-null) (f-ACCj-null 0))
2880 (define-pmacro (rd-null) (f-rd-null 0))
2881 (define-pmacro (cond-null) (f-cond-null 0))
2882 (define-pmacro (ccond-null) (f-ccond-null 0))
2883 (define-pmacro (s12-null) (f-s12-null 0))
2884 (define-pmacro (label16-null) (f-label16-null 0))
2885 (define-pmacro (misc-null-1) (f-misc-null-1 0))
2886 (define-pmacro (misc-null-2) (f-misc-null-2 0))
2887 (define-pmacro (misc-null-3) (f-misc-null-3 0))
2888 (define-pmacro (misc-null-4) (f-misc-null-4 0))
2889 (define-pmacro (misc-null-5) (f-misc-null-5 0))
2890 (define-pmacro (misc-null-6) (f-misc-null-6 0))
2891 (define-pmacro (misc-null-7) (f-misc-null-7 0))
2892 (define-pmacro (misc-null-8) (f-misc-null-8 0))
2893 (define-pmacro (misc-null-9) (f-misc-null-9 0))
2894 (define-pmacro (misc-null-10) (f-misc-null-10 0))
2895 (define-pmacro (misc-null-11) (f-misc-null-11 0))
2896
2897 (define-pmacro (LI-on) (f-LI-on 1))
2898 (define-pmacro (LI-off) (f-LI-off 0))
2899 \f
2900 ; Instruction definitions.
2901 ;
2902 ; Notes:
2903 ; - dni is short for "define-normal-instruction"
2904 ; - Macros are used to represent each insn format. These should be used as much
2905 ; as possible unless an insn has exceptional behaviour
2906 ;
2907
2908 ; Commonly used Macros
2909 ;
2910 ; Specific registers
2911 ;
2912
2913 ; Integer condition code manipulation
2914 ;
2915 (define-pmacro (set-z-and-n icc x)
2916 (if (eq x 0)
2917 (set icc (or (and icc #x7) #x4))
2918 (if (lt x 0)
2919 (set icc (or (and icc #xb) #x8))
2920 (set icc (and icc #x3))))
2921 )
2922
2923 (define-pmacro (set-n icc val)
2924 (if (eq val 0)
2925 (set icc (and icc #x7))
2926 (set icc (or icc #x8)))
2927 )
2928
2929 (define-pmacro (set-z icc val)
2930 (if (eq val 0)
2931 (set icc (and icc #xb))
2932 (set icc (or icc #x4)))
2933 )
2934
2935 (define-pmacro (set-v icc val)
2936 (if (eq val 0)
2937 (set icc (and icc #xd))
2938 (set icc (or icc #x2)))
2939 )
2940
2941 (define-pmacro (set-c icc val)
2942 (if (eq val 0)
2943 (set icc (and icc #xe))
2944 (set icc (or icc #x1)))
2945 )
2946
2947 (define-pmacro (nbit icc)
2948 (trunc BI (srl (and icc #x8) 3))
2949 )
2950
2951 (define-pmacro (zbit icc)
2952 (trunc BI (srl (and icc #x4) 2))
2953 )
2954
2955 (define-pmacro (vbit icc)
2956 (trunc BI (srl (and icc #x2) 1))
2957 )
2958
2959 (define-pmacro (cbit icc)
2960 (trunc BI (and icc #x1))
2961 )
2962
2963 (define-pmacro (ebit icc)
2964 (trunc BI (srl (and icc #x8) 3))
2965 )
2966
2967 (define-pmacro (lbit icc)
2968 (trunc BI (srl (and icc #x4) 2))
2969 )
2970
2971 (define-pmacro (gbit icc)
2972 (trunc BI (srl (and icc #x2) 1))
2973 )
2974
2975 (define-pmacro (ubit icc)
2976 (trunc BI (and icc #x1))
2977 )
2978
2979 ; FRV insns
2980 ;
2981 ;
2982 ; Format: INT, Logic, Shift r-r
2983 ;
2984 (define-pmacro (int-logic-r-r name operation op ope comment)
2985 (dni name
2986 (comment)
2987 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
2988 (.str name "$pack $GRi,$GRj,$GRk")
2989 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
2990 (set GRk (operation GRi GRj))
2991 ((fr400 (unit u-integer))
2992 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
2993 )
2994 )
2995
2996 (int-logic-r-r add add OP_00 OPE2_00 "add reg/reg")
2997 (int-logic-r-r sub sub OP_00 OPE2_04 "sub reg/reg")
2998 (int-logic-r-r and and OP_01 OPE2_00 "and reg/reg")
2999 (int-logic-r-r or or OP_01 OPE2_02 "or reg/reg")
3000 (int-logic-r-r xor xor OP_01 OPE2_04 "xor reg/reg")
3001
3002 (dni not
3003 ("not")
3004 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3005 ("not$pack $GRj,$GRk")
3006 (+ pack GRk OP_01 (rs-null) (ICCi_1-null) OPE2_06 GRj)
3007 (set GRk (inv GRj))
3008 ((fr400 (unit u-integer))
3009 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3010 )
3011
3012 (dni sdiv
3013 "signed division"
3014 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3015 "sdiv$pack $GRi,$GRj,$GRk"
3016 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0E GRj)
3017 (sequence ()
3018 (c-call VOID "@cpu@_signed_integer_divide"
3019 GRi GRj (index-of GRk) 0)
3020 (clobber GRk))
3021 ((fr400 (unit u-idiv))
3022 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3023 )
3024
3025 (dni nsdiv
3026 "non excepting signed division"
3027 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3028 (MACH simple,tomcat,fr500,fr550,frv))
3029 "nsdiv$pack $GRi,$GRj,$GRk"
3030 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0E GRj)
3031 (sequence ()
3032 (c-call VOID "@cpu@_signed_integer_divide"
3033 GRi GRj (index-of GRk) 1)
3034 (clobber GRk))
3035 ((fr400 (unit u-idiv))
3036 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3037 )
3038
3039 (dni udiv
3040 "unsigned division reg/reg"
3041 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3042 "udiv$pack $GRi,$GRj,$GRk"
3043 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0F GRj)
3044 (sequence ()
3045 (c-call VOID "@cpu@_unsigned_integer_divide"
3046 GRi GRj (index-of GRk) 0)
3047 (clobber GRk))
3048 ((fr400 (unit u-idiv))
3049 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3050 )
3051
3052 (dni nudiv
3053 "non excepting unsigned division"
3054 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3055 (MACH simple,tomcat,fr500,fr550,frv))
3056 "nudiv$pack $GRi,$GRj,$GRk"
3057 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0F GRj)
3058 (sequence ()
3059 (c-call VOID "@cpu@_unsigned_integer_divide"
3060 GRi GRj (index-of GRk) 1)
3061 (clobber GRk))
3062 ((fr400 (unit u-idiv))
3063 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3064 )
3065
3066 ; Multiplication
3067 ;
3068 (define-pmacro (multiply-r-r name signop op ope comment)
3069 (dni name
3070 (comment)
3071 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3072 (.str name "$pack $GRi,$GRj,$GRdoublek")
3073 (+ pack GRdoublek op GRi (ICCi_1-null) ope GRj)
3074 (set GRdoublek (mul DI (signop DI GRi) (signop DI GRj)))
3075 ((fr400 (unit u-imul))
3076 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3077 )
3078 )
3079
3080 (multiply-r-r smul ext OP_00 OPE2_08 "signed multiply reg/reg")
3081 (multiply-r-r umul zext OP_00 OPE2_0A "unsigned multiply reg/reg")
3082
3083 ; Multiplication with integer accumulator IACC
3084 ;
3085
3086 (define-pmacro (iacc-set value)
3087 (set (reg h-iacc0 0) value))
3088
3089 (define-pmacro (iacc-add value)
3090 (set (reg h-iacc0 0)
3091 (cond DI
3092 ((andif (andif (gt value 0) (gt (reg h-iacc0 0) 0))
3093 (lt (sub DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3094 ; Positive overflow
3095 (const DI #x7fffffffffffffff))
3096 ((andif (andif (lt value 0) (lt (reg h-iacc0 0) 0))
3097 (gt (sub DI #x8000000000000000 value) (reg h-iacc0 0)))
3098 ; Negative overflow
3099 (const DI #x8000000000000000))
3100 (else
3101 (add DI (reg h-iacc0 0) value))))
3102 )
3103
3104 (define-pmacro (iacc-sub value)
3105 (set (reg h-iacc0 0)
3106 (cond DI
3107 ((andif (andif (lt value 0) (gt (reg h-iacc0 0) 0))
3108 (lt (add DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3109 ; Positive overflow
3110 (const DI #x7fffffffffffffff))
3111 ((andif (andif (gt value 0) (lt (reg h-iacc0 0) 0))
3112 (gt (add DI #x8000000000000000 value) (reg h-iacc0 0)))
3113 ; Negative overflow
3114 (const DI #x8000000000000000))
3115 (else
3116 (sub DI (reg h-iacc0 0) value))))
3117 )
3118
3119 (define-pmacro (iacc-multiply-r-r name operation op ope comment)
3120 (dni name
3121 (comment)
3122 ((UNIT IACC) (FR400-MAJOR I-1) (MACH fr400))
3123 (.str name "$pack $GRi,$GRj")
3124 (+ pack (rd-null) op GRi ope GRj)
3125 ((.sym iacc- operation) (mul DI (ext DI GRi) (ext DI GRj)))
3126 ((fr400 (unit u-integer)))
3127 )
3128 )
3129
3130 (iacc-multiply-r-r smu set OP_46 OPE1_05 "Signed multiply reg/reg/iacc")
3131 (iacc-multiply-r-r smass add OP_46 OPE1_06 "Signed multiply/add reg/reg/iacc")
3132 (iacc-multiply-r-r smsss sub OP_46 OPE1_07 "Signed multiply/sub reg/reg/iacc")
3133
3134 (define-pmacro (int-shift-r-r name op ope comment)
3135 (dni name
3136 (comment)
3137 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3138 (.str name "$pack $GRi,$GRj,$GRk")
3139 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
3140 (set GRk (name GRi (and GRj #x1f)))
3141 ((fr400 (unit u-integer))
3142 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3143 )
3144 )
3145
3146 (int-shift-r-r sll OP_01 OPE2_08 "shift left logical reg/reg")
3147 (int-shift-r-r srl OP_01 OPE2_0A "shift right logical reg/reg")
3148 (int-shift-r-r sra OP_01 OPE2_0C "shift right arith reg/reg")
3149
3150 (dni slass
3151 "shift left arith reg/reg with saturation"
3152 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3153 "slass$pack $GRi,$GRj,$GRk"
3154 (+ pack GRk OP_46 GRi OPE1_02 GRj)
3155 (set GRk (c-call SI "@cpu@_shift_left_arith_saturate" GRi GRj))
3156 ()
3157 )
3158
3159 (dni scutss
3160 "Integer accumulator cut with saturation"
3161 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3162 "scutss$pack $GRj,$GRk"
3163 (+ pack GRk OP_46 (rs-null) OPE1_04 GRj)
3164 (set GRk (c-call SI "@cpu@_iacc_cut" (reg h-iacc0 0) GRj))
3165 ()
3166 )
3167
3168 (define-pmacro (scan-semantics arg1 arg2 targ)
3169 (sequence ((WI tmp1) (WI tmp2))
3170 (set tmp1 arg1)
3171 (set tmp2 (sra arg2 1))
3172 (set targ (c-call WI "@cpu@_scan_result" (xor tmp1 tmp2))))
3173 )
3174
3175 (dni scan
3176 "scan"
3177 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3178 "scan$pack $GRi,$GRj,$GRk"
3179 (+ pack GRk OP_0B GRi (ICCi_1-null) OPE2_00 GRj)
3180 (scan-semantics GRi GRj GRk)
3181 ((fr400 (unit u-integer))
3182 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3183 )
3184
3185 ; Format: conditional INT, Logic, Shift r-r
3186 ;
3187 (define-pmacro (conditional-int-logic name operation op ope comment)
3188 (dni name
3189 (comment)
3190 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3191 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3192 (+ pack GRk op GRi CCi cond ope GRj)
3193 (if (eq CCi (or cond 2))
3194 (set GRk (operation GRi GRj)))
3195 ((fr400 (unit u-integer))
3196 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3197 )
3198 )
3199
3200 (conditional-int-logic cadd add OP_58 OPE4_0 "conditional add")
3201 (conditional-int-logic csub sub OP_58 OPE4_1 "conditional sub")
3202 (conditional-int-logic cand and OP_5A OPE4_0 "conditional and")
3203 (conditional-int-logic cor or OP_5A OPE4_1 "conditional or")
3204 (conditional-int-logic cxor xor OP_5A OPE4_2 "conditional xor")
3205
3206 (dni cnot
3207 "conditional not"
3208 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3209 "cnot$pack $GRj,$GRk,$CCi,$cond"
3210 (+ pack GRk OP_5A (rs-null) CCi cond OPE4_3 GRj)
3211 (if (eq CCi (or cond 2))
3212 (set GRk (inv GRj)))
3213 ((fr400 (unit u-integer))
3214 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3215 )
3216
3217 (dni csmul
3218 "conditional signed multiply"
3219 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3220 "csmul$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3221 (+ pack GRdoublek OP_58 GRi CCi cond OPE4_2 GRj)
3222 (if (eq CCi (or cond 2))
3223 (set GRdoublek (mul DI (ext DI GRi) (ext DI GRj))))
3224 ((fr400 (unit u-imul))
3225 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3226 )
3227
3228 (dni csdiv
3229 "conditional signed division"
3230 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3231 "csdiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3232 (+ pack GRk OP_58 GRi CCi cond OPE4_3 GRj)
3233 (if (eq CCi (or cond 2))
3234 (sequence ()
3235 (c-call VOID "@cpu@_signed_integer_divide"
3236 GRi GRj (index-of GRk) 0)
3237 (clobber GRk)))
3238 ((fr400 (unit u-idiv))
3239 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3240 )
3241
3242 (dni cudiv
3243 "conditional unsigned division"
3244 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3245 "cudiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3246 (+ pack GRk OP_59 GRi CCi cond OPE4_3 GRj)
3247 (if (eq CCi (or cond 2))
3248 (sequence ()
3249 (c-call VOID "@cpu@_unsigned_integer_divide"
3250 GRi GRj (index-of GRk) 0)
3251 (clobber GRk)))
3252 ((fr400 (unit u-idiv))
3253 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3254 )
3255
3256 (define-pmacro (conditional-shift name operation op ope comment)
3257 (dni name
3258 (comment)
3259 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3260 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3261 (+ pack GRk op GRi CCi cond ope GRj)
3262 (if (eq CCi (or cond 2))
3263 (set GRk (operation GRi (and GRj #x1f))))
3264 ((fr400 (unit u-integer))
3265 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3266 )
3267 )
3268
3269 (conditional-shift csll sll OP_5C OPE4_0 "conditional shift left logical")
3270 (conditional-shift csrl srl OP_5C OPE4_1 "conditional shift right logical")
3271 (conditional-shift csra sra OP_5C OPE4_2 "conditional shift right arith")
3272
3273 (dni cscan
3274 "conditional scan"
3275 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3276 "cscan$pack $GRi,$GRj,$GRk,$CCi,$cond"
3277 (+ pack GRk OP_65 GRi CCi cond OPE4_3 GRj)
3278 (if (eq CCi (or cond 2))
3279 (scan-semantics GRi GRj GRk))
3280 ((fr400 (unit u-integer))
3281 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3282 )
3283
3284 ; Format: INT, Logic, Shift, cc r-r
3285 ;
3286 (define-pmacro (int-arith-cc-semantics operation icc)
3287 (sequence ((BI tmp) (QI cc) (SI result))
3288 (set cc icc)
3289 (set tmp ((.sym operation -oflag) GRi GRj (const 0)))
3290 (set-v cc tmp)
3291 (set tmp ((.sym operation -cflag) GRi GRj (const 0)))
3292 (set-c cc tmp)
3293 (set result (operation GRi GRj))
3294 (set-z-and-n cc result)
3295 (set GRk result)
3296 (set icc cc))
3297 )
3298
3299 (define-pmacro (int-arith-cc-r-r name operation op ope comment)
3300 (dni name
3301 (comment)
3302 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3303 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3304 (+ pack GRk op GRi ICCi_1 ope GRj)
3305 (int-arith-cc-semantics operation ICCi_1)
3306 ((fr400 (unit u-integer))
3307 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3308 )
3309 )
3310
3311 (int-arith-cc-r-r addcc add OP_00 OPE2_01 "add reg/reg, set icc")
3312 (int-arith-cc-r-r subcc sub OP_00 OPE2_05 "sub reg/reg, set icc")
3313
3314 (define-pmacro (int-logic-cc-semantics op icc)
3315 (sequence ((SI tmp))
3316 (set tmp (op GRi GRj))
3317 (set GRk tmp)
3318 (set-z-and-n icc tmp))
3319 )
3320
3321 (define-pmacro (int-logic-cc-r-r name op ope comment)
3322 (dni (.sym name cc)
3323 (comment)
3324 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3325 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3326 (+ pack GRk op GRi ICCi_1 ope GRj)
3327 (int-logic-cc-semantics name ICCi_1)
3328 ((fr400 (unit u-integer))
3329 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3330 )
3331 )
3332
3333 (int-logic-cc-r-r and OP_01 OPE2_01 "and reg/reg, set icc")
3334 (int-logic-cc-r-r or OP_01 OPE2_03 "or reg/reg, set icc")
3335 (int-logic-cc-r-r xor OP_01 OPE2_05 "xor reg/reg, set icc")
3336
3337 (define-pmacro (int-shift-cc-semantics op l-r icc)
3338 (sequence ((WI shift) (SI tmp) (QI cc))
3339 (set shift (and GRj #x1f))
3340 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3341 GRi shift icc))
3342 (set tmp (op GRi shift))
3343 (set GRk tmp)
3344 (set-z-and-n cc tmp)
3345 (set icc cc))
3346 )
3347
3348 (define-pmacro (int-shift-cc-r-r name l-r op ope comment)
3349 (dni (.sym name cc)
3350 (comment)
3351 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3352 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3353 (+ pack GRk op GRi ICCi_1 ope GRj)
3354 (int-shift-cc-semantics name l-r ICCi_1)
3355 ((fr400 (unit u-integer))
3356 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3357 )
3358 )
3359
3360 (int-shift-cc-r-r sll left OP_01 OPE2_09 "shift left logical reg/reg,set icc")
3361 (int-shift-cc-r-r srl right OP_01 OPE2_0B "shift right logical reg/reg,set icc")
3362 (int-shift-cc-r-r sra right OP_01 OPE2_0D "shift right arith reg/reg,set icc")
3363
3364 (define-pmacro (multiply-cc-semantics signop arg1 arg2 targ icc)
3365 (sequence ((DI tmp) (QI cc))
3366 (set cc icc)
3367 (set tmp (mul DI (signop DI arg1) (signop DI arg2)))
3368 (set-n cc (srl DI tmp 63))
3369 (set-z cc (eq tmp 0))
3370 (set targ tmp)
3371 (set icc cc))
3372 )
3373
3374 (define-pmacro (multiply-cc-r-r name signop op ope comment)
3375 (dni name
3376 (comment)
3377 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3378 (.str name "$pack $GRi,$GRj,$GRdoublek,$ICCi_1")
3379 (+ pack GRdoublek op GRi ICCi_1 ope GRj)
3380 (multiply-cc-semantics signop GRi GRj GRdoublek ICCi_1)
3381 ((fr400 (unit u-imul))
3382 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3383 )
3384 )
3385
3386 (multiply-cc-r-r smulcc ext OP_00 OPE2_09 "signed multiply reg/reg")
3387 (multiply-cc-r-r umulcc zext OP_00 OPE2_0B "unsigned multiply reg/reg")
3388
3389
3390 ; Format: conditional INT, Logic, Shift, cc r-r
3391 ;
3392 (define-pmacro (conditional-int-arith-cc name operation op ope comment)
3393 (dni name
3394 (comment)
3395 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3396 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3397 (+ pack GRk op GRi CCi cond ope GRj)
3398 (if (eq CCi (or cond 2))
3399 (int-arith-cc-semantics operation
3400 (reg h-iccr (and (index-of CCi) 3))))
3401 ((fr400 (unit u-integer))
3402 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3403 )
3404 )
3405
3406 (conditional-int-arith-cc caddcc add OP_59 OPE4_0 "add, set icc")
3407 (conditional-int-arith-cc csubcc sub OP_59 OPE4_1 "sub, set icc")
3408
3409 (dni csmulcc
3410 "conditional signed multiply and set condition code"
3411 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3412 "csmulcc$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3413 (+ pack GRdoublek OP_59 GRi CCi cond OPE4_2 GRj)
3414 (if (eq CCi (or cond 2))
3415 (multiply-cc-semantics ext GRi GRj GRdoublek
3416 (reg h-iccr (and (index-of CCi) 3))))
3417 ((fr400 (unit u-imul))
3418 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3419 )
3420
3421 (define-pmacro (conditional-int-logic-cc name operation op ope comment)
3422 (dni name
3423 (comment)
3424 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3425 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3426 (+ pack GRk op GRi CCi cond ope GRj)
3427 (if (eq CCi (or cond 2))
3428 (int-logic-cc-semantics operation
3429 (reg h-iccr (and (index-of CCi) 3))))
3430 ((fr400 (unit u-integer))
3431 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3432 )
3433 )
3434
3435 (conditional-int-logic-cc candcc and OP_5B OPE4_0 "conditional and, set icc")
3436 (conditional-int-logic-cc corcc or OP_5B OPE4_1 "conditional or , set icc")
3437 (conditional-int-logic-cc cxorcc xor OP_5B OPE4_2 "conditional xor, set icc")
3438
3439 (define-pmacro (conditional-int-shift-cc name l-r op ope comment)
3440 (dni (.sym c name cc)
3441 (comment)
3442 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3443 (.str (.sym c name cc) "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3444 (+ pack GRk op GRi CCi cond ope GRj)
3445 (if (eq CCi (or cond 2))
3446 (int-shift-cc-semantics name l-r
3447 (reg h-iccr (and (index-of CCi) 3))))
3448 ((fr400 (unit u-integer))
3449 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3450 )
3451 )
3452
3453 (conditional-int-shift-cc sll left OP_5D OPE4_0 "shift left logical, set icc")
3454 (conditional-int-shift-cc srl right OP_5D OPE4_1 "shift right logical, set icc")
3455 (conditional-int-shift-cc sra right OP_5D OPE4_2 "shift right arith , set icc")
3456
3457 ; Add and subtract with carry
3458 ;
3459 (define-pmacro (int-arith-x-r-r name operation op ope comment)
3460 (dni name
3461 (comment)
3462 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3463 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3464 (+ pack GRk op GRi ICCi_1 ope GRj)
3465 (set GRk ((.sym operation c) GRi GRj (cbit ICCi_1)))
3466 ((fr400 (unit u-integer))
3467 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3468 )
3469 )
3470
3471 (int-arith-x-r-r addx add OP_00 OPE2_02 "Add reg/reg, with carry")
3472 (int-arith-x-r-r subx sub OP_00 OPE2_06 "Sub reg/reg, with carry")
3473
3474 (define-pmacro (int-arith-x-cc-r-r name operation op ope comment)
3475 (dni name
3476 (comment)
3477 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3478 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3479 (+ pack GRk op GRi ICCi_1 ope GRj)
3480 (sequence ((WI tmp) (QI cc))
3481 (set cc ICCi_1)
3482 (set tmp ((.sym operation c) GRi GRj (cbit cc)))
3483 (set-v cc ((.sym operation -oflag) GRi GRj (cbit cc)))
3484 (set-c cc ((.sym operation -cflag) GRi GRj (cbit cc)))
3485 (set-z-and-n cc tmp)
3486 (set GRk tmp)
3487 (set ICCi_1 cc))
3488 ((fr400 (unit u-integer))
3489 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3490 )
3491 )
3492
3493 (int-arith-x-cc-r-r addxcc add OP_00 OPE2_03 "Add reg/reg, use/set carry")
3494 (int-arith-x-cc-r-r subxcc sub OP_00 OPE2_07 "Sub reg/reg, use/set carry")
3495 ; Add and subtract with saturation
3496 ;
3497 (define-pmacro (int-arith-ss-r-r name operation op ope comment)
3498 (dni name
3499 (comment)
3500 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3501 (.str name "$pack $GRi,$GRj,$GRk")
3502 (+ pack GRk op GRi ope GRj)
3503 (sequence ()
3504 (set GRk (operation GRi GRj))
3505 (if ((.sym operation -oflag) GRi GRj (const 0))
3506 ; Overflow, saturate.
3507 ; Sign of result will be
3508 ; same as sign of first operand.
3509 (set GRk
3510 (cond SI
3511 ((gt GRi 0) (const #x7fffffff))
3512 ((lt GRi 0) (const #x80000000))
3513 (else (const 0)))))
3514 )
3515 ((fr400 (unit u-integer)))
3516 )
3517 )
3518
3519 (int-arith-ss-r-r addss add OP_46 OPE1_00 "add reg/reg, with saturation")
3520 (int-arith-ss-r-r subss sub OP_46 OPE1_01 "sub reg/reg, with saturation")
3521
3522 ; Format: INT, Logic, Shift r-simm
3523 ;
3524 (define-pmacro (int-logic-r-simm name operation op comment)
3525 (dni name
3526 (comment)
3527 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3528 (.str name "$pack $GRi,$s12,$GRk")
3529 (+ pack GRk op GRi s12)
3530 (set GRk (operation GRi s12))
3531 ((fr400 (unit u-integer))
3532 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3533 )
3534 )
3535
3536 (int-logic-r-simm addi add OP_10 "add reg/immed")
3537 (int-logic-r-simm subi sub OP_14 "sub reg/immed")
3538 (int-logic-r-simm andi and OP_20 "and reg/immed")
3539 (int-logic-r-simm ori or OP_22 "or reg/immed")
3540 (int-logic-r-simm xori xor OP_24 "xor reg/immed")
3541
3542 (dni sdivi
3543 "signed division reg/immed"
3544 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3545 "sdivi$pack $GRi,$s12,$GRk"
3546 (+ pack GRk OP_1E GRi s12)
3547 (sequence ()
3548 (c-call VOID "@cpu@_signed_integer_divide"
3549 GRi s12 (index-of GRk) 0)
3550 (clobber GRk))
3551 ((fr400 (unit u-idiv))
3552 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3553 )
3554
3555 (dni nsdivi
3556 "non excepting signed division reg/immed"
3557 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3558 (MACH simple,tomcat,fr500,fr550,frv))
3559 "nsdivi$pack $GRi,$s12,$GRk"
3560 (+ pack GRk OP_2E GRi s12)
3561 (sequence ()
3562 (c-call VOID "@cpu@_signed_integer_divide"
3563 GRi s12 (index-of GRk) 1)
3564 (clobber GRk))
3565 ((fr400 (unit u-idiv))
3566 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3567 )
3568
3569 (dni udivi
3570 "unsigned division reg/immed"
3571 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3572 "udivi$pack $GRi,$s12,$GRk"
3573 (+ pack GRk OP_1F GRi s12)
3574 (sequence ()
3575 (c-call VOID "@cpu@_unsigned_integer_divide"
3576 GRi s12 (index-of GRk) 0)
3577 (clobber GRk))
3578 ((fr400 (unit u-idiv))
3579 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3580 )
3581
3582 (dni nudivi
3583 "non excepting unsigned division reg/immed"
3584 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3585 (MACH simple,tomcat,fr500,fr550,frv))
3586 "nudivi$pack $GRi,$s12,$GRk"
3587 (+ pack GRk OP_2F GRi s12)
3588 (sequence ()
3589 (c-call VOID "@cpu@_unsigned_integer_divide"
3590 GRi s12 (index-of GRk) 1)
3591 (clobber GRk))
3592 ((fr400 (unit u-idiv))
3593 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3594 )
3595
3596 (define-pmacro (multiply-r-simm name signop op comment)
3597 (dni name
3598 (comment)
3599 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3600 (.str name "$pack $GRi,$s12,$GRdoublek")
3601 (+ pack GRdoublek op GRi s12)
3602 (set GRdoublek (mul DI (signop DI GRi) (signop DI s12)))
3603 ((fr400 (unit u-imul))
3604 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3605 )
3606 )
3607
3608 (multiply-r-simm smuli ext OP_18 "signed multiply reg/immed")
3609 (multiply-r-simm umuli zext OP_1A "unsigned multiply reg/immed")
3610
3611 (define-pmacro (int-shift-r-simm name op comment)
3612 (dni (.sym name i)
3613 (comment)
3614 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3615 (.str (.sym name i) "$pack $GRi,$s12,$GRk")
3616 (+ pack GRk op GRi s12)
3617 (set GRk (name GRi (and s12 #x1f)))
3618 ((fr400 (unit u-integer))
3619 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3620 )
3621 )
3622
3623 (int-shift-r-simm sll OP_28 "shift left logical reg/immed")
3624 (int-shift-r-simm srl OP_2A "shift right logical reg/immed")
3625 (int-shift-r-simm sra OP_2C "shift right arith reg/immed")
3626
3627 (dni scani
3628 "scan immediate"
3629 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3630 "scani$pack $GRi,$s12,$GRk"
3631 (+ pack GRk OP_47 GRi s12)
3632 (scan-semantics GRi s12 GRk)
3633 ((fr400 (unit u-integer))
3634 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3635 )
3636
3637 ; Format: INT, Logic, Shift cc r-simm
3638 ;
3639 (define-pmacro (int-arith-cc-r-simm name operation op comment)
3640 (dni name
3641 (comment)
3642 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3643 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3644 (+ pack GRk op GRi ICCi_1 s10)
3645 (sequence ((BI tmp) (QI cc) (SI result))
3646 (set cc ICCi_1)
3647 (set tmp ((.sym operation -oflag) GRi s10 (const 0)))
3648 (set-v cc tmp)
3649 (set tmp ((.sym operation -cflag) GRi s10 (const 0)))
3650 (set-c cc tmp)
3651 (set result (operation GRi s10))
3652 (set-z-and-n cc result)
3653 (set GRk result)
3654 (set ICCi_1 cc))
3655 ((fr400 (unit u-integer))
3656 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3657 )
3658 )
3659
3660 (int-arith-cc-r-simm addicc add OP_11 "add reg/immed, set icc")
3661 (int-arith-cc-r-simm subicc sub OP_15 "sub reg/immed, set icc")
3662
3663 (define-pmacro (int-logic-cc-r-simm name op comment)
3664 (dni (.sym name icc)
3665 (comment)
3666 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3667 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3668 (+ pack GRk op GRi ICCi_1 s10)
3669 (sequence ((SI tmp))
3670 (set tmp (name GRi s10))
3671 (set GRk tmp)
3672 (set-z-and-n ICCi_1 tmp))
3673 ((fr400 (unit u-integer))
3674 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3675 )
3676 )
3677
3678 (int-logic-cc-r-simm and OP_21 "and reg/immed, set icc")
3679 (int-logic-cc-r-simm or OP_23 "or reg/immed, set icc")
3680 (int-logic-cc-r-simm xor OP_25 "xor reg/immed, set icc")
3681
3682 (define-pmacro (multiply-cc-r-simm name signop op comment)
3683 (dni name
3684 (comment)
3685 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3686 (.str name "$pack $GRi,$s10,$GRdoublek,$ICCi_1")
3687 (+ pack GRdoublek op GRi ICCi_1 s10)
3688 (multiply-cc-semantics signop GRi s10 GRdoublek ICCi_1)
3689 ((fr400 (unit u-imul))
3690 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3691 )
3692 )
3693
3694 (multiply-cc-r-simm smulicc ext OP_19 "signed multiply reg/immed")
3695 (multiply-cc-r-simm umulicc zext OP_1B "unsigned multiply reg/immed")
3696
3697 (define-pmacro (int-shift-cc-r-simm name l-r op comment)
3698 (dni (.sym name icc)
3699 (comment)
3700 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3701 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3702 (+ pack GRk op GRi ICCi_1 s10)
3703 (sequence ((WI shift) (SI tmp) (QI cc))
3704 (set shift (and s10 #x1f))
3705 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3706 GRi shift ICCi_1))
3707 (set tmp (name GRi shift))
3708 (set GRk tmp)
3709 (set-z-and-n cc tmp)
3710 (set ICCi_1 cc))
3711 ((fr400 (unit u-integer))
3712 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3713 )
3714 )
3715
3716 (int-shift-cc-r-simm sll left OP_29 "shift left logical reg/immed, set icc")
3717 (int-shift-cc-r-simm srl right OP_2B "shift right logical reg/immed, set icc")
3718 (int-shift-cc-r-simm sra right OP_2D "shift right arith reg/immed, set icc")
3719
3720 (define-pmacro (int-arith-x-r-simm name operation op comment)
3721 (dni name
3722 (comment)
3723 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3724 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3725 (+ pack GRk op GRi ICCi_1 s10)
3726 (set GRk ((.sym operation c) GRi s10 (cbit ICCi_1)))
3727 ((fr400 (unit u-integer))
3728 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3729 )
3730 )
3731
3732 (int-arith-x-r-simm addxi add OP_12 "Add reg/immed, with carry")
3733 (int-arith-x-r-simm subxi sub OP_16 "Sub reg/immed, with carry")
3734
3735 (define-pmacro (int-arith-x-cc-r-simm name operation op comment)
3736 (dni name
3737 (comment)
3738 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3739 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3740 (+ pack GRk op GRi ICCi_1 s10)
3741 (sequence ((WI tmp) (QI cc))
3742 (set cc ICCi_1)
3743 (set tmp ((.sym operation c) GRi s10 (cbit cc)))
3744 (set-v cc ((.sym operation -oflag) GRi s10 (cbit cc)))
3745 (set-c cc ((.sym operation -cflag) GRi s10 (cbit cc)))
3746 (set-z-and-n cc tmp)
3747 (set GRk tmp)
3748 (set ICCi_1 cc))
3749 ((fr400 (unit u-integer))
3750 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3751 )
3752 )
3753
3754 (int-arith-x-cc-r-simm addxicc add OP_13 "Add reg/immed, with carry")
3755 (int-arith-x-cc-r-simm subxicc sub OP_17 "Sub reg/immed, with carry")
3756
3757 ; Byte compare insns
3758
3759 (dni cmpb
3760 "Compare bytes"
3761 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
3762 "cmpb$pack $GRi,$GRj,$ICCi_1"
3763 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj)
3764 (sequence ((QI cc))
3765 (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000)))
3766 (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000)))
3767 (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00)))
3768 (set-c cc (eq (and GRi #x000000ff) (and GRj #x000000ff)))
3769 (set ICCi_1 cc))
3770 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
3771 )
3772
3773 (dni cmpba
3774 "OR of Compare bytes"
3775 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
3776 "cmpba$pack $GRi,$GRj,$ICCi_1"
3777 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0D GRj)
3778 (sequence ((QI cc))
3779 (set cc 0)
3780 (set-c cc
3781 (orif (eq (and GRi #xff000000) (and GRj #xff000000))
3782 (orif (eq (and GRi #x00ff0000) (and GRj #x00ff0000))
3783 (orif (eq (and GRi #x0000ff00)
3784 (and GRj #x0000ff00))
3785 (eq (and GRi #x000000ff)
3786 (and GRj #x000000ff))))))
3787 (set ICCi_1 cc))
3788 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
3789 )
3790
3791 ; Format: Load immediate
3792 ;
3793 (dni setlo
3794 "set low order bits"
3795 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3796 "setlo$pack $ulo16,$GRklo"
3797 (+ pack GRk OP_3D (misc-null-4) u16)
3798 (set GRklo u16)
3799 ((fr400 (unit u-set-hilo))
3800 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
3801 )
3802
3803 (dni sethi
3804 "set high order bits"
3805 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3806 "sethi$pack $uhi16,$GRkhi"
3807 (+ pack GRkhi OP_3E (misc-null-4) u16)
3808 (set GRkhi u16)
3809 ((fr400 (unit u-set-hilo))
3810 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
3811 )
3812
3813 (dni setlos
3814 "set low order bits and extend sign"
3815 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3816 "setlos$pack $slo16,$GRk"
3817 (+ pack GRk OP_3F (misc-null-4) s16)
3818 (set GRk s16)
3819 ((fr400 (unit u-integer))
3820 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3821 )
3822
3823 (define-pmacro (load-gr-r name mode op ope comment)
3824 (dni name
3825 (comment)
3826 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
3827 (.str name "$pack @($GRi,$GRj),$GRk")
3828 (+ pack GRk op GRi ope GRj)
3829 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3830 ((fr400 (unit u-gr-load))
3831 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3832 )
3833 )
3834
3835 (load-gr-r ldsb QI OP_02 OPE1_00 "Load signed byte")
3836 (load-gr-r ldub UQI OP_02 OPE1_01 "Load unsigned byte")
3837 (load-gr-r ldsh HI OP_02 OPE1_02 "Load signed half")
3838 (load-gr-r lduh UHI OP_02 OPE1_03 "Load unsigned half")
3839 (load-gr-r ld SI OP_02 OPE1_04 "Load word")
3840
3841 (define-pmacro (load-fr-r name mode op ope comment)
3842 (dni name
3843 (comment)
3844 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
3845 (.str name "$pack @($GRi,$GRj),$FRintk")
3846 (+ pack FRintk op GRi ope GRj)
3847 (set FRintk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3848 ((fr400 (unit u-fr-load))
3849 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3850 )
3851 )
3852
3853 (load-fr-r ldbf UQI OP_02 OPE1_08 "Load byte float")
3854 (load-fr-r ldhf UHI OP_02 OPE1_09 "Load half float")
3855 (load-fr-r ldf SI OP_02 OPE1_0A "Load word float")
3856
3857 (define-pmacro (load-cpr-r name mode op ope reg attr comment)
3858 (dni name
3859 (comment)
3860 ((UNIT LOAD) (FR500-MAJOR I-2) attr)
3861 (.str name "$pack @($GRi,$GRj),$" reg "k")
3862 (+ pack (.sym reg k) op GRi ope GRj)
3863 (set (.sym reg k)
3864 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3865 ()
3866 )
3867 )
3868
3869 (load-cpr-r ldc SI OP_02 OPE1_0D CPR (MACH frv) "Load coprocessor word")
3870
3871 ; These correspond to enumerators in frv-sim.h
3872 (define-pmacro (ne-UQI-size) 0)
3873 (define-pmacro (ne-QI-size) 1)
3874 (define-pmacro (ne-UHI-size) 2)
3875 (define-pmacro (ne-HI-size) 3)
3876 (define-pmacro (ne-SI-size) 4)
3877 (define-pmacro (ne-DI-size) 5)
3878 (define-pmacro (ne-XI-size) 6)
3879
3880 (define-pmacro (ne-load-semantics base dispix targ idisp size is_float action)
3881 (sequence ((BI do_op))
3882 (set do_op
3883 (c-call BI "@cpu@_check_non_excepting_load"
3884 (index-of base) dispix (index-of targ)
3885 idisp size is_float))
3886 (if do_op action))
3887 )
3888
3889 (define-pmacro (ne-load-gr-r name mode op ope size comment)
3890 (dni name
3891 (comment)
3892 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
3893 (MACH simple,tomcat,fr500,fr550,frv))
3894 (.str name "$pack @($GRi,$GRj),$GRk")
3895 (+ pack GRk op GRi ope GRj)
3896 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
3897 (set GRk
3898 (c-call mode (.str "@cpu@_read_mem_" mode)
3899 pc (add GRi GRj))))
3900 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3901 )
3902 )
3903
3904 (ne-load-gr-r nldsb QI OP_02 OPE1_20 (ne-QI-size) "Load signed byte")
3905 (ne-load-gr-r nldub UQI OP_02 OPE1_21 (ne-UQI-size) "Load unsigned byte")
3906 (ne-load-gr-r nldsh HI OP_02 OPE1_22 (ne-HI-size) "Load signed half")
3907 (ne-load-gr-r nlduh UHI OP_02 OPE1_23 (ne-UHI-size) "Load unsigned half")
3908 (ne-load-gr-r nld SI OP_02 OPE1_24 (ne-SI-size) "Load word")
3909
3910 (define-pmacro (ne-load-fr-r name mode op ope size comment)
3911 (dni name
3912 (comment)
3913 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
3914 (MACH simple,tomcat,fr500,fr550,frv))
3915 (.str name "$pack @($GRi,$GRj),$FRintk")
3916 (+ pack FRintk op GRi ope GRj)
3917 (ne-load-semantics GRi (index-of GRj) FRintk 0 size 1
3918 (set FRintk
3919 (c-call mode (.str "@cpu@_read_mem_" mode)
3920 pc (add GRi GRj))))
3921 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3922 )
3923 )
3924
3925 (ne-load-fr-r nldbf UQI OP_02 OPE1_28 (ne-UQI-size) "Load byte float")
3926 (ne-load-fr-r nldhf UHI OP_02 OPE1_29 (ne-UHI-size) "Load half float")
3927 (ne-load-fr-r nldf SI OP_02 OPE1_2A (ne-SI-size) "Load word float")
3928
3929 ; Semantics for a load-double insn
3930 ;
3931 (define-pmacro (load-double-semantics not_gr mode regtype address arg)
3932 (if (orif not_gr (ne (index-of (.sym regtype doublek)) 0))
3933 (sequence ()
3934 (set address (add GRi arg))
3935 (set (.sym regtype doublek)
3936 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))))
3937 )
3938
3939 (define-pmacro (load-double-r-r
3940 name not_gr mode op ope regtype attr profile comment)
3941 (dni name
3942 (comment)
3943 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
3944 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3945 (+ pack (.sym regtype doublek) op GRi ope GRj)
3946 (sequence ((WI address))
3947 (load-double-semantics not_gr mode regtype address GRj))
3948 profile
3949 )
3950 )
3951
3952 (load-double-r-r ldd 0 DI OP_02 OPE1_05 GR NA
3953 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3954 "Load double word")
3955 (load-double-r-r lddf 1 DF OP_02 OPE1_0B FR FR-ACCESS
3956 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3957 "Load double float")
3958 (load-double-r-r lddc 1 DI OP_02 OPE1_0E CPR (MACH frv) ()
3959 "Load coprocessor double")
3960
3961 (define-pmacro (ne-load-double-r-r
3962 name not_gr mode op ope regtype size is_float attr profile
3963 comment)
3964 (dni name
3965 (comment)
3966 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
3967 (MACH simple,tomcat,fr500,fr550,frv))
3968 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3969 (+ pack (.sym regtype doublek) op GRi ope GRj)
3970 (sequence ((WI address))
3971 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek)
3972 0 size is_float
3973 (load-double-semantics not_gr mode
3974 regtype
3975 address GRj)))
3976 profile
3977 )
3978 )
3979
3980 (ne-load-double-r-r nldd 0 DI OP_02 OPE1_25 GR (ne-DI-size) 0 NA
3981 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
3982 (ne-load-double-r-r nlddf 1 DF OP_02 OPE1_2B FR (ne-DI-size) 1 FR-ACCESS
3983 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
3984
3985 ; Semantics for a load-quad insn
3986 ;
3987 (define-pmacro (load-quad-semantics regtype address arg)
3988 (sequence ()
3989 (set address (add GRi arg))
3990 (c-call VOID (.str "@cpu@_load_quad_" regtype)
3991 pc address (index-of (.sym regtype k))))
3992 )
3993
3994 (define-pmacro (load-quad-r-r name op ope regtype attr profile comment)
3995 (dni name
3996 (comment)
3997 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
3998 (.str name "$pack @($GRi,$GRj),$" regtype "k")
3999 (+ pack (.sym regtype k) op GRi ope GRj)
4000 (sequence ((WI address))
4001 (load-quad-semantics regtype address GRj))
4002 ; TODO regtype-k not referenced for profiling
4003 profile
4004 )
4005 )
4006
4007 (load-quad-r-r ldq OP_02 OPE1_06 GR NA ((fr500 (unit u-gr-load)))
4008 "Load quad word")
4009 (load-quad-r-r ldqf OP_02 OPE1_0C FRint FR-ACCESS ((fr500 (unit u-fr-load)))
4010 "Load quad float")
4011 (load-quad-r-r ldqc OP_02 OPE1_0F CPR NA () "Load coprocessor quad")
4012
4013 (define-pmacro (ne-load-quad-r-r
4014 name op ope regtype size is_float attr profile comment)
4015 (dni name
4016 (comment)
4017 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4018 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4019 (+ pack (.sym regtype k) op GRi ope GRj)
4020 (sequence ((WI address))
4021 (ne-load-semantics GRi (index-of GRj) (.sym regtype k)
4022 0 size is_float
4023 (load-quad-semantics regtype address GRj)))
4024 ; TODO regtype-k not referenced for profiling
4025 profile
4026 )
4027 )
4028
4029 (ne-load-quad-r-r nldq OP_02 OPE1_26 GR (ne-XI-size) 0 NA
4030 ((fr500 (unit u-gr-load))) "Load quad word")
4031 (ne-load-quad-r-r nldqf OP_02 OPE1_2C FRint (ne-XI-size) 1 FR-ACCESS
4032 ((fr500 (unit u-fr-load))) "Load quad float")
4033
4034 (define-pmacro (load-gr-u-semantics mode)
4035 (sequence ((UWI address))
4036 (set address (add GRi GRj))
4037 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4038 (if (ne (index-of GRi) (index-of GRk))
4039 (sequence ()
4040 (set GRi address)
4041 (c-call VOID "@cpu@_force_update"))))
4042 )
4043
4044 (define-pmacro (load-gr-u name mode op ope comment)
4045 (dni name
4046 (comment)
4047 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
4048 (.str name "$pack @($GRi,$GRj),$GRk")
4049 (+ pack GRk op GRi ope GRj)
4050 (load-gr-u-semantics mode)
4051 ((fr400 (unit u-gr-load))
4052 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4053 )
4054 )
4055
4056 (load-gr-u ldsbu QI OP_02 OPE1_10 "Load signed byte, update index")
4057 (load-gr-u ldubu UQI OP_02 OPE1_11 "Load unsigned byte, update index")
4058 (load-gr-u ldshu HI OP_02 OPE1_12 "Load signed half, update index")
4059 (load-gr-u lduhu UHI OP_02 OPE1_13 "Load unsigned half, update index")
4060 (load-gr-u ldu SI OP_02 OPE1_14 "Load word, update index")
4061
4062 (define-pmacro (ne-load-gr-u name mode op ope size comment)
4063 (dni name
4064 (comment)
4065 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4066 (MACH simple,tomcat,fr500,fr550,frv))
4067 (.str name "$pack @($GRi,$GRj),$GRk")
4068 (+ pack GRk op GRi ope GRj)
4069 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 (load-gr-u-semantics mode))
4070 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4071 )
4072 )
4073
4074 (ne-load-gr-u nldsbu QI OP_02 OPE1_30 (ne-QI-size) "Load signed byte, update index")
4075 (ne-load-gr-u nldubu UQI OP_02 OPE1_31 (ne-UQI-size) "Load unsigned byte, update index")
4076 (ne-load-gr-u nldshu HI OP_02 OPE1_32 (ne-HI-size) "Load signed half, update index")
4077 (ne-load-gr-u nlduhu UHI OP_02 OPE1_33 (ne-UHI-size) "Load unsigned half, update index")
4078 (ne-load-gr-u nldu SI OP_02 OPE1_34 (ne-SI-size) "Load word, update index")
4079
4080 (define-pmacro (load-non-gr-u-semantics mode regtype)
4081 (sequence ((UWI address))
4082 (set address (add GRi GRj))
4083 (set (.sym regtype k)
4084 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4085 (set GRi address)
4086 (c-call VOID "@cpu@_force_update"))
4087 )
4088
4089 (define-pmacro (load-fr-u name mode op ope comment)
4090 (dni name
4091 (comment)
4092 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
4093 (.str name "$pack @($GRi,$GRj),$FRintk")
4094 (+ pack FRintk op GRi ope GRj)
4095 (load-non-gr-u-semantics mode FRint)
4096 ((fr400 (unit u-fr-load))
4097 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4098 )
4099 )
4100
4101 (load-fr-u ldbfu UQI OP_02 OPE1_18 "Load byte float, update index")
4102 (load-fr-u ldhfu UHI OP_02 OPE1_19 "Load half float, update index")
4103 (load-fr-u ldfu SI OP_02 OPE1_1A "Load word float, update index")
4104
4105 (define-pmacro (load-cpr-u name mode op ope comment)
4106 (dni name
4107 (comment)
4108 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4109 (.str name "$pack @($GRi,$GRj),$CPRk")
4110 (+ pack CPRk op GRi ope GRj)
4111 (load-non-gr-u-semantics mode CPR)
4112 ()
4113 )
4114 )
4115
4116 (load-cpr-u ldcu SI OP_02 OPE1_1D "Load coprocessor word float,update index")
4117
4118 (define-pmacro (ne-load-non-gr-u name mode op ope regtype size comment)
4119 (dni name
4120 (comment)
4121 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4122 (MACH simple,tomcat,fr500,fr550,frv))
4123 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4124 (+ pack (.sym regtype k) op GRi ope GRj)
4125 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4126 (load-non-gr-u-semantics mode regtype))
4127 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4128 )
4129 )
4130
4131 (ne-load-non-gr-u nldbfu UQI OP_02 OPE1_38 FRint (ne-UQI-size) "Load byte float, update index")
4132 (ne-load-non-gr-u nldhfu UHI OP_02 OPE1_39 FRint (ne-UHI-size) "Load half float, update index")
4133 (ne-load-non-gr-u nldfu SI OP_02 OPE1_3A FRint (ne-SI-size) "Load word float, update index")
4134
4135 (define-pmacro (load-double-gr-u-semantics)
4136 (sequence ((WI address))
4137 (load-double-semantics 0 DI GR address GRj)
4138 (if (ne (index-of GRi) (index-of GRdoublek))
4139 (sequence ()
4140 (set GRi address)
4141 (c-call VOID "@cpu@_force_update"))))
4142 )
4143
4144 (define-pmacro (load-double-gr-u name op ope comment)
4145 (dni name
4146 (comment)
4147 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
4148 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4149 (+ pack GRdoublek op GRi ope GRj)
4150 (load-double-gr-u-semantics)
4151 ((fr400 (unit u-gr-load))
4152 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4153 )
4154 )
4155
4156 (load-double-gr-u lddu OP_02 OPE1_15 "Load double word, update index")
4157
4158 (define-pmacro (ne-load-double-gr-u name op ope size comment)
4159 (dni name
4160 (comment)
4161 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4162 (MACH simple,tomcat,fr500,fr550,frv))
4163 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4164 (+ pack GRdoublek op GRi ope GRj)
4165 (ne-load-semantics GRi (index-of GRj) GRdoublek 0 size 0
4166 (load-double-gr-u-semantics))
4167 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4168
4169 )
4170 )
4171
4172 (ne-load-double-gr-u nlddu OP_02 OPE1_35 (ne-DI-size) "Load double word, update index")
4173
4174 (define-pmacro (load-double-non-gr-u-semantics mode regtype)
4175 (sequence ((WI address))
4176 (load-double-semantics 1 mode regtype address GRj)
4177 (set GRi address)
4178 (c-call VOID "@cpu@_force_update"))
4179 )
4180
4181 (define-pmacro (load-double-non-gr-u
4182 name mode op ope regtype attr profile comment)
4183 (dni name
4184 (comment)
4185 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4186 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4187 (+ pack (.sym regtype doublek) op GRi ope GRj)
4188 (load-double-non-gr-u-semantics mode regtype)
4189 profile
4190 )
4191 )
4192
4193 (load-double-non-gr-u lddfu DF OP_02 OPE1_1B FR FR-ACCESS
4194 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4195 "Load double float, update index")
4196 (load-double-non-gr-u lddcu DI OP_02 OPE1_1E CPR (MACH frv)
4197 () "Load coprocessor double float, update index")
4198
4199 (define-pmacro (ne-load-double-non-gr-u name mode op ope regtype size comment)
4200 (dni name
4201 (comment)
4202 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4203 (MACH simple,tomcat,fr500,fr550,frv))
4204 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4205 (+ pack (.sym regtype doublek) op GRi ope GRj)
4206 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) 0 size 1
4207 (load-double-non-gr-u-semantics mode regtype))
4208 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4209 )
4210 )
4211
4212 (ne-load-double-non-gr-u nlddfu DF OP_02 OPE1_3B FR (ne-DI-size) "Load double float, update index")
4213
4214 (define-pmacro (load-quad-gr-u-semantics)
4215 (sequence ((WI address))
4216 (load-quad-semantics GR address GRj)
4217 (if (ne (index-of GRi) (index-of GRk))
4218 (sequence ()
4219 (set GRi address)
4220 (c-call VOID "@cpu@_force_update"))))
4221 )
4222
4223 (define-pmacro (load-quad-gr-u name op ope comment)
4224 (dni name
4225 (comment)
4226 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4227 (.str name "$pack @($GRi,$GRj),$GRk")
4228 (+ pack GRk op GRi ope GRj)
4229 (load-quad-gr-u-semantics)
4230 ; TODO - GRk not referenced here for profiling
4231 ((fr500 (unit u-gr-load)))
4232 )
4233 )
4234
4235 (load-quad-gr-u ldqu OP_02 OPE1_16 "Load quad word, update index")
4236
4237 (define-pmacro (ne-load-quad-gr-u name op ope size comment)
4238 (dni name
4239 (comment)
4240 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING)
4241 (.str name "$pack @($GRi,$GRj),$GRk")
4242 (+ pack GRk op GRi ope GRj)
4243 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
4244 (load-quad-gr-u-semantics))
4245 ; TODO - GRk not referenced here for profiling
4246 ((fr500 (unit u-gr-load)))
4247 )
4248 )
4249
4250 (ne-load-quad-gr-u nldqu OP_02 OPE1_36 (ne-XI-size) "Load quad word, update index")
4251
4252 (define-pmacro (load-quad-non-gr-u-semantics regtype)
4253 (sequence ((WI address))
4254 (load-quad-semantics regtype address GRj)
4255 (set GRi address)
4256 (c-call VOID "@cpu@_force_update"))
4257 )
4258
4259 (define-pmacro (load-quad-non-gr-u name op ope regtype attr profile comment)
4260 (dni name
4261 (comment)
4262 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4263 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4264 (+ pack (.sym regtype k) op GRi ope GRj)
4265 (load-quad-non-gr-u-semantics regtype)
4266 profile
4267 )
4268 )
4269
4270 (load-quad-non-gr-u ldqfu OP_02 OPE1_1C FRint FR-ACCESS
4271 ((fr500 (unit u-fr-load))) "Load quad float, update index")
4272 (load-quad-non-gr-u ldqcu OP_02 OPE1_1F CPR NA
4273 () "Load coprocessor quad word, update index")
4274
4275 (define-pmacro (ne-load-quad-non-gr-u name op ope regtype size comment)
4276 (dni name
4277 (comment)
4278 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING FR-ACCESS)
4279 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4280 (+ pack (.sym regtype k) op GRi ope GRj)
4281 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4282 (load-quad-non-gr-u-semantics regtype))
4283 ((fr500 (unit u-fr-load)))
4284 )
4285 )
4286
4287 (ne-load-quad-non-gr-u nldqfu OP_02 OPE1_3C FRint (ne-XI-size) "Load quad float,update index")
4288
4289 (define-pmacro (load-r-simm name mode op regtype attr profile comment)
4290 (dni name
4291 (comment)
4292 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4293 (.str name "$pack @($GRi,$d12),$" regtype "k")
4294 (+ pack (.sym regtype k) op GRi d12)
4295 (set (.sym regtype k)
4296 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi d12)))
4297 profile
4298 )
4299 )
4300
4301 (load-r-simm ldsbi QI OP_30 GR NA
4302 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4303 "Load signed byte")
4304 (load-r-simm ldshi HI OP_31 GR NA
4305 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4306 "Load signed half")
4307 (load-r-simm ldi SI OP_32 GR NA
4308 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4309 "Load word")
4310 (load-r-simm ldubi UQI OP_35 GR NA
4311 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4312 "Load unsigned byte")
4313 (load-r-simm lduhi UHI OP_36 GR NA
4314 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4315 "Load unsigned half")
4316
4317 (load-r-simm ldbfi UQI OP_38 FRint FR-ACCESS
4318 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4319 "Load byte float")
4320 (load-r-simm ldhfi UHI OP_39 FRint FR-ACCESS
4321 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4322 "Load half float")
4323 (load-r-simm ldfi SI OP_3A FRint FR-ACCESS
4324 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4325 "Load word float")
4326
4327 (define-pmacro (ne-load-r-simm
4328 name mode op regtype size is_float attr profile comment)
4329 (dni name
4330 (comment)
4331 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4332 (MACH simple,tomcat,fr500,fr550,frv))
4333 (.str name "$pack @($GRi,$d12),$" regtype "k")
4334 (+ pack (.sym regtype k) op GRi d12)
4335 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4336 (set (.sym regtype k)
4337 (c-call mode (.str "@cpu@_read_mem_" mode)
4338 pc (add GRi d12))))
4339 profile
4340 )
4341 )
4342
4343 (ne-load-r-simm nldsbi QI OP_40 GR (ne-QI-size) 0 NA
4344 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed byte")
4345 (ne-load-r-simm nldubi UQI OP_41 GR (ne-UQI-size) 0 NA
4346 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned byte")
4347 (ne-load-r-simm nldshi HI OP_42 GR (ne-HI-size) 0 NA
4348 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed half")
4349 (ne-load-r-simm nlduhi UHI OP_43 GR (ne-UHI-size) 0 NA
4350 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned half")
4351 (ne-load-r-simm nldi SI OP_44 GR (ne-SI-size) 0 NA
4352 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load word")
4353
4354 (ne-load-r-simm nldbfi UQI OP_48 FRint (ne-UQI-size) 1 FR-ACCESS
4355 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load byte float")
4356 (ne-load-r-simm nldhfi UHI OP_49 FRint (ne-UHI-size) 1 FR-ACCESS
4357 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load half float")
4358 (ne-load-r-simm nldfi SI OP_4A FRint (ne-SI-size) 1 FR-ACCESS
4359 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load word float")
4360
4361 (define-pmacro (load-double-r-simm
4362 name not_gr mode op regtype attr profile comment)
4363 (dni name
4364 (comment)
4365 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4366 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4367 (+ pack (.sym regtype doublek) op GRi d12)
4368 (sequence ((WI address))
4369 (load-double-semantics not_gr mode regtype address d12))
4370 profile
4371 )
4372 )
4373
4374 (load-double-r-simm lddi 0 DI OP_33 GR NA
4375 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4376 "Load double word")
4377 (load-double-r-simm lddfi 1 DF OP_3B FR FR-ACCESS
4378 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4379 "Load double float")
4380
4381 (define-pmacro (ne-load-double-r-simm
4382 name not_gr mode op regtype size is_float attr profile comment)
4383 (dni name
4384 (comment)
4385 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4386 (MACH simple,tomcat,fr500,fr550,frv))
4387 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4388 (+ pack (.sym regtype doublek) op GRi d12)
4389 (sequence ((WI address))
4390 (ne-load-semantics GRi -1 (.sym regtype doublek)
4391 d12 size is_float
4392 (load-double-semantics not_gr mode
4393 regtype
4394 address d12)))
4395 profile
4396 )
4397 )
4398
4399 (ne-load-double-r-simm nlddi 0 DI OP_45 GR (ne-DI-size) 0 NA
4400 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
4401 (ne-load-double-r-simm nlddfi 1 DF OP_4B FR (ne-DI-size) 1 FR-ACCESS
4402 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
4403
4404 (define-pmacro (load-quad-r-simm name op regtype attr profile comment)
4405 (dni name
4406 (comment)
4407 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4408 (.str name "$pack @($GRi,$d12),$" regtype "k")
4409 (+ pack (.sym regtype k) op GRi d12)
4410 (sequence ((WI address))
4411 (load-quad-semantics regtype address d12))
4412 profile
4413 )
4414 )
4415
4416 (load-quad-r-simm ldqi OP_34 GR NA
4417 ((fr500 (unit u-gr-load))) "Load quad word")
4418 (load-quad-r-simm ldqfi OP_3C FRint FR-ACCESS
4419 ((fr500 (unit u-fr-load))) "Load quad float")
4420
4421 (define-pmacro (ne-load-quad-r-simm
4422 name op regtype size is_float attr profile comment)
4423 (dni name
4424 (comment)
4425 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4426 (.str name "$pack @($GRi,$d12),$" regtype "k")
4427 (+ pack (.sym regtype k) op GRi d12)
4428 (sequence ((WI address))
4429 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4430 (load-quad-semantics regtype address d12)))
4431 profile
4432 )
4433 )
4434
4435 (ne-load-quad-r-simm nldqfi OP_4C FRint (ne-XI-size) 1 FR-ACCESS
4436 ((fr500 (unit u-fr-load))) "Load quad float")
4437
4438 (define-pmacro (store-r-r name mode op ope reg attr profile comment)
4439 (dni name
4440 (comment)
4441 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4442 (.str name "$pack $" reg "k,@($GRi,$GRj)")
4443 (+ pack (.sym reg k) op GRi ope GRj)
4444 (c-call VOID (.str "@cpu@_write_mem_" mode)
4445 pc (add GRi GRj) (.sym reg k))
4446 profile
4447 )
4448 )
4449
4450 (store-r-r stb QI OP_03 OPE1_00 GR NA
4451 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4452 "Store unsigned byte")
4453 (store-r-r sth HI OP_03 OPE1_01 GR NA
4454 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4455 "Store unsigned half")
4456 (store-r-r st SI OP_03 OPE1_02 GR NA
4457 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4458 "Store word")
4459
4460 (store-r-r stbf QI OP_03 OPE1_08 FRint FR-ACCESS
4461 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4462 "Store byte float")
4463 (store-r-r sthf HI OP_03 OPE1_09 FRint FR-ACCESS
4464 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4465 "Store half float")
4466 (store-r-r stf SI OP_03 OPE1_0A FRint FR-ACCESS
4467 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4468 "Store word float")
4469
4470 (store-r-r stc SI OP_03 OPE1_25 CPR (MACH frv) () "Store coprocessor word")
4471
4472 ; Semantics for a store-double insn
4473 ;
4474 (define-pmacro (store-double-semantics mode regtype address arg)
4475 (sequence ()
4476 (set address (add GRi arg))
4477 (c-call VOID (.str "@cpu@_write_mem_" mode)
4478 pc address (.sym regtype doublek)))
4479 )
4480
4481 (define-pmacro (store-double-r-r name mode op ope regtype attr profile comment)
4482 (dni name
4483 (comment)
4484 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4485 (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
4486 (+ pack (.sym regtype doublek) op GRi ope GRj)
4487 (sequence ((WI address))
4488 (store-double-semantics mode regtype address GRj))
4489 profile
4490 )
4491 )
4492
4493 (store-double-r-r std DI OP_03 OPE1_03 GR NA
4494 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4495 "Store double word")
4496 (store-double-r-r stdf DF OP_03 OPE1_0B FR FR-ACCESS
4497 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4498 "Store double float")
4499
4500 (store-double-r-r stdc DI OP_03 OPE1_26 CPR (MACH frv)
4501 () "Store coprocessor double word")
4502
4503 ; Semantics for a store-quad insn
4504 ;
4505 (define-pmacro (store-quad-semantics regtype address arg)
4506 (sequence ()
4507 (set address (add GRi arg))
4508 (c-call VOID (.str "@cpu@_store_quad_" regtype)
4509 pc address (index-of (.sym regtype k))))
4510 )
4511
4512 (define-pmacro (store-quad-r-r name op ope regtype attr profile comment)
4513 (dni name
4514 (comment)
4515 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4516 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4517 (+ pack (.sym regtype k) op GRi ope GRj)
4518 (sequence ((WI address))
4519 (store-quad-semantics regtype address GRj))
4520 profile
4521 )
4522 )
4523
4524 (store-quad-r-r stq OP_03 OPE1_04 GR NA
4525 ((fr500 (unit u-gr-store))) "Store quad word")
4526 (store-quad-r-r stqf OP_03 OPE1_0C FRint FR-ACCESS
4527 ((fr500 (unit u-fr-store)))
4528 "Store quad float")
4529 (store-quad-r-r stqc OP_03 OPE1_27 CPR NA
4530 () "Store coprocessor quad word")
4531
4532 (define-pmacro (store-r-r-u name mode op ope regtype attr profile comment)
4533 (dni name
4534 (comment)
4535 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4536 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4537 (+ pack (.sym regtype k) op GRi ope GRj)
4538 (sequence ((UWI address))
4539 (set address (add GRi GRj))
4540 (c-call VOID (.str "@cpu@_write_mem_" mode)
4541 pc address (.sym regtype k))
4542 (set GRi address))
4543 profile
4544 )
4545 )
4546
4547 (store-r-r-u stbu QI OP_03 OPE1_10 GR NA
4548 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4549 "Store unsigned byte, update index")
4550 (store-r-r-u sthu HI OP_03 OPE1_11 GR NA
4551 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4552 "Store unsigned half, update index")
4553 (store-r-r-u stu WI OP_03 OPE1_12 GR NA
4554 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4555 "Store word, update index")
4556
4557 (store-r-r-u stbfu QI OP_03 OPE1_18 FRint FR-ACCESS
4558 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4559 "Store byte float, update index")
4560 (store-r-r-u sthfu HI OP_03 OPE1_19 FRint FR-ACCESS
4561 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4562 "Store half float, update index")
4563 (store-r-r-u stfu SI OP_03 OPE1_1A FRint FR-ACCESS
4564 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4565 "Store word float, update index")
4566
4567 (store-r-r-u stcu SI OP_03 OPE1_2D CPR (MACH frv) ()
4568 "Store coprocessor word, update index")
4569
4570 (define-pmacro (store-double-r-r-u
4571 name mode op ope regtype attr profile comment)
4572 (dni name
4573 (comment)
4574 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4575 (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
4576 (+ pack (.sym regtype doublek) op GRi ope GRj)
4577 (sequence ((WI address))
4578 (store-double-semantics mode regtype address GRj)
4579 (set GRi address))
4580 profile
4581 )
4582 )
4583
4584 (store-double-r-r-u stdu DI OP_03 OPE1_13 GR NA
4585 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4586 "Store double word, update index")
4587 (store-double-r-r-u stdfu DF OP_03 OPE1_1B FR FR-ACCESS
4588 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4589 "Store double float,update index")
4590 (store-double-r-r-u stdcu DI OP_03 OPE1_2E CPR (MACH frv) ()
4591 "Store coprocessor double word, update index")
4592
4593 (define-pmacro (store-quad-r-r-u name op ope regtype attr profile comment)
4594 (dni name
4595 (comment)
4596 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4597 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4598 (+ pack (.sym regtype k) op GRi ope GRj)
4599 (sequence ((WI address))
4600 (store-quad-semantics regtype address GRj)
4601 (set GRi address))
4602 profile
4603 )
4604 )
4605
4606 (store-quad-r-r-u stqu OP_03 OPE1_14 GR NA
4607 ((fr500 (unit u-gr-store)))
4608 "Store quad word, update index")
4609 (store-quad-r-r-u stqfu OP_03 OPE1_1C FRint FR-ACCESS
4610 ((fr500 (unit u-fr-store)))
4611 "Store quad float, update index")
4612 (store-quad-r-r-u stqcu OP_03 OPE1_2F CPR NA ()
4613 "Store coprocessor quad word, update index")
4614
4615 (define-pmacro (conditional-load name mode op ope regtype profile comment)
4616 (dni name
4617 (comment)
4618 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4619 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4620 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4621 (if (eq CCi (or cond 2))
4622 (set (.sym regtype k)
4623 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))))
4624 profile
4625 )
4626 )
4627
4628 (conditional-load cldsb QI OP_5E OPE4_0 GR
4629 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4630 "Load signed byte")
4631 (conditional-load cldub UQI OP_5E OPE4_1 GR
4632 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4633 "Load unsigned byte")
4634 (conditional-load cldsh HI OP_5E OPE4_2 GR
4635 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4636 "Load signed half")
4637 (conditional-load clduh UHI OP_5E OPE4_3 GR
4638 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4639 "Load unsigned half")
4640 (conditional-load cld SI OP_5F OPE4_0 GR
4641 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4642 "Load word")
4643
4644 (conditional-load cldbf UQI OP_60 OPE4_0 FRint
4645 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4646 "Load byte float")
4647 (conditional-load cldhf UHI OP_60 OPE4_1 FRint
4648 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4649 "Load half float")
4650 (conditional-load cldf SI OP_60 OPE4_2 FRint
4651 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4652 "Load word float")
4653
4654 (define-pmacro (conditional-load-double
4655 name not_gr mode op ope regtype attr profile comment)
4656 (dni name
4657 (comment)
4658 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL attr)
4659 (.str name "$pack @($GRi,$GRj),$" regtype "doublek,$CCi,$cond")
4660 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
4661 (if (eq CCi (or cond 2))
4662 (sequence ((WI address))
4663 (load-double-semantics not_gr mode regtype address GRj)))
4664 profile
4665 )
4666 )
4667
4668 (conditional-load-double cldd 0 DI OP_5F OPE4_1 GR NA
4669 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4670 "Load double word")
4671 (conditional-load-double clddf 1 DF OP_60 OPE4_3 FR FR-ACCESS
4672 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-fr-load)))
4673 "Load double float")
4674
4675 (dni cldq
4676 "conditional load quad integer"
4677 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4678 "cldq$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4679 (+ pack GRk OP_5F GRi CCi cond OPE4_2 GRj)
4680 (if (eq CCi (or cond 2))
4681 (sequence ((WI address))
4682 (load-quad-semantics GR address GRj)))
4683 ((fr500 (unit u-gr-load)))
4684 )
4685
4686 (define-pmacro (conditional-load-gr-u name mode op ope comment)
4687 (dni name
4688 (comment)
4689 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4690 (.str name "$pack @($GRi,$GRj),$GRk,$CCi,$cond")
4691 (+ pack GRk op GRi CCi cond ope GRj)
4692 (if (eq CCi (or cond 2))
4693 (sequence ((WI address))
4694 (set address (add GRi GRj))
4695 (set GRk
4696 (c-call mode (.str "@cpu@_read_mem_" mode)
4697 pc address))
4698 (if (ne (index-of GRi) (index-of GRk))
4699 (set GRi address))))
4700 ((fr400 (unit u-gr-load))
4701 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4702 )
4703 )
4704
4705 (conditional-load-gr-u cldsbu QI OP_61 OPE4_0 "Load signed byte, update")
4706 (conditional-load-gr-u cldubu UQI OP_61 OPE4_1 "Load unsigned byte, update")
4707 (conditional-load-gr-u cldshu HI OP_61 OPE4_2 "Load signed half, update")
4708 (conditional-load-gr-u clduhu UHI OP_61 OPE4_3 "Load unsigned half, update")
4709 (conditional-load-gr-u cldu SI OP_62 OPE4_0 "Load word, update")
4710
4711 (define-pmacro (conditional-load-non-gr-u name mode op ope regtype comment)
4712 (dni name
4713 (comment)
4714 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
4715 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4716 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4717 (if (eq CCi (or cond 2))
4718 (sequence ((WI address))
4719 (set address (add GRi GRj))
4720 (set (.sym regtype k)
4721 (c-call mode (.str "@cpu@_read_mem_" mode)
4722 pc address))
4723 (set GRi address)))
4724 ((fr400 (unit u-fr-load))
4725 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4726 )
4727 )
4728
4729 (conditional-load-non-gr-u cldbfu UQI OP_63 OPE4_0 FRint "Load byte float, update")
4730 (conditional-load-non-gr-u cldhfu UHI OP_63 OPE4_1 FRint "Load half float, update")
4731 (conditional-load-non-gr-u cldfu SI OP_63 OPE4_2 FRint "Load word float, update")
4732
4733
4734 (dni clddu
4735 "Load double word, update"
4736 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4737 "clddu$pack @($GRi,$GRj),$GRdoublek,$CCi,$cond"
4738 (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj)
4739 (if (eq CCi (or cond 2))
4740 (sequence ((WI address))
4741 (load-double-semantics 0 DI GR address GRj)
4742 (if (ne (index-of GRi) (index-of GRdoublek))
4743 (set GRi address))))
4744 ((fr400 (unit u-gr-load))
4745 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4746 )
4747
4748 (dni clddfu
4749 "Load double float, update"
4750 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
4751 "clddfu$pack @($GRi,$GRj),$FRdoublek,$CCi,$cond"
4752 (+ pack FRdoublek OP_63 GRi CCi cond OPE4_3 GRj)
4753 (if (eq CCi (or cond 2))
4754 (sequence ((WI address))
4755 (load-double-semantics 1 DF FR address GRj)
4756 (set GRi address)))
4757 ((fr400 (unit u-fr-load))
4758 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4759 )
4760
4761 (dni cldqu
4762 "conditional load quad integer and update index"
4763 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4764 "cldqu$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4765 (+ pack GRk OP_62 GRi CCi cond OPE4_2 GRj)
4766 (if (eq CCi (or cond 2))
4767 (sequence ((WI address))
4768 (load-quad-semantics GR address GRj)
4769 (if (ne (index-of GRi) (index-of GRk))
4770 (set GRi address))))
4771 ((fr500 (unit u-gr-load)))
4772 )
4773
4774 (define-pmacro (conditional-store name mode op ope regtype profile comment)
4775 (dni name
4776 (comment)
4777 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL)
4778 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4779 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4780 (if (eq CCi (or cond 2))
4781 (c-call VOID (.str "@cpu@_write_mem_" mode)
4782 pc (add GRi GRj) (.sym regtype k)))
4783 profile
4784 )
4785 )
4786
4787 (conditional-store cstb QI OP_64 OPE4_0 GR
4788 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4789 "Store unsigned byte")
4790 (conditional-store csth HI OP_64 OPE4_1 GR
4791 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4792 "Store unsigned half")
4793 (conditional-store cst SI OP_64 OPE4_2 GR
4794 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4795 "Store word")
4796
4797 (conditional-store cstbf QI OP_66 OPE4_0 FRint
4798 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4799 "Store byte float")
4800 (conditional-store csthf HI OP_66 OPE4_1 FRint
4801 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4802 "Store half float")
4803 (conditional-store cstf SI OP_66 OPE4_2 FRint
4804 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4805 "Store word float")
4806
4807 (define-pmacro (conditional-store-double
4808 name mode op ope regtype attr profile comment)
4809 (dni name
4810 (comment)
4811 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4812 (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
4813 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
4814 (if (eq CCi (or cond 2))
4815 (sequence ((WI address))
4816 (store-double-semantics mode regtype address GRj)))
4817 profile
4818 )
4819 )
4820
4821 (conditional-store-double cstd DI OP_64 OPE4_3 GR NA
4822 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4823 "Store double word")
4824 (conditional-store-double cstdf DF OP_66 OPE4_3 FR FR-ACCESS
4825 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4826 "Store double float")
4827
4828 (dni cstq
4829 "conditionally store quad word"
4830 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) CONDITIONAL)
4831 "cstq$pack $GRk,@($GRi,$GRj),$CCi,$cond"
4832 (+ pack GRk OP_65 GRi CCi cond OPE4_0 GRj)
4833 (if (eq CCi (or cond 2))
4834 (sequence ((WI address))
4835 (store-quad-semantics GR address GRj)))
4836 ((fr500 (unit u-gr-store)))
4837 )
4838
4839 (define-pmacro (conditional-store-u
4840 name mode op ope regtype attr profile comment)
4841 (dni name
4842 (comment)
4843 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4844 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4845 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4846 (if (eq CCi (or cond 2))
4847 (sequence ((WI address))
4848 (set address (add GRi GRj))
4849 (c-call VOID (.str "@cpu@_write_mem_" mode)
4850 pc address (.sym regtype k))
4851 (set GRi address)))
4852 profile
4853 )
4854 )
4855
4856 (conditional-store-u cstbu QI OP_67 OPE4_0 GR NA
4857 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4858 "Store unsigned byte, update index")
4859 (conditional-store-u csthu HI OP_67 OPE4_1 GR NA
4860 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4861 "Store unsigned half, update index")
4862 (conditional-store-u cstu SI OP_67 OPE4_2 GR NA
4863 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4864 "Store word, update index")
4865
4866 (conditional-store-u cstbfu QI OP_68 OPE4_0 FRint FR-ACCESS
4867 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4868 "Store byte float, update index")
4869 (conditional-store-u csthfu HI OP_68 OPE4_1 FRint FR-ACCESS
4870 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4871 "Store half float, update index")
4872 (conditional-store-u cstfu SI OP_68 OPE4_2 FRint FR-ACCESS
4873 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4874 "Store word float, update index")
4875
4876 (define-pmacro (conditional-store-double-u
4877 name mode op ope regtype attr profile comment)
4878 (dni name
4879 (comment)
4880 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4881 (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
4882 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
4883 (if (eq CCi (or cond 2))
4884 (sequence ((WI address))
4885 (store-double-semantics mode regtype address GRj)
4886 (set GRi address)))
4887 profile
4888 )
4889 )
4890
4891 (conditional-store-double-u cstdu DI OP_67 OPE4_3 GR NA
4892 ((fr400 (unit u-gr-store))
4893 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4894 "Store double word, update index")
4895 (conditional-store-double-u cstdfu DF OP_68 OPE4_3 FR FR-ACCESS
4896 ((fr400 (unit u-fr-store))
4897 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4898 "Store double float, update index")
4899
4900 (define-pmacro (store-r-simm name mode op regtype attr profile comment)
4901 (dni name
4902 (comment)
4903 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4904 (.str name "$pack $" regtype "k,@($GRi,$d12)")
4905 (+ pack (.sym regtype k) op GRi d12)
4906 (c-call VOID (.str "@cpu@_write_mem_" mode)
4907 pc (add GRi d12) (.sym regtype k))
4908 profile
4909 )
4910 )
4911
4912 (store-r-simm stbi QI OP_50 GR NA
4913 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4914 "Store unsigned byte")
4915 (store-r-simm sthi HI OP_51 GR NA
4916 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4917 "Store unsigned half")
4918 (store-r-simm sti SI OP_52 GR NA
4919 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4920 "Store word")
4921
4922 (store-r-simm stbfi QI OP_4E FRint FR-ACCESS
4923 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4924 "Store byte float")
4925 (store-r-simm sthfi HI OP_4F FRint FR-ACCESS
4926 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4927 "Store half float")
4928 (store-r-simm stfi SI OP_55 FRint FR-ACCESS
4929 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4930 "Store word float")
4931
4932 (define-pmacro (store-double-r-simm name mode op regtype attr profile comment)
4933 (dni name
4934 (comment)
4935 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4936 (.str name "$pack $" regtype "doublek,@($GRi,$d12)")
4937 (+ pack (.sym regtype doublek) op GRi d12)
4938 (sequence ((WI address))
4939 (store-double-semantics mode regtype address d12))
4940 profile
4941 )
4942 )
4943
4944 (store-double-r-simm stdi DI OP_53 GR NA
4945 ((fr400 (unit u-gr-store))
4946 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4947 "Store double word")
4948 (store-double-r-simm stdfi DF OP_56 FR FR-ACCESS
4949 ((fr400 (unit u-fr-store))
4950 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4951 "Store double float")
4952
4953 (define-pmacro (store-quad-r-simm name op regtype attr profile comment)
4954 (dni name
4955 (comment)
4956 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4957 (.str name "$pack $" regtype "k,@($GRi,$d12)")
4958 (+ pack (.sym regtype k) op GRi d12)
4959 (sequence ((WI address))
4960 (store-quad-semantics regtype address d12))
4961 profile
4962 )
4963 )
4964
4965 (store-quad-r-simm stqi OP_54 GR NA ((fr500 (unit u-gr-store)))
4966 "Store quad word")
4967 (store-quad-r-simm stqfi OP_57 FRint FR-ACCESS ()
4968 "Store quad float")
4969
4970 (define-pmacro (swap-semantics base offset arg)
4971 (sequence ((WI tmp) (WI address))
4972 (set tmp arg)
4973 (set address (add base offset))
4974 (c-call VOID "@cpu@_check_swap_address" address)
4975 (set arg (c-call WI "@cpu@_read_mem_WI" pc address))
4976 (c-call VOID "@cpu@_write_mem_WI" pc address tmp))
4977 )
4978
4979 (dni swap
4980 "Swap contents of memory with GR"
4981 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
4982 "swap$pack @($GRi,$GRj),$GRk"
4983 (+ pack GRk OP_03 GRi OPE1_05 GRj)
4984 (swap-semantics GRi GRj GRk)
4985 ((fr400 (unit u-swap))
4986 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
4987 )
4988
4989 (dni "swapi"
4990 "Swap contents of memory with GR"
4991 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
4992 ("swapi$pack @($GRi,$d12),$GRk")
4993 (+ pack GRk OP_4D GRi d12)
4994 (swap-semantics GRi d12 GRk)
4995 ((fr400 (unit u-swap))
4996 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
4997 )
4998
4999 (dni cswap
5000 "Conditionally swap contents of memory with GR"
5001 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) CONDITIONAL)
5002 "cswap$pack @($GRi,$GRj),$GRk,$CCi,$cond"
5003 (+ pack GRk OP_65 GRi CCi cond OPE4_2 GRj)
5004 (if (eq CCi (or cond 2))
5005 (swap-semantics GRi GRj GRk))
5006 ((fr400 (unit u-swap))
5007 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
5008 )
5009
5010 (define-pmacro (register-transfer
5011 name op ope reg_src reg_targ pipe attrs profile comment)
5012 (dni name
5013 (comment)
5014 (.splice (UNIT pipe) (.unsplice attrs))
5015 (.str name "$pack $" reg_src ",$" reg_targ)
5016 (+ pack reg_targ op (rs-null) ope reg_src)
5017 (set reg_targ reg_src)
5018 profile
5019 )
5020 )
5021
5022 (register-transfer movgf OP_03 OPE1_15
5023 GRj FRintk I0
5024 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5025 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5026 "transfer gr to fr")
5027 (register-transfer movfg OP_03 OPE1_0D
5028 FRintk GRj I0
5029 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5030 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5031 "transfer fr to gr")
5032
5033 (define-pmacro (nextreg hw r offset) (reg hw (add (index-of r) offset)))
5034
5035 (define-pmacro (register-transfer-double-from-gr-semantics cond)
5036 (if cond
5037 (if (eq (index-of GRj) 0)
5038 (sequence ()
5039 (set FRintk 0)
5040 (set (nextreg h-fr_int FRintk 1) 0))
5041 (sequence ()
5042 (set FRintk GRj)
5043 (set (nextreg h-fr_int FRintk 1) (nextreg h-gr GRj 1)))))
5044 )
5045
5046 (dni movgfd
5047 "move GR for FR double"
5048 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5049 "movgfd$pack $GRj,$FRintk"
5050 (+ pack FRintk OP_03 (rs-null) OPE1_16 GRj)
5051 (register-transfer-double-from-gr-semantics 1)
5052 ; TODO -- doesn't handle second register in the pair
5053 ((fr400 (unit u-gr2fr))
5054 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5055 )
5056
5057 (define-pmacro (register-transfer-double-to-gr-semantics cond)
5058 (if (andif (ne (index-of GRj) 0) cond)
5059 (sequence ()
5060 (set GRj FRintk)
5061 (set (nextreg h-gr GRj 1) (nextreg h-fr_int FRintk 1))))
5062 )
5063
5064 (dni movfgd
5065 "move FR for GR double"
5066 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5067 "movfgd$pack $FRintk,$GRj"
5068 (+ pack FRintk OP_03 (rs-null) OPE1_0E GRj)
5069 (register-transfer-double-to-gr-semantics 1)
5070 ; TODO -- doesn't handle second register in the pair
5071 ((fr400 (unit u-fr2gr))
5072 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5073 )
5074
5075 (dni movgfq
5076 "move GR for FR quad"
5077 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5078 "movgfq$pack $GRj,$FRintk"
5079 (+ pack FRintk OP_03 (rs-null) OPE1_17 GRj)
5080 (if (eq (index-of GRj) 0)
5081 (sequence ()
5082 (set FRintk 0)
5083 (set (reg h-fr_int (add (index-of FRintk) 1)) 0)
5084 (set (reg h-fr_int (add (index-of FRintk) 2)) 0)
5085 (set (reg h-fr_int (add (index-of FRintk) 3)) 0))
5086 (sequence ()
5087 (set FRintk GRj)
5088 (set (reg h-fr_int (add (index-of FRintk) 1))
5089 (reg h-gr (add (index-of GRj) 1)))
5090 (set (reg h-fr_int (add (index-of FRintk) 2))
5091 (reg h-gr (add (index-of GRj) 2)))
5092 (set (reg h-fr_int (add (index-of FRintk) 3))
5093 (reg h-gr (add (index-of GRj) 3)))))
5094 ()
5095 )
5096
5097 (dni movfgq
5098 "move FR for GR quad"
5099 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5100 "movfgq$pack $FRintk,$GRj"
5101 (+ pack FRintk OP_03 (rs-null) OPE1_0F GRj)
5102 (if (ne (index-of GRj) 0)
5103 (sequence ()
5104 (set GRj FRintk)
5105 (set (reg h-gr (add (index-of GRj) 1))
5106 (reg h-fr_int (add (index-of FRintk) 1)))
5107 (set (reg h-gr (add (index-of GRj) 2))
5108 (reg h-fr_int (add (index-of FRintk) 2)))
5109 (set (reg h-gr (add (index-of GRj) 3))
5110 (reg h-fr_int (add (index-of FRintk) 3)))))
5111 ()
5112 )
5113
5114 (define-pmacro (conditional-register-transfer
5115 name op ope reg_src reg_targ pipe attrs profile comment)
5116 (dni name
5117 (comment)
5118 (.splice (UNIT pipe) CONDITIONAL FR-ACCESS (.unsplice attrs))
5119 (.str name "$pack $" reg_src ",$" reg_targ ",$CCi,$cond")
5120 (+ pack reg_targ op (rs-null) CCi cond ope reg_src)
5121 (if (eq CCi (or cond 2))
5122 (set reg_targ reg_src))
5123 profile
5124 )
5125 )
5126
5127 (conditional-register-transfer cmovgf OP_69 OPE4_0 GRj FRintk I0
5128 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5129 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5130 "transfer gr to fr")
5131 (conditional-register-transfer cmovfg OP_69 OPE4_2 FRintk GRj I0
5132 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5133 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5134 "transfer fr to gr")
5135
5136
5137 (dni cmovgfd
5138 "Conditional move GR to FR double"
5139 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
5140 "cmovgfd$pack $GRj,$FRintk,$CCi,$cond"
5141 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_1 GRj)
5142 (register-transfer-double-from-gr-semantics (eq CCi (or cond 2)))
5143 ; TODO -- doesn't handle extra registers in double
5144 ((fr400 (unit u-gr2fr))
5145 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5146 )
5147
5148 (dni cmovfgd
5149 "Conditional move FR to GR double"
5150 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
5151 "cmovfgd$pack $FRintk,$GRj,$CCi,$cond"
5152 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_3 GRj)
5153 (register-transfer-double-to-gr-semantics (eq CCi (or cond 2)))
5154 ; TODO -- doesn't handle second register in the pair
5155 ((fr400 (unit u-fr2gr))
5156 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5157 )
5158
5159 (define-pmacro (register-transfer-spr
5160 name op ope reg_src reg_targ unitname comment)
5161 (dni name
5162 (comment)
5163 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
5164 (.str name "$pack $" reg_src ",$" reg_targ)
5165 (+ pack reg_targ op ope reg_src)
5166 (set reg_targ reg_src)
5167 ((fr400 (unit unitname))
5168 (fr500 (unit unitname)) (fr550 (unit unitname)))
5169 )
5170 )
5171
5172 (register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr "transfer gr->spr")
5173 (register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr "transfer spr->gr")
5174
5175 ; Integer Branch Conditions
5176 (define-pmacro (Inev cc) (const BI 0))
5177 (define-pmacro (Ira cc) (const BI 1))
5178 (define-pmacro (Ieq cc) ( zbit cc))
5179 (define-pmacro (Ine cc) (not (zbit cc)))
5180 (define-pmacro (Ile cc) ( orif (zbit cc) (xor (nbit cc) (vbit cc))))
5181 (define-pmacro (Igt cc) (not (orif (zbit cc) (xor (nbit cc) (vbit cc)))))
5182 (define-pmacro (Ilt cc) ( xor (nbit cc) (vbit cc)))
5183 (define-pmacro (Ige cc) (not (xor (nbit cc) (vbit cc))))
5184 (define-pmacro (Ils cc) ( orif (cbit cc) (zbit cc)))
5185 (define-pmacro (Ihi cc) (not (orif (cbit cc) (zbit cc))))
5186 (define-pmacro (Ic cc) ( cbit cc))
5187 (define-pmacro (Inc cc) (not (cbit cc)))
5188 (define-pmacro (In cc) ( nbit cc))
5189 (define-pmacro (Ip cc) (not (nbit cc)))
5190 (define-pmacro (Iv cc) ( vbit cc))
5191 (define-pmacro (Inv cc) (not (vbit cc)))
5192
5193 ; Float Branch Conditions
5194 (define-pmacro (Fnev cc) (const BI 0))
5195 (define-pmacro (Fra cc) (const BI 1))
5196 (define-pmacro (Fne cc) (orif (lbit cc) (orif (gbit cc) (ubit cc))))
5197 (define-pmacro (Feq cc) (ebit cc))
5198 (define-pmacro (Flg cc) (orif (lbit cc) (gbit cc)))
5199 (define-pmacro (Fue cc) (orif (ebit cc) (ubit cc)))
5200 (define-pmacro (Ful cc) (orif (lbit cc) (ubit cc)))
5201 (define-pmacro (Fge cc) (orif (ebit cc) (gbit cc)))
5202 (define-pmacro (Flt cc) (lbit cc))
5203 (define-pmacro (Fuge cc) (orif (ebit cc) (orif (gbit cc) (ubit cc))))
5204 (define-pmacro (Fug cc) (orif (gbit cc) (ubit cc)))
5205 (define-pmacro (Fle cc) (orif (ebit cc) (lbit cc)))
5206 (define-pmacro (Fgt cc) (gbit cc))
5207 (define-pmacro (Fule cc) (orif (ebit cc) (orif (lbit cc) (ubit cc))))
5208 (define-pmacro (Fu cc) (ubit cc))
5209 (define-pmacro (Fo cc) (orif (ebit cc) (orif (lbit cc) (gbit cc))))
5210
5211 (define-pmacro (conditional-branch-i prefix cc op cond comment)
5212 (dni (.sym prefix cc)
5213 (comment)
5214 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5215 (.str (.sym prefix cc) "$pack $ICCi_2,$hint,$label16")
5216 (+ pack (.sym ICC_ cc) ICCi_2 op hint label16)
5217 (sequence ()
5218 (c-call VOID "@cpu@_model_branch" label16 hint)
5219 (if (cond ICCi_2)
5220 (set pc label16)))
5221 ((fr400 (unit u-branch))
5222 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5223 )
5224 )
5225
5226 (dni bra
5227 "integer branch equal"
5228 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5229 "bra$pack $hint_taken$label16"
5230 (+ pack ICC_ra (ICCi_2-null) OP_06 hint_taken label16)
5231 (sequence ()
5232 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5233 (set pc label16))
5234 ((fr400 (unit u-branch))
5235 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5236 )
5237
5238 (dni bno
5239 "integer branch never"
5240 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5241 "bno$pack$hint_not_taken"
5242 (+ pack ICC_nev (ICCi_2-null) OP_06 hint_not_taken (label16-null))
5243 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5244 ((fr400 (unit u-branch))
5245 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5246 )
5247
5248 (conditional-branch-i b eq OP_06 Ieq "integer branch equal")
5249 (conditional-branch-i b ne OP_06 Ine "integer branch not equal")
5250 (conditional-branch-i b le OP_06 Ile "integer branch less or equal")
5251 (conditional-branch-i b gt OP_06 Igt "integer branch greater")
5252 (conditional-branch-i b lt OP_06 Ilt "integer branch less")
5253 (conditional-branch-i b ge OP_06 Ige "integer branch greater or equal")
5254 (conditional-branch-i b ls OP_06 Ils "integer branch less or equal unsigned")
5255 (conditional-branch-i b hi OP_06 Ihi "integer branch greater unsigned")
5256 (conditional-branch-i b c OP_06 Ic "integer branch carry set")
5257 (conditional-branch-i b nc OP_06 Inc "integer branch carry clear")
5258 (conditional-branch-i b n OP_06 In "integer branch negative")
5259 (conditional-branch-i b p OP_06 Ip "integer branch positive")
5260 (conditional-branch-i b v OP_06 Iv "integer branch overflow set")
5261 (conditional-branch-i b nv OP_06 Inv "integer branch overflow clear")
5262
5263 (define-pmacro (conditional-branch-f prefix cc op cond comment)
5264 (dni (.sym prefix cc)
5265 (comment)
5266 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5267 (.str (.sym prefix cc) "$pack $FCCi_2,$hint,$label16")
5268 (+ pack (.sym FCC_ cc) FCCi_2 op hint label16)
5269 (sequence ()
5270 (c-call VOID "@cpu@_model_branch" label16 hint)
5271 (if (cond FCCi_2) (set pc label16)))
5272 ((fr400 (unit u-branch))
5273 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5274 )
5275 )
5276
5277 (dni fbra
5278 "float branch equal"
5279 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5280 "fbra$pack $hint_taken$label16"
5281 (+ pack FCC_ra (FCCi_2-null) OP_07 hint_taken label16)
5282 (sequence ()
5283 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5284 (set pc label16))
5285 ((fr400 (unit u-branch))
5286 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5287 )
5288
5289 (dni fbno
5290 "float branch never"
5291 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5292 "fbno$pack$hint_not_taken"
5293 (+ pack FCC_nev (FCCi_2-null) OP_07 hint_not_taken (label16-null))
5294 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5295 ((fr400 (unit u-branch))
5296 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5297 )
5298
5299 (conditional-branch-f fb ne OP_07 Fne "float branch not equal")
5300 (conditional-branch-f fb eq OP_07 Feq "float branch equal")
5301 (conditional-branch-f fb lg OP_07 Flg "float branch less or greater")
5302 (conditional-branch-f fb ue OP_07 Fue "float branch unordered or equal")
5303 (conditional-branch-f fb ul OP_07 Ful "float branch unordered or less")
5304 (conditional-branch-f fb ge OP_07 Fge "float branch greater or equal")
5305 (conditional-branch-f fb lt OP_07 Flt "float branch less")
5306 (conditional-branch-f fb uge OP_07 Fuge "float branch unordered, greater,equal")
5307 (conditional-branch-f fb ug OP_07 Fug "float branch unordered or greater")
5308 (conditional-branch-f fb le OP_07 Fle "float branch less or equal")
5309 (conditional-branch-f fb gt OP_07 Fgt "float branch greater")
5310 (conditional-branch-f fb ule OP_07 Fule "float branch unordered, less or equal")
5311 (conditional-branch-f fb u OP_07 Fu "float branch unordered")
5312 (conditional-branch-f fb o OP_07 Fo "float branch ordered")
5313
5314 (define-pmacro (ctrlr-branch-semantics cond ccond)
5315 (sequence ((SI tmp))
5316 (set tmp (sub (spr-lcr) 1))
5317 (set (spr-lcr) tmp)
5318 (if cond
5319 (if (eq ccond 0)
5320 (if (ne tmp 0)
5321 (set pc (spr-lr)))
5322 (if (eq tmp 0)
5323 (set pc (spr-lr))))))
5324 )
5325
5326 (dni bctrlr
5327 "LCR conditional branch to lr"
5328 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5329 ("bctrlr$pack $ccond,$hint")
5330 (+ pack (cond-null) (ICCi_2-null) OP_0E hint OPE3_01 ccond (s12-null))
5331 (sequence ()
5332 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5333 (ctrlr-branch-semantics (const BI 1) ccond))
5334 ((fr400 (unit u-branch))
5335 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5336 )
5337
5338 (define-pmacro (conditional-branch-cclr prefix cc i-f op ope cond attr comment)
5339 (dni (.sym prefix cc lr)
5340 (comment)
5341 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) attr)
5342 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$hint")
5343 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope
5344 (ccond-null) (s12-null))
5345 (sequence ()
5346 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5347 (if (cond (.sym i-f CCi_2)) (set pc (spr-lr))))
5348 ((fr400 (unit u-branch))
5349 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5350 )
5351 )
5352
5353 (dni bralr
5354 "integer cclr branch always"
5355 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
5356 "bralr$pack$hint_taken"
5357 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_02 (ccond-null) (s12-null))
5358 (sequence ()
5359 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5360 (set pc (spr-lr)))
5361 ((fr400 (unit u-branch))
5362 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5363 )
5364
5365 (dni bnolr
5366 "integer cclr branch never"
5367 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
5368 "bnolr$pack$hint_not_taken"
5369 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_02 (ccond-null) (s12-null))
5370 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5371 ((fr400 (unit u-branch))
5372 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5373 )
5374
5375 (conditional-branch-cclr b eq I OP_0E OPE3_02 Ieq NA "integer cclr branch equal")
5376 (conditional-branch-cclr b ne I OP_0E OPE3_02 Ine NA "integer cclr branch not equal")
5377 (conditional-branch-cclr b le I OP_0E OPE3_02 Ile NA "integer cclr branch less or equal")
5378 (conditional-branch-cclr b gt I OP_0E OPE3_02 Igt NA "integer cclr branch greater")
5379 (conditional-branch-cclr b lt I OP_0E OPE3_02 Ilt NA "integer cclr branch less")
5380 (conditional-branch-cclr b ge I OP_0E OPE3_02 Ige NA "integer cclr branch greater or equal")
5381 (conditional-branch-cclr b ls I OP_0E OPE3_02 Ils NA "integer cclr branch less or equal unsigned")
5382 (conditional-branch-cclr b hi I OP_0E OPE3_02 Ihi NA "integer cclr branch greater unsigned")
5383 (conditional-branch-cclr b c I OP_0E OPE3_02 Ic NA "integer cclr branch carry set")
5384 (conditional-branch-cclr b nc I OP_0E OPE3_02 Inc NA "integer cclr branch carry clear")
5385 (conditional-branch-cclr b n I OP_0E OPE3_02 In NA "integer cclr branch negative")
5386 (conditional-branch-cclr b p I OP_0E OPE3_02 Ip NA "integer cclr branch positive")
5387 (conditional-branch-cclr b v I OP_0E OPE3_02 Iv NA "integer cclr branch overflow set")
5388 (conditional-branch-cclr b nv I OP_0E OPE3_02 Inv NA "integer cclr branch overflow clear")
5389
5390 (dni fbralr
5391 "float cclr branch always"
5392 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
5393 "fbralr$pack$hint_taken"
5394 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_06 (ccond-null) (s12-null))
5395 (sequence ()
5396 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5397 (set pc (spr-lr)))
5398 ((fr400 (unit u-branch))
5399 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5400 )
5401
5402 (dni fbnolr
5403 "float cclr branch never"
5404 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
5405 "fbnolr$pack$hint_not_taken"
5406 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_06 (ccond-null) (s12-null))
5407 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5408 ((fr400 (unit u-branch))
5409 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5410 )
5411
5412 (conditional-branch-cclr fb eq F OP_0E OPE3_06 Feq FR-ACCESS "float cclr branch equal")
5413 (conditional-branch-cclr fb ne F OP_0E OPE3_06 Fne FR-ACCESS "float cclr branch not equal")
5414 (conditional-branch-cclr fb lg F OP_0E OPE3_06 Flg FR-ACCESS "float branch less or greater")
5415 (conditional-branch-cclr fb ue F OP_0E OPE3_06 Fue FR-ACCESS "float branch unordered or equal")
5416 (conditional-branch-cclr fb ul F OP_0E OPE3_06 Ful FR-ACCESS "float branch unordered or less")
5417 (conditional-branch-cclr fb ge F OP_0E OPE3_06 Fge FR-ACCESS "float branch greater or equal")
5418 (conditional-branch-cclr fb lt F OP_0E OPE3_06 Flt FR-ACCESS "float branch less")
5419 (conditional-branch-cclr fb uge F OP_0E OPE3_06 Fuge FR-ACCESS "float branch unordered, greater, equal")
5420 (conditional-branch-cclr fb ug F OP_0E OPE3_06 Fug FR-ACCESS "float branch unordered or greater")
5421 (conditional-branch-cclr fb le F OP_0E OPE3_06 Fle FR-ACCESS "float branch less or equal")
5422 (conditional-branch-cclr fb gt F OP_0E OPE3_06 Fgt FR-ACCESS "float branch greater")
5423 (conditional-branch-cclr fb ule F OP_0E OPE3_06 Fule FR-ACCESS "float branch unordered, less or equal")
5424 (conditional-branch-cclr fb u F OP_0E OPE3_06 Fu FR-ACCESS "float branch unordered")
5425 (conditional-branch-cclr fb o F OP_0E OPE3_06 Fo FR-ACCESS "float branch ordered")
5426
5427 (define-pmacro (conditional-branch-ctrlr prefix cc i-f op ope cond attr comment)
5428 (dni (.sym prefix cc lr)
5429 (comment)
5430 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) attr)
5431 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$ccond,$hint")
5432 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope ccond (s12-null))
5433 (sequence ()
5434 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5435 (ctrlr-branch-semantics (cond (.sym i-f CCi_2)) ccond))
5436 ((fr400 (unit u-branch))
5437 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5438 )
5439 )
5440
5441 (dni bcralr
5442 "integer ctrlr branch always"
5443 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5444 "bcralr$pack $ccond$hint_taken"
5445 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_03 ccond (s12-null))
5446 (sequence ()
5447 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5448 (ctrlr-branch-semantics (const BI 1) ccond))
5449 ((fr400 (unit u-branch))
5450 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5451 )
5452
5453 (dni bcnolr
5454 "integer ctrlr branch never"
5455 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5456 "bcnolr$pack$hint_not_taken"
5457 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_03 (ccond-null) (s12-null))
5458 (sequence ()
5459 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5460 (ctrlr-branch-semantics (const BI 0) ccond))
5461 ((fr400 (unit u-branch))
5462 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5463 )
5464
5465 (conditional-branch-ctrlr bc eq I OP_0E OPE3_03 Ieq NA "integer ctrlr branch equal")
5466 (conditional-branch-ctrlr bc ne I OP_0E OPE3_03 Ine NA "integer ctrlr branch not equal")
5467 (conditional-branch-ctrlr bc le I OP_0E OPE3_03 Ile NA "integer ctrlr branch less equal")
5468 (conditional-branch-ctrlr bc gt I OP_0E OPE3_03 Igt NA "integer ctrlr branch greater")
5469 (conditional-branch-ctrlr bc lt I OP_0E OPE3_03 Ilt NA "integer ctrlr branch less")
5470 (conditional-branch-ctrlr bc ge I OP_0E OPE3_03 Ige NA "integer ctrlr branch greater equal")
5471 (conditional-branch-ctrlr bc ls I OP_0E OPE3_03 Ils NA "integer ctrlr branch less equal unsigned")
5472 (conditional-branch-ctrlr bc hi I OP_0E OPE3_03 Ihi NA "integer ctrlr branch greater unsigned")
5473 (conditional-branch-ctrlr bc c I OP_0E OPE3_03 Ic NA "integer ctrlr branch carry set")
5474 (conditional-branch-ctrlr bc nc I OP_0E OPE3_03 Inc NA "integer ctrlr branch carry clear")
5475 (conditional-branch-ctrlr bc n I OP_0E OPE3_03 In NA "integer ctrlr branch negative")
5476 (conditional-branch-ctrlr bc p I OP_0E OPE3_03 Ip NA "integer ctrlr branch positive")
5477 (conditional-branch-ctrlr bc v I OP_0E OPE3_03 Iv NA "integer ctrlr branch overflow set")
5478 (conditional-branch-ctrlr bc nv I OP_0E OPE3_03 Inv NA "integer ctrlr branch overflow clear")
5479
5480 (dni fcbralr
5481 "float ctrlr branch always"
5482 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
5483 "fcbralr$pack $ccond$hint_taken"
5484 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_07 ccond (s12-null))
5485 (sequence ()
5486 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5487 (ctrlr-branch-semantics (const BI 1) ccond))
5488 ((fr400 (unit u-branch))
5489 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5490 )
5491
5492 (dni fcbnolr
5493 "float ctrlr branch never"
5494 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
5495 "fcbnolr$pack$hint_not_taken"
5496 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_07 (ccond-null) (s12-null))
5497 (sequence ()
5498 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5499 (ctrlr-branch-semantics (const BI 0) ccond))
5500 ((fr400 (unit u-branch))
5501 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5502 )
5503
5504 (conditional-branch-ctrlr fcb eq F OP_0E OPE3_07 Feq FR-ACCESS "float cclr branch equal")
5505 (conditional-branch-ctrlr fcb ne F OP_0E OPE3_07 Fne FR-ACCESS "float cclr branch not equal")
5506 (conditional-branch-ctrlr fcb lg F OP_0E OPE3_07 Flg FR-ACCESS "float branch less or greater")
5507 (conditional-branch-ctrlr fcb ue F OP_0E OPE3_07 Fue FR-ACCESS "float branch unordered or equal")
5508 (conditional-branch-ctrlr fcb ul F OP_0E OPE3_07 Ful FR-ACCESS "float branch unordered or less")
5509 (conditional-branch-ctrlr fcb ge F OP_0E OPE3_07 Fge FR-ACCESS "float branch greater or equal")
5510 (conditional-branch-ctrlr fcb lt F OP_0E OPE3_07 Flt FR-ACCESS "float branch less")
5511 (conditional-branch-ctrlr fcb uge F OP_0E OPE3_07 Fuge FR-ACCESS "float branch unordered, greater, equal")
5512 (conditional-branch-ctrlr fcb ug F OP_0E OPE3_07 Fug FR-ACCESS "float branch unordered or greater")
5513 (conditional-branch-ctrlr fcb le F OP_0E OPE3_07 Fle FR-ACCESS "float branch less or equal")
5514 (conditional-branch-ctrlr fcb gt F OP_0E OPE3_07 Fgt FR-ACCESS "float branch greater")
5515 (conditional-branch-ctrlr fcb ule F OP_0E OPE3_07 Fule FR-ACCESS "float branch unordered, less or equal")
5516 (conditional-branch-ctrlr fcb u F OP_0E OPE3_07 Fu FR-ACCESS "float branch unordered")
5517 (conditional-branch-ctrlr fcb o F OP_0E OPE3_07 Fo FR-ACCESS "float branch ordered")
5518
5519 (define-pmacro (jump-and-link-semantics base offset LI)
5520 (sequence ()
5521 (if (eq LI 1)
5522 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1))
5523 ; Target address gets aligned here
5524 (set pc (and (add base offset) #xfffffffc))
5525 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5526 )
5527
5528 (dni jmpl
5529 "jump and link"
5530 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
5531 "jmpl$pack @($GRi,$GRj)"
5532 (+ pack (misc-null-1) (LI-off) OP_0C GRi (misc-null-2) GRj)
5533 (jump-and-link-semantics GRi GRj LI)
5534 ((fr400 (unit u-branch))
5535 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5536 )
5537
5538 (dni calll
5539 "call and link"
5540 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5541 "calll$pack @($GRi,$GRj)"
5542 (+ pack (misc-null-1) (LI-on) OP_0C GRi (misc-null-2) GRj)
5543 (jump-and-link-semantics GRi GRj LI)
5544 ((fr400 (unit u-branch))
5545 (fr500 (unit u-branch)))
5546 )
5547
5548 (dni jmpil
5549 "jump immediate and link"
5550 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
5551 "jmpil$pack @($GRi,$s12)"
5552 (+ pack (misc-null-1) (LI-off) OP_0D GRi s12)
5553 (jump-and-link-semantics GRi s12 LI)
5554 ((fr400 (unit u-branch))
5555 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5556 )
5557
5558 (dni callil
5559 "call immediate and link"
5560 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5561 "callil$pack @($GRi,$s12)"
5562 (+ pack (misc-null-1) (LI-on) OP_0D GRi s12)
5563 (jump-and-link-semantics GRi s12 LI)
5564 ((fr400 (unit u-branch))
5565 (fr500 (unit u-branch)))
5566 )
5567
5568 (dni call
5569 "call and link"
5570 ((UNIT B0) (FR500-MAJOR B-4) (FR550-MAJOR B-4) (FR400-MAJOR B-4))
5571 "call$pack $label24"
5572 (+ pack OP_0F label24)
5573 (sequence ()
5574 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1)
5575 (set pc label24)
5576 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5577 ((fr400 (unit u-branch))
5578 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5579 )
5580
5581 (dni rett
5582 "return from trap"
5583 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) PRIVILEGED)
5584 "rett$pack $debug"
5585 (+ pack (misc-null-1) debug OP_05 (rs-null) (s12-null))
5586 ; frv_rett handles operating vs user mode
5587 (sequence ()
5588 (set pc (c-call UWI "frv_rett" pc debug))
5589 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5590 ()
5591 )
5592
5593 (dni rei
5594 "run exception instruction"
5595 ((UNIT C) (FR500-MAJOR C-1) (MACH frv) PRIVILEGED)
5596 "rei$pack $eir"
5597 (+ pack (rd-null) OP_37 eir (s12-null))
5598 (nop) ; for now
5599 ()
5600 )
5601
5602 (define-pmacro (trap-semantics cond base offset)
5603 (if cond
5604 (sequence ()
5605 ; This is defered to frv_itrap because for the breakpoint
5606 ; case we want to change as little of the machine state as
5607 ; possible.
5608 ;
5609 ; PCSR=PC
5610 ; PSR.PS=PSR.S
5611 ; PSR.ET=0
5612 ; if PSR.ESR==1
5613 ; SR0 through SR3=GR4 through GR7
5614 ; TBR.TT=0x80 + ((GRi + s12) & 0x7f)
5615 ; PC=TBR
5616 ; We still should indicate what is modified by this insn.
5617 (clobber (spr-pcsr))
5618 (clobber psr_ps)
5619 (clobber psr_et)
5620 (clobber tbr_tt)
5621 (if (ne psr_esr (const 0))
5622 (sequence ()
5623 (clobber (spr-sr0))
5624 (clobber (spr-sr1))
5625 (clobber (spr-sr2))
5626 (clobber (spr-sr3))))
5627 ; frv_itrap handles operating vs user mode
5628 (c-call VOID "frv_itrap" pc base offset)))
5629 )
5630
5631 (define-pmacro (trap-r prefix cc i-f op ope cond attr comment)
5632 (dni (.sym prefix cc)
5633 (comment)
5634 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
5635 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$GRj")
5636 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi (misc-null-3) ope GRj)
5637 (trap-semantics (cond (.sym i-f CCi_2)) GRi GRj)
5638 ((fr400 (unit u-trap))
5639 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5640 )
5641 )
5642
5643 (dni tra
5644 "integer trap always"
5645 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5646 "tra$pack $GRi,$GRj"
5647 (+ pack ICC_ra (ICCi_2-null) OP_04 GRi (misc-null-3) OPE4_0 GRj)
5648 (trap-semantics (const BI 1) GRi GRj)
5649 ((fr400 (unit u-trap))
5650 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5651 )
5652
5653 (dni tno
5654 "integer trap never"
5655 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5656 "tno$pack"
5657 (+ pack ICC_nev (ICCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_0 (GRj-null))
5658 (trap-semantics (const BI 0) GRi GRj)
5659 ((fr400 (unit u-trap))
5660 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5661 )
5662
5663 (trap-r t eq I OP_04 OPE4_0 Ieq NA "integer trap equal")
5664 (trap-r t ne I OP_04 OPE4_0 Ine NA "integer trap not equal")
5665 (trap-r t le I OP_04 OPE4_0 Ile NA "integer trap less or equal")
5666 (trap-r t gt I OP_04 OPE4_0 Igt NA "integer trap greater")
5667 (trap-r t lt I OP_04 OPE4_0 Ilt NA "integer trap less")
5668 (trap-r t ge I OP_04 OPE4_0 Ige NA "integer trap greater or equal")
5669 (trap-r t ls I OP_04 OPE4_0 Ils NA "integer trap less or equal unsigned")
5670 (trap-r t hi I OP_04 OPE4_0 Ihi NA "integer trap greater unsigned")
5671 (trap-r t c I OP_04 OPE4_0 Ic NA "integer trap carry set")
5672 (trap-r t nc I OP_04 OPE4_0 Inc NA "integer trap carry clear")
5673 (trap-r t n I OP_04 OPE4_0 In NA "integer trap negative")
5674 (trap-r t p I OP_04 OPE4_0 Ip NA "integer trap positive")
5675 (trap-r t v I OP_04 OPE4_0 Iv NA "integer trap overflow set")
5676 (trap-r t nv I OP_04 OPE4_0 Inv NA "integer trap overflow clear")
5677
5678 (dni ftra
5679 "float trap always"
5680 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5681 "ftra$pack $GRi,$GRj"
5682 (+ pack FCC_ra (FCCi_2-null) OP_04 GRi (misc-null-3) OPE4_1 GRj)
5683 (trap-semantics (const BI 1) GRi GRj)
5684 ((fr400 (unit u-trap))
5685 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5686 )
5687
5688 (dni ftno
5689 "flost trap never"
5690 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5691 "ftno$pack"
5692 (+ pack FCC_nev (FCCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_1 (GRj-null))
5693 (trap-semantics (const BI 0) GRi GRj)
5694 ((fr400 (unit u-trap))
5695 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5696 )
5697
5698 (trap-r ft ne F OP_04 OPE4_1 Fne FR-ACCESS "float trap not equal")
5699 (trap-r ft eq F OP_04 OPE4_1 Feq FR-ACCESS "float trap equal")
5700 (trap-r ft lg F OP_04 OPE4_1 Flg FR-ACCESS "float trap greater or less")
5701 (trap-r ft ue F OP_04 OPE4_1 Fue FR-ACCESS "float trap unordered or equal")
5702 (trap-r ft ul F OP_04 OPE4_1 Ful FR-ACCESS "float trap unordered or less")
5703 (trap-r ft ge F OP_04 OPE4_1 Fge FR-ACCESS "float trap greater or equal")
5704 (trap-r ft lt F OP_04 OPE4_1 Flt FR-ACCESS "float trap less")
5705 (trap-r ft uge F OP_04 OPE4_1 Fuge FR-ACCESS "float trap unordered greater or equal")
5706 (trap-r ft ug F OP_04 OPE4_1 Fug FR-ACCESS "float trap unordered or greater")
5707 (trap-r ft le F OP_04 OPE4_1 Fle FR-ACCESS "float trap less or equal")
5708 (trap-r ft gt F OP_04 OPE4_1 Fgt FR-ACCESS "float trap greater")
5709 (trap-r ft ule F OP_04 OPE4_1 Fule FR-ACCESS "float trap unordered less or equal")
5710 (trap-r ft u F OP_04 OPE4_1 Fu FR-ACCESS "float trap unordered")
5711 (trap-r ft o F OP_04 OPE4_1 Fo FR-ACCESS "float trap ordered")
5712
5713 (define-pmacro (trap-immed prefix cc i-f op cond attr comment)
5714 (dni (.sym prefix cc)
5715 (comment)
5716 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
5717 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$s12")
5718 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi s12)
5719 (trap-semantics (cond (.sym i-f CCi_2)) GRi s12)
5720 ((fr400 (unit u-trap))
5721 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5722 )
5723 )
5724
5725 (dni tira
5726 "integer trap always"
5727 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5728 "tira$pack $GRi,$s12"
5729 (+ pack ICC_ra (ICCi_2-null) OP_1C GRi s12)
5730 (trap-semantics (const BI 1) GRi s12)
5731 ((fr400 (unit u-trap))
5732 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5733 )
5734
5735 (dni tino
5736 "integer trap never"
5737 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5738 "tino$pack"
5739 (+ pack ICC_nev (ICCi_2-null) OP_1C (GRi-null) (s12-null))
5740 (trap-semantics (const BI 0) GRi s12)
5741 ((fr400 (unit u-trap))
5742 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5743 )
5744
5745 (trap-immed ti eq I OP_1C Ieq NA "integer trap equal")
5746 (trap-immed ti ne I OP_1C Ine NA "integer trap not equal")
5747 (trap-immed ti le I OP_1C Ile NA "integer trap less or equal")
5748 (trap-immed ti gt I OP_1C Igt NA "integer trap greater")
5749 (trap-immed ti lt I OP_1C Ilt NA "integer trap less")
5750 (trap-immed ti ge I OP_1C Ige NA "integer trap greater or equal")
5751 (trap-immed ti ls I OP_1C Ils NA "integer trap less or equal unsigned")
5752 (trap-immed ti hi I OP_1C Ihi NA "integer trap greater unsigned")
5753 (trap-immed ti c I OP_1C Ic NA "integer trap carry set")
5754 (trap-immed ti nc I OP_1C Inc NA "integer trap carry clear")
5755 (trap-immed ti n I OP_1C In NA "integer trap negative")
5756 (trap-immed ti p I OP_1C Ip NA "integer trap positive")
5757 (trap-immed ti v I OP_1C Iv NA "integer trap overflow set")
5758 (trap-immed ti nv I OP_1C Inv NA "integer trap overflow clear")
5759
5760 (dni ftira
5761 "float trap always"
5762 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5763 "ftira$pack $GRi,$s12"
5764 (+ pack FCC_ra (ICCi_2-null) OP_1D GRi s12)
5765 (trap-semantics (const BI 1) GRi s12)
5766 ((fr400 (unit u-trap))
5767 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5768 )
5769
5770 (dni ftino
5771 "float trap never"
5772 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5773 "ftino$pack"
5774 (+ pack FCC_nev (FCCi_2-null) OP_1D (GRi-null) (s12-null))
5775 (trap-semantics (const BI 0) GRi s12)
5776 ((fr400 (unit u-trap))
5777 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5778 )
5779
5780 (trap-immed fti ne F OP_1D Fne FR-ACCESS "float trap not equal")
5781 (trap-immed fti eq F OP_1D Feq FR-ACCESS "float trap equal")
5782 (trap-immed fti lg F OP_1D Flg FR-ACCESS "float trap greater or less")
5783 (trap-immed fti ue F OP_1D Fue FR-ACCESS "float trap unordered or equal")
5784 (trap-immed fti ul F OP_1D Ful FR-ACCESS "float trap unordered or less")
5785 (trap-immed fti ge F OP_1D Fge FR-ACCESS "float trap greater or equal")
5786 (trap-immed fti lt F OP_1D Flt FR-ACCESS "float trap less")
5787 (trap-immed fti uge F OP_1D Fuge FR-ACCESS "float trap unordered greater or equal")
5788 (trap-immed fti ug F OP_1D Fug FR-ACCESS "float trap unordered or greater")
5789 (trap-immed fti le F OP_1D Fle FR-ACCESS "float trap less or equal")
5790 (trap-immed fti gt F OP_1D Fgt FR-ACCESS "float trap greater")
5791 (trap-immed fti ule F OP_1D Fule FR-ACCESS "float trap unordered less or equal")
5792 (trap-immed fti u F OP_1D Fu FR-ACCESS "float trap unordered")
5793 (trap-immed fti o F OP_1D Fo FR-ACCESS "float trap ordered")
5794
5795 (dni break
5796 "break trap"
5797 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5798 "break$pack"
5799 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_3 (GRj-null))
5800 (sequence ()
5801 ; This is defered to frv_break because for the breakpoint
5802 ; case we want to change as little of the machine state as
5803 ; possible.
5804 ;
5805 ; BPCSR=PC
5806 ; BPSR.BS=PSR.S
5807 ; BPSR.BET=PSR.ET
5808 ; PSR.S=1
5809 ; PSR.ET=0
5810 ; TBR.TT=0xff
5811 ; PC=TBR
5812 ; We still should indicate what is modified by this insn.
5813 (clobber (spr-bpcsr))
5814 (clobber bpsr_bs)
5815 (clobber bpsr_bet)
5816 (clobber psr_s)
5817 (clobber psr_et)
5818 (clobber tbr_tt)
5819 (c-call VOID "frv_break"))
5820 ()
5821 )
5822
5823 (dni mtrap
5824 "media trap"
5825 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5826 "mtrap$pack"
5827 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_2 (GRj-null))
5828 (c-call VOID "frv_mtrap")
5829 ()
5830 )
5831
5832 (define-pmacro (condition-code-logic name operation ope comment)
5833 (dni name
5834 (comment)
5835 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
5836 (.str name "$pack $CRi,$CRj,$CRk")
5837 (+ pack (misc-null-6) CRk OP_0A (misc-null-7) CRi ope (misc-null-8) CRj)
5838 (set CRk (c-call UQI "@cpu@_cr_logic" operation CRi CRj))
5839 ()
5840 )
5841 )
5842 (define-pmacro (op-andcr) 0)
5843 (define-pmacro (op-orcr) 1)
5844 (define-pmacro (op-xorcr) 2)
5845 (define-pmacro (op-nandcr) 3)
5846 (define-pmacro (op-norcr) 4)
5847 (define-pmacro (op-andncr) 5)
5848 (define-pmacro (op-orncr) 6)
5849 (define-pmacro (op-nandncr) 7)
5850 (define-pmacro (op-norncr) 8)
5851
5852 (define-pmacro (cr-true) 3)
5853 (define-pmacro (cr-false) 2)
5854 (define-pmacro (cr-undefined) 0)
5855
5856 (condition-code-logic andcr (op-andcr) OPE1_08 "and condition code regs")
5857 (condition-code-logic orcr (op-orcr) OPE1_09 "or condition code regs")
5858 (condition-code-logic xorcr (op-xorcr) OPE1_0A "xor condition code regs")
5859 (condition-code-logic nandcr (op-nandcr) OPE1_0C "nand condition code regs")
5860 (condition-code-logic norcr (op-norcr) OPE1_0D "nor condition code regs")
5861 (condition-code-logic andncr (op-andncr) OPE1_10 "andn condition code regs")
5862 (condition-code-logic orncr (op-orncr) OPE1_11 "orn condition code regs")
5863 (condition-code-logic nandncr (op-nandncr) OPE1_14 "nandn condition code regs")
5864 (condition-code-logic norncr (op-norncr) OPE1_15 "norn condition code regs")
5865
5866 (dni notcr
5867 ("not cccr register")
5868 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
5869 (.str notcr "$pack $CRj,$CRk")
5870 (+ pack (misc-null-6) CRk OP_0A (rs-null) OPE1_0B (misc-null-8) CRj)
5871 (set CRk (xor CRj 1))
5872 ()
5873 )
5874
5875 (define-pmacro (check-semantics cond cr)
5876 (if cond (set cr (cr-true)) (set cr (cr-false)))
5877 )
5878
5879 (define-pmacro (check-int-condition-code prefix cc op cond comment)
5880 (dni (.sym prefix cc)
5881 (comment)
5882 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5883 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int")
5884 (+ pack (.sym ICC_ cc) CRj_int op (misc-null-5) ICCi_3)
5885 (check-semantics (cond ICCi_3) CRj_int)
5886 ((fr400 (unit u-check))
5887 (fr500 (unit u-check)) (fr550 (unit u-check)))
5888 )
5889 )
5890
5891 (dni ckra
5892 "check integer cc always"
5893 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5894 "ckra$pack $CRj_int"
5895 (+ pack ICC_ra CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5896 (check-semantics (const BI 1) CRj_int)
5897 ((fr400 (unit u-check))
5898 (fr500 (unit u-check)) (fr550 (unit u-check)))
5899 )
5900
5901 (dni ckno
5902 "check integer cc never"
5903 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5904 "ckno$pack $CRj_int"
5905 (+ pack ICC_nev CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5906 (check-semantics (const BI 0) CRj_int)
5907 ((fr400 (unit u-check))
5908 (fr500 (unit u-check)) (fr550 (unit u-check)))
5909 )
5910
5911 (check-int-condition-code ck eq OP_08 Ieq "check integer cc equal")
5912 (check-int-condition-code ck ne OP_08 Ine "check integer cc not equal")
5913 (check-int-condition-code ck le OP_08 Ile "check integer cc less or equal")
5914 (check-int-condition-code ck gt OP_08 Igt "check integer cc greater")
5915 (check-int-condition-code ck lt OP_08 Ilt "check integer cc less")
5916 (check-int-condition-code ck ge OP_08 Ige "check integer cc greater or equal")
5917 (check-int-condition-code ck ls OP_08 Ils "check integer cc less or equal unsigned")
5918 (check-int-condition-code ck hi OP_08 Ihi "check integer cc greater unsigned")
5919 (check-int-condition-code ck c OP_08 Ic "check integer cc carry set")
5920 (check-int-condition-code ck nc OP_08 Inc "check integer cc carry clear")
5921 (check-int-condition-code ck n OP_08 In "check integer cc negative")
5922 (check-int-condition-code ck p OP_08 Ip "check integer cc positive")
5923 (check-int-condition-code ck v OP_08 Iv "check integer cc overflow set")
5924 (check-int-condition-code ck nv OP_08 Inv "check integer cc overflow clear")
5925
5926 (define-pmacro (check-float-condition-code prefix cc op cond comment)
5927 (dni (.sym prefix cc)
5928 (comment)
5929 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
5930 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float")
5931 (+ pack (.sym FCC_ cc) CRj_float op (misc-null-5) FCCi_3)
5932 (check-semantics (cond FCCi_3) CRj_float)
5933 ((fr400 (unit u-check))
5934 (fr500 (unit u-check)) (fr550 (unit u-check)))
5935 )
5936 )
5937
5938 (dni fckra
5939 "check float cc always"
5940 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
5941 "fckra$pack $CRj_float"
5942 (+ pack FCC_ra CRj_float OP_09 (misc-null-5) FCCi_3)
5943 (check-semantics (const BI 1) CRj_float)
5944 ((fr400 (unit u-check))
5945 (fr500 (unit u-check)) (fr550 (unit u-check)))
5946 )
5947
5948 (dni fckno
5949 "check float cc never"
5950 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
5951 "fckno$pack $CRj_float"
5952 (+ pack FCC_nev CRj_float OP_09 (misc-null-5) FCCi_3)
5953 (check-semantics (const BI 0) CRj_float)
5954 ((fr400 (unit u-check))
5955 (fr500 (unit u-check)) (fr550 (unit u-check)))
5956 )
5957
5958 (check-float-condition-code fck ne OP_09 Fne "check float cc not equal")
5959 (check-float-condition-code fck eq OP_09 Feq "check float cc equal")
5960 (check-float-condition-code fck lg OP_09 Flg "check float cc greater or less")
5961 (check-float-condition-code fck ue OP_09 Fue "check float cc unordered or equal")
5962 (check-float-condition-code fck ul OP_09 Ful "check float cc unordered or less")
5963 (check-float-condition-code fck ge OP_09 Fge "check float cc greater or equal")
5964 (check-float-condition-code fck lt OP_09 Flt "check float cc less")
5965 (check-float-condition-code fck uge OP_09 Fuge "check float cc unordered greater or equal")
5966 (check-float-condition-code fck ug OP_09 Fug "check float cc unordered or greater")
5967 (check-float-condition-code fck le OP_09 Fle "check float cc less or equal")
5968 (check-float-condition-code fck gt OP_09 Fgt "check float cc greater")
5969 (check-float-condition-code fck ule OP_09 Fule "check float cc unordered less or equal")
5970 (check-float-condition-code fck u OP_09 Fu "check float cc unordered")
5971 (check-float-condition-code fck o OP_09 Fo "check float cc ordered")
5972
5973 (define-pmacro (conditional-check-int-condition-code prefix cc op ope test comment)
5974 (dni (.sym prefix cc)
5975 (comment)
5976 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
5977 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int,$CCi,$cond")
5978 (+ pack (.sym ICC_ cc) CRj_int op (rs-null) CCi cond ope
5979 (misc-null-9) ICCi_3)
5980 (if (eq CCi (or cond 2))
5981 (check-semantics (test ICCi_3) CRj_int)
5982 (set CRj_int (cr-undefined)))
5983 ((fr400 (unit u-check))
5984 (fr500 (unit u-check)) (fr550 (unit u-check)))
5985 )
5986 )
5987
5988 (dni cckra
5989 "conditional check integer cc always"
5990 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
5991 "cckra$pack $CRj_int,$CCi,$cond"
5992 (+ pack ICC_ra CRj_int OP_6A (rs-null) CCi cond OPE4_0
5993 (misc-null-9) (ICCi_3-null))
5994 (if (eq CCi (or cond 2))
5995 (check-semantics (const BI 1) CRj_int)
5996 (set CRj_int (cr-undefined)))
5997 ((fr400 (unit u-check))
5998 (fr500 (unit u-check)) (fr550 (unit u-check)))
5999 )
6000
6001 (dni cckno
6002 "conditional check integer cc never"
6003 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
6004 "cckno$pack $CRj_int,$CCi,$cond"
6005 (+ pack ICC_nev CRj_int OP_6A (rs-null) CCi cond OPE4_0
6006 (misc-null-9) (ICCi_3-null))
6007 (if (eq CCi (or cond 2))
6008 (check-semantics (const BI 0) CRj_int)
6009 (set CRj_int (cr-undefined)))
6010 ((fr400 (unit u-check))
6011 (fr500 (unit u-check)) (fr550 (unit u-check)))
6012 )
6013
6014 (conditional-check-int-condition-code cck eq OP_6A OPE4_0 Ieq "check integer cc equal")
6015 (conditional-check-int-condition-code cck ne OP_6A OPE4_0 Ine "check integer cc not equal")
6016 (conditional-check-int-condition-code cck le OP_6A OPE4_0 Ile "check integer cc less or equal")
6017 (conditional-check-int-condition-code cck gt OP_6A OPE4_0 Igt "check integer cc greater")
6018 (conditional-check-int-condition-code cck lt OP_6A OPE4_0 Ilt "check integer cc less")
6019 (conditional-check-int-condition-code cck ge OP_6A OPE4_0 Ige "check integer cc greater or equal")
6020 (conditional-check-int-condition-code cck ls OP_6A OPE4_0 Ils "check integer cc less or equal unsigned")
6021 (conditional-check-int-condition-code cck hi OP_6A OPE4_0 Ihi "check integer cc greater unsigned")
6022 (conditional-check-int-condition-code cck c OP_6A OPE4_0 Ic "check integer cc carry set")
6023 (conditional-check-int-condition-code cck nc OP_6A OPE4_0 Inc "check integer cc carry clear")
6024 (conditional-check-int-condition-code cck n OP_6A OPE4_0 In "check integer cc negative")
6025 (conditional-check-int-condition-code cck p OP_6A OPE4_0 Ip "check integer cc positive")
6026 (conditional-check-int-condition-code cck v OP_6A OPE4_0 Iv "check integer cc overflow set")
6027 (conditional-check-int-condition-code cck nv OP_6A OPE4_0 Inv "check integer cc overflow clear")
6028
6029 (define-pmacro (conditional-check-float-condition-code prefix cc op ope test comment)
6030 (dni (.sym prefix cc)
6031 (comment)
6032 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6033 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float,$CCi,$cond")
6034 (+ pack (.sym FCC_ cc) CRj_float op (rs-null) CCi cond ope
6035 (misc-null-9) FCCi_3)
6036 (if (eq CCi (or cond 2))
6037 (check-semantics (test FCCi_3) CRj_float)
6038 (set CRj_float (cr-undefined)))
6039 ((fr400 (unit u-check))
6040 (fr500 (unit u-check)) (fr550 (unit u-check)))
6041 )
6042 )
6043
6044 (dni cfckra
6045 "conditional check float cc always"
6046 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6047 "cfckra$pack $CRj_float,$CCi,$cond"
6048 (+ pack FCC_ra CRj_float OP_6A (rs-null) CCi cond OPE4_1
6049 (misc-null-9) (FCCi_3-null))
6050 (if (eq CCi (or cond 2))
6051 (check-semantics (const BI 1) CRj_float)
6052 (set CRj_float (cr-undefined)))
6053 ((fr400 (unit u-check))
6054 (fr500 (unit u-check)) (fr550 (unit u-check)))
6055 )
6056
6057 (dni cfckno
6058 "conditional check float cc never"
6059 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6060 "cfckno$pack $CRj_float,$CCi,$cond"
6061 (+ pack FCC_nev CRj_float OP_6A (rs-null) CCi cond OPE4_1
6062 (misc-null-9) (FCCi_3-null))
6063 (if (eq CCi (or cond 2))
6064 (check-semantics (const BI 0) CRj_float)
6065 (set CRj_float (cr-undefined)))
6066 ((fr400 (unit u-check))
6067 (fr500 (unit u-check)) (fr550 (unit u-check)))
6068 )
6069
6070 (conditional-check-float-condition-code cfck ne OP_6A OPE4_1 Fne "check float cc not equal")
6071 (conditional-check-float-condition-code cfck eq OP_6A OPE4_1 Feq "check float cc equal")
6072 (conditional-check-float-condition-code cfck lg OP_6A OPE4_1 Flg "check float cc greater or less")
6073 (conditional-check-float-condition-code cfck ue OP_6A OPE4_1 Fue "check float cc unordered or equal")
6074 (conditional-check-float-condition-code cfck ul OP_6A OPE4_1 Ful "check float cc unordered or less")
6075 (conditional-check-float-condition-code cfck ge OP_6A OPE4_1 Fge "check float cc greater or equal")
6076 (conditional-check-float-condition-code cfck lt OP_6A OPE4_1 Flt "check float cc less")
6077 (conditional-check-float-condition-code cfck uge OP_6A OPE4_1 Fuge "check float cc unordered greater or equal")
6078 (conditional-check-float-condition-code cfck ug OP_6A OPE4_1 Fug "check float cc unordered or greater")
6079 (conditional-check-float-condition-code cfck le OP_6A OPE4_1 Fle "check float cc less or equal")
6080 (conditional-check-float-condition-code cfck gt OP_6A OPE4_1 Fgt "check float cc greater")
6081 (conditional-check-float-condition-code cfck ule OP_6A OPE4_1 Fule "check float cc unordered less or equal")
6082 (conditional-check-float-condition-code cfck u OP_6A OPE4_1 Fu "check float cc unordered")
6083 (conditional-check-float-condition-code cfck o OP_6A OPE4_1 Fo "check float cc ordered")
6084
6085 (dni cjmpl
6086 "conditional jump and link"
6087 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5) CONDITIONAL)
6088 "cjmpl$pack @($GRi,$GRj),$CCi,$cond"
6089 (+ pack (misc-null-1) (LI-off) OP_6A GRi CCi cond OPE4_2 GRj)
6090 (if (eq CCi (or cond 2))
6091 (jump-and-link-semantics GRi GRj LI))
6092 ((fr400 (unit u-branch))
6093 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
6094 )
6095
6096 (dni ccalll
6097 "conditional call and link"
6098 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5) CONDITIONAL)
6099 "ccalll$pack @($GRi,$GRj),$CCi,$cond"
6100 (+ pack (misc-null-1) (LI-on) OP_6A GRi CCi cond OPE4_2 GRj)
6101 (if (eq CCi (or cond 2))
6102 (jump-and-link-semantics GRi GRj LI))
6103 ((fr400 (unit u-branch))
6104 (fr500 (unit u-branch)))
6105 )
6106
6107 (define-pmacro (cache-invalidate name cache all op ope profile comment)
6108 (dni name
6109 (comment)
6110 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6111 (.str name "$pack @($GRi,$GRj)")
6112 (+ pack (rd-null) op GRi ope GRj)
6113 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) all)
6114 profile
6115 )
6116 )
6117
6118 (cache-invalidate ici insn 0 OP_03 OPE1_38
6119 ((fr400 (unit u-ici)) (fr500 (unit u-ici)) (fr550 (unit u-ici)))
6120 "invalidate insn cache")
6121 (cache-invalidate dci data 0 OP_03 OPE1_3C
6122 ((fr400 (unit u-dci)) (fr500 (unit u-dci)) (fr550 (unit u-dci)))
6123 "invalidate data cache")
6124
6125 (define-pmacro (cache-invalidate-entry name cache op ope profile comment)
6126 (dni name
6127 (comment)
6128 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
6129 (.str name "$pack @($GRi,$GRj),$ae")
6130 (+ pack (misc-null-1) ae op GRi ope GRj)
6131 (if (eq ae 0)
6132 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) -1) ; Invalid ae setting for this insn
6133 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) ae))
6134 profile
6135 )
6136 )
6137
6138 (cache-invalidate-entry icei insn OP_03 OPE1_39
6139 ((fr400 (unit u-ici)) (fr550 (unit u-ici)))
6140 "invalidate insn cache entry")
6141 (cache-invalidate-entry dcei data OP_03 OPE1_3A
6142 ((fr400 (unit u-dci)) (fr550 (unit u-dci)))
6143 "invalidate data cache entry")
6144
6145 (dni dcf
6146 "Data cache flush"
6147 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6148 "dcf$pack @($GRi,$GRj)"
6149 (+ pack (rd-null) OP_03 GRi OPE1_3D GRj)
6150 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) 0)
6151 ((fr400 (unit u-dcf))
6152 (fr500 (unit u-dcf)) (fr550 (unit u-dcf)))
6153 )
6154
6155 (dni dcef
6156 "Data cache entry flush"
6157 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
6158 "dcef$pack @($GRi,$GRj),$ae"
6159 (+ pack (misc-null-1) ae OP_03 GRi OPE1_3B GRj)
6160 (if (eq ae 0)
6161 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) -1)
6162 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) ae))
6163 ((fr400 (unit u-dcf)) (fr550 (unit u-dcf)))
6164 )
6165
6166 (define-pmacro (write-TLB name insn op ope comment)
6167 (dni name
6168 (comment)
6169 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6170 (.str insn "$pack $GRk,@($GRi,$GRj)")
6171 (+ pack GRk op GRi ope GRj)
6172 (nop) ; for now
6173 ()
6174 )
6175 )
6176
6177 (write-TLB witlb witlb OP_03 OPE1_32 "write for insn TLB")
6178 (write-TLB wdtlb wdtlb OP_03 OPE1_36 "write for data TLB")
6179
6180 (define-pmacro (invalidate-TLB name insn op ope comment)
6181 (dni name
6182 (comment)
6183 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6184 (.str insn "$pack @($GRi,$GRj)")
6185 (+ pack (rd-null) op GRi ope GRj)
6186 (nop) ; for now
6187 ()
6188 )
6189 )
6190
6191 (invalidate-TLB itlbi itlbi OP_03 OPE1_33 "invalidate insn TLB")
6192 (invalidate-TLB dtlbi dtlbi OP_03 OPE1_37 "invalidate data TLB")
6193
6194 (define-pmacro (cache-preload name cache pipe attrs op ope profile comment)
6195 (dni name
6196 (comment)
6197 (.splice (UNIT pipe) (FR500-MAJOR C-2) (FR400-MAJOR C-2) (.unsplice attrs))
6198 (.str name "$pack $GRi,$GRj,$lock")
6199 (+ pack (misc-null-1) lock op GRi ope GRj)
6200 (c-call VOID (.str "@cpu@_" cache "_cache_preload") GRi GRj lock)
6201 profile
6202 )
6203 )
6204
6205 (cache-preload icpl insn C ((FR550-MAJOR C-2)) OP_03 OPE1_30
6206 ((fr400 (unit u-icpl)) (fr500 (unit u-icpl)) (fr550 (unit u-icpl)))
6207 "preload insn cache")
6208 (cache-preload dcpl data DCPL ((FR550-MAJOR I-8)) OP_03 OPE1_34
6209 ((fr400 (unit u-dcpl)) (fr500 (unit u-dcpl)) (fr550 (unit u-dcpl)))
6210 "preload data cache")
6211
6212 (define-pmacro (cache-unlock name cache op ope profile comment)
6213 (dni name
6214 (comment)
6215 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6216 (.str name "$pack $GRi")
6217 (+ pack (rd-null) op GRi ope (GRj-null))
6218 (c-call VOID (.str "@cpu@_" cache "_cache_unlock") GRi)
6219 profile
6220 )
6221 )
6222
6223 (cache-unlock icul insn OP_03 OPE1_31
6224 ((fr400 (unit u-icul)) (fr500 (unit u-icul)) (fr550 (unit u-icul)))
6225 "unlock insn cache")
6226 (cache-unlock dcul data OP_03 OPE1_35
6227 ((fr400 (unit u-dcul)) (fr500 (unit u-dcul)) (fr550 (unit u-dcul)))
6228 "unlock data cache")
6229
6230 (define-pmacro (barrier name insn op ope profile comment)
6231 (dni name
6232 (comment)
6233 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6234 (.str insn "$pack")
6235 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6236 (nop) ; sufficient implementation
6237 profile
6238 )
6239 )
6240
6241 (barrier bar bar OP_03 OPE1_3E
6242 ((fr400 (unit u-barrier)) (fr500 (unit u-barrier)))
6243 "barrier")
6244 (barrier membar membar OP_03 OPE1_3F
6245 ((fr400 (unit u-membar)) (fr500 (unit u-membar)))
6246 "memory barrier")
6247
6248 ; Coprocessor operations
6249 (define-pmacro (cop-op num op)
6250 (dni (.sym cop num)
6251 "Coprocessor operation"
6252 ((UNIT C) (FR500-MAJOR C-2) (MACH frv))
6253 (.str "cop" num "$pack $s6_1,$CPRi,$CPRj,$CPRk")
6254 (+ pack CPRk op CPRi s6_1 CPRj)
6255 (nop) ; sufficient implementation
6256 ()
6257 )
6258 )
6259
6260 (cop-op 1 OP_7E)
6261 (cop-op 2 OP_7F)
6262
6263 (define-pmacro (clear-ne-flag-semantics target_index is_float)
6264 (c-call VOID "@cpu@_clear_ne_flags" target_index is_float)
6265 )
6266
6267 (define-pmacro (clear-ne-flag-r name op ope reg is_float attr profile comment)
6268 (dni name
6269 (comment)
6270 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
6271 (.str name "$pack $" reg "k")
6272 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
6273 (sequence ()
6274 ; hack to get this referenced for profiling
6275 (c-raw-call VOID "frv_ref_SI" (.sym reg k))
6276 (clear-ne-flag-semantics (index-of (.sym reg k)) is_float))
6277 profile
6278 )
6279 )
6280
6281 (clear-ne-flag-r clrgr OP_0A OPE1_00 GR 0 NA
6282 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
6283 "Clear GR NE flag")
6284 (clear-ne-flag-r clrfr OP_0A OPE1_02 FR 1 FR-ACCESS
6285 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
6286 "Clear FR NE flag")
6287
6288 (define-pmacro (clear-ne-flag-all name op ope is_float attr profile comment)
6289 (dni name
6290 (comment)
6291 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
6292 (.str name "$pack")
6293 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6294 (clear-ne-flag-semantics -1 is_float)
6295 profile
6296 )
6297 )
6298
6299 (clear-ne-flag-all clrga OP_0A OPE1_01 0 NA
6300 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
6301 "Clear GR NE flag ALL")
6302 (clear-ne-flag-all clrfa OP_0A OPE1_03 1 FR-ACCESS
6303 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
6304 "Clear FR NE flag ALL")
6305
6306 (define-pmacro (commit-semantics target_index is_float)
6307 (c-call VOID "@cpu@_commit" target_index is_float)
6308 )
6309
6310 (define-pmacro (commit-r name op ope reg is_float attr comment)
6311 (dni name
6312 (comment)
6313 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
6314 (.str name "$pack $" reg "k")
6315 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
6316 (commit-semantics (index-of (.sym reg k)) is_float)
6317 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
6318 )
6319 )
6320
6321 (commit-r commitgr OP_0A OPE1_04 GR 0 NA "commit exceptions, specific GR")
6322 (commit-r commitfr OP_0A OPE1_06 FR 1 FR-ACCESS "commit exceptions, specific FR")
6323
6324 (define-pmacro (commit name op ope is_float attr comment)
6325 (dni name
6326 (comment)
6327 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
6328 (.str name "$pack")
6329 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6330 (commit-semantics -1 is_float)
6331 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
6332 )
6333 )
6334
6335 (commit commitga OP_0A OPE1_05 0 NA "commit exceptions, any GR")
6336 (commit commitfa OP_0A OPE1_07 1 FR-ACCESS "commit exceptions, any FR")
6337
6338 (define-pmacro (floating-point-conversion
6339 name op ope conv mode src targ attr comment)
6340 (dni name
6341 (comment)
6342 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6343 (.str name "$pack $" src ",$" targ)
6344 (+ pack targ op (rs-null) ope src)
6345 (set targ (conv mode src))
6346 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6347 )
6348 )
6349
6350 (floating-point-conversion fitos OP_79 OPE1_00 float SF FRintj FRk
6351 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6352 "Convert Integer to Single")
6353 (floating-point-conversion fstoi OP_79 OPE1_01 fix SI FRj FRintk
6354 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6355 "Convert Single to Integer")
6356 (floating-point-conversion fitod OP_7A OPE1_00 float DF FRintj FRdoublek
6357 ((MACH frv))
6358 "Convert Integer to Double")
6359 (floating-point-conversion fdtoi OP_7A OPE1_01 fix SI FRdoublej FRintk
6360 ((MACH frv))
6361 "Convert Double to Integer")
6362
6363 (define-pmacro (floating-point-dual-conversion
6364 name op ope conv mode src src_hw targ targ_hw attr comment)
6365 (dni name
6366 (comment)
6367 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) attr)
6368 (.str name "$pack $" src ",$" targ)
6369 (+ pack targ op (rs-null) ope src)
6370 (sequence ()
6371 (set targ (conv mode src))
6372 (set (nextreg targ_hw targ 1)
6373 (conv mode (nextreg src_hw src 1))))
6374 ((fr500 (unit u-float-dual-convert)))
6375 )
6376 )
6377
6378 (floating-point-dual-conversion fditos OP_79 OPE1_10 float SF FRintj h-fr_int FRk h-fr NA "Dual Convert Integer to Single")
6379 (floating-point-dual-conversion fdstoi OP_79 OPE1_11 fix SI FRj h-fr FRintk h-fr_int NA "Dual Convert Single to Integer")
6380
6381 (define-pmacro (ne-floating-point-dual-conversion
6382 name op ope conv mode src src_hw targ targ_hw attr comment)
6383 (dni name
6384 (comment)
6385 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) NON-EXCEPTING attr)
6386 (.str name "$pack $" src ",$" targ)
6387 (+ pack targ op (rs-null) ope src)
6388 (sequence ()
6389 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6390 (set targ (conv mode src))
6391 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6392 (set (nextreg targ_hw targ 1)
6393 (conv mode (nextreg src_hw src 1))))
6394 ((fr500 (unit u-float-dual-convert)))
6395 )
6396 )
6397
6398 (ne-floating-point-dual-conversion nfditos OP_79 OPE1_30 float SF FRintj h-fr_int FRk h-fr NA "Non excepting dual Convert Integer to Single")
6399 (ne-floating-point-dual-conversion nfdstoi OP_79 OPE1_31 fix SI FRj h-fr FRintk h-fr_int NA "Non excepting dual Convert Single to Integer")
6400
6401 (define-pmacro (conditional-floating-point-conversion
6402 name op ope conv mode src targ comment)
6403 (dni name
6404 (comment)
6405 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6406 (.str name "$pack $" src ",$" targ ",$CCi,$cond")
6407 (+ pack targ op (rs-null) CCi cond ope src)
6408 (if (eq CCi (or cond 2))
6409 (set targ (conv mode src)))
6410 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6411 )
6412 )
6413
6414 (conditional-floating-point-conversion cfitos OP_6B OPE4_0 float SF FRintj FRk "Conditional convert Integer to Single")
6415 (conditional-floating-point-conversion cfstoi OP_6B OPE4_1 fix SI FRj FRintk "Conditional convert Single to Integer")
6416
6417 (define-pmacro (ne-floating-point-conversion
6418 name op ope conv mode src targ comment)
6419 (dni name
6420 (comment)
6421 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6422 (.str name "$pack $" src ",$" targ)
6423 (+ pack targ op (rs-null) ope src)
6424 (sequence ()
6425 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6426 (set targ (conv mode src)))
6427 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6428 )
6429 )
6430
6431 (ne-floating-point-conversion nfitos OP_79 OPE1_20 float SF FRintj FRk "NE convert Integer to Single")
6432 (ne-floating-point-conversion nfstoi OP_79 OPE1_21 fix SI FRj FRintk "NE convert Single to Integer")
6433
6434 (register-transfer fmovs OP_79 OPE1_02
6435 FRj FRk FMALL
6436 ((FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6437 ((fr500 (unit u-fr2fr)))
6438 "Move Single Float")
6439 (register-transfer fmovd OP_7A OPE1_02
6440 ; TODO -- unit doesn't handle extra register
6441 FRdoublej FRdoublek FM01
6442 ((FR500-MAJOR F-1) (MACH frv))
6443 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
6444 "Move Double Float")
6445
6446 (dni fdmovs
6447 "Dual move single float"
6448 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6449 "fdmovs$pack $FRj,$FRk"
6450 (+ pack FRk OP_79 (rs-null) OPE1_12 FRj)
6451 (sequence ()
6452 (set FRk FRj)
6453 (set (nextreg h-fr FRk 1) (nextreg h-fr FRj 1)))
6454 ; TODO -- unit doesn't handle extra register
6455 ((fr500 (unit u-fr2fr)))
6456 )
6457
6458 (conditional-register-transfer cfmovs OP_6C OPE4_0 FRj FRk FM01
6459 ((FR500-MAJOR F-1) (FR550-MAJOR F-2)
6460 (MACH simple,tomcat,fr500,fr550,frv))
6461 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
6462 "Conditional move Single Float")
6463
6464 (define-pmacro (floating-point-neg name src targ op ope attr comment)
6465 (dni name
6466 (comment)
6467 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6468 (.str name "$pack $" src ",$" targ)
6469 (+ pack src op (rs-null) ope targ)
6470 (set targ (neg src))
6471 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6472 )
6473 )
6474
6475 (floating-point-neg fnegs FRj FRk OP_79 OPE1_03 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Floating point negate, single")
6476 (floating-point-neg fnegd FRdoublej FRdoublek OP_7A OPE1_03 ((MACH frv)) "Floating point negate, double")
6477
6478 (dni fdnegs
6479 "Floating point dual negate, single"
6480 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6481 "fdnegs$pack $FRj,$FRk"
6482 (+ pack FRk OP_79 (rs-null) OPE1_13 FRj)
6483 (sequence ()
6484 (set FRk (neg FRj))
6485 (set (nextreg h-fr FRk 1) (neg (nextreg h-fr FRj 1))))
6486 ((fr500 (unit u-float-dual-arith)))
6487 )
6488
6489 (dni cfnegs
6490 "Conditional floating point negate, single"
6491 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6492 "cfnegs$pack $FRj,$FRk,$CCi,$cond"
6493 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_1 FRk)
6494 (if (eq CCi (or cond 2))
6495 (set FRk (neg FRj)))
6496 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6497 )
6498
6499 (define-pmacro (float-abs name src targ op ope attr comment)
6500 (dni name
6501 (comment)
6502 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6503 (.str name "$pack $" src ",$" targ )
6504 (+ pack targ op (rs-null) ope src)
6505 (set targ (abs src))
6506 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6507 )
6508 )
6509
6510 (float-abs fabss FRj FRk OP_79 OPE1_04 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Float absolute value, single")
6511 (float-abs fabsd FRdoublej FRdoublek OP_7A OPE1_04 ((MACH frv)) "Float absolute value, double")
6512
6513 (dni fdabss
6514 "Floating point dual absolute value, single"
6515 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6516 "fdabss$pack $FRj,$FRk"
6517 (+ pack FRk OP_79 (rs-null) OPE1_14 FRj)
6518 (sequence ()
6519 (set FRk (abs FRj))
6520 (set (nextreg h-fr FRk 1) (abs (nextreg h-fr FRj 1))))
6521 ((fr500 (unit u-float-dual-arith)))
6522 )
6523
6524 (dni cfabss
6525 "Conditional floating point absolute value, single"
6526 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6527 "cfabss$pack $FRj,$FRk,$CCi,$cond"
6528 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_2 FRk)
6529 (if (eq CCi (or cond 2))
6530 (set FRk (abs FRj)))
6531 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6532 )
6533
6534 (dni fsqrts
6535 "Square root single"
6536 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6537 "fsqrts$pack $FRj,$FRk"
6538 (+ pack FRk OP_79 (rs-null) OPE1_05 FRj)
6539 (set FRk (sqrt SF FRj))
6540 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6541 )
6542
6543 (dni fdsqrts
6544 "Dual square root single"
6545 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4))
6546 "fdsqrts$pack $FRj,$FRk"
6547 (+ pack FRk OP_79 (rs-null) OPE1_15 FRj)
6548 (sequence ()
6549 (set FRk (sqrt SF FRj))
6550 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6551 ((fr500 (unit u-float-dual-sqrt)))
6552 )
6553
6554 (dni nfdsqrts
6555 "Non excepting Dual square root single"
6556 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4) NON-EXCEPTING)
6557 "nfdsqrts$pack $FRj,$FRk"
6558 (+ pack FRk OP_79 (rs-null) OPE1_35 FRj)
6559 (sequence ()
6560 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6561 (set FRk (sqrt SF FRj))
6562 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6563 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6564 ((fr500 (unit u-float-dual-sqrt)))
6565 )
6566
6567 (dni fsqrtd
6568 "Square root double"
6569 ((UNIT FM01) (FR500-MAJOR F-4) (MACH frv))
6570 "fsqrtd$pack $FRdoublej,$FRdoublek"
6571 (+ pack FRdoublek OP_7A (rs-null) OPE1_05 FRdoublej)
6572 (set FRdoublek (sqrt DF FRdoublej))
6573 ((fr500 (unit u-float-sqrt)))
6574 )
6575
6576 (dni cfsqrts
6577 "Conditional square root single"
6578 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6579 "cfsqrts$pack $FRj,$FRk,$CCi,$cond"
6580 (+ pack FRk OP_6E (rs-null) CCi cond OPE4_2 FRj)
6581 (if (eq CCi (or cond 2))
6582 (set FRk (sqrt SF FRj)))
6583 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6584 )
6585
6586 (dni nfsqrts
6587 "Non exception square root, single"
6588 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6589 "nfsqrts$pack $FRj,$FRk"
6590 (+ pack FRk OP_79 (rs-null) OPE1_25 FRj)
6591 (sequence ()
6592 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6593 (set FRk (sqrt SF FRj)))
6594 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6595 )
6596
6597 (define-pmacro (float-binary-op-s name pipe attr operation op ope comment)
6598 (dni name
6599 (comment)
6600 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) (.unsplice attr))
6601 (.str name "$pack $FRi,$FRj,$FRk")
6602 (+ pack FRk op FRi ope FRj)
6603 (set FRk (operation FRi FRj))
6604 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6605 )
6606 )
6607
6608 (float-binary-op-s fadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_06 "add single float")
6609 (float-binary-op-s fsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_07 "sub single float")
6610 (float-binary-op-s fmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_08 "mul single float")
6611
6612 (dni fdivs
6613 "div single float"
6614 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6615 "fdivs$pack $FRi,$FRj,$FRk"
6616 (+ pack FRk OP_79 FRi OPE1_09 FRj)
6617 (set FRk (div FRi FRj))
6618 ((fr500 (unit u-float-div))
6619 (fr550 (unit u-float-div)))
6620 )
6621
6622 (define-pmacro (float-binary-op-d name operation op ope major comment)
6623 (dni name
6624 (comment)
6625 ((UNIT FMALL) (FR500-MAJOR major) (MACH frv))
6626 (.str name "$pack $FRdoublei,$FRdoublej,$FRdoublek")
6627 (+ pack FRdoublek op FRdoublei ope FRdoublej)
6628 (set FRdoublek (operation FRdoublei FRdoublej))
6629 ((fr500 (unit u-float-arith)))
6630 )
6631 )
6632
6633 (float-binary-op-d faddd add OP_7A OPE1_06 F-2 "add double float")
6634 (float-binary-op-d fsubd sub OP_7A OPE1_07 F-2 "sub double float")
6635 (float-binary-op-d fmuld mul OP_7A OPE1_08 F-3 "mul double float")
6636 (float-binary-op-d fdivd div OP_7A OPE1_09 F-4 "div double float")
6637
6638 (define-pmacro (conditional-float-binary-op name pipe attr operation op ope profile comment)
6639 (dni name
6640 (comment)
6641 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
6642 (.unsplice attr))
6643 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6644 (+ pack FRk op FRi CCi cond ope FRj)
6645 (if (eq CCi (or cond 2))
6646 (set FRk (operation FRi FRj)))
6647 profile
6648 )
6649 )
6650
6651 (conditional-float-binary-op cfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_6D OPE4_0
6652 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6653 "cond add single")
6654 (conditional-float-binary-op cfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_6D OPE4_1
6655 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6656 "cond sub single")
6657 (conditional-float-binary-op cfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_6E OPE4_0
6658 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6659 "cond mul single")
6660 (conditional-float-binary-op cfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_6E OPE4_1
6661 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
6662 "cond div single")
6663
6664 (define-pmacro (ne-float-binary-op name pipe attr operation op ope profile comment)
6665 (dni name
6666 (comment)
6667 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
6668 (.unsplice attr))
6669 (.str name "$pack $FRi,$FRj,$FRk")
6670 (+ pack FRk op FRi ope FRj)
6671 (sequence ()
6672 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6673 (set FRk (operation FRi FRj)))
6674 profile
6675 )
6676 )
6677
6678 (ne-float-binary-op nfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_26
6679 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6680 "ne add single")
6681 (ne-float-binary-op nfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_27
6682 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6683 "ne sub single")
6684 (ne-float-binary-op nfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_28
6685 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6686 "ne mul single")
6687 (ne-float-binary-op nfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_79 OPE1_29
6688 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
6689 "ne div single")
6690
6691 (define-pmacro (fcc-eq) 8)
6692 (define-pmacro (fcc-lt) 4)
6693 (define-pmacro (fcc-gt) 2)
6694 (define-pmacro (fcc-uo) 1)
6695
6696 (define-pmacro (compare-and-set-fcc arg1 arg2 fcc)
6697 (if (gt arg1 arg2)
6698 (set fcc (fcc-gt))
6699 (if (eq arg1 arg2)
6700 (set fcc (fcc-eq))
6701 (if (lt arg1 arg2)
6702 (set fcc (fcc-lt))
6703 (set fcc (fcc-uo)))))
6704 )
6705
6706 (dni fcmps
6707 "compare single float"
6708 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6709 "fcmps$pack $FRi,$FRj,$FCCi_2"
6710 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_0A FRj)
6711 (compare-and-set-fcc FRi FRj FCCi_2)
6712 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
6713 )
6714
6715 (dni fcmpd
6716 "compare double float"
6717 ((UNIT FMALL) (FR500-MAJOR F-2) (MACH frv))
6718 "fcmpd$pack $FRdoublei,$FRdoublej,$FCCi_2"
6719 (+ pack (cond-null) FCCi_2 OP_7A FRdoublei OPE1_0A FRdoublej)
6720 (compare-and-set-fcc FRdoublei FRdoublej FCCi_2)
6721 ((fr500 (unit u-float-compare)))
6722 )
6723
6724 (dni cfcmps
6725 "Conditional compare single, float"
6726 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6727 "cfcmps$pack $FRi,$FRj,$FCCi_2,$CCi,$cond"
6728 (+ pack (cond-null) FCCi_2 OP_6D FRi CCi cond OPE4_2 FRj)
6729 (if (eq CCi (or cond 2))
6730 (compare-and-set-fcc FRi FRj FCCi_2))
6731 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
6732 )
6733
6734 (dni fdcmps
6735 "float dual compare single"
6736 ((UNIT FMALL) (FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6737 "fdcmps$pack $FRi,$FRj,$FCCi_2"
6738 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_1A FRj)
6739 (sequence ()
6740 (compare-and-set-fcc FRi FRj FCCi_2)
6741 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
6742 (nextreg h-fccr FCCi_2 1)))
6743 ((fr500 (unit u-float-dual-compare)) (fr550 (unit u-float-dual-compare)))
6744 )
6745
6746 (define-pmacro (float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6747 (dni name
6748 (comment)
6749 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6750 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6751 (+ pack targ op arg1 ope arg2)
6752 (set targ (add_sub (mul arg1 arg2) targ))
6753 ((fr500 (unit u-float-dual-arith)))
6754 )
6755 )
6756
6757 (float-mul-with-add fmadds add FRi FRj FRk OP_79 OPE1_0B "mul with add, single")
6758 (float-mul-with-add fmsubs sub FRi FRj FRk OP_79 OPE1_0C "mul with sub, single")
6759
6760 (float-mul-with-add fmaddd add FRdoublei FRdoublej FRdoublek OP_7A OPE1_0B "mul with add, double")
6761 (float-mul-with-add fmsubd sub FRdoublei FRdoublej FRdoublek OP_7A OPE1_0C "mul with sub, double")
6762
6763 (dni fdmadds
6764 "Float dual multiply with add"
6765 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6766 "fdmadds$pack $FRi,$FRj,$FRk"
6767 (+ pack FRk OP_79 FRi OPE1_1B FRj)
6768 (sequence ()
6769 (set FRk (add (mul FRi FRj) FRk))
6770 (set (nextreg h-fr FRk 1)
6771 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6772 (nextreg h-fr FRk 1))))
6773 ; TODO dual registers not referenced for profiling
6774 ((fr500 (unit u-float-dual-arith)))
6775 )
6776
6777 (dni nfdmadds
6778 "Non excepting float dual multiply with add"
6779 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6780 "nfdmadds$pack $FRi,$FRj,$FRk"
6781 (+ pack FRk OP_79 FRi OPE1_3B FRj)
6782 (sequence ()
6783 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6784 (set FRk (add (mul FRi FRj) FRk))
6785 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6786 (set (nextreg h-fr FRk 1)
6787 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6788 (nextreg h-fr FRk 1))))
6789 ; TODO dual registers not referenced for profiling
6790 ((fr500 (unit u-float-dual-arith)))
6791 )
6792
6793 (define-pmacro (conditional-float-mul-with-add
6794 name add_sub arg1 arg2 targ op ope comment)
6795 (dni name
6796 (comment)
6797 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) CONDITIONAL)
6798 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6799 (+ pack FRk op FRi CCi cond ope FRj)
6800 (if (eq CCi (or cond 2))
6801 (set targ (add_sub (mul arg1 arg2) targ)))
6802 ((fr500 (unit u-float-dual-arith)))
6803 )
6804 )
6805
6806 (conditional-float-mul-with-add cfmadds add FRi FRj FRk OP_6F OPE4_0 "conditional mul with add, single")
6807 (conditional-float-mul-with-add cfmsubs sub FRi FRj FRk OP_6F OPE4_1 "conditional mul with sub, single")
6808
6809 (define-pmacro (ne-float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6810 (dni name
6811 (comment)
6812 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) NON-EXCEPTING)
6813 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6814 (+ pack targ op arg1 ope arg2)
6815 (sequence ()
6816 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6817 (set targ (add_sub (mul arg1 arg2) targ)))
6818 ((fr500 (unit u-float-dual-arith)))
6819 )
6820 )
6821
6822 (ne-float-mul-with-add nfmadds add FRi FRj FRk OP_79 OPE1_2B "non excepting mul with add, single")
6823 (ne-float-mul-with-add nfmsubs sub FRi FRj FRk OP_79 OPE1_2C "non excepting mul with sub, single")
6824
6825 (define-pmacro (float-parallel-mul-add-semantics cond add_sub arg1 arg2 targ)
6826 (if cond
6827 (sequence ()
6828 (set targ (mul arg1 arg2))
6829 (set (nextreg h-fr targ 1)
6830 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))))
6831 )
6832
6833 (define-pmacro (float-parallel-mul-add
6834 name add_sub arg1 arg2 targ op ope comment)
6835 (dni name
6836 (comment)
6837 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6838 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6839 (+ pack targ op arg1 ope arg2)
6840 (float-parallel-mul-add-semantics 1 add_sub arg1 arg2 targ)
6841 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6842 )
6843 )
6844
6845 (float-parallel-mul-add fmas add FRi FRj FRk OP_79 OPE1_0E "parallel mul/add, single")
6846 (float-parallel-mul-add fmss sub FRi FRj FRk OP_79 OPE1_0F "parallel mul/sub, single")
6847
6848 (define-pmacro (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6849 (sequence ()
6850 (set targ (mul arg1 arg2))
6851 (set (nextreg h-fr targ 1)
6852 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6853 (set (nextreg h-fr targ 2)
6854 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6855 (set (nextreg h-fr targ 3)
6856 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6857 )
6858
6859 (define-pmacro (float-dual-parallel-mul-add
6860 name add_sub arg1 arg2 targ op ope comment)
6861 (dni name
6862 (comment)
6863 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6864 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6865 (+ pack targ op arg1 ope arg2)
6866 (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6867 ()
6868 )
6869 )
6870
6871 (float-dual-parallel-mul-add fdmas add FRi FRj FRk OP_79 OPE1_1C "dual parallel mul/add, single")
6872 (float-dual-parallel-mul-add fdmss sub FRi FRj FRk OP_79 OPE1_1D "dual parallel mul/sub, single")
6873
6874 (define-pmacro (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6875 (sequence ()
6876 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6877 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6878 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 2))
6879 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 3))
6880 (set targ (mul arg1 arg2))
6881 (set (nextreg h-fr targ 1)
6882 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6883 (set (nextreg h-fr targ 2)
6884 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6885 (set (nextreg h-fr targ 3)
6886 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6887 )
6888
6889 (define-pmacro (ne-float-dual-parallel-mul-add
6890 name add_sub arg1 arg2 targ op ope comment)
6891 (dni name
6892 (comment)
6893 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6894 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6895 (+ pack targ op arg1 ope arg2)
6896 (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6897 ()
6898 )
6899 )
6900
6901 (ne-float-dual-parallel-mul-add nfdmas add FRi FRj FRk OP_79 OPE1_3C "non excepting dual parallel mul/add, single")
6902 (ne-float-dual-parallel-mul-add nfdmss sub FRi FRj FRk OP_79 OPE1_3D "non excepting dual parallel mul/sub, single")
6903
6904 (define-pmacro (conditional-float-parallel-mul-add name add_sub op ope comment)
6905 (dni name
6906 (comment)
6907 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) CONDITIONAL (MACH simple,tomcat,fr500,fr550,frv))
6908 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6909 (+ pack FRk op FRi CCi cond ope FRj)
6910 (float-parallel-mul-add-semantics (eq CCi (or cond 2))
6911 add_sub FRi FRj FRk)
6912 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6913 )
6914 )
6915
6916 (conditional-float-parallel-mul-add cfmas add OP_6F OPE4_2 "conditional parallel mul/add, single")
6917 (conditional-float-parallel-mul-add cfmss sub OP_6F OPE4_3 "conditional parallel mul/sub, single")
6918
6919 (define-pmacro (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
6920 (sequence ()
6921 (set targ (ftrunc SF (mul DF (fext DF arg1) (fext DF arg2))))
6922 (set (nextreg h-fr targ 1)
6923 (ftrunc SF (add_sub DF
6924 (fext DF (nextreg h-fr arg1 1))
6925 (fext DF (nextreg h-fr arg2 1))))))
6926 )
6927
6928 (define-pmacro (float-parallel-mul-add-double
6929 name add_sub arg1 arg2 targ op ope comment)
6930 (dni name
6931 (comment)
6932 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6933 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6934 (+ pack targ op arg1 ope arg2)
6935 (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
6936 ()
6937 )
6938 )
6939
6940 (float-parallel-mul-add-double fmad add FRi FRj FRk OP_7A OPE1_0E "parallel mul/add, double")
6941 (float-parallel-mul-add-double fmsd sub FRi FRj FRk OP_7A OPE1_0F "parallel mul/sub, double")
6942
6943 (define-pmacro (ne-float-parallel-mul-add name add_sub op ope comment)
6944 (dni name
6945 (comment)
6946 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6947 (.str name "$pack $FRi,$FRj,$FRk")
6948 (+ pack FRk op FRi ope FRj)
6949 (sequence ()
6950 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6951 (set FRk (mul FRi FRj))
6952 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6953 (set (nextreg h-fr FRk 1)
6954 (add_sub (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
6955 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6956 )
6957 )
6958
6959 (ne-float-parallel-mul-add nfmas add OP_79 OPE1_2E "ne parallel mul/add,single")
6960 (ne-float-parallel-mul-add nfmss sub OP_79 OPE1_2F "ne parallel mul/sub,single")
6961
6962 (define-pmacro (float-dual-arith name attr oper1 oper2 op ope comment)
6963 (dni name
6964 (comment)
6965 (.splice (UNIT FM01) (.unsplice attr))
6966 (.str name "$pack $FRi,$FRj,$FRk")
6967 (+ pack FRk op FRi ope FRj)
6968 (sequence ()
6969 (set FRk (oper1 FRi FRj))
6970 (set (nextreg h-fr FRk 1)
6971 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
6972 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6973 )
6974 )
6975
6976 (float-dual-arith fdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_16 "dual add, single")
6977 (float-dual-arith fdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_17 "dual sub, single")
6978 (float-dual-arith fdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_18 "dual mul, single")
6979 (float-dual-arith fddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_19 "dual div,single")
6980 (float-dual-arith fdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_1E "dual add/sub, single")
6981
6982 (dni fdmulcs
6983 "Float dual cross multiply single"
6984 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6985 "fdmulcs$pack $FRi,$FRj,$FRk"
6986 (+ pack FRk OP_79 FRi OPE1_1F FRj)
6987 (sequence ()
6988 (set FRk (mul FRi (nextreg h-fr FRj 1)))
6989 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
6990 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6991 )
6992
6993 (dni nfdmulcs
6994 "NE float dual cross multiply single"
6995 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6996 "nfdmulcs$pack $FRi,$FRj,$FRk"
6997 (+ pack FRk OP_79 FRi OPE1_3F FRj)
6998 (sequence ()
6999 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7000 (set FRk (mul FRi (nextreg h-fr FRj 1)))
7001 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7002 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
7003 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7004 )
7005
7006 (define-pmacro (ne-float-dual-arith name attr oper1 oper2 op ope comment)
7007 (dni name
7008 (comment)
7009 (.splice (UNIT FM01) (.unsplice attr))
7010 (.str name "$pack $FRi,$FRj,$FRk")
7011 (+ pack FRk op FRi ope FRj)
7012 (sequence ()
7013 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7014 (set FRk (oper1 FRi FRj))
7015 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7016 (set (nextreg h-fr FRk 1)
7017 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
7018 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7019 )
7020 )
7021
7022 (ne-float-dual-arith nfdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_36 "ne dual add, single")
7023 (ne-float-dual-arith nfdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_37 "ne dual sub, single")
7024 (ne-float-dual-arith nfdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_38 "ne dual mul, single")
7025 (ne-float-dual-arith nfddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_39 "ne dual div,single")
7026 (ne-float-dual-arith nfdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_3E "ne dual add/sub, single")
7027
7028 (dni nfdcmps
7029 "non-excepting dual float compare"
7030 ((UNIT FM01) (FR500-MAJOR F-6) (MACH simple,tomcat,frv))
7031 "nfdcmps$pack $FRi,$FRj,$FCCi_2"
7032 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_3A FRj)
7033 (sequence ()
7034 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7035 (compare-and-set-fcc FRi FRj FCCi_2)
7036 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7037 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
7038 (nextreg h-fccr FCCi_2 1)))
7039 ((fr500 (unit u-float-dual-compare)))
7040 )
7041
7042 ; Media Instructions
7043 ;
7044 (define-pmacro (halfword hilo arg offset)
7045 (reg (.sym h-fr_ hilo) (add (index-of arg) offset)))
7046
7047 (dni mhsetlos
7048 "Media set lower signed 12 bits"
7049 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7050 "mhsetlos$pack $u12,$FRklo"
7051 (+ pack FRklo OP_78 OPE1_20 u12)
7052 (set FRklo u12)
7053 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRklo))))
7054 )
7055
7056 (dni mhsethis
7057 "Media set upper signed 12 bits"
7058 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7059 "mhsethis$pack $u12,$FRkhi"
7060 (+ pack FRkhi OP_78 OPE1_22 u12)
7061 (set FRkhi u12)
7062 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRkhi))))
7063 )
7064
7065 (dni mhdsets
7066 "Media dual set halfword signed 12 bits"
7067 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7068 "mhdsets$pack $u12,$FRintk"
7069 (+ pack FRintk OP_78 OPE1_24 u12)
7070 (sequence ()
7071 ; hack to get FRintk passed to modelling functions
7072 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7073 (set (halfword hi FRintk 0) u12)
7074 (set (halfword lo FRintk 0) u12))
7075 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
7076 )
7077
7078 (define-pmacro (set-5-semantics target value)
7079 (sequence ((HI tmp))
7080 (set tmp target)
7081 (set tmp (and tmp #x07ff))
7082 (set tmp (or tmp (sll (and s5 #x1f) 11)))
7083 (set target tmp))
7084 )
7085
7086 (define-pmacro (media-set-5 name hilo op ope comment)
7087 (dni name
7088 (comment)
7089 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7090 (.str name "$pack $s5,$FRk" hilo)
7091 (+ pack (.sym FRk hilo) op (FRi-null) ope (misc-null-11) s5)
7092 (set-5-semantics (.sym FRk hilo) s5)
7093 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk (.sym FRk hilo)))))
7094 )
7095 )
7096
7097 (media-set-5 mhsetloh lo OP_78 OPE1_21 "Media set upper 5 bits lo")
7098 (media-set-5 mhsethih hi OP_78 OPE1_23 "Media set upper 5 bits hi")
7099
7100 (dni mhdseth
7101 "Media dual set halfword upper 5 bits"
7102 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7103 "mhdseth$pack $s5,$FRintk"
7104 (+ pack FRintk OP_78 (FRi-null) OPE1_25 (misc-null-11) s5)
7105 (sequence ()
7106 ; hack to get FRintk passed to modelling functions
7107 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7108 (set-5-semantics (halfword hi FRintk 0) s5)
7109 (set-5-semantics (halfword lo FRintk 0) s5))
7110 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
7111 )
7112
7113 (define-pmacro (media-logic-r-r name operation op ope comment)
7114 (dni name
7115 (comment)
7116 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7117 (.str name "$pack $FRinti,$FRintj,$FRintk")
7118 (+ pack FRintk op FRinti ope FRintj)
7119 (set FRintk (operation FRinti FRintj))
7120 ((fr400 (unit u-media-1))
7121 (fr500 (unit u-media)) (fr550 (unit u-media)))
7122 )
7123 )
7124
7125 (media-logic-r-r mand and OP_7B OPE1_00 "and reg/reg")
7126 (media-logic-r-r mor or OP_7B OPE1_01 "or reg/reg")
7127 (media-logic-r-r mxor xor OP_7B OPE1_02 "xor reg/reg")
7128
7129 (define-pmacro (conditional-media-logic name operation op ope comment)
7130 (dni name
7131 (comment)
7132 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7133 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7134 (+ pack FRintk op FRinti CCi cond ope FRintj)
7135 (if (eq CCi (or cond 2))
7136 (set FRintk (operation FRinti FRintj)))
7137 ((fr400 (unit u-media-1))
7138 (fr500 (unit u-media)) (fr550 (unit u-media)))
7139 )
7140 )
7141
7142 (conditional-media-logic cmand and OP_70 OPE4_0 "conditional and reg/reg")
7143 (conditional-media-logic cmor or OP_70 OPE4_1 "conditional or reg/reg")
7144 (conditional-media-logic cmxor xor OP_70 OPE4_2 "conditional xor reg/reg")
7145
7146 (dni mnot
7147 ("mnot")
7148 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7149 ("mnot$pack $FRintj,$FRintk")
7150 (+ pack FRintk OP_7B (rs-null) OPE1_03 FRintj)
7151 (set FRintk (inv FRintj))
7152 ((fr400 (unit u-media-1))
7153 (fr500 (unit u-media)) (fr550 (unit u-media)))
7154 )
7155
7156 (dni cmnot
7157 ("cmnot")
7158 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7159 ("cmnot$pack $FRintj,$FRintk,$CCi,$cond")
7160 (+ pack FRintk OP_70 (rs-null) CCi cond OPE4_3 FRintj)
7161 (if (eq CCi (or cond 2))
7162 (set FRintk (inv FRintj)))
7163 ((fr400 (unit u-media-1))
7164 (fr500 (unit u-media)) (fr550 (unit u-media)))
7165 )
7166
7167 (define-pmacro (media-rotate-r-r name operation op ope comment)
7168 (dni name
7169 (comment)
7170 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7171 (.str name "$pack $FRinti,$u6,$FRintk")
7172 (+ pack FRintk op FRinti ope u6)
7173 (set FRintk (operation FRinti (and u6 #x1f)))
7174 ((fr400 (unit u-media-3))
7175 (fr500 (unit u-media)) (fr550 (unit u-media)))
7176 )
7177 )
7178
7179 (media-rotate-r-r mrotli rol OP_7B OPE1_04 "rotate left reg/reg")
7180 (media-rotate-r-r mrotri ror OP_7B OPE1_05 "rotate right reg/reg")
7181
7182 (define-pmacro (media-cut-r-r name arg op ope comment)
7183 (dni name
7184 (comment)
7185 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7186 (.str name "$pack $FRinti,$" arg ",$FRintk")
7187 (+ pack FRintk op FRinti ope arg)
7188 (set FRintk (c-call SI "@cpu@_cut" FRinti (nextreg h-fr_int FRinti 1) arg))
7189 ((fr400 (unit u-media-3))
7190 (fr500 (unit u-media)) (fr550 (unit u-media)))
7191 )
7192 )
7193
7194 (media-cut-r-r mwcut FRintj OP_7B OPE1_06 "media cut")
7195 (media-cut-r-r mwcuti u6 OP_7B OPE1_07 "media cut")
7196
7197 (define-pmacro (media-cut-acc name arg op ope comment)
7198 (dni name
7199 (comment)
7200 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7201 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7202 (+ pack FRintk op ACC40Si ope arg)
7203 (set FRintk (c-call SI "@cpu@_media_cut" ACC40Si arg))
7204 ((fr400 (unit u-media-4))
7205 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
7206 )
7207 )
7208
7209 (media-cut-acc mcut FRintj OP_7B OPE1_2C "media accumulator cut reg")
7210 (media-cut-acc mcuti s6 OP_7B OPE1_2E "media accumulator cut immed")
7211
7212 (define-pmacro (media-cut-acc-ss name arg op ope comment)
7213 (dni name
7214 (comment)
7215 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7216 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7217 (+ pack FRintk op ACC40Si ope arg)
7218 (set FRintk (c-call SI "@cpu@_media_cut_ss" ACC40Si arg))
7219 ((fr400 (unit u-media-4))
7220 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
7221 )
7222 )
7223
7224 (media-cut-acc-ss mcutss FRintj OP_7B OPE1_2D "media accumulator cut reg with saturation")
7225 (media-cut-acc-ss mcutssi s6 OP_7B OPE1_2F "media accumulator cut immed with saturation")
7226
7227 ; Dual Media Instructions
7228 ;
7229 (define-pmacro (register-unaligned register alignment)
7230 (and (index-of register) (sub alignment 1))
7231 )
7232
7233 (dni mdcutssi
7234 "Media dual cut with signed saturation"
7235 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7236 "mdcutssi$pack $ACC40Si,$s6,$FRintkeven"
7237 (+ pack FRintkeven OP_78 ACC40Si OPE1_0E s6)
7238 (if (register-unaligned ACC40Si 2)
7239 (c-call VOID "@cpu@_media_acc_not_aligned")
7240 (if (register-unaligned FRintkeven 2)
7241 (c-call VOID "@cpu@_media_register_not_aligned")
7242 (sequence ()
7243 (set FRintkeven (c-call SI "@cpu@_media_cut_ss" ACC40Si s6))
7244 (set (nextreg h-fr_int FRintkeven 1)
7245 (c-call SI "@cpu@_media_cut_ss"
7246 (nextreg h-acc40S ACC40Si 1) s6)))))
7247 ((fr400 (unit u-media-4-acc-dual
7248 (out FRintk FRintkeven))) (fr550 (unit u-media-3-acc-dual)))
7249 )
7250
7251 ; The (add (xxxx) (mul arg 0)) is a hack to get a reference to arg generated
7252 ; so it will be passed to the unit modelers. YUCK!!!!!
7253 (define-pmacro (extract-hilo reg1 off1 reg2 off2 arg1hi arg1lo arg2hi arg2lo)
7254 (sequence ()
7255 (set arg1hi (add (halfword hi reg1 off1) (mul reg1 0)))
7256 (set arg1lo (add (halfword lo reg1 off1) (mul reg1 0)))
7257 (set arg2hi (add (halfword hi reg2 off2) (mul reg2 0)))
7258 (set arg2lo (add (halfword lo reg2 off2) (mul reg2 0))))
7259 )
7260
7261 (dni maveh
7262 "Media dual average"
7263 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7264 "maveh$pack $FRinti,$FRintj,$FRintk"
7265 (+ pack FRintk OP_7B FRinti OPE1_08 FRintj)
7266 (set FRintk (c-call SI "@cpu@_media_average" FRinti FRintj))
7267 ((fr400 (unit u-media-1))
7268 (fr500 (unit u-media)) (fr550 (unit u-media)))
7269 )
7270
7271 (define-pmacro (media-dual-shift name operation op ope profile comment)
7272 (dni name
7273 (comment)
7274 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7275 (.str name "$pack $FRinti,$u6,$FRintk")
7276 (+ pack FRintk op FRinti ope u6)
7277 (sequence ()
7278 ; hack to get these referenced for profiling
7279 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7280 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7281 (set (halfword hi FRintk 0)
7282 (operation (halfword hi FRinti 0) (and u6 #xf)))
7283 (set (halfword lo FRintk 0)
7284 (operation (halfword lo FRinti 0) (and u6 #xf))))
7285 profile
7286 )
7287 )
7288
7289 (media-dual-shift msllhi sll OP_7B OPE1_09
7290 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7291 "Media dual shift left logical")
7292 (media-dual-shift msrlhi srl OP_7B OPE1_0A
7293 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7294 "Media dual shift right logical")
7295 (media-dual-shift msrahi sra OP_7B OPE1_0B
7296 ((fr400 (unit u-media-6)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7297 "Media dual shift right arithmetic")
7298
7299 (define-pmacro (media-dual-word-rotate-r-r name operation op ope comment)
7300 (dni name
7301 (comment)
7302 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7303 (.str name "$pack $FRintieven,$s6,$FRintkeven")
7304 (+ pack FRintkeven op FRintieven ope s6)
7305 (if (orif (register-unaligned FRintieven 2)
7306 (register-unaligned FRintkeven 2))
7307 (c-call VOID "@cpu@_media_register_not_aligned")
7308 (sequence ()
7309 (set FRintkeven (operation FRintieven (and s6 #x1f)))
7310 (set (nextreg h-fr_int FRintkeven 1)
7311 (operation (nextreg h-fr_int FRintieven 1)
7312 (and s6 #x1f)))))
7313 ((fr400 (unit u-media-3-quad
7314 (in FRinti FRintieven)
7315 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7316 )
7317 )
7318
7319 (media-dual-word-rotate-r-r mdrotli rol OP_78 OPE1_0B "rotate left reg/reg")
7320
7321 (dni mcplhi
7322 "Media bit concatenate, halfword"
7323 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7324 "mcplhi$pack $FRinti,$u6,$FRintk"
7325 (+ pack FRintk OP_78 FRinti OPE1_0C u6)
7326 (sequence ((HI arg1) (HI arg2) (HI shift))
7327 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7328 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7329 (set shift (and u6 #xf))
7330 (set arg1 (sll (halfword hi FRinti 0) shift))
7331 (if (ne shift 0)
7332 (sequence ()
7333 (set arg2 (halfword hi FRinti 1))
7334 (set arg2 (srl HI (sll HI arg2 (sub 15 shift))
7335 (sub 15 shift)))
7336 (set arg1 (or HI arg1 arg2))))
7337 (set (halfword hi FRintk 0) arg1))
7338 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
7339 )
7340
7341 (dni mcpli
7342 "Media bit concatenate, word"
7343 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7344 "mcpli$pack $FRinti,$u6,$FRintk"
7345 (+ pack FRintk OP_78 FRinti OPE1_0D u6)
7346 (sequence ((SI tmp) (SI shift))
7347 (set shift (and u6 #x1f))
7348 (set tmp (sll FRinti shift))
7349 (if (ne shift 0)
7350 (sequence ((SI tmp1))
7351 (set tmp1 (srl (sll (nextreg h-fr_int FRinti 1)
7352 (sub 31 shift))
7353 (sub 31 shift)))
7354 (set tmp (or tmp tmp1))))
7355 (set FRintk tmp))
7356 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
7357 )
7358
7359 (define-pmacro (saturate arg max min result)
7360 (if (gt arg max)
7361 (set result max)
7362 (if (lt arg min)
7363 (set result min)
7364 (set result arg)))
7365 )
7366
7367 (dni msaths
7368 "Media dual saturation signed"
7369 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7370 "msaths$pack $FRinti,$FRintj,$FRintk"
7371 (+ pack FRintk OP_7B FRinti OPE1_0C FRintj)
7372 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
7373 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7374 (saturate argihi argjhi (inv argjhi) (halfword hi FRintk 0))
7375 (saturate argilo argjlo (inv argjlo) (halfword lo FRintk 0)))
7376 ((fr400 (unit u-media-1))
7377 (fr500 (unit u-media)) (fr550 (unit u-media)))
7378 )
7379
7380 (dni mqsaths
7381 "Media quad saturation signed"
7382 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7383 "mqsaths$pack $FRintieven,$FRintjeven,$FRintkeven"
7384 (+ pack FRintkeven OP_78 FRintieven OPE1_0F FRintjeven)
7385 (if (orif (register-unaligned FRintieven 2)
7386 (orif (register-unaligned FRintjeven 2)
7387 (register-unaligned FRintkeven 2)))
7388 (c-call VOID "@cpu@_media_register_not_aligned")
7389 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
7390 ; hack to get FRintkeven referenced as a target for profiling
7391 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7392 (extract-hilo FRintieven 0 FRintjeven 0 argihi argilo argjhi argjlo)
7393 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 0))
7394 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 0))
7395 (extract-hilo FRintieven 1 FRintjeven 1 argihi argilo argjhi argjlo)
7396 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 1))
7397 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 1))))
7398 ((fr400 (unit u-media-1-quad
7399 (in FRinti FRintieven)
7400 (in FRintj FRintjeven)
7401 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7402 )
7403
7404 (define-pmacro (saturate-unsigned arg max result)
7405 (if (gt arg max)
7406 (set result max)
7407 (set result arg))
7408 )
7409
7410 (dni msathu
7411 "Media dual saturation unsigned"
7412 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7413 "msathu$pack $FRinti,$FRintj,$FRintk"
7414 (+ pack FRintk OP_7B FRinti OPE1_0D FRintj)
7415 (sequence ((UHI argihi) (UHI argilo) (UHI argjhi) (UHI argjlo))
7416 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7417 (saturate-unsigned argihi argjhi (halfword hi FRintk 0))
7418 (saturate-unsigned argilo argjlo (halfword lo FRintk 0)))
7419 ((fr400 (unit u-media-1))
7420 (fr500 (unit u-media)) (fr550 (unit u-media)))
7421 )
7422
7423 (define-pmacro (media-dual-compare name mode op ope comment)
7424 (dni name
7425 (comment)
7426 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7427 (.str name "$pack $FRinti,$FRintj,$FCCk")
7428 (+ pack (cond-null) FCCk op FRinti ope FRintj)
7429 (if (register-unaligned FCCk 2)
7430 (c-call VOID "@cpu@_media_cr_not_aligned")
7431 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7432 (extract-hilo FRinti 0 FRintj 0
7433 argihi argilo argjhi argjlo)
7434 (compare-and-set-fcc argihi argjhi FCCk)
7435 (compare-and-set-fcc argilo argjlo (nextreg h-fccr FCCk 1))))
7436 ; TODO - doesn't handle second FCC
7437 ((fr400 (unit u-media-7))
7438 (fr500 (unit u-media)) (fr550 (unit u-media)))
7439 )
7440 )
7441
7442 (media-dual-compare mcmpsh HI OP_7B OPE1_0E "Media dual compare signed")
7443 (media-dual-compare mcmpuh UHI OP_7B OPE1_0F "Media dual compare unsigned")
7444
7445 ; Bits for the MSR.SIE field
7446 (define-pmacro (msr-sie-nil) 0)
7447 (define-pmacro (msr-sie-fri-hi) 8)
7448 (define-pmacro (msr-sie-fri-lo) 4)
7449 (define-pmacro (msr-sie-fri-1-hi) 2)
7450 (define-pmacro (msr-sie-fri-1-lo) 1)
7451 (define-pmacro (msr-sie-acci) 8)
7452 (define-pmacro (msr-sie-acci-1) 4)
7453 (define-pmacro (msr-sie-acci-2) 2)
7454 (define-pmacro (msr-sie-acci-3) 1)
7455
7456 (define-pmacro (saturate-v arg max min sie result)
7457 (if (gt DI arg max)
7458 (sequence ()
7459 (set result max)
7460 (c-call VOID "@cpu@_media_overflow" sie))
7461 (if (lt DI arg min)
7462 (sequence ()
7463 (set result min)
7464 (c-call VOID "@cpu@_media_overflow" sie))
7465 (set result arg)))
7466 )
7467
7468 (dni mabshs
7469 "Media dual absolute value, halfword"
7470 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7471 "mabshs$pack $FRintj,$FRintk"
7472 (+ pack FRintk OP_78 (FRi-null) OPE1_0A FRintj)
7473 (sequence ((HI arghi) (HI arglo))
7474 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
7475 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7476 (set arghi (halfword hi FRintj 0))
7477 (set arglo (halfword lo FRintj 0))
7478 (saturate-v (abs arghi) 32767 -32768 (msr-sie-fri-hi)
7479 (halfword hi FRintk 0))
7480 (saturate-v (abs arglo) 32767 -32768 (msr-sie-fri-lo)
7481 (halfword lo FRintk 0)))
7482 ((fr400 (unit u-media-1)) (fr550 (unit u-media)))
7483 )
7484
7485 (define-pmacro (media-arith-sat-semantics
7486 operation arg1 arg2 res mode max min sie)
7487 (sequence ((DI tmp))
7488 (set tmp (operation arg1 arg2))
7489 (saturate-v tmp max min sie res))
7490 )
7491
7492 (define-pmacro (media-dual-arith-sat-semantics operation mode max min)
7493 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7494 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7495 (media-arith-sat-semantics operation argihi argjhi
7496 (halfword hi FRintk 0) mode max min
7497 (msr-sie-fri-hi))
7498 (media-arith-sat-semantics operation argilo argjlo
7499 (halfword lo FRintk 0) mode max min
7500 (msr-sie-fri-lo)))
7501 )
7502
7503 (define-pmacro (media-dual-arith-sat name operation mode max min op ope comment)
7504 (dni name
7505 (comment)
7506 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7507 (.str name "$pack $FRinti,$FRintj,$FRintk")
7508 (+ pack FRintk op FRinti ope FRintj)
7509 (media-dual-arith-sat-semantics operation mode max min)
7510 ((fr400 (unit u-media-1))
7511 (fr500 (unit u-media)) (fr550 (unit u-media)))
7512 )
7513 )
7514
7515 (media-dual-arith-sat maddhss add HI 32767 -32768 OP_7B OPE1_10 "Media dual add signed with saturation")
7516 (media-dual-arith-sat maddhus add UHI 65535 0 OP_7B OPE1_11 "Media dual add unsigned with saturation")
7517
7518 (media-dual-arith-sat msubhss sub HI 32767 -32768 OP_7B OPE1_12 "Media dual sub signed with saturation")
7519 (media-dual-arith-sat msubhus sub UHI 65535 0 OP_7B OPE1_13 "Media dual sub unsigned with saturation")
7520
7521 (define-pmacro (conditional-media-dual-arith-sat
7522 name operation mode max min op ope comment)
7523 (dni name
7524 (comment)
7525 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7526 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7527 (+ pack FRintk op FRinti CCi cond ope FRintj)
7528 (if (eq CCi (or cond 2))
7529 (media-dual-arith-sat-semantics operation mode max min))
7530 ((fr400 (unit u-media-1))
7531 (fr500 (unit u-media)) (fr550 (unit u-media)))
7532 )
7533 )
7534
7535 (conditional-media-dual-arith-sat cmaddhss add HI 32767 -32768 OP_71 OPE4_0 "Conditional Media dual add signed with saturation")
7536 (conditional-media-dual-arith-sat cmaddhus add UHI 65535 0 OP_71 OPE4_1 "Conditional Media dual add unsigned with saturation")
7537
7538 (conditional-media-dual-arith-sat cmsubhss sub HI 32767 -32768 OP_71 OPE4_2 "Conditional Media dual sub signed with saturation")
7539 (conditional-media-dual-arith-sat cmsubhus sub UHI 65535 0 OP_71 OPE4_3 "Conditional Media dual sub unsigned with saturation")
7540
7541 (define-pmacro (media-quad-arith-sat-semantics cond operation mode max min)
7542 (if (orif (register-unaligned FRintieven 2)
7543 (orif (register-unaligned FRintjeven 2)
7544 (register-unaligned FRintkeven 2)))
7545 (c-call VOID "@cpu@_media_register_not_aligned")
7546 (if cond
7547 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7548 ; hack to get FRintkeven referenced as a target for profiling
7549 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7550 (extract-hilo FRintieven 0 FRintjeven 0
7551 argihi argilo argjhi argjlo)
7552 (media-arith-sat-semantics operation argihi argjhi
7553 (halfword hi FRintkeven 0) mode
7554 max min (msr-sie-fri-hi))
7555 (media-arith-sat-semantics operation argilo argjlo
7556 (halfword lo FRintkeven 0) mode
7557 max min (msr-sie-fri-lo))
7558 (extract-hilo FRintieven 1 FRintjeven 1
7559 argihi argilo argjhi argjlo)
7560 (media-arith-sat-semantics operation argihi argjhi
7561 (halfword hi FRintkeven 1) mode
7562 max min (msr-sie-fri-1-hi))
7563 (media-arith-sat-semantics operation argilo argjlo
7564 (halfword lo FRintkeven 1) mode
7565 max min (msr-sie-fri-1-lo)))))
7566 )
7567
7568 (define-pmacro (media-quad-arith-sat name operation mode max min op ope comment)
7569 (dni name
7570 (comment)
7571 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2))
7572 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven")
7573 (+ pack FRintkeven op FRintieven ope FRintjeven)
7574 (media-quad-arith-sat-semantics 1 operation mode max min)
7575 ((fr400 (unit u-media-1-quad
7576 (in FRinti FRintieven)
7577 (in FRintj FRintjeven)
7578 (out FRintk FRintkeven)))
7579 (fr500 (unit u-media-quad-arith
7580 (in FRinti FRintieven)
7581 (in FRintj FRintjeven)
7582 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7583 )
7584 )
7585
7586 (media-quad-arith-sat mqaddhss add HI 32767 -32768 OP_7B OPE1_18 "Media quad add signed with saturation")
7587 (media-quad-arith-sat mqaddhus add UHI 65535 0 OP_7B OPE1_19 "Media quad add unsigned with saturation")
7588
7589 (media-quad-arith-sat mqsubhss sub HI 32767 -32768 OP_7B OPE1_1A "Media quad sub signed with saturation")
7590 (media-quad-arith-sat mqsubhus sub UHI 65535 0 OP_7B OPE1_1B "Media quad sub unsigned with saturation")
7591
7592 (define-pmacro (conditional-media-quad-arith-sat
7593 name operation mode max min op ope comment)
7594 (dni name
7595 (comment)
7596 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2) CONDITIONAL)
7597 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven,$CCi,$cond")
7598 (+ pack FRintkeven op FRintieven CCi cond ope FRintjeven)
7599 (media-quad-arith-sat-semantics (eq CCi (or cond 2))
7600 operation mode max min)
7601 ((fr400 (unit u-media-1-quad
7602 (in FRinti FRintieven)
7603 (in FRintj FRintjeven)
7604 (out FRintk FRintkeven)))
7605 (fr500 (unit u-media-quad-arith
7606 (in FRinti FRintieven)
7607 (in FRintj FRintjeven)
7608 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7609 )
7610 )
7611
7612 (conditional-media-quad-arith-sat cmqaddhss add HI 32767 -32768 OP_73 OPE4_0 "Conditional Media quad add signed with saturation")
7613 (conditional-media-quad-arith-sat cmqaddhus add UHI 65535 0 OP_73 OPE4_1 "Conditional Media quad add unsigned with saturation")
7614
7615 (conditional-media-quad-arith-sat cmqsubhss sub HI 32767 -32768 OP_73 OPE4_2 "Conditional Media quad sub signed with saturation")
7616 (conditional-media-quad-arith-sat cmqsubhus sub UHI 65535 0 OP_73 OPE4_3 "Conditional Media quad sub unsigned with saturation")
7617
7618 (define-pmacro (media-acc-arith-sat name operation mode max min op ope comment)
7619 (dni name
7620 (comment)
7621 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7622 (.str name "$pack $ACC40Si,$ACC40Sk")
7623 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
7624 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7625 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7626 (if (register-unaligned ACC40Si 2)
7627 (c-call VOID "@cpu@_media_acc_not_aligned")
7628 (media-arith-sat-semantics operation ACC40Si
7629 (nextreg h-acc40S ACC40Si 1)
7630 ACC40Sk mode max min (msr-sie-acci)))))
7631 ((fr400 (unit u-media-2-acc)) (fr550 (unit u-media-4-acc)))
7632 )
7633 )
7634
7635 (media-acc-arith-sat maddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7636 OP_78 OPE1_04 "Media accumulator addition")
7637 (media-acc-arith-sat msubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7638 OP_78 OPE1_05 "Media accumulator subtraction")
7639
7640 (define-pmacro (media-dual-acc-arith-sat name operation mode max min op ope
7641 comment)
7642 (dni name
7643 (comment)
7644 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
7645 (.str name "$pack $ACC40Si,$ACC40Sk")
7646 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
7647 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7648 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7649 (if (register-unaligned ACC40Si 4)
7650 (c-call VOID "@cpu@_media_acc_not_aligned")
7651 (if (register-unaligned ACC40Sk 2)
7652 (c-call VOID "@cpu@_media_acc_not_aligned")
7653 (sequence ()
7654 (media-arith-sat-semantics operation ACC40Si
7655 (nextreg h-acc40S ACC40Si 1)
7656 ACC40Sk mode max min
7657 (msr-sie-acci))
7658 (media-arith-sat-semantics operation
7659 (nextreg h-acc40S ACC40Si 2)
7660 (nextreg h-acc40S ACC40Si 3)
7661 (nextreg h-acc40S ACC40Sk 1)
7662 mode max min
7663 (msr-sie-acci-1)))))))
7664 ((fr400 (unit u-media-2-acc-dual)) (fr550 (unit u-media-4-acc-dual)))
7665 )
7666 )
7667
7668 (media-dual-acc-arith-sat mdaddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7669 OP_78 OPE1_06 "Media accumulator addition")
7670 (media-dual-acc-arith-sat mdsubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7671 OP_78 OPE1_07 "Media accumulator subtraction")
7672
7673 (dni masaccs
7674 "Media add and subtract signed accumulator with saturation"
7675 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7676 "masaccs$pack $ACC40Si,$ACC40Sk"
7677 (+ pack ACC40Sk OP_78 ACC40Si OPE1_08 (ACCj-null))
7678 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7679 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7680 (if (register-unaligned ACC40Si 2)
7681 (c-call VOID "@cpu@_media_acc_not_aligned")
7682 (if (register-unaligned ACC40Sk 2)
7683 (c-call VOID "@cpu@_media_acc_not_aligned")
7684 (sequence ()
7685 (media-arith-sat-semantics add ACC40Si
7686 (nextreg h-acc40S ACC40Si 1)
7687 ACC40Sk DI
7688 #x7fffffffff
7689 (inv DI #x7fffffffff)
7690 (msr-sie-acci))
7691 (media-arith-sat-semantics sub ACC40Si
7692 (nextreg h-acc40S ACC40Si 1)
7693 (nextreg h-acc40S ACC40Sk 1)
7694 DI
7695 #x7fffffffff
7696 (inv DI #x7fffffffff)
7697 (msr-sie-acci-1)))))))
7698 ((fr400 (unit u-media-2-add-sub)) (fr550 (unit u-media-4-add-sub)))
7699 )
7700
7701 (dni mdasaccs
7702 "Media add and subtract signed accumulator with saturation"
7703 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
7704 "mdasaccs$pack $ACC40Si,$ACC40Sk"
7705 (+ pack ACC40Sk OP_78 ACC40Si OPE1_09 (ACCj-null))
7706 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7707 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7708 (if (register-unaligned ACC40Si 4)
7709 (c-call VOID "@cpu@_media_acc_not_aligned")
7710 (if (register-unaligned ACC40Sk 4)
7711 (c-call VOID "@cpu@_media_acc_not_aligned")
7712 (sequence ()
7713 (media-arith-sat-semantics add ACC40Si
7714 (nextreg h-acc40S ACC40Si 1)
7715 ACC40Sk DI
7716 #x7fffffffff
7717 (inv DI #x7fffffffff)
7718 (msr-sie-acci))
7719 (media-arith-sat-semantics sub ACC40Si
7720 (nextreg h-acc40S ACC40Si 1)
7721 (nextreg h-acc40S ACC40Sk 1)
7722 DI
7723 #x7fffffffff
7724 (inv DI #x7fffffffff)
7725 (msr-sie-acci-1))
7726 (media-arith-sat-semantics add
7727 (nextreg h-acc40S ACC40Si 2)
7728 (nextreg h-acc40S ACC40Si 3)
7729 (nextreg h-acc40S ACC40Sk 2)
7730 DI
7731 #x7fffffffff
7732 (inv DI #x7fffffffff)
7733 (msr-sie-acci-2))
7734 (media-arith-sat-semantics sub
7735 (nextreg h-acc40S ACC40Si 2)
7736 (nextreg h-acc40S ACC40Si 3)
7737 (nextreg h-acc40S ACC40Sk 3)
7738 DI
7739 #x7fffffffff
7740 (inv DI #x7fffffffff)
7741 (msr-sie-acci-3)))))))
7742 ((fr400 (unit u-media-2-add-sub-dual)) (fr550 (unit u-media-4-add-sub-dual)))
7743 )
7744
7745 (define-pmacro (media-multiply-semantics conv arg1 arg2 res)
7746 (set res (mul DI (conv DI arg1) (conv DI arg2)))
7747 )
7748
7749 (define-pmacro (media-dual-multiply-semantics cond mode conv rhs1 rhs2)
7750 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7751 (if (register-unaligned ACC40Sk 2)
7752 (c-call VOID "@cpu@_media_acc_not_aligned")
7753 (if cond
7754 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7755 (extract-hilo FRinti 0 FRintj 0
7756 argihi argilo argjhi argjlo)
7757 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7758 (media-multiply-semantics conv argilo rhs2
7759 (nextreg h-acc40S ACC40Sk 1))))))
7760 )
7761
7762 (define-pmacro (media-dual-multiply name mode conv rhs1 rhs2 op ope comment)
7763 (dni name
7764 (comment)
7765 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) PRESERVE-OVF)
7766 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
7767 (+ pack ACC40Sk op FRinti ope FRintj)
7768 (media-dual-multiply-semantics 1 mode conv rhs1 rhs2)
7769 ((fr400 (unit u-media-2))
7770 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7771 )
7772 )
7773
7774 (media-dual-multiply mmulhs HI ext argjhi argjlo OP_7B OPE1_14 "Media dual multiply signed")
7775 (media-dual-multiply mmulhu UHI zext argjhi argjlo OP_7B OPE1_15 "Media dual multiply unsigned")
7776
7777 (media-dual-multiply mmulxhs HI ext argjlo argjhi OP_7B OPE1_28 "Media dual cross multiply signed")
7778 (media-dual-multiply mmulxhu UHI zext argjlo argjhi OP_7B OPE1_29 "Media dual cross multiply unsigned")
7779
7780 (define-pmacro (conditional-media-dual-multiply
7781 name mode conv rhs1 rhs2 op ope comment)
7782 (dni name
7783 (comment)
7784 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)
7785 PRESERVE-OVF CONDITIONAL)
7786 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
7787 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
7788 (media-dual-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
7789 ((fr400 (unit u-media-2))
7790 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7791 )
7792 )
7793
7794 (conditional-media-dual-multiply cmmulhs HI ext argjhi argjlo OP_72 OPE4_0 "Conditional Media dual multiply signed")
7795 (conditional-media-dual-multiply cmmulhu UHI zext argjhi argjlo OP_72 OPE4_1 "Conditional Media dual multiply unsigned")
7796
7797 (define-pmacro (media-quad-multiply-semantics cond mode conv rhs1 rhs2)
7798 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7799 (if (register-unaligned ACC40Sk 4)
7800 (c-call VOID "@cpu@_media_acc_not_aligned")
7801 (if (orif (register-unaligned FRintieven 2)
7802 (register-unaligned FRintjeven 2))
7803 (c-call VOID "@cpu@_media_register_not_aligned")
7804 (if cond
7805 (sequence ((mode argihi) (mode argilo)
7806 (mode argjhi) (mode argjlo))
7807 (extract-hilo FRintieven 0 FRintjeven 0
7808 argihi argilo argjhi argjlo)
7809 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7810 (media-multiply-semantics conv argilo rhs2
7811 (nextreg h-acc40S ACC40Sk 1))
7812 (extract-hilo FRintieven 1 FRintjeven 1
7813 argihi argilo argjhi argjlo)
7814 (media-multiply-semantics conv argihi rhs1
7815 (nextreg h-acc40S ACC40Sk 2))
7816 (media-multiply-semantics conv argilo rhs2
7817 (nextreg h-acc40S ACC40Sk 3)))))))
7818 )
7819
7820 (define-pmacro (media-quad-multiply name mode conv rhs1 rhs2 op ope comment)
7821 (dni name
7822 (comment)
7823 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) PRESERVE-OVF)
7824 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
7825 (+ pack ACC40Sk op FRintieven ope FRintjeven)
7826 (media-quad-multiply-semantics 1 mode conv rhs1 rhs2)
7827 ((fr400 (unit u-media-2-quad
7828 (in FRinti FRintieven)
7829 (in FRintj FRintjeven)))
7830 (fr500 (unit u-media-quad-mul
7831 (in FRinti FRintieven)
7832 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
7833 )
7834 )
7835
7836 (media-quad-multiply mqmulhs HI ext argjhi argjlo OP_7B OPE1_1C "Media quad multiply signed")
7837 (media-quad-multiply mqmulhu UHI zext argjhi argjlo OP_7B OPE1_1D "Media quad multiply unsigned")
7838
7839 (media-quad-multiply mqmulxhs HI ext argjlo argjhi OP_7B OPE1_2A "Media quad cross multiply signed")
7840 (media-quad-multiply mqmulxhu UHI zext argjlo argjhi OP_7B OPE1_2B "Media quad cross multiply unsigned")
7841
7842 (define-pmacro (conditional-media-quad-multiply
7843 name mode conv rhs1 rhs2 op ope comment)
7844 (dni name
7845 (comment)
7846 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)
7847 PRESERVE-OVF CONDITIONAL)
7848 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk,$CCi,$cond")
7849 (+ pack ACC40Sk op FRintieven CCi cond ope FRintjeven)
7850 (media-quad-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
7851 ((fr400 (unit u-media-2-quad
7852 (in FRinti FRintieven)
7853 (in FRintj FRintjeven)))
7854 (fr500 (unit u-media-quad-mul
7855 (in FRinti FRintieven)
7856 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
7857 )
7858 )
7859
7860 (conditional-media-quad-multiply cmqmulhs HI ext argjhi argjlo OP_74 OPE4_0 "Conditional Media quad multiply signed")
7861 (conditional-media-quad-multiply cmqmulhu UHI zext argjhi argjlo OP_74 OPE4_1 "Conditional Media quad multiply unsigned")
7862
7863 (define-pmacro (media-multiply-acc-semantics
7864 conv arg1 addop arg2 res max min sie)
7865 (sequence ((DI tmp))
7866 (set tmp (addop res (mul DI (conv DI arg1) (conv DI arg2))))
7867 (saturate-v tmp max min sie res))
7868 )
7869
7870 (define-pmacro (media-dual-multiply-acc-semantics
7871 cond mode conv addop rhw res max min)
7872 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
7873 (if (register-unaligned res 2)
7874 (c-call VOID "@cpu@_media_acc_not_aligned")
7875 (if cond
7876 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7877 (extract-hilo FRinti 0 FRintj 0
7878 argihi argilo argjhi argjlo)
7879 (media-multiply-acc-semantics conv argihi addop argjhi
7880 res
7881 max min (msr-sie-acci))
7882 (media-multiply-acc-semantics conv argilo addop argjlo
7883 (nextreg rhw res 1)
7884 max min (msr-sie-acci-1))))))
7885 )
7886
7887 (define-pmacro (media-dual-multiply-acc
7888 name mode conv addop rhw res max min op ope comment)
7889 (dni name
7890 (comment)
7891 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7892 (.str name "$pack $FRinti,$FRintj,$" res)
7893 (+ pack res op FRinti ope FRintj)
7894 (media-dual-multiply-acc-semantics 1 mode conv addop rhw res max min)
7895 ((fr400 (unit u-media-2))
7896 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7897 )
7898 )
7899
7900 (media-dual-multiply-acc mmachs HI ext add h-acc40S ACC40Sk
7901 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7902 OP_7B OPE1_16
7903 "Media dual multiply and accumulate signed")
7904
7905 (media-dual-multiply-acc mmachu UHI zext add h-acc40U ACC40Uk
7906 (const DI #xffffffffff) (const DI 0)
7907 OP_7B OPE1_17
7908 "Media dual multiply and accumulate unsigned")
7909
7910 (media-dual-multiply-acc mmrdhs HI ext sub h-acc40S ACC40Sk
7911 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7912 OP_7B OPE1_30
7913 "Media dual multiply and reduce signed")
7914
7915 (media-dual-multiply-acc mmrdhu UHI zext sub h-acc40U ACC40Uk
7916 (const DI #xffffffffff) (const DI 0)
7917 OP_7B OPE1_31
7918 "Media dual multiply and reduce unsigned")
7919
7920 (define-pmacro (conditional-media-dual-multiply-acc
7921 name mode conv addop rhw res max min op ope comment)
7922 (dni name
7923 (comment)
7924 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
7925 (.str name "$pack $FRinti,$FRintj,$" res ",$CCi,$cond")
7926 (+ pack res op FRinti CCi cond ope FRintj)
7927 (media-dual-multiply-acc-semantics (eq CCi (or cond 2))
7928 mode conv addop rhw res max min)
7929 ((fr400 (unit u-media-2))
7930 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7931 )
7932 )
7933
7934 (conditional-media-dual-multiply-acc cmmachs HI ext add h-acc40S ACC40Sk
7935 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7936 OP_72 OPE4_2
7937 "Conditional Media dual multiply and accumulate signed")
7938
7939 (conditional-media-dual-multiply-acc cmmachu UHI zext add h-acc40U ACC40Uk
7940 (const DI #xffffffffff) (const DI 0)
7941 OP_72 OPE4_3
7942 "Conditional Media dual multiply and accumulate unsigned")
7943
7944 (define-pmacro (media-quad-multiply-acc-semantics
7945 cond mode conv addop rhw res max min)
7946 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
7947 (if (register-unaligned res 4)
7948 (c-call VOID "@cpu@_media_acc_not_aligned")
7949 (if (orif (register-unaligned FRintieven 2)
7950 (register-unaligned FRintjeven 2))
7951 (c-call VOID "@cpu@_media_register_not_aligned")
7952 (if cond
7953 (sequence ((mode argihi) (mode argilo)
7954 (mode argjhi) (mode argjlo))
7955 (extract-hilo FRintieven 0 FRintjeven 0
7956 argihi argilo argjhi argjlo)
7957 (media-multiply-acc-semantics conv argihi addop argjhi
7958 res
7959 max min (msr-sie-acci))
7960 (media-multiply-acc-semantics conv argilo addop argjlo
7961 (nextreg rhw res 1)
7962 max min (msr-sie-acci-1))
7963 (extract-hilo FRintieven 1 FRintjeven 1
7964 argihi argilo argjhi argjlo)
7965 (media-multiply-acc-semantics conv argihi addop argjhi
7966 (nextreg rhw res 2)
7967 max min (msr-sie-acci-2))
7968 (media-multiply-acc-semantics conv argilo addop argjlo
7969 (nextreg rhw res 3)
7970 max min
7971 (msr-sie-acci-3)))))))
7972 )
7973
7974 (define-pmacro (media-quad-multiply-acc
7975 name mode conv addop rhw res max min op ope comment)
7976 (dni name
7977 (comment)
7978 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
7979 (.str name "$pack $FRintieven,$FRintjeven,$" res)
7980 (+ pack res op FRintieven ope FRintjeven)
7981 (media-quad-multiply-acc-semantics 1 mode conv addop rhw res max min)
7982 ((fr400 (unit u-media-2-quad
7983 (in FRinti FRintieven)
7984 (in FRintj FRintjeven)))
7985 (fr500 (unit u-media-quad-mul
7986 (in FRinti FRintieven)
7987 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
7988 )
7989 )
7990
7991 (media-quad-multiply-acc mqmachs HI ext add h-acc40S ACC40Sk
7992 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7993 OP_7B OPE1_1E
7994 "Media quad multiply and accumulate signed")
7995
7996 (media-quad-multiply-acc mqmachu UHI zext add h-acc40U ACC40Uk
7997 (const DI #xffffffffff) (const DI 0)
7998 OP_7B OPE1_1F
7999 "Media quad multiply and accumulate unsigned")
8000
8001 (define-pmacro (conditional-media-quad-multiply-acc
8002 name mode conv addop rhw res max min op ope comment)
8003 (dni name
8004 (comment)
8005 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) CONDITIONAL)
8006 (.str name "$pack $FRintieven,$FRintjeven,$" res ",$CCi,$cond")
8007 (+ pack res op FRintieven CCi cond ope FRintjeven)
8008 (media-quad-multiply-acc-semantics (eq CCi (or cond 2))
8009 mode conv addop rhw res max min)
8010 ((fr400 (unit u-media-2-quad
8011 (in FRinti FRintieven)
8012 (in FRintj FRintjeven)))
8013 (fr500 (unit u-media-quad-mul
8014 (in FRinti FRintieven)
8015 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8016 )
8017 )
8018
8019 (conditional-media-quad-multiply-acc cmqmachs HI ext add h-acc40S ACC40Sk
8020 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8021 OP_74 OPE4_2
8022 "Conditional Media quad multiply and accumulate signed")
8023
8024 (conditional-media-quad-multiply-acc cmqmachu UHI zext add h-acc40U ACC40Uk
8025 (const DI #xffffffffff) (const DI 0)
8026 OP_74 OPE4_3
8027 "Conditional media quad multiply and accumulate unsigned")
8028
8029 (define-pmacro (media-quad-multiply-cross-acc-semantics
8030 cond mode conv addop rhw res max min)
8031 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8032 (if (register-unaligned res 4)
8033 (c-call VOID "@cpu@_media_acc_not_aligned")
8034 (if (orif (register-unaligned FRintieven 2)
8035 (register-unaligned FRintjeven 2))
8036 (c-call VOID "@cpu@_media_register_not_aligned")
8037 (if cond
8038 (sequence ((mode argihi) (mode argilo)
8039 (mode argjhi) (mode argjlo))
8040 (extract-hilo FRintieven 0 FRintjeven 0
8041 argihi argilo argjhi argjlo)
8042 (media-multiply-acc-semantics conv argihi addop argjhi
8043 (nextreg rhw res 2)
8044 max min (msr-sie-acci-2))
8045 (media-multiply-acc-semantics conv argilo addop argjlo
8046 (nextreg rhw res 3)
8047 max min (msr-sie-acci-3))
8048 (extract-hilo FRintieven 1 FRintjeven 1
8049 argihi argilo argjhi argjlo)
8050 (media-multiply-acc-semantics conv argihi addop argjhi
8051 res
8052 max min (msr-sie-acci))
8053 (media-multiply-acc-semantics conv argilo addop argjlo
8054 (nextreg rhw res 1)
8055 max min
8056 (msr-sie-acci-1)))))))
8057 )
8058
8059 (define-pmacro (media-quad-multiply-cross-acc
8060 name mode conv addop rhw res max min op ope comment)
8061 (dni name
8062 (comment)
8063 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8064 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8065 (+ pack res op FRintieven ope FRintjeven)
8066 (media-quad-multiply-cross-acc-semantics 1 mode conv addop rhw res
8067 max min)
8068 ((fr400 (unit u-media-2-quad
8069 (in FRinti FRintieven)
8070 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8071 )
8072 )
8073
8074 (media-quad-multiply-cross-acc mqxmachs HI ext add h-acc40S ACC40Sk
8075 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8076 OP_78 OPE1_00
8077 "Media quad multiply and cross accumulate signed")
8078
8079 (define-pmacro (media-quad-cross-multiply-cross-acc-semantics
8080 cond mode conv addop rhw res max min)
8081 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8082 (if (register-unaligned res 4)
8083 (c-call VOID "@cpu@_media_acc_not_aligned")
8084 (if (orif (register-unaligned FRintieven 2)
8085 (register-unaligned FRintjeven 2))
8086 (c-call VOID "@cpu@_media_register_not_aligned")
8087 (if cond
8088 (sequence ((mode argihi) (mode argilo)
8089 (mode argjhi) (mode argjlo))
8090 (extract-hilo FRintieven 0 FRintjeven 0
8091 argihi argilo argjhi argjlo)
8092 (media-multiply-acc-semantics conv argihi addop argjlo
8093 (nextreg rhw res 2)
8094 max min (msr-sie-acci-2))
8095 (media-multiply-acc-semantics conv argilo addop argjhi
8096 (nextreg rhw res 3)
8097 max min (msr-sie-acci-3))
8098 (extract-hilo FRintieven 1 FRintjeven 1
8099 argihi argilo argjhi argjlo)
8100 (media-multiply-acc-semantics conv argihi addop argjlo
8101 res
8102 max min (msr-sie-acci))
8103 (media-multiply-acc-semantics conv argilo addop argjhi
8104 (nextreg rhw res 1)
8105 max min
8106 (msr-sie-acci-1)))))))
8107 )
8108
8109 (define-pmacro (media-quad-cross-multiply-cross-acc
8110 name mode conv addop rhw res max min op ope comment)
8111 (dni name
8112 (comment)
8113 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8114 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8115 (+ pack res op FRintieven ope FRintjeven)
8116 (media-quad-cross-multiply-cross-acc-semantics 1 mode conv addop rhw res
8117 max min)
8118 ((fr400 (unit u-media-2-quad
8119 (in FRinti FRintieven)
8120 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8121 )
8122 )
8123
8124 (media-quad-cross-multiply-cross-acc mqxmacxhs HI ext add h-acc40S ACC40Sk
8125 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8126 OP_78 OPE1_01
8127 "Media quad cross multiply and cross accumulate signed")
8128
8129 (define-pmacro (media-quad-cross-multiply-acc-semantics
8130 cond mode conv addop rhw res max min)
8131 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8132 (if (register-unaligned res 4)
8133 (c-call VOID "@cpu@_media_acc_not_aligned")
8134 (if (orif (register-unaligned FRintieven 2)
8135 (register-unaligned FRintjeven 2))
8136 (c-call VOID "@cpu@_media_register_not_aligned")
8137 (if cond
8138 (sequence ((mode argihi) (mode argilo)
8139 (mode argjhi) (mode argjlo))
8140 (extract-hilo FRintieven 0 FRintjeven 0
8141 argihi argilo argjhi argjlo)
8142 (media-multiply-acc-semantics conv argihi addop argjlo
8143 res
8144 max min (msr-sie-acci))
8145 (media-multiply-acc-semantics conv argilo addop argjhi
8146 (nextreg rhw res 1)
8147 max min (msr-sie-acci-1))
8148 (extract-hilo FRintieven 1 FRintjeven 1
8149 argihi argilo argjhi argjlo)
8150 (media-multiply-acc-semantics conv argihi addop argjlo
8151 (nextreg rhw res 2)
8152 max min (msr-sie-acci-2))
8153 (media-multiply-acc-semantics conv argilo addop argjhi
8154 (nextreg rhw res 3)
8155 max min
8156 (msr-sie-acci-3)))))))
8157 )
8158
8159 (define-pmacro (media-quad-cross-multiply-acc
8160 name mode conv addop rhw res max min op ope comment)
8161 (dni name
8162 (comment)
8163 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8164 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8165 (+ pack res op FRintieven ope FRintjeven)
8166 (media-quad-cross-multiply-acc-semantics 1 mode conv addop rhw res
8167 max min)
8168 ((fr400 (unit u-media-2-quad
8169 (in FRinti FRintieven)
8170 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8171 )
8172 )
8173
8174 (media-quad-cross-multiply-acc mqmacxhs HI ext add h-acc40S ACC40Sk
8175 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8176 OP_78 OPE1_02
8177 "Media quad cross multiply and accumulate signed")
8178
8179 (define-pmacro (media-complex-semantics
8180 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8181 (sequence ((DI tmp1) (DI tmp2))
8182 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8183 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8184 (set tmp1 (sub tmp1 tmp2))
8185 (saturate-v tmp1 max min sie res))
8186 )
8187
8188 (define-pmacro (media-complex-semantics-i
8189 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8190 (sequence ((DI tmp1) (DI tmp2))
8191 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8192 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8193 (set tmp1 (add tmp1 tmp2))
8194 (saturate-v tmp1 max min sie res))
8195 )
8196
8197 (define-pmacro (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
8198 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8199 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8200 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8201 (media-complex-semantics conv argihi rhs1 argilo rhs2 ACC40Sk
8202 max min (msr-sie-acci))))
8203 )
8204
8205 (define-pmacro (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
8206 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8207 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8208 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8209 (media-complex-semantics-i conv argihi rhs1 argilo rhs2 ACC40Sk
8210 max min (msr-sie-acci))))
8211 )
8212
8213 (define-pmacro (media-dual-complex
8214 name mode conv rhs1 rhs2 max min op ope comment)
8215 (dni name
8216 (comment)
8217 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
8218 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8219 (+ pack ACC40Sk op FRinti ope FRintj)
8220 (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
8221 ((fr400 (unit u-media-2))
8222 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8223 )
8224 )
8225
8226 (define-pmacro (media-dual-complex-i
8227 name mode conv rhs1 rhs2 max min op ope comment)
8228 (dni name
8229 (comment)
8230 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
8231 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8232 (+ pack ACC40Sk op FRinti ope FRintj)
8233 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
8234 ((fr400 (unit u-media-2))
8235 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8236 )
8237 )
8238
8239 (media-dual-complex mcpxrs HI ext argjhi argjlo
8240 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8241 OP_7B OPE1_20
8242 "Media dual complex real signed with saturation")
8243
8244 (media-dual-complex mcpxru UHI zext argjhi argjlo
8245 (const DI #xffffffffff) (const DI 0)
8246 OP_7B OPE1_21
8247 "Media dual complex real unsigned with saturation")
8248
8249 (media-dual-complex-i mcpxis HI ext argjlo argjhi
8250 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8251 OP_7B OPE1_22
8252 "Media dual complex imaginary signed with saturation")
8253
8254 (media-dual-complex-i mcpxiu UHI zext argjlo argjhi
8255 (const DI #xffffffffff) (const DI 0)
8256 OP_7B OPE1_23
8257 "Media dual complex imaginary unsigned with saturation")
8258
8259 (define-pmacro (conditional-media-dual-complex
8260 name mode conv rhs1 rhs2 max min op ope comment)
8261 (dni name
8262 (comment)
8263 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
8264 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8265 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8266 (if (eq CCi (or cond 2))
8267 (media-dual-complex-semantics mode conv rhs1 rhs2 max min))
8268 ((fr400 (unit u-media-2))
8269 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8270 )
8271 )
8272
8273 (define-pmacro (conditional-media-dual-complex-i
8274 name mode conv rhs1 rhs2 max min op ope comment)
8275 (dni name
8276 (comment)
8277 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
8278 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8279 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8280 (if (eq CCi (or cond 2))
8281 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min))
8282 ((fr400 (unit u-media-2))
8283 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8284 )
8285 )
8286
8287 (conditional-media-dual-complex cmcpxrs HI ext argjhi argjlo
8288 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8289 OP_75 OPE4_0
8290 "Conditional Media dual complex real signed with saturation")
8291
8292 (conditional-media-dual-complex cmcpxru UHI zext argjhi argjlo
8293 (const DI #xffffffffff) (const DI 0)
8294 OP_75 OPE4_1
8295 "Conditional Media dual complex real unsigned with saturation")
8296
8297 (conditional-media-dual-complex-i cmcpxis HI ext argjlo argjhi
8298 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8299 OP_75 OPE4_2
8300 "Conditional Media dual complex imaginary signed with saturation")
8301
8302 (conditional-media-dual-complex-i cmcpxiu UHI zext argjlo argjhi
8303 (const DI #xffffffffff) (const DI 0)
8304 OP_75 OPE4_3
8305 "Conditional Media dual complex imaginary unsigned with saturation")
8306
8307 (define-pmacro (media-quad-complex
8308 name mode conv rhs1 rhs2 max min op ope comment)
8309 (dni name
8310 (comment)
8311 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8312 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8313 (+ pack ACC40Sk op FRintieven ope FRintjeven)
8314 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8315 (if (register-unaligned ACC40Sk 2)
8316 (c-call VOID "@cpu@_media_acc_not_aligned")
8317 (if (orif (register-unaligned FRintieven 2)
8318 (register-unaligned FRintjeven 2))
8319 (c-call VOID "@cpu@_media_register_not_aligned")
8320 (sequence ((mode argihi) (mode argilo)
8321 (mode argjhi) (mode argjlo))
8322 (extract-hilo FRintieven 0 FRintjeven 0
8323 argihi argilo argjhi argjlo)
8324 (media-complex-semantics conv argihi rhs1 argilo rhs2
8325 ACC40Sk
8326 max min (msr-sie-acci))
8327 (extract-hilo FRintieven 1 FRintjeven 1
8328 argihi argilo argjhi argjlo)
8329 (media-complex-semantics conv argihi rhs1 argilo rhs2
8330 (nextreg h-acc40S ACC40Sk 1)
8331 max min (msr-sie-acci-1))))))
8332 ((fr400 (unit u-media-2-quad
8333 (in FRinti FRintieven)
8334 (in FRintj FRintjeven)))
8335 (fr500 (unit u-media-quad-complex
8336 (in FRinti FRintieven)
8337 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8338 )
8339 )
8340
8341 (define-pmacro (media-quad-complex-i
8342 name mode conv rhs1 rhs2 max min op ope comment)
8343 (dni name
8344 (comment)
8345 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8346 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8347 (+ pack ACC40Sk op FRintieven ope FRintjeven)
8348 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8349 (if (register-unaligned ACC40Sk 2)
8350 (c-call VOID "@cpu@_media_acc_not_aligned")
8351 (if (orif (register-unaligned FRintieven 2)
8352 (register-unaligned FRintjeven 2))
8353 (c-call VOID "@cpu@_media_register_not_aligned")
8354 (sequence ((mode argihi) (mode argilo)
8355 (mode argjhi) (mode argjlo))
8356 (extract-hilo FRintieven 0 FRintjeven 0
8357 argihi argilo argjhi argjlo)
8358 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8359 ACC40Sk
8360 max min (msr-sie-acci))
8361 (extract-hilo FRintieven 1 FRintjeven 1
8362 argihi argilo argjhi argjlo)
8363 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8364 (nextreg h-acc40S ACC40Sk 1)
8365 max min (msr-sie-acci-1))))))
8366 ((fr400 (unit u-media-2-quad
8367 (in FRinti FRintieven)
8368 (in FRintj FRintjeven)))
8369 (fr500 (unit u-media-quad-complex
8370 (in FRinti FRintieven)
8371 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8372 )
8373 )
8374
8375 (media-quad-complex mqcpxrs HI ext argjhi argjlo
8376 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8377 OP_7B OPE1_24
8378 "Media quad complex real signed with saturation")
8379
8380 (media-quad-complex mqcpxru UHI zext argjhi argjlo
8381 (const DI #xffffffffff) (const DI 0)
8382 OP_7B OPE1_25
8383 "Media quad complex real unsigned with saturation")
8384
8385 (media-quad-complex-i mqcpxis HI ext argjlo argjhi
8386 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8387 OP_7B OPE1_26
8388 "Media quad complex imaginary signed with saturation")
8389
8390 (media-quad-complex-i mqcpxiu UHI zext argjlo argjhi
8391 (const DI #xffffffffff) (const DI 0)
8392 OP_7B OPE1_27
8393 "Media quad complex imaginary unsigned with saturation")
8394
8395 (define-pmacro (media-pack src1 src2 targ offset)
8396 (sequence ()
8397 (set (halfword hi targ offset) (halfword lo src1 offset))
8398 (set (halfword lo targ offset) (halfword lo src2 offset)))
8399 )
8400
8401 (define-pmacro (media-expand-halfword-to-word-semantics cond)
8402 (if cond
8403 (sequence ((UHI tmp))
8404 (if (and u6 1)
8405 (set tmp (halfword lo FRinti 0))
8406 (set tmp (halfword hi FRinti 0)))
8407 (set (halfword hi FRintk 0) tmp)
8408 (set (halfword lo FRintk 0) tmp)))
8409 )
8410
8411 (dni mexpdhw
8412 "Media expand halfword to word"
8413 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8414 "mexpdhw$pack $FRinti,$u6,$FRintk"
8415 (+ pack FRintk OP_7B FRinti OPE1_32 u6)
8416 (media-expand-halfword-to-word-semantics 1)
8417 ((fr400 (unit u-media-3))
8418 (fr500 (unit u-media)) (fr550 (unit u-media)))
8419 )
8420
8421 (dni cmexpdhw
8422 "Conditional media expand halfword to word"
8423 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1) CONDITIONAL)
8424 "cmexpdhw$pack $FRinti,$u6,$FRintk,$CCi,$cond"
8425 (+ pack FRintk OP_76 FRinti CCi cond OPE4_2 u6)
8426 (media-expand-halfword-to-word-semantics (eq CCi (or cond 2)))
8427 ((fr400 (unit u-media-3))
8428 (fr500 (unit u-media)) (fr550 (unit u-media)))
8429 )
8430
8431 (define-pmacro (media-expand-halfword-to-double-semantics cond)
8432 (if (register-unaligned FRintkeven 2)
8433 (c-call VOID "@cpu@_media_register_not_aligned")
8434 (if cond
8435 (sequence ((UHI tmp))
8436 ; a hack to get FRintkeven referenced for profiling
8437 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8438 (if (and u6 1)
8439 (set tmp (halfword lo FRinti 0))
8440 (set tmp (halfword hi FRinti 0)))
8441 (set (halfword hi FRintkeven 0) tmp)
8442 (set (halfword lo FRintkeven 0) tmp)
8443 (set (halfword hi FRintkeven 1) tmp)
8444 (set (halfword lo FRintkeven 1) tmp))))
8445 )
8446
8447 (dni mexpdhd
8448 "Media expand halfword to double"
8449 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8450 "mexpdhd$pack $FRinti,$u6,$FRintkeven"
8451 (+ pack FRintkeven OP_7B FRinti OPE1_33 u6)
8452 (media-expand-halfword-to-double-semantics 1)
8453 ((fr400 (unit u-media-dual-expand
8454 (out FRintk FRintkeven)))
8455 (fr500 (unit u-media-dual-expand
8456 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8457 )
8458
8459 (dni cmexpdhd
8460 "Conditional media expand halfword to double"
8461 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8462 "cmexpdhd$pack $FRinti,$u6,$FRintkeven,$CCi,$cond"
8463 (+ pack FRintkeven OP_76 FRinti CCi cond OPE4_3 u6)
8464 (media-expand-halfword-to-double-semantics (eq CCi (or cond 2)))
8465 ((fr400 (unit u-media-dual-expand
8466 (out FRintk FRintkeven)))
8467 (fr500 (unit u-media-dual-expand
8468 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8469 )
8470
8471 (dni mpackh
8472 "Media halfword pack"
8473 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8474 "mpackh$pack $FRinti,$FRintj,$FRintk"
8475 (+ pack FRintk OP_7B FRinti OPE1_34 FRintj)
8476 (media-pack FRinti FRintj FRintk 0)
8477 ((fr400 (unit u-media-3))
8478 (fr500 (unit u-media)) (fr550 (unit u-media)))
8479 )
8480
8481 (dni mdpackh
8482 "Media dual pack"
8483 ((UNIT FM01) (FR500-MAJOR M-5) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8484 "mdpackh$pack $FRintieven,$FRintjeven,$FRintkeven"
8485 (+ pack FRintkeven OP_7B FRintieven OPE1_36 FRintjeven)
8486 (if (orif (register-unaligned FRintieven 2)
8487 (orif (register-unaligned FRintjeven 2)
8488 (register-unaligned FRintkeven 2)))
8489 (c-call VOID "@cpu@_media_register_not_aligned")
8490 (sequence ()
8491 ; hack to get these referenced for profiling
8492 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
8493 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8494 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8495 (media-pack FRintieven FRintjeven FRintkeven 0)
8496 (media-pack FRintieven FRintjeven FRintkeven 1)))
8497 ((fr400 (unit u-media-3-quad
8498 (in FRinti FRintieven)
8499 (in FRintj FRintjeven)
8500 (out FRintk FRintkeven)))
8501 (fr500 (unit u-media-quad-arith
8502 (in FRinti FRintieven)
8503 (in FRintj FRintjeven)
8504 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
8505 )
8506
8507 (define-pmacro (media-unpack src soff targ toff)
8508 (sequence ()
8509 (set (halfword hi targ toff) (halfword hi src soff))
8510 (set (halfword lo targ toff) (halfword hi src soff))
8511 (set (halfword hi targ (add toff 1)) (halfword lo src soff))
8512 (set (halfword lo targ (add toff 1)) (halfword lo src soff)))
8513 )
8514
8515 (dni munpackh
8516 "Media halfword unpack"
8517 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8518 "munpackh$pack $FRinti,$FRintkeven"
8519 (+ pack FRintkeven OP_7B FRinti OPE1_35 (FRj-null))
8520 (if (register-unaligned FRintkeven 2)
8521 (c-call VOID "@cpu@_media_register_not_aligned")
8522 (sequence ()
8523 ; hack to get these referenced for profiling
8524 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
8525 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8526 (media-unpack FRinti 0 FRintkeven 0)))
8527 ((fr400 (unit u-media-dual-expand
8528 (out FRintk FRintkeven)))
8529 (fr500 (unit u-media-dual-expand
8530 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8531 )
8532
8533 (dni mdunpackh
8534 "Media dual unpack"
8535 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
8536 "mdunpackh$pack $FRintieven,$FRintk"
8537 (+ pack FRintk OP_7B FRintieven OPE1_37 (FRj-null))
8538 (if (orif (register-unaligned FRintieven 2) (register-unaligned FRintk 4))
8539 (c-call VOID "@cpu@_media_register_not_aligned")
8540 (sequence ()
8541 ; hack to get these referenced for profiling
8542 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
8543 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8544 (media-unpack FRintieven 0 FRintk 0)
8545 (media-unpack FRintieven 1 FRintk 2)))
8546 ((fr500 (unit u-media-dual-unpack
8547 (in FRinti FRintieven))))
8548 )
8549
8550 (define-pmacro (ubyte num arg offset)
8551 (reg (.sym h-fr_ num) (add (index-of arg) offset)))
8552
8553 (define-pmacro (mbtoh-semantics cond)
8554 (if (register-unaligned FRintkeven 2)
8555 (c-call VOID "@cpu@_media_register_not_aligned")
8556 (if cond
8557 (sequence ()
8558 (set (halfword hi FRintkeven 0) (ubyte 3 FRintj 0))
8559 (set (halfword lo FRintkeven 0) (ubyte 2 FRintj 0))
8560 (set (halfword hi FRintkeven 1) (ubyte 1 FRintj 0))
8561 (set (halfword lo FRintkeven 1) (ubyte 0 FRintj 0)))))
8562 )
8563
8564 (dni mbtoh
8565 "Media convert byte to halfword"
8566 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8567 "mbtoh$pack $FRintj,$FRintkeven"
8568 (+ pack FRintkeven OP_7B (FRi-null) OPE1_38 FRintj)
8569 (sequence ()
8570 ; hack to get these referenced for profiling
8571 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8572 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8573 (mbtoh-semantics 1))
8574 ((fr400 (unit u-media-dual-expand
8575 (out FRintk FRintkeven)))
8576 (fr500 (unit u-media-dual-btoh
8577 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8578 )
8579
8580 (dni cmbtoh
8581 "Conditional media convert byte to halfword"
8582 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8583 "cmbtoh$pack $FRintj,$FRintkeven,$CCi,$cond"
8584 (+ pack FRintkeven OP_77 (FRi-null) CCi cond OPE4_0 FRintj)
8585 (sequence ()
8586 ; hack to get these referenced for profiling
8587 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8588 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8589 (mbtoh-semantics (eq CCi (or cond 2))))
8590 ((fr400 (unit u-media-dual-expand
8591 (out FRintk FRintkeven)))
8592 (fr500 (unit u-media-dual-btoh
8593 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand (in FRinti FRintj))))
8594 )
8595
8596 (define-pmacro (mhtob-semantics cond)
8597 (if (register-unaligned FRintjeven 2)
8598 (c-call VOID "@cpu@_media_register_not_aligned")
8599 (if cond
8600 (sequence ()
8601 (set (ubyte 3 FRintk 0) (halfword hi FRintjeven 0))
8602 (set (ubyte 2 FRintk 0) (halfword lo FRintjeven 0))
8603 (set (ubyte 1 FRintk 0) (halfword hi FRintjeven 1))
8604 (set (ubyte 0 FRintk 0) (halfword lo FRintjeven 1)))))
8605 )
8606
8607 (dni mhtob
8608 "Media convert halfword to byte"
8609 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8610 "mhtob$pack $FRintjeven,$FRintk"
8611 (+ pack FRintk OP_7B (FRi-null) OPE1_39 FRintjeven)
8612 (sequence ()
8613 ; hack to get these referenced for profiling
8614 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8615 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8616 (mhtob-semantics 1))
8617 ((fr400 (unit u-media-dual-htob
8618 (in FRintj FRintjeven)))
8619 (fr500 (unit u-media-dual-htob
8620 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
8621 )
8622
8623 (dni cmhtob
8624 "Conditional media convert halfword to byte"
8625 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8626 "cmhtob$pack $FRintjeven,$FRintk,$CCi,$cond"
8627 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_1 FRintjeven)
8628 (sequence ()
8629 ; hack to get these referenced for profiling
8630 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8631 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8632 (mhtob-semantics (eq CCi (or cond 2))))
8633 ((fr400 (unit u-media-dual-htob
8634 (in FRintj FRintjeven)))
8635 (fr500 (unit u-media-dual-htob
8636 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
8637 )
8638
8639 (define-pmacro (mbtohe-semantics cond)
8640 (if (register-unaligned FRintk 4)
8641 (c-call VOID "@cpu@_media_register_not_aligned")
8642 (if cond
8643 (sequence ()
8644 (set (halfword hi FRintk 0) (ubyte 3 FRintj 0))
8645 (set (halfword lo FRintk 0) (ubyte 3 FRintj 0))
8646 (set (halfword hi FRintk 1) (ubyte 2 FRintj 0))
8647 (set (halfword lo FRintk 1) (ubyte 2 FRintj 0))
8648 (set (halfword hi FRintk 2) (ubyte 1 FRintj 0))
8649 (set (halfword lo FRintk 2) (ubyte 1 FRintj 0))
8650 (set (halfword hi FRintk 3) (ubyte 0 FRintj 0))
8651 (set (halfword lo FRintk 3) (ubyte 0 FRintj 0)))))
8652 )
8653
8654 (dni mbtohe
8655 "Media convert byte to halfword extended"
8656 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
8657 "mbtohe$pack $FRintj,$FRintk"
8658 (+ pack FRintk OP_7B (FRi-null) OPE1_3A FRintj)
8659 (sequence ()
8660 ; hack to get these referenced for profiling
8661 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8662 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8663 (mbtohe-semantics 1))
8664 ((fr500 (unit u-media-dual-btohe)))
8665 )
8666
8667 (dni cmbtohe
8668 "Conditional media convert byte to halfword extended"
8669 ((UNIT FM01) (FR500-MAJOR M-7) CONDITIONAL (MACH simple,tomcat,frv))
8670 "cmbtohe$pack $FRintj,$FRintk,$CCi,$cond"
8671 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_2 FRintj)
8672 (sequence ()
8673 ; hack to get these referenced for profiling
8674 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8675 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8676 (mbtohe-semantics (eq CCi (or cond 2))))
8677 ((fr500 (unit u-media-dual-btohe)))
8678 )
8679
8680 ; Media NOP
8681 ; A special case of mclracc
8682 (dni mnop "Media nop"
8683 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-1) (FR400-MAJOR M-1))
8684 "mnop$pack"
8685 (+ pack (f-ACC40Sk 63) OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8686 (nop)
8687 ()
8688 )
8689
8690 ; mclracc with #A==0
8691 (dni mclracc-0
8692 "Media clear accumulator(s)"
8693 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8694 "mclracc$pack $ACC40Sk,$A0"
8695 (+ pack ACC40Sk OP_7B (f-A 0) (misc-null-10) OPE1_3B (FRj-null))
8696 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 0)
8697 ((fr400 (unit u-media-4))
8698 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
8699 )
8700
8701 ; mclracc with #A==1
8702 (dni mclracc-1
8703 "Media clear accumulator(s)"
8704 ((UNIT MCLRACC-1) (FR500-MAJOR M-6) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8705 "mclracc$pack $ACC40Sk,$A1"
8706 (+ pack ACC40Sk OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8707 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 1)
8708 ((fr400 (unit u-media-4))
8709 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
8710 )
8711
8712 (dni mrdacc
8713 "Media read accumulator"
8714 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8715 "mrdacc$pack $ACC40Si,$FRintk"
8716 (+ pack FRintk OP_7B ACC40Si OPE1_3C (FRj-null))
8717 (set FRintk ACC40Si)
8718 ((fr400 (unit u-media-4))
8719 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
8720 )
8721
8722 (dni mrdaccg
8723 "Media read accumulator guard"
8724 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8725 "mrdaccg$pack $ACCGi,$FRintk"
8726 (+ pack FRintk OP_7B ACCGi OPE1_3E (FRj-null))
8727 (set FRintk ACCGi)
8728 ((fr400 (unit u-media-4-accg))
8729 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc (in ACC40Si ACCGi))))
8730 )
8731
8732 (dni mwtacc
8733 "Media write accumulator"
8734 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8735 "mwtacc$pack $FRinti,$ACC40Sk"
8736 (+ pack ACC40Sk OP_7B FRinti OPE1_3D (FRj-null))
8737 (set ACC40Sk (or (and ACC40Sk (const DI #xffffffff00000000))
8738 FRinti))
8739 ((fr400 (unit u-media-4))
8740 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc)))
8741 )
8742
8743 (dni mwtaccg
8744 "Media write accumulator guard"
8745 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8746 "mwtaccg$pack $FRinti,$ACCGk"
8747 (+ pack ACCGk OP_7B FRinti OPE1_3F (FRj-null))
8748 (sequence ()
8749 ; hack to get these referenced for profiling
8750 (c-raw-call VOID "frv_ref_SI" ACCGk)
8751 (set ACCGk FRinti))
8752 ((fr400 (unit u-media-4-accg))
8753 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc (in ACC40Sk ACCGk))))
8754 )
8755
8756 (define-pmacro (media-cop num op)
8757 (dni (.sym mcop num)
8758 "Media custom instruction"
8759 ((UNIT FM01) (FR500-MAJOR M-1) (MACH frv))
8760 (.str "mcop" num "$pack $FRi,$FRj,$FRk")
8761 (+ pack FRk op FRi OPE1_00 FRj)
8762 (c-call VOID "@cpu@_media_cop" num)
8763 ()
8764 )
8765 )
8766
8767 (media-cop 1 OP_7C)
8768 (media-cop 2 OP_7D)
8769
8770 ; nop
8771 ; A nop is defined to be a "ori gr0,0,gr0"
8772 ; This needn't be a macro-insn, but making it one greatly simplifies decode.c
8773 ; On the other hand spending a little time in the decoder is often worth it.
8774 ;
8775 (dnmi nop "nop"
8776 ((UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8777 "nop$pack"
8778 (emit ori pack (GRi 0) (s12 0) (GRk 0))
8779 )
8780
8781 ; Floating point NOP
8782 (dni fnop
8783 "Floating point nop"
8784 ((UNIT FMALL) (FR500-MAJOR F-8) (FR550-MAJOR F-1) (MACH simple,tomcat,fr500,fr550,frv))
8785 "fnop$pack"
8786 (+ pack (rd-null) OP_79 (FRi-null) OPE1_0D (FRj-null))
8787 (nop)
8788 ()
8789 )
8790
8791 ; A return instruction
8792 (dnmi ret "return"
8793 (NO-DIS (UNIT B01) (FR500-MAJOR B-3) (FR400-MAJOR B-3))
8794 "ret$pack"
8795 (emit bralr pack (hint_taken 2))
8796 )
8797
8798 (dnmi cmp "compare"
8799 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8800 "cmp$pack $GRi,$GRj,$ICCi_1"
8801 (emit subcc pack GRi GRj (GRk 0) ICCi_1)
8802 )
8803
8804 (dnmi cmpi "compare immediate"
8805 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8806 "cmpi$pack $GRi,$s10,$ICCi_1"
8807 (emit subicc pack GRi s10 (GRk 0) ICCi_1)
8808 )
8809
8810 (dnmi ccmp "conditional compare"
8811 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
8812 "ccmp$pack $GRi,$GRj,$CCi,$cond"
8813 (emit csubcc pack GRi GRj (GRk 0) CCi cond)
8814 )
8815
8816 (dnmi mov "move"
8817 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8818 "mov$pack $GRi,$GRk"
8819 (emit ori pack GRi (s12 0) GRk)
8820 )
8821
8822 (dnmi cmov "conditional move"
8823 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
8824 "cmov$pack $GRi,$GRk,$CCi,$cond"
8825 (emit cor pack GRi (GRj 0) GRk CCi cond)
8826 )
This page took 0.220587 seconds and 5 git commands to generate.