2003-10-06 Dave Brolley <brolley@redhat.com>
[deliverable/binutils-gdb.git] / cpu / frv.cpu
1 ; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*-
2 ;
3 ; Copyright 2000, 2001, 2003 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 LOAD ; loads slotted differently on different machines
1392 STORE ; store slotted differently on different machines
1393 SCAN ; scan, scani slotted differently on different machines
1394 DCPL ; dcpl slotted differently on different machines
1395 MDUALACC ; media dual acc slotted differently on different machines
1396 MCLRACC-1; mclracc A==1 slotted differently on different machines
1397 NUM_UNITS
1398 )
1399 )
1400 ; Attributes to describe major categories of insns
1401 (define-attr
1402 (for insn)
1403 (type enum)
1404 (name FR400-MAJOR)
1405 (comment "fr400 major insn categories")
1406 ; The order of declaration is significant. Keep variations on the same major
1407 ; together.
1408 (values NONE
1409 I-1 I-2 I-3 I-4 I-5
1410 B-1 B-2 B-3 B-4 B-5 B-6
1411 C-1 C-2
1412 M-1 M-2
1413 )
1414 )
1415 (define-attr
1416 (for insn)
1417 (type enum)
1418 (name FR500-MAJOR)
1419 (comment "fr500 major insn categories")
1420 ; The order of declaration is significant. Keep variations on the same major
1421 ; together.
1422 (values NONE
1423 I-1 I-2 I-3 I-4 I-5 I-6
1424 B-1 B-2 B-3 B-4 B-5 B-6
1425 C-1 C-2
1426 F-1 F-2 F-3 F-4 F-5 F-6 F-7 F-8
1427 M-1 M-2 M-3 M-4 M-5 M-6 M-7 M-8
1428 )
1429 )
1430 (define-attr
1431 (for insn)
1432 (type enum)
1433 (name FR550-MAJOR)
1434 (comment "fr550 major insn categories")
1435 ; The order of declaration is significant. Keep variations on the same major
1436 ; together.
1437 (values NONE
1438 I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8
1439 B-1 B-2 B-3 B-4 B-5 B-6
1440 C-1 C-2
1441 F-1 F-2 F-3 F-4
1442 M-1 M-2 M-3 M-4 M-5
1443 )
1444 )
1445 ; Privileged insn
1446 (define-attr
1447 (for insn)
1448 (type boolean)
1449 (name PRIVILEGED)
1450 (comment "insn only allowed in supervisor mode")
1451 )
1452 ; Non-Excepting insn
1453 (define-attr
1454 (for insn)
1455 (type boolean)
1456 (name NON-EXCEPTING)
1457 (comment "non-excepting insn")
1458 )
1459 ; Conditional insn
1460 (define-attr
1461 (for insn)
1462 (type boolean)
1463 (name CONDITIONAL)
1464 (comment "conditional insn")
1465 )
1466 ; insn accesses FR registers
1467 (define-attr
1468 (for insn)
1469 (type boolean)
1470 (name FR-ACCESS)
1471 (comment "insn accesses FR registers")
1472 )
1473 ; insn preserves MSR.OVF
1474 (define-attr
1475 (for insn)
1476 (type boolean)
1477 (name PRESERVE-OVF)
1478 (comment "Preserve value of MSR.OVF")
1479 )
1480 ; null attribute -- used as a place holder for where an attribue is required.
1481 (define-attr
1482 (for insn)
1483 (type boolean)
1484 (name NA)
1485 (comment "placeholder attribute")
1486 (attrs META) ; do not define in any generated file for now
1487 )
1488
1489 ; IDOC attribute for instruction documentation.
1490
1491 (define-attr
1492 (for insn)
1493 (type enum)
1494 (name IDOC)
1495 (comment "insn kind for documentation")
1496 (attrs META)
1497 (values
1498 (MEM - () "Memory")
1499 (ALU - () "ALU")
1500 (FPU - () "FPU")
1501 (BR - () "Branch")
1502 (PRIV - () "Priviledged")
1503 (MISC - () "Miscellaneous")
1504 )
1505 )
1506 \f
1507 ; Instruction fields.
1508 ;
1509 ; Attributes:
1510 ; PCREL-ADDR: pc relative value (for reloc and disassembly purposes)
1511 ; ABS-ADDR: absolute address (for reloc and disassembly purposes?)
1512 ; RESERVED: bits are not used to decode insn, must be all 0
1513 (dnf f-pack "packing bit" () 31 1)
1514 (dnf f-op "primary opcode" () 24 7)
1515 (dnf f-ope1 "extended opcode" () 11 6)
1516 (dnf f-ope2 "extended opcode" () 9 4)
1517 (dnf f-ope3 "extended opcode" () 15 3)
1518 (dnf f-ope4 "extended opcode" () 7 2)
1519
1520 (dnf f-GRi "source register 1" () 17 6)
1521 (dnf f-GRj "source register 2" () 5 6)
1522 (dnf f-GRk "destination register" () 30 6)
1523
1524 (dnf f-FRi "source register 1" () 17 6)
1525 (dnf f-FRj "source register 2" () 5 6)
1526 (dnf f-FRk "destination register" () 30 6)
1527
1528 (dnf f-CPRi "source register 1" () 17 6)
1529 (dnf f-CPRj "source register 2" () 5 6)
1530 (dnf f-CPRk "destination register" () 30 6)
1531
1532 (dnf f-ACCGi "source register" () 17 6)
1533 (dnf f-ACCGk "destination register" () 30 6)
1534
1535 (dnf f-ACC40Si "40 bit signed accumulator" () 17 6)
1536 (dnf f-ACC40Ui "40 bit unsigned accumulator" () 17 6)
1537 (dnf f-ACC40Sk "40 bit accumulator" () 30 6)
1538 (dnf f-ACC40Uk "40 bit accumulator" () 30 6)
1539
1540 (dnf f-CRi "source register" () 14 3)
1541 (dnf f-CRj "source register" () 2 3)
1542 (dnf f-CRk "destination register" () 27 3)
1543 (dnf f-CCi "condition register" () 11 3)
1544
1545 (df f-CRj_int "target cr for ck insns" () 26 2 UINT
1546 ((value pc) (sub WI value 4))
1547 ((value pc) (add WI value 4))
1548 )
1549 (dnf f-CRj_float "target cr for fck insns" () 26 2)
1550
1551 (dnf f-ICCi_1 "condition register" () 11 2)
1552 (dnf f-ICCi_2 "condition register" () 26 2)
1553 (dnf f-ICCi_3 "condition register" () 1 2)
1554 (dnf f-FCCi_1 "condition register" () 11 2)
1555 (dnf f-FCCi_2 "condition register" () 26 2)
1556 (dnf f-FCCi_3 "condition register" () 1 2)
1557 (dnf f-FCCk "condition register" () 26 2)
1558 (dnf f-eir "exception insn register" () 17 6)
1559
1560 (df f-s10 "10 bit sign extended" () 9 10 INT #f #f)
1561 (df f-s12 "12 bit sign extended" () 11 12 INT #f #f)
1562 (df f-d12 "12 bit sign extended" () 11 12 INT #f #f)
1563 (df f-u16 "16 bit unsigned" () 15 16 UINT #f #f)
1564 (df f-s16 "16 bit sign extended" () 15 16 INT #f #f)
1565 (df f-s6 "6 bit signed" () 5 6 INT #f #f)
1566 (df f-s6_1 "6 bit signed" () 11 6 INT #f #f)
1567 (df f-u6 "6 bit unsigned" () 5 6 UINT #f #f)
1568 (df f-s5 "5 bit signed" () 4 5 INT #f #f)
1569
1570 (df f-u12-h "upper 6 bits of u12" () 17 6 INT #f #f)
1571 (df f-u12-l "lower 6 bits of u12" () 5 6 UINT #f #f)
1572 (dnmf f-u12 "12 bit signed immediate" () INT
1573 (f-u12-h f-u12-l)
1574 (sequence () ; insert
1575 (set (ifield f-u12-h) (sra SI (ifield f-u12) 6))
1576 (set (ifield f-u12-l) (and (ifield f-u12) #x3f))
1577 )
1578 (sequence () ; extract
1579 (set (ifield f-u12) (or (sll (ifield f-u12-h) 6)
1580 (ifield f-u12-l)))
1581 )
1582 )
1583
1584 (dnf f-int-cc "integer branch conditions" () 30 4)
1585 (dnf f-flt-cc "floating branch conditions" () 30 4)
1586 (df f-cond "conditional arithmetic" () 8 1 UINT #f #f)
1587 (df f-ccond "lr branch condition" () 12 1 UINT #f #f)
1588 (df f-hint "2 bit branch prediction hint" () 17 2 UINT #f #f)
1589 (df f-LI "link indicator" () 25 1 UINT #f #f)
1590 (df f-lock "cache lock indicator" () 25 1 UINT #f #f)
1591 (df f-debug "debug mode indicator" () 25 1 UINT #f #f)
1592 (df f-A "all accumulator bit" () 17 1 UINT #f #f)
1593 (df f-ae "cache all entries indicator" () 25 1 UINT #f #f)
1594
1595 (dnf f-spr-h "upper 6 bits of spr" () 30 6)
1596 (dnf f-spr-l "lower 6 bits of spr" () 17 6)
1597 (dnmf f-spr "special purpose register" () UINT
1598 (f-spr-h f-spr-l)
1599 (sequence () ; insert
1600 (set (ifield f-spr-h) (srl (ifield f-spr) (const 6)))
1601 (set (ifield f-spr-l) (and (ifield f-spr) (const #x3f)))
1602 )
1603 (sequence () ; extract
1604 (set (ifield f-spr) (or (sll (ifield f-spr-h) (const 6))
1605 (ifield f-spr-l)))
1606 )
1607 )
1608
1609 (df f-label16 "18 bit pc relative signed offset" (PCREL-ADDR) 15 16 INT
1610 ((value pc) (sra WI (sub WI value pc) (const 2)))
1611 ((value pc) (add WI (sll WI value (const 2)) pc))
1612 )
1613
1614 (df f-labelH6 "upper 6 bits of label24" () 30 6 INT #f #f)
1615 (dnf f-labelL18 "lower 18 bits of label24" () 17 18)
1616 (dnmf f-label24 "26 bit signed offset" (PCREL-ADDR) INT
1617 (f-labelH6 f-labelL18)
1618 ; insert
1619 (sequence ()
1620 (set (ifield f-labelH6)
1621 (sra WI (sub (ifield f-label24) pc) (const 20)))
1622 (set (ifield f-labelL18)
1623 (and (srl (sub (ifield f-label24) pc) (const 2))
1624 (const #x3ffff)))
1625 )
1626 ; extract
1627 (sequence ()
1628 (set (ifield f-label24)
1629 (add (sll (or (sll (ifield f-labelH6) (const 18))
1630 (ifield f-labelL18))
1631 (const 2))
1632 pc)))
1633 )
1634
1635 (dnf f-ICCi_1-null "null field" (RESERVED) 11 2)
1636 (dnf f-ICCi_2-null "null field" (RESERVED) 26 2)
1637 (dnf f-ICCi_3-null "null field" (RESERVED) 1 2)
1638 (dnf f-FCCi_1-null "null field" (RESERVED) 11 2)
1639 (dnf f-FCCi_2-null "null field" (RESERVED) 26 2)
1640 (dnf f-FCCi_3-null "null field" (RESERVED) 1 2)
1641 (dnf f-rs-null "null field" (RESERVED) 17 6)
1642 (dnf f-GRi-null "null field" (RESERVED) 17 6)
1643 (dnf f-GRj-null "null field" (RESERVED) 5 6)
1644 (dnf f-GRk-null "null field" (RESERVED) 30 6)
1645 (dnf f-FRi-null "null field" (RESERVED) 17 6)
1646 (dnf f-FRj-null "null field" (RESERVED) 5 6)
1647 (dnf f-ACCj-null "null field" (RESERVED) 5 6)
1648 (dnf f-rd-null "null field" (RESERVED) 30 6)
1649 (dnf f-cond-null "null field" (RESERVED) 30 4)
1650 (dnf f-ccond-null "null field" (RESERVED) 12 1)
1651 (dnf f-s12-null "null field" (RESERVED) 11 12)
1652 (dnf f-label16-null "null field" (RESERVED) 15 16)
1653 (dnf f-misc-null-1 "null field" (RESERVED) 30 5)
1654 (dnf f-misc-null-2 "null field" (RESERVED) 11 6)
1655 (dnf f-misc-null-3 "null field" (RESERVED) 11 4)
1656 (dnf f-misc-null-4 "null field" (RESERVED) 17 2)
1657 (dnf f-misc-null-5 "null field" (RESERVED) 17 16)
1658 (dnf f-misc-null-6 "null field" (RESERVED) 30 3)
1659 (dnf f-misc-null-7 "null field" (RESERVED) 17 3)
1660 (dnf f-misc-null-8 "null field" (RESERVED) 5 3)
1661 (dnf f-misc-null-9 "null field" (RESERVED) 5 4)
1662 (dnf f-misc-null-10 "null field" (RESERVED) 16 5)
1663 (dnf f-misc-null-11 "null field" (RESERVED) 5 1)
1664
1665 (dnf f-LI-off "null field" (RESERVED) 25 1)
1666 (dnf f-LI-on "null field" (RESERVED) 25 1)
1667 \f
1668 ; Enums.
1669
1670 ; insn-op:
1671 ; FIXME: should use die macro or some such
1672 (define-normal-insn-enum insn-op "insn op enums" () OP_ f-op
1673 (
1674 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1675 "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
1676 "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
1677 "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
1678 "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" "4D" "4E" "4F"
1679 "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "5A" "5B" "5C" "5D" "5E" "5F"
1680 "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "6A" "6B" "6C" "6D" "6E" "6F"
1681 "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "7A" "7B" "7C" "7D" "7E" "7F"
1682 )
1683 )
1684
1685 (define-normal-insn-enum insn-ope1 "insn ope enums" () OPE1_ f-ope1
1686 (
1687 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1688 "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
1689 "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
1690 "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
1691 )
1692 )
1693
1694 (define-normal-insn-enum insn-ope2 "insn ope enums" () OPE2_ f-ope2
1695 (
1696 "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
1697 )
1698 )
1699
1700 (define-normal-insn-enum insn-ope3 "insn ope enums" () OPE3_ f-ope3
1701 (
1702 "00" "01" "02" "03" "04" "05" "06" "07"
1703 )
1704 )
1705
1706 (define-normal-insn-enum insn-ope4 "insn ope enums" () OPE4_ f-ope4
1707 (
1708 "0" "1" "2" "3"
1709 )
1710 )
1711
1712 ; int-cc: integer branch conditions
1713 ; FIXME: should use die macro or some such
1714 (define-normal-insn-enum int-cc "integer branch cond enums" () ICC_ f-int-cc
1715 (
1716 "nev" "c" "v" "lt" "eq" "ls" "n" "le"
1717 "ra" "nc" "nv" "ge" "ne" "hi" "p" "gt"
1718 )
1719 )
1720
1721 ; flt-cc: floating-point/media branch conditions
1722 ; FIXME: should use die macro or some such
1723 (define-normal-insn-enum flt-cc "float branch cond enums" () FCC_ f-flt-cc
1724 ("nev" "u" "gt" "ug" "lt" "ul" "lg" "ne"
1725 "eq" "ue" "ge" "uge" "le" "ule" "o" "ra")
1726 )
1727 \f
1728 ; Hardware pieces.
1729 ; These entries list the elements of the raw hardware.
1730 ; They're also used to provide tables and other elements of the assembly
1731 ; language.
1732 (dnh h-pc "program counter" (PC PROFILE) (pc) () () ())
1733
1734 ; The PSR. The individual fields are referenced more than the entire
1735 ; register, so reference them directly. We can assemble the
1736 ; entire register contents when necessary.
1737 ;
1738 (dsh h-psr_imple "PSR.IMPLE" () (register UQI))
1739 (dsh h-psr_ver "PSR.VER" () (register UQI))
1740 (dsh h-psr_ice "PSR.ICE bit" () (register BI))
1741 (dsh h-psr_nem "PSR.NEM bit" () (register BI))
1742 (dsh h-psr_cm "PSR.CM bit" () (register BI))
1743 (dsh h-psr_be "PSR.BE bit" () (register BI))
1744 (dsh h-psr_esr "PSR.ESR bit" () (register BI))
1745 (dsh h-psr_ef "PSR.EF bit" () (register BI))
1746 (dsh h-psr_em "PSR.EM bit" () (register BI))
1747 (dsh h-psr_pil "PSR.PIL " () (register UQI))
1748 (dsh h-psr_ps "PSR.PS bit" () (register BI))
1749 (dsh h-psr_et "PSR.ET bit" () (register BI))
1750
1751 ; PSR.S requires special handling because the shadow registers (SR0-SR4) must
1752 ; be switched with GR4-GR7 when changing from user to supervisor mode or
1753 ; vice-versa.
1754 (define-hardware
1755 (name h-psr_s)
1756 (comment "PSR.S bit")
1757 (attrs)
1758 (type register BI)
1759 (get)
1760 (set (newval) (c-call VOID "@cpu@_h_psr_s_set_handler" newval))
1761 )
1762
1763 ; The TBR. The individual bits are referenced more than the entire
1764 ; register, so reference them directly. We can assemble the
1765 ; entire register contents when necessary.
1766 ;
1767 (dsh h-tbr_tba "TBR.TBA" () (register UWI))
1768 (dsh h-tbr_tt "TBR.TT" () (register UQI))
1769
1770 ; The BPSR. The individual bits are referenced more than the entire
1771 ; register, so reference them directly. We can assemble the
1772 ; entire register contents when necessary.
1773 ;
1774 (dsh h-bpsr_bs "PSR.S bit" () (register BI))
1775 (dsh h-bpsr_bet "PSR.ET bit" () (register BI))
1776
1777 ; General registers
1778 ;
1779 (define-keyword
1780 (name gr-names)
1781 (print-name h-gr)
1782 (prefix "")
1783 (values
1784 (sp 1) (fp 2)
1785 (gr0 0)(gr1 1)(gr2 2)(gr3 3)(gr4 4)(gr5 5)(gr6 6)(gr7 7)
1786 (gr8 8)(gr9 9)(gr10 10)(gr11 11)(gr12 12)(gr13 13)(gr14 14)(gr15 15)
1787 (gr16 16)(gr17 17)(gr18 18)(gr19 19)(gr20 20)(gr21 21)(gr22 22)(gr23 23)
1788 (gr24 24)(gr25 25)(gr26 26)(gr27 27)(gr28 28)(gr29 29)(gr30 30)(gr31 31)
1789 (gr32 32)(gr33 33)(gr34 34)(gr35 35)(gr36 36)(gr37 37)(gr38 38)(gr39 39)
1790 (gr40 40)(gr41 41)(gr42 42)(gr43 43)(gr44 44)(gr45 45)(gr46 46)(gr47 47)
1791 (gr48 48)(gr49 49)(gr50 50)(gr51 51)(gr52 52)(gr53 53)(gr54 54)(gr55 55)
1792 (gr56 56)(gr57 57)(gr58 58)(gr59 59)(gr60 60)(gr61 61)(gr62 62)(gr63 63)
1793 )
1794 )
1795
1796 (define-hardware
1797 (name h-gr)
1798 (comment "general registers")
1799 (attrs PROFILE)
1800 (type register USI (64))
1801 (indices extern-keyword gr-names)
1802 (get (index) (c-call WI "@cpu@_h_gr_get_handler" index))
1803 (set (index newval) (c-call VOID "@cpu@_h_gr_set_handler" index newval))
1804 )
1805
1806 ; General Registers as double words
1807 ; These registers are shadowed onto h-gr
1808 (define-hardware
1809 (name h-gr_double)
1810 (comment "general registers as double words")
1811 (attrs PROFILE VIRTUAL)
1812 (type register DI (32))
1813 ; FIXME: Need constraint to prohibit odd numbers.
1814 (indices extern-keyword gr-names)
1815 (get (index)
1816 (c-call DI "@cpu@_h_gr_double_get_handler" index))
1817 (set (index newval)
1818 (c-call VOID "@cpu@_h_gr_double_set_handler" index newval))
1819 )
1820
1821 ; General Registers as high and low half words
1822 ; These registers are shadowed onto h-gr
1823 (define-hardware
1824 (name h-gr_hi)
1825 (comment "general registers as high half word")
1826 (attrs PROFILE VIRTUAL)
1827 (type register UHI (64))
1828 (indices extern-keyword gr-names)
1829 (get (index) (c-call UHI "@cpu@_h_gr_hi_get_handler" index))
1830 (set (index newval) (c-call VOID "@cpu@_h_gr_hi_set_handler" index newval))
1831 )
1832 (define-hardware
1833 (name h-gr_lo)
1834 (comment "general registers as low half word")
1835 (attrs PROFILE VIRTUAL)
1836 (type register UHI (64))
1837 (indices extern-keyword gr-names)
1838 (get (index) (c-call UHI "@cpu@_h_gr_lo_get_handler" index))
1839 (set (index newval) (c-call VOID "@cpu@_h_gr_lo_set_handler" index newval))
1840 )
1841
1842 ; Floating Point Registers
1843 (define-keyword
1844 (name fr-names)
1845 (print-name h-fr)
1846 (prefix "")
1847 (values
1848 (fr0 0)(fr1 1)(fr2 2)(fr3 3)(fr4 4)(fr5 5)(fr6 6)(fr7 7)
1849 (fr8 8)(fr9 9)(fr10 10)(fr11 11)(fr12 12)(fr13 13)(fr14 14)(fr15 15)
1850 (fr16 16)(fr17 17)(fr18 18)(fr19 19)(fr20 20)(fr21 21)(fr22 22)(fr23 23)
1851 (fr24 24)(fr25 25)(fr26 26)(fr27 27)(fr28 28)(fr29 29)(fr30 30)(fr31 31)
1852 (fr32 32)(fr33 33)(fr34 34)(fr35 35)(fr36 36)(fr37 37)(fr38 38)(fr39 39)
1853 (fr40 40)(fr41 41)(fr42 42)(fr43 43)(fr44 44)(fr45 45)(fr46 46)(fr47 47)
1854 (fr48 48)(fr49 49)(fr50 50)(fr51 51)(fr52 52)(fr53 53)(fr54 54)(fr55 55)
1855 (fr56 56)(fr57 57)(fr58 58)(fr59 59)(fr60 60)(fr61 61)(fr62 62)(fr63 63)
1856 )
1857 )
1858
1859 (define-hardware
1860 (name h-fr)
1861 (comment "floating point registers")
1862 (attrs PROFILE)
1863 (type register SF (64))
1864 (indices extern-keyword fr-names)
1865 (get (index) (c-call SF "@cpu@_h_fr_get_handler" index))
1866 (set (index newval) (c-call VOID "@cpu@_h_fr_set_handler" index newval))
1867 )
1868
1869 ; Floating Point Registers as double precision
1870 ; These registers are shadowed onto h-fr
1871
1872 (define-hardware
1873 (name h-fr_double)
1874 (comment "floating point registers as double precision")
1875 (attrs PROFILE VIRTUAL)
1876 (type register DF (32))
1877 ; FIXME: Need constraint to prohibit odd numbers.
1878 (indices extern-keyword fr-names)
1879 (get (index)
1880 (c-call DF "@cpu@_h_fr_double_get_handler" index))
1881 (set (index newval)
1882 (c-call VOID "@cpu@_h_fr_double_set_handler" index newval))
1883 )
1884
1885 ; Floating Point Registers as integer words.
1886 ; These registers are shadowed onto h-fr
1887
1888 (define-hardware
1889 (name h-fr_int)
1890 (comment "floating point registers as integers")
1891 (attrs PROFILE VIRTUAL)
1892 (type register USI (64))
1893 (indices extern-keyword fr-names)
1894 (get (index)
1895 (c-call USI "@cpu@_h_fr_int_get_handler" index))
1896 (set (index newval)
1897 (c-call VOID "@cpu@_h_fr_int_set_handler" index newval))
1898 )
1899
1900 ; Floating Point Registers as high and low half words
1901 ; These registers are shadowed onto h-fr
1902 (define-hardware
1903 (name h-fr_hi)
1904 (comment "floating point registers as unsigned high half word")
1905 (attrs PROFILE VIRTUAL)
1906 (type register UHI (64))
1907 (indices extern-keyword fr-names)
1908 (get (regno) (srl (reg h-fr_int regno) 16))
1909 (set (regno newval) (set (reg h-fr_int regno)
1910 (or (and (reg h-fr_int regno) #xffff)
1911 (sll newval 16))))
1912 )
1913 (define-hardware
1914 (name h-fr_lo)
1915 (comment "floating point registers as unsigned low half word")
1916 (attrs PROFILE VIRTUAL)
1917 (type register UHI (64))
1918 (indices extern-keyword fr-names)
1919 (get (regno) (and (reg h-fr_int regno) #xffff))
1920 (set (regno newval) (set (reg h-fr_int regno)
1921 (or (and (reg h-fr_int regno) #xffff0000)
1922 (and newval #xffff))))
1923 )
1924
1925 ; Floating Point Registers as unsigned bytes
1926 ; These registers are shadowed onto h-fr
1927 (define-hardware
1928 (name h-fr_0)
1929 (comment "floating point registers as unsigned byte 0")
1930 (attrs PROFILE VIRTUAL)
1931 (type register UHI (64))
1932 (indices extern-keyword fr-names)
1933 (get (regno) (and (reg h-fr_int regno) #xff))
1934 (set (regno newval)
1935 (sequence ()
1936 (if (gt USI newval #xff)
1937 (set newval #xff))
1938 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffffff00)
1939 newval))))
1940 )
1941 (define-hardware
1942 (name h-fr_1)
1943 (comment "floating point registers as unsigned byte 1")
1944 (attrs PROFILE VIRTUAL)
1945 (type register UHI (64))
1946 (indices extern-keyword fr-names)
1947 (get (regno) (and (srl (reg h-fr_int regno) 8) #xff))
1948 (set (regno newval)
1949 (sequence ()
1950 (if (gt USI newval #xff)
1951 (set newval #xff))
1952 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffff00ff)
1953 (sll newval 8)))))
1954 )
1955 (define-hardware
1956 (name h-fr_2)
1957 (comment "floating point registers as unsigned byte 2")
1958 (attrs PROFILE VIRTUAL)
1959 (type register UHI (64))
1960 (indices extern-keyword fr-names)
1961 (get (regno) (and (srl (reg h-fr_int regno) 16) #xff))
1962 (set (regno newval)
1963 (sequence ()
1964 (if (gt USI newval #xff)
1965 (set newval #xff))
1966 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xff00ffff)
1967 (sll newval 16)))))
1968 )
1969 (define-hardware
1970 (name h-fr_3)
1971 (comment "floating point registers as unsigned byte 3")
1972 (attrs PROFILE VIRTUAL)
1973 (type register UHI (64))
1974 (indices extern-keyword fr-names)
1975 (get (regno) (and (srl (reg h-fr_int regno) 24) #xff))
1976 (set (regno newval)
1977 (sequence ()
1978 (if (gt USI newval #xff)
1979 (set newval #xff))
1980 (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #x00ffffff)
1981 (sll newval 24)))))
1982 )
1983 ; Coprocessor Registers
1984 ;
1985 (define-keyword
1986 (name cpr-names)
1987 (print-name h-cpr)
1988 (prefix "")
1989 (values
1990 (cpr0 0)(cpr1 1)(cpr2 2)(cpr3 3)(cpr4 4)(cpr5 5)(cpr6 6)(cpr7 7)
1991 (cpr8 8)(cpr9 9)(cpr10 10)(cpr11 11)(cpr12 12)(cpr13 13)(cpr14 14)(cpr15 15)
1992 (cpr16 16)(cpr17 17)(cpr18 18)(cpr19 19)(cpr20 20)(cpr21 21)(cpr22 22)(cpr23 23)
1993 (cpr24 24)(cpr25 25)(cpr26 26)(cpr27 27)(cpr28 28)(cpr29 29)(cpr30 30)(cpr31 31)
1994 (cpr32 32)(cpr33 33)(cpr34 34)(cpr35 35)(cpr36 36)(cpr37 37)(cpr38 38)(cpr39 39)
1995 (cpr40 40)(cpr41 41)(cpr42 42)(cpr43 43)(cpr44 44)(cpr45 45)(cpr46 46)(cpr47 47)
1996 (cpr48 48)(cpr49 49)(cpr50 50)(cpr51 51)(cpr52 52)(cpr53 53)(cpr54 54)(cpr55 55)
1997 (cpr56 56)(cpr57 57)(cpr58 58)(cpr59 59)(cpr60 60)(cpr61 61)(cpr62 62)(cpr63 63)
1998 )
1999 )
2000
2001 (define-hardware
2002 (name h-cpr)
2003 (comment "coprocessor registers")
2004 (attrs PROFILE (MACH frv))
2005 (type register WI (64))
2006 (indices extern-keyword cpr-names)
2007 )
2008
2009 ; Coprocessor Registers as double words
2010 ; These registers are shadowed onto h-cpr
2011 (define-hardware
2012 (name h-cpr_double)
2013 (comment "coprocessor registers as double words")
2014 (attrs PROFILE VIRTUAL (MACH frv))
2015 (type register DI (32))
2016 ; FIXME: Need constraint to prohibit odd numbers.
2017 (indices extern-keyword cpr-names)
2018 (get (index)
2019 (c-call DI "@cpu@_h_cpr_double_get_handler" index))
2020 (set (index newval)
2021 (c-call VOID "@cpu@_h_cpr_double_set_handler" index newval))
2022 )
2023
2024 ; Special Purpose Registers
2025 ;
2026 (define-keyword
2027 (name spr-names)
2028 (print-name h-spr)
2029 (prefix "")
2030 (values
2031 (psr 0) (pcsr 1) (bpcsr 2) (tbr 3) (bpsr 4)
2032
2033 (hsr0 16) (hsr1 17) (hsr2 18) (hsr3 19)
2034 (hsr4 20) (hsr5 21) (hsr6 22) (hsr7 23)
2035 (hsr8 24) (hsr9 25) (hsr10 26) (hsr11 27)
2036 (hsr12 28) (hsr13 29) (hsr14 30) (hsr15 31)
2037 (hsr16 32) (hsr17 33) (hsr18 34) (hsr19 35)
2038 (hsr20 36) (hsr21 37) (hsr22 38) (hsr23 39)
2039 (hsr24 40) (hsr25 41) (hsr26 42) (hsr27 43)
2040 (hsr28 44) (hsr29 45) (hsr30 46) (hsr31 47)
2041 (hsr32 48) (hsr33 49) (hsr34 50) (hsr35 51)
2042 (hsr36 52) (hsr37 53) (hsr38 54) (hsr39 55)
2043 (hsr40 56) (hsr41 57) (hsr42 58) (hsr43 59)
2044 (hsr44 60) (hsr45 61) (hsr46 62) (hsr47 63)
2045 (hsr48 64) (hsr49 65) (hsr50 66) (hsr51 67)
2046 (hsr52 68) (hsr53 69) (hsr54 70) (hsr55 71)
2047 (hsr56 72) (hsr57 73) (hsr58 74) (hsr59 75)
2048 (hsr60 76) (hsr61 77) (hsr62 78) (hsr63 79)
2049
2050 (ccr 256) (cccr 263) (lr 272) (lcr 273) (iacc0h 280) (iacc0l 281) (isr 288)
2051
2052 (neear0 352) (neear1 353) (neear2 354) (neear3 355)
2053 (neear4 356) (neear5 357) (neear6 358) (neear7 359)
2054 (neear8 360) (neear9 361) (neear10 362) (neear11 363)
2055 (neear12 364) (neear13 365) (neear14 366) (neear15 367)
2056 (neear16 368) (neear17 369) (neear18 370) (neear19 371)
2057 (neear20 372) (neear21 373) (neear22 374) (neear23 375)
2058 (neear24 376) (neear25 377) (neear26 378) (neear27 379)
2059 (neear28 380) (neear29 381) (neear30 382) (neear31 383)
2060
2061 (nesr0 384) (nesr1 385) (nesr2 386) (nesr3 387)
2062 (nesr4 388) (nesr5 389) (nesr6 390) (nesr7 391)
2063 (nesr8 392) (nesr9 393) (nesr10 394) (nesr11 395)
2064 (nesr12 396) (nesr13 397) (nesr14 398) (nesr15 399)
2065 (nesr16 400) (nesr17 401) (nesr18 402) (nesr19 403)
2066 (nesr20 404) (nesr21 405) (nesr22 406) (nesr23 407)
2067 (nesr24 408) (nesr25 409) (nesr26 410) (nesr27 411)
2068 (nesr28 412) (nesr29 413) (nesr30 414) (nesr31 415)
2069
2070 (necr 416)
2071
2072 (gner0 432) (gner1 433)
2073
2074 (fner0 434) (fner1 435)
2075
2076 (epcr0 512) (epcr1 513) (epcr2 514) (epcr3 515)
2077 (epcr4 516) (epcr5 517) (epcr6 518) (epcr7 519)
2078 (epcr8 520) (epcr9 521) (epcr10 522) (epcr11 523)
2079 (epcr12 524) (epcr13 525) (epcr14 526) (epcr15 527)
2080 (epcr16 528) (epcr17 529) (epcr18 530) (epcr19 531)
2081 (epcr20 532) (epcr21 533) (epcr22 534) (epcr23 535)
2082 (epcr24 536) (epcr25 537) (epcr26 538) (epcr27 539)
2083 (epcr28 540) (epcr29 541) (epcr30 542) (epcr31 543)
2084 (epcr32 544) (epcr33 545) (epcr34 546) (epcr35 547)
2085 (epcr36 548) (epcr37 549) (epcr38 550) (epcr39 551)
2086 (epcr40 552) (epcr41 553) (epcr42 554) (epcr43 555)
2087 (epcr44 556) (epcr45 557) (epcr46 558) (epcr47 559)
2088 (epcr48 560) (epcr49 561) (epcr50 562) (epcr51 563)
2089 (epcr52 564) (epcr53 565) (epcr54 566) (epcr55 567)
2090 (epcr56 568) (epcr57 569) (epcr58 570) (epcr59 571)
2091 (epcr60 572) (epcr61 573) (epcr62 574) (epcr63 575)
2092
2093 (esr0 576) (esr1 577) (esr2 578) (esr3 579)
2094 (esr4 580) (esr5 581) (esr6 582) (esr7 583)
2095 (esr8 584) (esr9 585) (esr10 586) (esr11 587)
2096 (esr12 588) (esr13 589) (esr14 590) (esr15 591)
2097 (esr16 592) (esr17 593) (esr18 594) (esr19 595)
2098 (esr20 596) (esr21 597) (esr22 598) (esr23 599)
2099 (esr24 600) (esr25 601) (esr26 602) (esr27 603)
2100 (esr28 604) (esr29 605) (esr30 606) (esr31 607)
2101 (esr32 608) (esr33 609) (esr34 610) (esr35 611)
2102 (esr36 612) (esr37 613) (esr38 614) (esr39 615)
2103 (esr40 616) (esr41 617) (esr42 618) (esr43 619)
2104 (esr44 620) (esr45 621) (esr46 622) (esr47 623)
2105 (esr48 624) (esr49 625) (esr50 626) (esr51 627)
2106 (esr52 628) (esr53 629) (esr54 630) (esr55 631)
2107 (esr56 632) (esr57 633) (esr58 634) (esr59 635)
2108 (esr60 636) (esr61 637) (esr62 638) (esr63 639)
2109
2110 (eir0 640) (eir1 641) (eir2 642) (eir3 643)
2111 (eir4 644) (eir5 645) (eir6 646) (eir7 647)
2112 (eir8 648) (eir9 649) (eir10 650) (eir11 651)
2113 (eir12 652) (eir13 653) (eir14 654) (eir15 655)
2114 (eir16 656) (eir17 657) (eir18 658) (eir19 659)
2115 (eir20 660) (eir21 661) (eir22 662) (eir23 663)
2116 (eir24 664) (eir25 665) (eir26 666) (eir27 667)
2117 (eir28 668) (eir29 669) (eir30 670) (eir31 671)
2118
2119 (esfr0 672) (esfr1 673)
2120
2121 (sr0 768) (sr1 769) (sr2 770) (sr3 771)
2122
2123 (fsr0 1024) (fsr1 1025) (fsr2 1026) (fsr3 1027)
2124 (fsr4 1028) (fsr5 1029) (fsr6 1030) (fsr7 1031)
2125 (fsr8 1032) (fsr9 1033) (fsr10 1034) (fsr11 1035)
2126 (fsr12 1036) (fsr13 1037) (fsr14 1038) (fsr15 1039)
2127 (fsr16 1040) (fsr17 1041) (fsr18 1042) (fsr19 1043)
2128 (fsr20 1044) (fsr21 1045) (fsr22 1046) (fsr23 1047)
2129 (fsr24 1048) (fsr25 1049) (fsr26 1050) (fsr27 1051)
2130 (fsr28 1052) (fsr29 1053) (fsr30 1054) (fsr31 1055)
2131 (fsr32 1056) (fsr33 1057) (fsr34 1058) (fsr35 1059)
2132 (fsr36 1060) (fsr37 1061) (fsr38 1062) (fsr39 1063)
2133 (fsr40 1064) (fsr41 1065) (fsr42 1066) (fsr43 1067)
2134 (fsr44 1068) (fsr45 1069) (fsr46 1070) (fsr47 1071)
2135 (fsr48 1072) (fsr49 1073) (fsr50 1074) (fsr51 1075)
2136 (fsr52 1076) (fsr53 1077) (fsr54 1078) (fsr55 1079)
2137 (fsr56 1080) (fsr57 1081) (fsr58 1082) (fsr59 1083)
2138 (fsr60 1084) (fsr61 1085) (fsr62 1086) (fsr63 1087)
2139
2140 ; FQ0-FQ31 are 64 bit registers.
2141 ; These names allow access to the upper 32 bits of the FQ registers.
2142 (fqop0 1088) (fqop1 1090) (fqop2 1092) (fqop3 1094)
2143 (fqop4 1096) (fqop5 1098) (fqop6 1100) (fqop7 1102)
2144 (fqop8 1104) (fqop9 1106) (fqop10 1108) (fqop11 1110)
2145 (fqop12 1112) (fqop13 1114) (fqop14 1116) (fqop15 1118)
2146 (fqop16 1120) (fqop17 1122) (fqop18 1124) (fqop19 1126)
2147 (fqop20 1128) (fqop21 1130) (fqop22 1132) (fqop23 1134)
2148 (fqop24 1136) (fqop25 1138) (fqop26 1140) (fqop27 1142)
2149 (fqop28 1144) (fqop29 1146) (fqop30 1148) (fqop31 1150)
2150 ; These names allow access to the lower 32 bits of the FQ registers.
2151 (fqst0 1089) (fqst1 1091) (fqst2 1093) (fqst3 1095)
2152 (fqst4 1097) (fqst5 1099) (fqst6 1101) (fqst7 1103)
2153 (fqst8 1105) (fqst9 1107) (fqst10 1109) (fqst11 1111)
2154 (fqst12 1113) (fqst13 1115) (fqst14 1117) (fqst15 1119)
2155 (fqst16 1121) (fqst17 1123) (fqst18 1125) (fqst19 1127)
2156 (fqst20 1129) (fqst21 1131) (fqst22 1133) (fqst23 1135)
2157 (fqst24 1137) (fqst25 1139) (fqst26 1141) (fqst27 1143)
2158 (fqst28 1145) (fqst29 1147) (fqst30 1149) (fqst31 1151)
2159 ; These also access the lower 32 bits of the FQ registers.
2160 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2161 ; (fq0 1089) (fq1 1091) (fq2 1093) (fq3 1095)
2162 ; (fq4 1097) (fq5 1099) (fq6 1101) (fq7 1103)
2163 ; (fq8 1105) (fq9 1107) (fq10 1109) (fq11 1111)
2164 ; (fq12 1113) (fq13 1115) (fq14 1117) (fq15 1119)
2165 ; (fq16 1121) (fq17 1123) (fq18 1125) (fq19 1127)
2166 ; (fq20 1129) (fq21 1131) (fq22 1133) (fq23 1135)
2167 ; (fq24 1137) (fq25 1139) (fq26 1141) (fq27 1143)
2168 ; (fq28 1145) (fq29 1147) (fq30 1149) (fq31 1151)
2169
2170 (mcilr0 1272) (mcilr1 1273)
2171
2172 (msr0 1280) (msr1 1281) (msr2 1282) (msr3 1283)
2173 (msr4 1284) (msr5 1285) (msr6 1286) (msr7 1287)
2174 (msr8 1288) (msr9 1289) (msr10 1290) (msr11 1291)
2175 (msr12 1292) (msr13 1293) (msr14 1294) (msr15 1295)
2176 (msr16 1296) (msr17 1297) (msr18 1298) (msr19 1299)
2177 (msr20 1300) (msr21 1301) (msr22 1302) (msr23 1303)
2178 (msr24 1304) (msr25 1305) (msr26 1306) (msr27 1307)
2179 (msr28 1308) (msr29 1309) (msr30 1310) (msr31 1311)
2180 (msr32 1312) (msr33 1313) (msr34 1314) (msr35 1315)
2181 (msr36 1316) (msr37 1317) (msr38 1318) (msr39 1319)
2182 (msr40 1320) (msr41 1321) (msr42 1322) (msr43 1323)
2183 (msr44 1324) (msr45 1325) (msr46 1326) (msr47 1327)
2184 (msr48 1328) (msr49 1329) (msr50 1330) (msr51 1331)
2185 (msr52 1332) (msr53 1333) (msr54 1334) (msr55 1335)
2186 (msr56 1336) (msr57 1337) (msr58 1338) (msr59 1339)
2187 (msr60 1340) (msr61 1341) (msr62 1342) (msr63 1343)
2188
2189 ; MQ0-MQ31 are 64 bit registers.
2190 ; These names allow access to the upper 32 bits of the MQ registers.
2191 (mqop0 1344) (mqop1 1346) (mqop2 1348) (mqop3 1350)
2192 (mqop4 1352) (mqop5 1354) (mqop6 1356) (mqop7 1358)
2193 (mqop8 1360) (mqop9 1362) (mqop10 1364) (mqop11 1366)
2194 (mqop12 1368) (mqop13 1370) (mqop14 1372) (mqop15 1374)
2195 (mqop16 1376) (mqop17 1378) (mqop18 1380) (mqop19 1382)
2196 (mqop20 1384) (mqop21 1386) (mqop22 1388) (mqop23 1390)
2197 (mqop24 1392) (mqop25 1394) (mqop26 1396) (mqop27 1398)
2198 (mqop28 1400) (mqop29 1402) (mqop30 1404) (mqop31 1406)
2199 ; These names allow access to the lower 32 bits of the MQ registers.
2200 (mqst0 1345) (mqst1 1347) (mqst2 1349) (mqst3 1351)
2201 (mqst4 1353) (mqst5 1355) (mqst6 1357) (mqst7 1359)
2202 (mqst8 1361) (mqst9 1363) (mqst10 1365) (mqst11 1367)
2203 (mqst12 1369) (mqst13 1371) (mqst14 1373) (mqst15 1375)
2204 (mqst16 1377) (mqst17 1379) (mqst18 1381) (mqst19 1383)
2205 (mqst20 1385) (mqst21 1387) (mqst22 1389) (mqst23 1391)
2206 (mqst24 1393) (mqst25 1395) (mqst26 1397) (mqst27 1399)
2207 (mqst28 1401) (mqst29 1403) (mqst30 1405) (mqst31 1407)
2208 ; These also access the lower 32 bits of the MQ registers.
2209 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2210 ; (mq0 1345) (mq1 1347) (mq2 1349) (mq3 1351)
2211 ; (mq4 1353) (mq5 1355) (mq6 1357) (mq7 1359)
2212 ; (mq8 1361) (mq9 1363) (mq10 1365) (mq11 1367)
2213 ; (mq12 1369) (mq13 1371) (mq14 1373) (mq15 1375)
2214 ; (mq16 1377) (mq17 1379) (mq18 1381) (mq19 1383)
2215 ; (mq20 1385) (mq21 1387) (mq22 1389) (mq23 1391)
2216 ; (mq24 1393) (mq25 1395) (mq26 1397) (mq27 1399)
2217 ; (mq28 1401) (mq29 1403) (mq30 1405) (mq31 1407)
2218
2219 ; These are not accessible as spr registers (see LSI appendix - section 13.4)
2220 ; (acc0 1408) (acc1 1409) (acc2 1410) (acc3 1411)
2221 ; (acc4 1412) (acc5 1413) (acc6 1414) (acc7 1415)
2222 ; (acc8 1416) (acc9 1417) (acc10 1418) (acc11 1419)
2223 ; (acc12 1420) (acc13 1421) (acc14 1422) (acc15 1423)
2224 ; (acc16 1424) (acc17 1425) (acc18 1426) (acc19 1427)
2225 ; (acc20 1428) (acc21 1429) (acc22 1430) (acc23 1431)
2226 ; (acc24 1432) (acc25 1433) (acc26 1434) (acc27 1435)
2227 ; (acc28 1436) (acc29 1437) (acc30 1438) (acc31 1439)
2228 ; (acc32 1440) (acc33 1441) (acc34 1442) (acc35 1443)
2229 ; (acc36 1444) (acc37 1445) (acc38 1446) (acc39 1447)
2230 ; (acc40 1448) (acc41 1449) (acc42 1450) (acc43 1451)
2231 ; (acc44 1452) (acc45 1453) (acc46 1454) (acc47 1455)
2232 ; (acc48 1456) (acc49 1457) (acc50 1458) (acc51 1459)
2233 ; (acc52 1460) (acc53 1461) (acc54 1462) (acc55 1463)
2234 ; (acc56 1464) (acc57 1465) (acc58 1466) (acc59 1467)
2235 ; (acc60 1468) (acc61 1469) (acc62 1470) (acc63 1471)
2236
2237 ; (accg0 1472) (accg1 1473) (accg2 1474) (accg3 1475)
2238 ; (accg4 1476) (accg5 1477) (accg6 1478) (accg7 1479)
2239 ; (accg8 1480) (accg9 1481) (accg10 1482) (accg11 1483)
2240 ; (accg12 1484) (accg13 1485) (accg14 1486) (accg15 1487)
2241 ; (accg16 1488) (accg17 1489) (accg18 1490) (accg19 1491)
2242 ; (accg20 1492) (accg21 1493) (accg22 1494) (accg23 1495)
2243 ; (accg24 1496) (accg25 1497) (accg26 1498) (accg27 1499)
2244 ; (accg28 1500) (accg29 1501) (accg30 1502) (accg31 1503)
2245 ; (accg32 1504) (accg33 1505) (accg34 1506) (accg35 1507)
2246 ; (accg36 1508) (accg37 1509) (accg38 1510) (accg39 1511)
2247 ; (accg40 1512) (accg41 1513) (accg42 1514) (accg43 1515)
2248 ; (accg44 1516) (accg45 1517) (accg46 1518) (accg47 1519)
2249 ; (accg48 1520) (accg49 1521) (accg50 1522) (accg51 1523)
2250 ; (accg52 1524) (accg53 1525) (accg54 1526) (accg55 1527)
2251 ; (accg56 1528) (accg57 1529) (accg58 1530) (accg59 1531)
2252 ; (accg60 1532) (accg61 1533) (accg62 1534) (accg63 1535)
2253
2254 (ear0 1536) (ear1 1537) (ear2 1538) (ear3 1539)
2255 (ear4 1540) (ear5 1541) (ear6 1542) (ear7 1543)
2256 (ear8 1544) (ear9 1545) (ear10 1546) (ear11 1547)
2257 (ear12 1548) (ear13 1549) (ear14 1550) (ear15 1551)
2258 (ear16 1552) (ear17 1553) (ear18 1554) (ear19 1555)
2259 (ear20 1556) (ear21 1557) (ear22 1558) (ear23 1559)
2260 (ear24 1560) (ear25 1561) (ear26 1562) (ear27 1563)
2261 (ear28 1564) (ear29 1565) (ear30 1566) (ear31 1567)
2262 (ear32 1568) (ear33 1569) (ear34 1570) (ear35 1571)
2263 (ear36 1572) (ear37 1573) (ear38 1574) (ear39 1575)
2264 (ear40 1576) (ear41 1577) (ear42 1578) (ear43 1579)
2265 (ear44 1580) (ear45 1581) (ear46 1582) (ear47 1583)
2266 (ear48 1584) (ear49 1585) (ear50 1586) (ear51 1587)
2267 (ear52 1588) (ear53 1589) (ear54 1590) (ear55 1591)
2268 (ear56 1592) (ear57 1593) (ear58 1594) (ear59 1595)
2269 (ear60 1596) (ear61 1597) (ear62 1598) (ear63 1599)
2270
2271 (edr0 1600) (edr1 1601) (edr2 1602) (edr3 1603)
2272 (edr4 1604) (edr5 1605) (edr6 1606) (edr7 1607)
2273 (edr8 1608) (edr9 1609) (edr10 1610) (edr11 1611)
2274 (edr12 1612) (edr13 1613) (edr14 1614) (edr15 1615)
2275 (edr16 1616) (edr17 1617) (edr18 1618) (edr19 1619)
2276 (edr20 1620) (edr21 1621) (edr22 1622) (edr23 1623)
2277 (edr24 1624) (edr25 1625) (edr26 1626) (edr27 1627)
2278 (edr28 1628) (edr29 1629) (edr30 1630) (edr31 1631)
2279 (edr32 1632) (edr33 1636) (edr34 1634) (edr35 1635)
2280 (edr36 1636) (edr37 1637) (edr38 1638) (edr39 1639)
2281 (edr40 1640) (edr41 1641) (edr42 1642) (edr43 1643)
2282 (edr44 1644) (edr45 1645) (edr46 1646) (edr47 1647)
2283 (edr48 1648) (edr49 1649) (edr50 1650) (edr51 1651)
2284 (edr52 1652) (edr53 1653) (edr54 1654) (edr55 1655)
2285 (edr56 1656) (edr57 1657) (edr58 1658) (edr59 1659)
2286 (edr60 1660) (edr61 1661) (edr62 1662) (edr63 1663)
2287
2288 (iamlr0 1664) (iamlr1 1665) (iamlr2 1666) (iamlr3 1667)
2289 (iamlr4 1668) (iamlr5 1669) (iamlr6 1670) (iamlr7 1671)
2290 (iamlr8 1672) (iamlr9 1673) (iamlr10 1674) (iamlr11 1675)
2291 (iamlr12 1676) (iamlr13 1677) (iamlr14 1678) (iamlr15 1679)
2292 (iamlr16 1680) (iamlr17 1681) (iamlr18 1682) (iamlr19 1683)
2293 (iamlr20 1684) (iamlr21 1685) (iamlr22 1686) (iamlr23 1687)
2294 (iamlr24 1688) (iamlr25 1689) (iamlr26 1690) (iamlr27 1691)
2295 (iamlr28 1692) (iamlr29 1693) (iamlr30 1694) (iamlr31 1695)
2296 (iamlr32 1696) (iamlr33 1697) (iamlr34 1698) (iamlr35 1699)
2297 (iamlr36 1700) (iamlr37 1701) (iamlr38 1702) (iamlr39 1703)
2298 (iamlr40 1704) (iamlr41 1705) (iamlr42 1706) (iamlr43 1707)
2299 (iamlr44 1708) (iamlr45 1709) (iamlr46 1710) (iamlr47 1711)
2300 (iamlr48 1712) (iamlr49 1713) (iamlr50 1714) (iamlr51 1715)
2301 (iamlr52 1716) (iamlr53 1717) (iamlr54 1718) (iamlr55 1719)
2302 (iamlr56 1720) (iamlr57 1721) (iamlr58 1722) (iamlr59 1723)
2303 (iamlr60 1724) (iamlr61 1725) (iamlr62 1726) (iamlr63 1727)
2304
2305 (iampr0 1728) (iampr1 1729) (iampr2 1730) (iampr3 1731)
2306 (iampr4 1732) (iampr5 1733) (iampr6 1734) (iampr7 1735)
2307 (iampr8 1736) (iampr9 1737) (iampr10 1738) (iampr11 1739)
2308 (iampr12 1740) (iampr13 1741) (iampr14 1742) (iampr15 1743)
2309 (iampr16 1744) (iampr17 1745) (iampr18 1746) (iampr19 1747)
2310 (iampr20 1748) (iampr21 1749) (iampr22 1750) (iampr23 1751)
2311 (iampr24 1752) (iampr25 1753) (iampr26 1754) (iampr27 1755)
2312 (iampr28 1756) (iampr29 1757) (iampr30 1758) (iampr31 1759)
2313 (iampr32 1760) (iampr33 1761) (iampr34 1762) (iampr35 1763)
2314 (iampr36 1764) (iampr37 1765) (iampr38 1766) (iampr39 1767)
2315 (iampr40 1768) (iampr41 1769) (iampr42 1770) (iampr43 1771)
2316 (iampr44 1772) (iampr45 1773) (iampr46 1774) (iampr47 1775)
2317 (iampr48 1776) (iampr49 1777) (iampr50 1778) (iampr51 1779)
2318 (iampr52 1780) (iampr53 1781) (iampr54 1782) (iampr55 1783)
2319 (iampr56 1784) (iampr57 1785) (iampr58 1786) (iampr59 1787)
2320 (iampr60 1788) (iampr61 1789) (iampr62 1790) (iampr63 1791)
2321
2322 (damlr0 1792) (damlr1 1793) (damlr2 1794) (damlr3 1795)
2323 (damlr4 1796) (damlr5 1797) (damlr6 1798) (damlr7 1799)
2324 (damlr8 1800) (damlr9 1801) (damlr10 1802) (damlr11 1803)
2325 (damlr12 1804) (damlr13 1805) (damlr14 1806) (damlr15 1807)
2326 (damlr16 1808) (damlr17 1809) (damlr18 1810) (damlr19 1811)
2327 (damlr20 1812) (damlr21 1813) (damlr22 1814) (damlr23 1815)
2328 (damlr24 1816) (damlr25 1817) (damlr26 1818) (damlr27 1819)
2329 (damlr28 1820) (damlr29 1821) (damlr30 1822) (damlr31 1823)
2330 (damlr32 1824) (damlr33 1825) (damlr34 1826) (damlr35 1827)
2331 (damlr36 1828) (damlr37 1829) (damlr38 1830) (damlr39 1831)
2332 (damlr40 1832) (damlr41 1833) (damlr42 1834) (damlr43 1835)
2333 (damlr44 1836) (damlr45 1837) (damlr46 1838) (damlr47 1839)
2334 (damlr48 1840) (damlr49 1841) (damlr50 1842) (damlr51 1843)
2335 (damlr52 1844) (damlr53 1845) (damlr54 1846) (damlr55 1847)
2336 (damlr56 1848) (damlr57 1849) (damlr58 1850) (damlr59 1851)
2337 (damlr60 1852) (damlr61 1853) (damlr62 1854) (damlr63 1855)
2338
2339 (dampr0 1856) (dampr1 1857) (dampr2 1858) (dampr3 1859)
2340 (dampr4 1860) (dampr5 1861) (dampr6 1862) (dampr7 1863)
2341 (dampr8 1864) (dampr9 1865) (dampr10 1866) (dampr11 1867)
2342 (dampr12 1868) (dampr13 1869) (dampr14 1870) (dampr15 1871)
2343 (dampr16 1872) (dampr17 1873) (dampr18 1874) (dampr19 1875)
2344 (dampr20 1876) (dampr21 1877) (dampr22 1878) (dampr23 1879)
2345 (dampr24 1880) (dampr25 1881) (dampr26 1882) (dampr27 1883)
2346 (dampr28 1884) (dampr29 1885) (dampr30 1886) (dampr31 1887)
2347 (dampr32 1888) (dampr33 1889) (dampr34 1890) (dampr35 1891)
2348 (dampr36 1892) (dampr37 1893) (dampr38 1894) (dampr39 1895)
2349 (dampr40 1896) (dampr41 1897) (dampr42 1898) (dampr43 1899)
2350 (dampr44 1900) (dampr45 1901) (dampr46 1902) (dampr47 1903)
2351 (dampr48 1904) (dampr49 1905) (dampr50 1906) (dampr51 1907)
2352 (dampr52 1908) (dampr53 1909) (dampr54 1910) (dampr55 1911)
2353 (dampr56 1912) (dampr57 1913) (dampr58 1914) (dampr59 1915)
2354 (dampr60 1916) (dampr61 1917) (dampr62 1918) (dampr63 1919)
2355
2356 (amcr 1920) (stbar 1921) (mmcr 1922)
2357 (dcr 2048) (brr 2049) (nmar 2050)
2358
2359 (ibar0 2052) (ibar1 2053) (ibar2 2054) (ibar3 2055)
2360 (dbar0 2056) (dbar1 2057) (dbar2 2058) (dbar3 2059)
2361
2362 (dbdr00 2060) (dbdr01 2061) (dbdr02 2062) (dbdr03 2063)
2363 (dbdr10 2064) (dbdr11 2065) (dbdr12 2066) (dbdr13 2067)
2364 (dbdr20 2068) (dbdr21 2069) (dbdr22 2070) (dbdr23 2071)
2365 (dbdr30 2072) (dbdr31 2073) (dbdr32 2074) (dbdr33 2075)
2366
2367 (dbmr00 2076) (dbmr01 2077) (dbmr02 2078) (dbmr03 2079)
2368 (dbmr10 2080) (dbmr11 2081) (dbmr12 2082) (dbmr13 2083)
2369 (dbmr20 2084) (dbmr21 2085) (dbmr22 2086) (dbmr23 2087)
2370 (dbmr30 2088) (dbmr31 2089) (dbmr32 2090) (dbmr33 2091)
2371
2372 (cpcfr 2092) (cpcr 2093) (cpsr 2094)
2373
2374 (cpesr0 2096) (cpesr1 2097)
2375 (cpemr0 2098) (cpemr1 2099)
2376
2377 (ihsr8 3848)
2378 )
2379 )
2380
2381 (define-hardware
2382 (name h-spr)
2383 (comment "special purpose registers")
2384 (attrs PROFILE)
2385 (type register UWI (4096))
2386 (indices extern-keyword spr-names)
2387 (get (index) (c-call UWI "@cpu@_h_spr_get_handler" index))
2388 (set (index newval) (c-call VOID "@cpu@_h_spr_set_handler" index newval))
2389 )
2390
2391 (define-pmacro (spr-pcsr) (reg h-spr 1))
2392 (define-pmacro (spr-bpcsr) (reg h-spr 2))
2393 (define-pmacro (spr-lr) (reg h-spr 272))
2394 (define-pmacro (spr-lcr) (reg h-spr 273))
2395 (define-pmacro (spr-iacc0h) (reg h-spr 280))
2396 (define-pmacro (spr-iacc0l) (reg h-spr 281))
2397 (define-pmacro (spr-sr0) (reg h-spr 768))
2398 (define-pmacro (spr-sr1) (reg h-spr 769))
2399 (define-pmacro (spr-sr2) (reg h-spr 770))
2400 (define-pmacro (spr-sr3) (reg h-spr 771))
2401
2402 ; Accumulator guard. Actually a subset of the SPR registers, but those SPRs
2403 ; are read-only in most insns. This hardware element is used by those insns
2404 ; which have direct access (mwtaccg, mrdaccg).
2405 (define-keyword
2406 (name accg-names)
2407 (print-name h-accg)
2408 (prefix "")
2409 (values
2410 (accg0 0)(accg1 1)(accg2 2)(accg3 3)
2411 (accg4 4)(accg5 5)(accg6 6)(accg7 7)
2412 (accg8 8)(accg9 9)(accg10 10)(accg11 11)
2413 (accg12 12)(accg13 13)(accg14 14)(accg15 15)
2414 (accg16 16)(accg17 17)(accg18 18)(accg19 19)
2415 (accg20 20)(accg21 21)(accg22 22)(accg23 23)
2416 (accg24 24)(accg25 25)(accg26 26)(accg27 27)
2417 (accg28 28)(accg29 29)(accg30 30)(accg31 31)
2418 (accg32 32)(accg33 33)(accg34 34)(accg35 35)
2419 (accg36 36)(accg37 37)(accg38 38)(accg39 39)
2420 (accg40 40)(accg41 41)(accg42 42)(accg43 43)
2421 (accg44 44)(accg45 45)(accg46 46)(accg47 47)
2422 (accg48 48)(accg49 49)(accg50 50)(accg51 51)
2423 (accg52 52)(accg53 53)(accg54 54)(accg55 55)
2424 (accg56 56)(accg57 57)(accg58 58)(accg59 59)
2425 (accg60 60)(accg61 61)(accg62 62)(accg63 63)
2426 )
2427 )
2428
2429 (define-hardware
2430 (name h-accg)
2431 (comment "accumulator guard")
2432 (attrs PROFILE VIRTUAL)
2433 (type register UWI (64))
2434 (indices extern-keyword accg-names)
2435 (get (index)
2436 (and (reg h-spr (add index 1472)) #xff))
2437 (set (index newval)
2438 (set (raw-reg UWI h-spr (add index 1472)) (and newval #xff)))
2439 )
2440
2441 ; 40 bit accumulator. Composed of ACCG and ACC registers concatenated, but
2442 ; referenced more often as the composed 40 bits.
2443 (define-keyword
2444 (name acc-names)
2445 (print-name h-acc40)
2446 (prefix "")
2447 (values
2448 (acc0 0)(acc1 1)(acc2 2)(acc3 3)(acc4 4)(acc5 5)(acc6 6)(acc7 7)
2449 (acc8 8)(acc9 9)(acc10 10)(acc11 11)(acc12 12)(acc13 13)(acc14 14)(acc15 15)
2450 (acc16 16)(acc17 17)(acc18 18)(acc19 19)(acc20 20)(acc21 21)(acc22 22)(acc23 23)
2451 (acc24 24)(acc25 25)(acc26 26)(acc27 27)(acc28 28)(acc29 29)(acc30 30)(acc31 31)
2452 (acc32 32)(acc33 33)(acc34 34)(acc35 35)(acc36 36)(acc37 37)(acc38 38)(acc39 39)
2453 (acc40 40)(acc41 41)(acc42 42)(acc43 43)(acc44 44)(acc45 45)(acc46 46)(acc47 47)
2454 (acc48 48)(acc49 49)(acc50 50)(acc51 51)(acc52 52)(acc53 53)(acc54 54)(acc55 55)
2455 (acc56 56)(acc57 57)(acc58 58)(acc59 59)(acc60 60)(acc61 61)(acc62 62)(acc63 63)
2456 )
2457 )
2458
2459 (define-hardware
2460 (name h-acc40S)
2461 (comment "40 bit signed accumulator")
2462 (attrs PROFILE VIRTUAL)
2463 (type register DI (64))
2464 (indices extern-keyword acc-names)
2465 ; The accumlator is made up of two 32 bit registers, accgi/acci.
2466 ; We want to extract this as a combined 40 signed bits
2467 (get (index)
2468 (or DI
2469 (sll DI (ext DI (trunc QI (reg h-spr (add index 1472))))
2470 32)
2471 (zext DI (reg h-spr (add index 1408)))))
2472 ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
2473 ; on ACC and ACCG registers
2474 (set (index newval)
2475 (sequence ()
2476 (c-call VOID "frv_check_spr_write_access" (add index 1408))
2477 (set (raw-reg UWI h-spr
2478 (add index 1472)) (and (srl newval 32) #xff))
2479 (set (raw-reg UWI h-spr
2480 (add index 1408)) (trunc USI newval))))
2481 )
2482
2483 (define-hardware
2484 (name h-acc40U)
2485 (comment "40 bit unsigned accumulator")
2486 (attrs PROFILE VIRTUAL)
2487 (type register UDI (64))
2488 (indices extern-keyword acc-names)
2489 ; The accumlator is made up of two 32 bit registers, accgi/acci.
2490 ; We want to extract this as a combined 40 unsigned bits
2491 (get (index)
2492 (or DI
2493 (sll DI (zext DI (reg h-spr (add index 1472))) 32)
2494 (zext DI (reg h-spr (add index 1408)))))
2495 ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions
2496 ; on ACC and ACCG registers
2497 (set (index newval)
2498 (sequence ()
2499 (c-call VOID "frv_check_spr_write_access" (add index 1408))
2500 (set (raw-reg UWI h-spr
2501 (add index 1472)) (and (srl newval 32) #xff))
2502 (set (raw-reg UWI h-spr
2503 (add index 1408)) (trunc USI newval))))
2504 )
2505 ; 64-bit signed accumulator. Composed of iacc0h and iacc0l registers
2506 ; concatenated, but referenced more often as the composed 64 bits.
2507 (define-keyword
2508 ; This is totally hokey -- I have to have an index!
2509 (name iacc0-names)
2510 (print-name h-iacc0)
2511 (prefix "")
2512 (values (iacc0 0))
2513 )
2514
2515 (define-hardware
2516 (name h-iacc0)
2517 (comment "64 bit signed accumulator")
2518 (attrs PROFILE VIRTUAL (MACH fr400))
2519 (type register DI (1))
2520 (indices extern-keyword iacc0-names)
2521 ; The single 64-bit integer accumulator is made up of two 32 bit
2522 ; registers, iacc0h and iacc0l. We want to extract this as a
2523 ; combined 64 signed bits.
2524 (get (idx) (or DI (sll DI (ext DI (spr-iacc0h)) 32) (zext DI (spr-iacc0l))))
2525 (set (idx newval)
2526 (sequence ()
2527 (set (spr-iacc0h) (trunc SI (srl newval 32)))
2528 (set (spr-iacc0l) (trunc SI newval))))
2529 )
2530
2531 ; Integer condition code registers (CCR)
2532 ;
2533 ; The individual sub registers bits of the CCR are referenced more often than
2534 ; the entire register so set them directly. We can assemble the
2535 ; entire register when necessary.
2536 ;
2537 (define-keyword
2538 (name iccr-names)
2539 (print-name h-iccr)
2540 (prefix "")
2541 (values (icc0 0) (icc1 1) (icc2 2) (icc3 3))
2542 )
2543
2544 (define-hardware
2545 (name h-iccr)
2546 (comment "Integer condition code registers")
2547 (attrs PROFILE)
2548 (type register UQI (4))
2549 (indices extern-keyword iccr-names)
2550 )
2551
2552 ; Floating point condition code registers (CCR)
2553 ;
2554 ; The individual sub registers bits of the CCR are referenced more often than
2555 ; the entire register so set them directly. We can assemble the
2556 ; entire register when necessary.
2557 ;
2558 (define-keyword
2559 (name fccr-names)
2560 (print-name h-fccr)
2561 (prefix "")
2562 (values (fcc0 0) (fcc1 1) (fcc2 2) (fcc3 3))
2563 )
2564
2565 (define-hardware
2566 (name h-fccr)
2567 (comment "Floating point condition code registers")
2568 (attrs PROFILE)
2569 (type register UQI (4))
2570 (indices extern-keyword fccr-names)
2571 )
2572
2573 ; C condition code registers (CCCR)
2574 ;
2575 (define-keyword
2576 (name cccr-names)
2577 (print-name h-cccr)
2578 (prefix "")
2579 (values (cc0 0) (cc1 1) (cc2 2) (cc3 3) (cc4 4) (cc5 5) (cc6 6) (cc7 7))
2580 )
2581
2582 (define-hardware
2583 (name h-cccr)
2584 (comment "Condition code registers")
2585 (attrs PROFILE)
2586 (type register UQI (8))
2587 (indices extern-keyword cccr-names)
2588 )
2589 \f
2590 ; Dummy hardware used to define packing bit on insns
2591 ;
2592 (define-hardware
2593 (name h-pack)
2594 (comment "Packing bit dummy hardware")
2595 (type immediate (UINT 1))
2596 (values keyword "" (("" 1) (".p" 0) (".P" 0)))
2597 )
2598 ; Dummy hardware used to define hint field for branches always taken
2599 ;
2600 (define-hardware
2601 (name h-hint-taken)
2602 (comment "Branch taken hint dummy hardware")
2603 (type immediate (UINT 1))
2604 ; The order of these is important. We want '2' to get written by default,
2605 ; but we also want the docoder/disassembler to allow the values '0', '1' and
2606 ; '3'.
2607 (values keyword "" (("" 2) ("" 0) ("" 1) ("" 3)))
2608 )
2609 ; Dummy hardware used to define hint field for branches never taken
2610 ;
2611 (define-hardware
2612 (name h-hint-not-taken)
2613 (comment "Branch not taken hint dummy hardware")
2614 (type immediate (UINT 1))
2615 ; The order of these is important. We want '0' to get written by default,
2616 ; but we also want the docoder/disassembler to allow the values '1', '2' and
2617 ; '3'.
2618 (values keyword "" (("" 0) ("" 1) ("" 2) ("" 3)))
2619 )
2620 \f
2621 ; Instruction Operands.
2622 ; These entries provide a layer between the assembler and the raw hardware
2623 ; description, and are used to refer to hardware elements in the semantic
2624 ; code. Usually there's a bit of over-specification, but in more complicated
2625 ; instruction sets there isn't.
2626
2627 ; FRV specific operand attributes:
2628
2629 (define-attr
2630 (for operand)
2631 (type boolean)
2632 (name HASH-PREFIX)
2633 (comment "immediates have an optional '#' prefix")
2634 )
2635
2636 ; ??? Convention says this should be o-sr, but then the insn definitions
2637 ; should refer to o-sr which is clumsy. The "o-" could be implicit, but
2638 ; then it should be implicit for all the symbols here, but then there would
2639 ; be confusion between (f-)simm8 and (h-)simm8.
2640 ; So for now the rule is exactly as it appears here.
2641
2642 ; dnmop: define-normal-mode-operand: temporary, pending potential removal
2643 ; of modes from h/w.
2644 (define-pmacro (dnmop xname xcomment xattrs xtype xindex xmode)
2645 (define-operand
2646 (name xname)
2647 (comment xcomment)
2648 (.splice attrs (.unsplice xattrs))
2649 (type xtype)
2650 (index xindex)
2651 (mode xmode)
2652 )
2653 )
2654
2655 (dnop pack "packing bit" () h-pack f-pack)
2656
2657 (dnmop GRi "source register 1" () h-gr f-GRi SI)
2658 (dnmop GRj "source register 2" () h-gr f-GRj SI)
2659 (dnmop GRk "destination register" () h-gr f-GRk SI)
2660 (dnmop GRkhi "destination register" () h-gr_hi f-GRk UHI)
2661 (dnmop GRklo "destination register" () h-gr_lo f-GRk UHI)
2662 (dnmop GRdoublek "destination register" () h-gr_double f-GRk DI)
2663 (dnmop ACC40Si "signed accumulator" () h-acc40S f-ACC40Si DI)
2664 (dnmop ACC40Ui "unsigned accumulator" () h-acc40U f-ACC40Ui UDI)
2665 (dnmop ACC40Sk "target accumulator" () h-acc40S f-ACC40Sk DI)
2666 (dnmop ACC40Uk "target accumulator" () h-acc40U f-ACC40Uk UDI)
2667 (dnmop ACCGi "source register" () h-accg f-ACCGi UWI)
2668 (dnmop ACCGk "target register" () h-accg f-ACCGk UWI)
2669
2670 (dnmop CPRi "source register" ((MACH frv)) h-cpr f-CPRi SI)
2671 (dnmop CPRj "source register" ((MACH frv)) h-cpr f-CPRj SI)
2672 (dnmop CPRk "destination register" ((MACH frv)) h-cpr f-CPRk SI)
2673 (dnmop CPRdoublek "destination register" ((MACH frv)) h-cpr_double f-CPRk DI)
2674
2675 ; floating point operands
2676 (dnmop FRinti "source register 1" () h-fr_int f-FRi SI)
2677 (dnmop FRintj "source register 2" () h-fr_int f-FRj SI)
2678 (dnmop FRintk "target register" () h-fr_int f-FRk SI)
2679 (dnmop FRi "source register 1" () h-fr f-FRi SF)
2680 (dnmop FRj "source register 2" () h-fr f-FRj SF)
2681 (dnmop FRk "destination register" () h-fr f-FRk SF)
2682 (dnmop FRkhi "destination register" () h-fr_hi f-FRk UHI)
2683 (dnmop FRklo "destination register" () h-fr_lo f-FRk UHI)
2684 (dnmop FRdoublei "source register 1" () h-fr_double f-FRi DF)
2685 (dnmop FRdoublej "source register 2" () h-fr_double f-FRj DF)
2686 (dnmop FRdoublek "target register" () h-fr_double f-FRk DF)
2687
2688 (dnop CRi "source register 1" () h-cccr f-CRi)
2689 (dnop CRj "source register 2" () h-cccr f-CRj)
2690 (dnop CRj_int "destination register" () h-cccr f-CRj_int)
2691 (dnop CRj_float "destination register" () h-cccr f-CRj_float)
2692 (dnop CRk "destination register" () h-cccr f-CRk)
2693 (dnop CCi "condition register" () h-cccr f-CCi)
2694
2695 (dnop ICCi_1 "condition register" () h-iccr f-ICCi_1)
2696 (dnop ICCi_2 "condition register" () h-iccr f-ICCi_2)
2697 (dnop ICCi_3 "condition register" () h-iccr f-ICCi_3)
2698 (dnop FCCi_1 "condition register" () h-fccr f-FCCi_1)
2699 (dnop FCCi_2 "condition register" () h-fccr f-FCCi_2)
2700 (dnop FCCi_3 "condition register" () h-fccr f-FCCi_3)
2701 (dnop FCCk "condition register" () h-fccr f-FCCk)
2702
2703 (dnop eir "exception insn reg" () h-uint f-eir)
2704 (dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10)
2705 (dnop u16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-u16)
2706 (dnop s16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-s16)
2707 (dnop s6 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6)
2708 (dnop s6_1 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6_1)
2709 (dnop u6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-u6)
2710 (dnop s5 "5 bit signed immediate" (HASH-PREFIX) h-sint f-s5)
2711 (dnop cond "conditional arithmetic" (HASH-PREFIX) h-uint f-cond)
2712 (dnop ccond "lr branch condition" (HASH-PREFIX) h-uint f-ccond)
2713 (dnop hint "2 bit branch predictor" (HASH-PREFIX) h-uint f-hint)
2714 (dnop hint_taken "2 bit branch predictor" () h-hint-taken f-hint)
2715 (dnop hint_not_taken "2 bit branch predictor" () h-hint-not-taken f-hint)
2716
2717 (dnop LI "link indicator" () h-uint f-LI)
2718 (dnop lock "cache lock indicator" (HASH-PREFIX) h-uint f-lock)
2719 (dnop debug "debug mode indicator" (HASH-PREFIX) h-uint f-debug)
2720 (dnop ae "all entries indicator" (HASH-PREFIX) h-uint f-ae)
2721
2722 (dnop label16 "18 bit pc relative address" () h-iaddr f-label16)
2723 (dnop label24 "26 bit pc relative address" () h-iaddr f-label24)
2724
2725 (define-operand
2726 (name A0)
2727 (comment "A==0 operand of mclracc")
2728 (attrs)
2729 (type h-uint)
2730 (index f-A)
2731 (mode USI)
2732 (handlers (parse "A0"))
2733 )
2734
2735 (define-operand
2736 (name A1)
2737 (comment "A==1 operand of mclracc")
2738 (attrs)
2739 (type h-uint)
2740 (index f-A)
2741 (mode USI)
2742 (handlers (parse "A1"))
2743 )
2744
2745 (define-operand
2746 (name FRintieven)
2747 (comment "(even) source register 1")
2748 (attrs)
2749 (type h-fr_int)
2750 (index f-FRi)
2751 (mode SI)
2752 (handlers (parse "even_register"))
2753 )
2754
2755 (define-operand
2756 (name FRintjeven)
2757 (comment "(even) source register 2")
2758 (attrs)
2759 (type h-fr_int)
2760 (index f-FRj)
2761 (mode SI)
2762 (handlers (parse "even_register"))
2763 )
2764
2765 (define-operand
2766 (name FRintkeven)
2767 (comment "(even) target register")
2768 (attrs)
2769 (type h-fr_int)
2770 (index f-FRk)
2771 (mode SI)
2772 (handlers (parse "even_register"))
2773 )
2774
2775 (define-operand
2776 (name d12)
2777 (comment "12 bit signed immediate")
2778 (attrs)
2779 (type h-sint)
2780 (index f-d12)
2781 (handlers (parse "d12"))
2782 )
2783
2784 (define-operand
2785 (name s12)
2786 (comment "12 bit signed immediate")
2787 (attrs HASH-PREFIX)
2788 (type h-sint)
2789 (index f-d12)
2790 (handlers (parse "s12"))
2791 )
2792
2793 (define-operand
2794 (name u12)
2795 (comment "12 bit signed immediate")
2796 (attrs HASH-PREFIX)
2797 (type h-sint)
2798 (index f-u12)
2799 (handlers (parse "u12"))
2800 )
2801
2802 (define-operand
2803 (name spr)
2804 (comment "special purpose register")
2805 (attrs)
2806 (type h-spr)
2807 (index f-spr)
2808 (handlers (parse "spr") (print "spr"))
2809 )
2810
2811 (define-operand
2812 (name ulo16)
2813 (comment "16 bit unsigned immediate, for #lo()")
2814 (attrs)
2815 (type h-uint)
2816 (index f-u16)
2817 (handlers (parse "ulo16") (print "lo"))
2818 )
2819
2820 (define-operand
2821 (name slo16)
2822 (comment "16 bit unsigned immediate, for #lo()")
2823 (attrs)
2824 (type h-sint)
2825 (index f-s16)
2826 (handlers (parse "uslo16") (print "lo"))
2827 )
2828
2829 (define-operand
2830 (name uhi16)
2831 (comment "16 bit unsigned immediate, for #hi()")
2832 (attrs)
2833 (type h-uint)
2834 (index f-u16)
2835 (handlers (parse "uhi16") (print "hi"))
2836 )
2837
2838 ; operands representing hardware
2839 ;
2840 (dnop psr_esr "PSR.ESR bit" (SEM-ONLY) h-psr_esr f-nil)
2841 (dnop psr_s "PSR.S bit" (SEM-ONLY) h-psr_s f-nil)
2842 (dnop psr_ps "PSR.PS bit" (SEM-ONLY) h-psr_ps f-nil)
2843 (dnop psr_et "PSR.ET bit" (SEM-ONLY) h-psr_et f-nil)
2844
2845 (dnop bpsr_bs "BPSR.BS bit" (SEM-ONLY) h-bpsr_bs f-nil)
2846 (dnop bpsr_bet "BPSR.BET bit" (SEM-ONLY) h-bpsr_bet f-nil)
2847
2848 (dnop tbr_tba "TBR.TBA" (SEM-ONLY) h-tbr_tba f-nil)
2849 (dnop tbr_tt "TBR.TT" (SEM-ONLY) h-tbr_tt f-nil)
2850
2851 ; Null operands
2852 ;
2853 (define-pmacro (ICCi_1-null) (f-ICCi_1-null 0))
2854 (define-pmacro (ICCi_2-null) (f-ICCi_2-null 0))
2855 (define-pmacro (ICCi_3-null) (f-ICCi_3-null 0))
2856 (define-pmacro (FCCi_1-null) (f-FCCi_1-null 0))
2857 (define-pmacro (FCCi_2-null) (f-FCCi_2-null 0))
2858 (define-pmacro (FCCi_3-null) (f-FCCi_3-null 0))
2859 (define-pmacro (rs-null) (f-rs-null 0))
2860 (define-pmacro (GRi-null) (f-GRi-null 0))
2861 (define-pmacro (GRj-null) (f-GRj-null 0))
2862 (define-pmacro (GRk-null) (f-GRk-null 0))
2863 (define-pmacro (FRi-null) (f-FRi-null 0))
2864 (define-pmacro (FRj-null) (f-FRj-null 0))
2865 (define-pmacro (ACCj-null) (f-ACCj-null 0))
2866 (define-pmacro (rd-null) (f-rd-null 0))
2867 (define-pmacro (cond-null) (f-cond-null 0))
2868 (define-pmacro (ccond-null) (f-ccond-null 0))
2869 (define-pmacro (s12-null) (f-s12-null 0))
2870 (define-pmacro (label16-null) (f-label16-null 0))
2871 (define-pmacro (misc-null-1) (f-misc-null-1 0))
2872 (define-pmacro (misc-null-2) (f-misc-null-2 0))
2873 (define-pmacro (misc-null-3) (f-misc-null-3 0))
2874 (define-pmacro (misc-null-4) (f-misc-null-4 0))
2875 (define-pmacro (misc-null-5) (f-misc-null-5 0))
2876 (define-pmacro (misc-null-6) (f-misc-null-6 0))
2877 (define-pmacro (misc-null-7) (f-misc-null-7 0))
2878 (define-pmacro (misc-null-8) (f-misc-null-8 0))
2879 (define-pmacro (misc-null-9) (f-misc-null-9 0))
2880 (define-pmacro (misc-null-10) (f-misc-null-10 0))
2881 (define-pmacro (misc-null-11) (f-misc-null-11 0))
2882
2883 (define-pmacro (LI-on) (f-LI-on 1))
2884 (define-pmacro (LI-off) (f-LI-off 0))
2885 \f
2886 ; Instruction definitions.
2887 ;
2888 ; Notes:
2889 ; - dni is short for "define-normal-instruction"
2890 ; - Macros are used to represent each insn format. These should be used as much
2891 ; as possible unless an insn has exceptional behaviour
2892 ;
2893
2894 ; Commonly used Macros
2895 ;
2896 ; Specific registers
2897 ;
2898
2899 ; Integer condition code manipulation
2900 ;
2901 (define-pmacro (set-z-and-n icc x)
2902 (if (eq x 0)
2903 (set icc (or (and icc #x7) #x4))
2904 (if (lt x 0)
2905 (set icc (or (and icc #xb) #x8))
2906 (set icc (and icc #x3))))
2907 )
2908
2909 (define-pmacro (set-n icc val)
2910 (if (eq val 0)
2911 (set icc (and icc #x7))
2912 (set icc (or icc #x8)))
2913 )
2914
2915 (define-pmacro (set-z icc val)
2916 (if (eq val 0)
2917 (set icc (and icc #xb))
2918 (set icc (or icc #x4)))
2919 )
2920
2921 (define-pmacro (set-v icc val)
2922 (if (eq val 0)
2923 (set icc (and icc #xd))
2924 (set icc (or icc #x2)))
2925 )
2926
2927 (define-pmacro (set-c icc val)
2928 (if (eq val 0)
2929 (set icc (and icc #xe))
2930 (set icc (or icc #x1)))
2931 )
2932
2933 (define-pmacro (nbit icc)
2934 (trunc BI (srl (and icc #x8) 3))
2935 )
2936
2937 (define-pmacro (zbit icc)
2938 (trunc BI (srl (and icc #x4) 2))
2939 )
2940
2941 (define-pmacro (vbit icc)
2942 (trunc BI (srl (and icc #x2) 1))
2943 )
2944
2945 (define-pmacro (cbit icc)
2946 (trunc BI (and icc #x1))
2947 )
2948
2949 (define-pmacro (ebit icc)
2950 (trunc BI (srl (and icc #x8) 3))
2951 )
2952
2953 (define-pmacro (lbit icc)
2954 (trunc BI (srl (and icc #x4) 2))
2955 )
2956
2957 (define-pmacro (gbit icc)
2958 (trunc BI (srl (and icc #x2) 1))
2959 )
2960
2961 (define-pmacro (ubit icc)
2962 (trunc BI (and icc #x1))
2963 )
2964
2965 ; FRV insns
2966 ;
2967 ;
2968 ; Format: INT, Logic, Shift r-r
2969 ;
2970 (define-pmacro (int-logic-r-r name operation op ope comment)
2971 (dni name
2972 (comment)
2973 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
2974 (.str name "$pack $GRi,$GRj,$GRk")
2975 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
2976 (set GRk (operation GRi GRj))
2977 ((fr400 (unit u-integer))
2978 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
2979 )
2980 )
2981
2982 (int-logic-r-r add add OP_00 OPE2_00 "add reg/reg")
2983 (int-logic-r-r sub sub OP_00 OPE2_04 "sub reg/reg")
2984 (int-logic-r-r and and OP_01 OPE2_00 "and reg/reg")
2985 (int-logic-r-r or or OP_01 OPE2_02 "or reg/reg")
2986 (int-logic-r-r xor xor OP_01 OPE2_04 "xor reg/reg")
2987
2988 (dni not
2989 ("not")
2990 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
2991 ("not$pack $GRj,$GRk")
2992 (+ pack GRk OP_01 (rs-null) (ICCi_1-null) OPE2_06 GRj)
2993 (set GRk (inv GRj))
2994 ((fr400 (unit u-integer))
2995 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
2996 )
2997
2998 (dni sdiv
2999 "signed division"
3000 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3001 "sdiv$pack $GRi,$GRj,$GRk"
3002 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0E GRj)
3003 (sequence ()
3004 (c-call VOID "@cpu@_signed_integer_divide"
3005 GRi GRj (index-of GRk) 0)
3006 (clobber GRk))
3007 ((fr400 (unit u-idiv))
3008 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3009 )
3010
3011 (dni nsdiv
3012 "non excepting signed division"
3013 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3014 (MACH simple,tomcat,fr500,fr550,frv))
3015 "nsdiv$pack $GRi,$GRj,$GRk"
3016 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0E GRj)
3017 (sequence ()
3018 (c-call VOID "@cpu@_signed_integer_divide"
3019 GRi GRj (index-of GRk) 1)
3020 (clobber GRk))
3021 ((fr400 (unit u-idiv))
3022 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3023 )
3024
3025 (dni udiv
3026 "unsigned division reg/reg"
3027 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3028 "udiv$pack $GRi,$GRj,$GRk"
3029 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0F GRj)
3030 (sequence ()
3031 (c-call VOID "@cpu@_unsigned_integer_divide"
3032 GRi GRj (index-of GRk) 0)
3033 (clobber GRk))
3034 ((fr400 (unit u-idiv))
3035 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3036 )
3037
3038 (dni nudiv
3039 "non excepting unsigned division"
3040 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3041 (MACH simple,tomcat,fr500,fr550,frv))
3042 "nudiv$pack $GRi,$GRj,$GRk"
3043 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0F GRj)
3044 (sequence ()
3045 (c-call VOID "@cpu@_unsigned_integer_divide"
3046 GRi GRj (index-of GRk) 1)
3047 (clobber GRk))
3048 ((fr400 (unit u-idiv))
3049 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3050 )
3051
3052 ; Multiplication
3053 ;
3054 (define-pmacro (multiply-r-r name signop op ope comment)
3055 (dni name
3056 (comment)
3057 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3058 (.str name "$pack $GRi,$GRj,$GRdoublek")
3059 (+ pack GRdoublek op GRi (ICCi_1-null) ope GRj)
3060 (set GRdoublek (mul DI (signop DI GRi) (signop DI GRj)))
3061 ((fr400 (unit u-imul))
3062 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3063 )
3064 )
3065
3066 (multiply-r-r smul ext OP_00 OPE2_08 "signed multiply reg/reg")
3067 (multiply-r-r umul zext OP_00 OPE2_0A "unsigned multiply reg/reg")
3068
3069 ; Multiplication with integer accumulator IACC
3070 ;
3071
3072 (define-pmacro (iacc-set value)
3073 (set (reg h-iacc0 0) value))
3074
3075 (define-pmacro (iacc-add value)
3076 (set (reg h-iacc0 0)
3077 (cond DI
3078 ((andif (andif (gt value 0) (gt (reg h-iacc0 0) 0))
3079 (lt (sub DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3080 ; Positive overflow
3081 (const DI #x7fffffffffffffff))
3082 ((andif (andif (lt value 0) (lt (reg h-iacc0 0) 0))
3083 (gt (sub DI #x8000000000000000 value) (reg h-iacc0 0)))
3084 ; Negative overflow
3085 (const DI #x8000000000000000))
3086 (else
3087 (add DI (reg h-iacc0 0) value))))
3088 )
3089
3090 (define-pmacro (iacc-sub value)
3091 (set (reg h-iacc0 0)
3092 (cond DI
3093 ((andif (andif (lt value 0) (gt (reg h-iacc0 0) 0))
3094 (lt (add DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3095 ; Positive overflow
3096 (const DI #x7fffffffffffffff))
3097 ((andif (andif (gt value 0) (lt (reg h-iacc0 0) 0))
3098 (gt (add DI #x8000000000000000 value) (reg h-iacc0 0)))
3099 ; Negative overflow
3100 (const DI #x8000000000000000))
3101 (else
3102 (sub DI (reg h-iacc0 0) value))))
3103 )
3104
3105 (define-pmacro (iacc-multiply-r-r name operation op ope comment)
3106 (dni name
3107 (comment)
3108 ((UNIT MULT-DIV) (FR400-MAJOR I-1) (MACH fr400))
3109 (.str name "$pack $GRi,$GRj")
3110 (+ pack (rd-null) op GRi ope GRj)
3111 ((.sym iacc- operation) (mul DI (ext DI GRi) (ext DI GRj)))
3112 ((fr400 (unit u-integer)))
3113 )
3114 )
3115
3116 (iacc-multiply-r-r smu set OP_46 OPE1_05 "Signed multiply reg/reg/iacc")
3117 (iacc-multiply-r-r smass add OP_46 OPE1_06 "Signed multiply/add reg/reg/iacc")
3118 (iacc-multiply-r-r smsss sub OP_46 OPE1_07 "Signed multiply/sub reg/reg/iacc")
3119
3120 (define-pmacro (int-shift-r-r name op ope comment)
3121 (dni name
3122 (comment)
3123 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3124 (.str name "$pack $GRi,$GRj,$GRk")
3125 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
3126 (set GRk (name GRi (and GRj #x1f)))
3127 ((fr400 (unit u-integer))
3128 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3129 )
3130 )
3131
3132 (int-shift-r-r sll OP_01 OPE2_08 "shift left logical reg/reg")
3133 (int-shift-r-r srl OP_01 OPE2_0A "shift right logical reg/reg")
3134 (int-shift-r-r sra OP_01 OPE2_0C "shift right arith reg/reg")
3135
3136 (dni slass
3137 "shift left arith reg/reg with saturation"
3138 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3139 "slass$pack $GRi,$GRj,$GRk"
3140 (+ pack GRk OP_46 GRi OPE1_02 GRj)
3141 (set GRk (c-call SI "@cpu@_shift_left_arith_saturate" GRi GRj))
3142 ()
3143 )
3144
3145 (dni scutss
3146 "Integer accumulator cut with saturation"
3147 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3148 "scutss$pack $GRj,$GRk"
3149 (+ pack GRk OP_46 (rs-null) OPE1_04 GRj)
3150 (set GRk (c-call SI "@cpu@_iacc_cut" (reg h-iacc0 0) GRj))
3151 ()
3152 )
3153
3154 (define-pmacro (scan-semantics arg1 arg2 targ)
3155 (sequence ((WI tmp1) (WI tmp2))
3156 (set tmp1 arg1)
3157 (set tmp2 (sra arg2 1))
3158 (set targ (c-call WI "@cpu@_scan_result" (xor tmp1 tmp2))))
3159 )
3160
3161 (dni scan
3162 "scan"
3163 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3164 "scan$pack $GRi,$GRj,$GRk"
3165 (+ pack GRk OP_0B GRi (ICCi_1-null) OPE2_00 GRj)
3166 (scan-semantics GRi GRj GRk)
3167 ((fr400 (unit u-integer))
3168 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3169 )
3170
3171 ; Format: conditional INT, Logic, Shift r-r
3172 ;
3173 (define-pmacro (conditional-int-logic name operation op ope comment)
3174 (dni name
3175 (comment)
3176 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3177 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3178 (+ pack GRk op GRi CCi cond ope GRj)
3179 (if (eq CCi (or cond 2))
3180 (set GRk (operation GRi GRj)))
3181 ((fr400 (unit u-integer))
3182 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3183 )
3184 )
3185
3186 (conditional-int-logic cadd add OP_58 OPE4_0 "conditional add")
3187 (conditional-int-logic csub sub OP_58 OPE4_1 "conditional sub")
3188 (conditional-int-logic cand and OP_5A OPE4_0 "conditional and")
3189 (conditional-int-logic cor or OP_5A OPE4_1 "conditional or")
3190 (conditional-int-logic cxor xor OP_5A OPE4_2 "conditional xor")
3191
3192 (dni cnot
3193 "conditional not"
3194 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3195 "cnot$pack $GRj,$GRk,$CCi,$cond"
3196 (+ pack GRk OP_5A (rs-null) CCi cond OPE4_3 GRj)
3197 (if (eq CCi (or cond 2))
3198 (set GRk (inv GRj)))
3199 ((fr400 (unit u-integer))
3200 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3201 )
3202
3203 (dni csmul
3204 "conditional signed multiply"
3205 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3206 "csmul$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3207 (+ pack GRdoublek OP_58 GRi CCi cond OPE4_2 GRj)
3208 (if (eq CCi (or cond 2))
3209 (set GRdoublek (mul DI (ext DI GRi) (ext DI GRj))))
3210 ((fr400 (unit u-imul))
3211 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3212 )
3213
3214 (dni csdiv
3215 "conditional signed division"
3216 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3217 "csdiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3218 (+ pack GRk OP_58 GRi CCi cond OPE4_3 GRj)
3219 (if (eq CCi (or cond 2))
3220 (sequence ()
3221 (c-call VOID "@cpu@_signed_integer_divide"
3222 GRi GRj (index-of GRk) 0)
3223 (clobber GRk)))
3224 ((fr400 (unit u-idiv))
3225 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3226 )
3227
3228 (dni cudiv
3229 "conditional unsigned division"
3230 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3231 "cudiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3232 (+ pack GRk OP_59 GRi CCi cond OPE4_3 GRj)
3233 (if (eq CCi (or cond 2))
3234 (sequence ()
3235 (c-call VOID "@cpu@_unsigned_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 (define-pmacro (conditional-shift name operation op ope comment)
3243 (dni name
3244 (comment)
3245 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3246 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3247 (+ pack GRk op GRi CCi cond ope GRj)
3248 (if (eq CCi (or cond 2))
3249 (set GRk (operation GRi (and GRj #x1f))))
3250 ((fr400 (unit u-integer))
3251 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3252 )
3253 )
3254
3255 (conditional-shift csll sll OP_5C OPE4_0 "conditional shift left logical")
3256 (conditional-shift csrl srl OP_5C OPE4_1 "conditional shift right logical")
3257 (conditional-shift csra sra OP_5C OPE4_2 "conditional shift right arith")
3258
3259 (dni cscan
3260 "conditional scan"
3261 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3262 "cscan$pack $GRi,$GRj,$GRk,$CCi,$cond"
3263 (+ pack GRk OP_65 GRi CCi cond OPE4_3 GRj)
3264 (if (eq CCi (or cond 2))
3265 (scan-semantics GRi GRj GRk))
3266 ((fr400 (unit u-integer))
3267 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3268 )
3269
3270 ; Format: INT, Logic, Shift, cc r-r
3271 ;
3272 (define-pmacro (int-arith-cc-semantics operation icc)
3273 (sequence ((BI tmp) (QI cc) (SI result))
3274 (set cc icc)
3275 (set tmp ((.sym operation -oflag) GRi GRj (const 0)))
3276 (set-v cc tmp)
3277 (set tmp ((.sym operation -cflag) GRi GRj (const 0)))
3278 (set-c cc tmp)
3279 (set result (operation GRi GRj))
3280 (set-z-and-n cc result)
3281 (set GRk result)
3282 (set icc cc))
3283 )
3284
3285 (define-pmacro (int-arith-cc-r-r name operation op ope comment)
3286 (dni name
3287 (comment)
3288 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3289 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3290 (+ pack GRk op GRi ICCi_1 ope GRj)
3291 (int-arith-cc-semantics operation ICCi_1)
3292 ((fr400 (unit u-integer))
3293 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3294 )
3295 )
3296
3297 (int-arith-cc-r-r addcc add OP_00 OPE2_01 "add reg/reg, set icc")
3298 (int-arith-cc-r-r subcc sub OP_00 OPE2_05 "sub reg/reg, set icc")
3299
3300 (define-pmacro (int-logic-cc-semantics op icc)
3301 (sequence ((SI tmp))
3302 (set tmp (op GRi GRj))
3303 (set GRk tmp)
3304 (set-z-and-n icc tmp))
3305 )
3306
3307 (define-pmacro (int-logic-cc-r-r name op ope comment)
3308 (dni (.sym name cc)
3309 (comment)
3310 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3311 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3312 (+ pack GRk op GRi ICCi_1 ope GRj)
3313 (int-logic-cc-semantics name ICCi_1)
3314 ((fr400 (unit u-integer))
3315 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3316 )
3317 )
3318
3319 (int-logic-cc-r-r and OP_01 OPE2_01 "and reg/reg, set icc")
3320 (int-logic-cc-r-r or OP_01 OPE2_03 "or reg/reg, set icc")
3321 (int-logic-cc-r-r xor OP_01 OPE2_05 "xor reg/reg, set icc")
3322
3323 (define-pmacro (int-shift-cc-semantics op l-r icc)
3324 (sequence ((WI shift) (SI tmp) (QI cc))
3325 (set shift (and GRj #x1f))
3326 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3327 GRi shift icc))
3328 (set tmp (op GRi shift))
3329 (set GRk tmp)
3330 (set-z-and-n cc tmp)
3331 (set icc cc))
3332 )
3333
3334 (define-pmacro (int-shift-cc-r-r name l-r op ope comment)
3335 (dni (.sym name cc)
3336 (comment)
3337 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3338 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3339 (+ pack GRk op GRi ICCi_1 ope GRj)
3340 (int-shift-cc-semantics name l-r ICCi_1)
3341 ((fr400 (unit u-integer))
3342 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3343 )
3344 )
3345
3346 (int-shift-cc-r-r sll left OP_01 OPE2_09 "shift left logical reg/reg,set icc")
3347 (int-shift-cc-r-r srl right OP_01 OPE2_0B "shift right logical reg/reg,set icc")
3348 (int-shift-cc-r-r sra right OP_01 OPE2_0D "shift right arith reg/reg,set icc")
3349
3350 (define-pmacro (multiply-cc-semantics signop arg1 arg2 targ icc)
3351 (sequence ((DI tmp) (QI cc))
3352 (set cc icc)
3353 (set tmp (mul DI (signop DI arg1) (signop DI arg2)))
3354 (set-n cc (srl DI tmp 63))
3355 (set-z cc (eq tmp 0))
3356 (set targ tmp)
3357 (set icc cc))
3358 )
3359
3360 (define-pmacro (multiply-cc-r-r name signop op ope comment)
3361 (dni name
3362 (comment)
3363 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3364 (.str name "$pack $GRi,$GRj,$GRdoublek,$ICCi_1")
3365 (+ pack GRdoublek op GRi ICCi_1 ope GRj)
3366 (multiply-cc-semantics signop GRi GRj GRdoublek ICCi_1)
3367 ((fr400 (unit u-imul))
3368 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3369 )
3370 )
3371
3372 (multiply-cc-r-r smulcc ext OP_00 OPE2_09 "signed multiply reg/reg")
3373 (multiply-cc-r-r umulcc zext OP_00 OPE2_0B "unsigned multiply reg/reg")
3374
3375
3376 ; Format: conditional INT, Logic, Shift, cc r-r
3377 ;
3378 (define-pmacro (conditional-int-arith-cc name operation op ope comment)
3379 (dni name
3380 (comment)
3381 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3382 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3383 (+ pack GRk op GRi CCi cond ope GRj)
3384 (if (eq CCi (or cond 2))
3385 (int-arith-cc-semantics operation
3386 (reg h-iccr (and (index-of CCi) 3))))
3387 ((fr400 (unit u-integer))
3388 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3389 )
3390 )
3391
3392 (conditional-int-arith-cc caddcc add OP_59 OPE4_0 "add, set icc")
3393 (conditional-int-arith-cc csubcc sub OP_59 OPE4_1 "sub, set icc")
3394
3395 (dni csmulcc
3396 "conditional signed multiply and set condition code"
3397 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
3398 "csmulcc$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3399 (+ pack GRdoublek OP_59 GRi CCi cond OPE4_2 GRj)
3400 (if (eq CCi (or cond 2))
3401 (multiply-cc-semantics ext GRi GRj GRdoublek
3402 (reg h-iccr (and (index-of CCi) 3))))
3403 ((fr400 (unit u-imul))
3404 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3405 )
3406
3407 (define-pmacro (conditional-int-logic-cc name operation op ope comment)
3408 (dni name
3409 (comment)
3410 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3411 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3412 (+ pack GRk op GRi CCi cond ope GRj)
3413 (if (eq CCi (or cond 2))
3414 (int-logic-cc-semantics operation
3415 (reg h-iccr (and (index-of CCi) 3))))
3416 ((fr400 (unit u-integer))
3417 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3418 )
3419 )
3420
3421 (conditional-int-logic-cc candcc and OP_5B OPE4_0 "conditional and, set icc")
3422 (conditional-int-logic-cc corcc or OP_5B OPE4_1 "conditional or , set icc")
3423 (conditional-int-logic-cc cxorcc xor OP_5B OPE4_2 "conditional xor, set icc")
3424
3425 (define-pmacro (conditional-int-shift-cc name l-r op ope comment)
3426 (dni (.sym c name cc)
3427 (comment)
3428 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
3429 (.str (.sym c name cc) "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3430 (+ pack GRk op GRi CCi cond ope GRj)
3431 (if (eq CCi (or cond 2))
3432 (int-shift-cc-semantics name l-r
3433 (reg h-iccr (and (index-of CCi) 3))))
3434 ((fr400 (unit u-integer))
3435 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3436 )
3437 )
3438
3439 (conditional-int-shift-cc sll left OP_5D OPE4_0 "shift left logical, set icc")
3440 (conditional-int-shift-cc srl right OP_5D OPE4_1 "shift right logical, set icc")
3441 (conditional-int-shift-cc sra right OP_5D OPE4_2 "shift right arith , set icc")
3442
3443 ; Add and subtract with carry
3444 ;
3445 (define-pmacro (int-arith-x-r-r name operation op ope comment)
3446 (dni name
3447 (comment)
3448 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3449 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3450 (+ pack GRk op GRi ICCi_1 ope GRj)
3451 (set GRk ((.sym operation c) GRi GRj (cbit ICCi_1)))
3452 ((fr400 (unit u-integer))
3453 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3454 )
3455 )
3456
3457 (int-arith-x-r-r addx add OP_00 OPE2_02 "Add reg/reg, with carry")
3458 (int-arith-x-r-r subx sub OP_00 OPE2_06 "Sub reg/reg, with carry")
3459
3460 (define-pmacro (int-arith-x-cc-r-r name operation op ope comment)
3461 (dni name
3462 (comment)
3463 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3464 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3465 (+ pack GRk op GRi ICCi_1 ope GRj)
3466 (sequence ((WI tmp) (QI cc))
3467 (set cc ICCi_1)
3468 (set tmp ((.sym operation c) GRi GRj (cbit cc)))
3469 (set-v cc ((.sym operation -oflag) GRi GRj (cbit cc)))
3470 (set-c cc ((.sym operation -cflag) GRi GRj (cbit cc)))
3471 (set-z-and-n cc tmp)
3472 (set GRk tmp)
3473 (set ICCi_1 cc))
3474 ((fr400 (unit u-integer))
3475 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3476 )
3477 )
3478
3479 (int-arith-x-cc-r-r addxcc add OP_00 OPE2_03 "Add reg/reg, use/set carry")
3480 (int-arith-x-cc-r-r subxcc sub OP_00 OPE2_07 "Sub reg/reg, use/set carry")
3481 ; Add and subtract with saturation
3482 ;
3483 (define-pmacro (int-arith-ss-r-r name operation op ope comment)
3484 (dni name
3485 (comment)
3486 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3487 (.str name "$pack $GRi,$GRj,$GRk")
3488 (+ pack GRk op GRi ope GRj)
3489 (sequence ()
3490 (set GRk (operation GRi GRj))
3491 (if ((.sym operation -oflag) GRi GRj (const 0))
3492 ; Overflow, saturate.
3493 ; Sign of result will be
3494 ; same as sign of first operand.
3495 (set GRk
3496 (cond SI
3497 ((gt GRi 0) (const #x7fffffff))
3498 ((lt GRi 0) (const #x80000000))
3499 (else (const 0)))))
3500 )
3501 ((fr400 (unit u-integer)))
3502 )
3503 )
3504
3505 (int-arith-ss-r-r addss add OP_46 OPE1_00 "add reg/reg, with saturation")
3506 (int-arith-ss-r-r subss sub OP_46 OPE1_01 "sub reg/reg, with saturation")
3507
3508 ; Format: INT, Logic, Shift r-simm
3509 ;
3510 (define-pmacro (int-logic-r-simm name operation op comment)
3511 (dni name
3512 (comment)
3513 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3514 (.str name "$pack $GRi,$s12,$GRk")
3515 (+ pack GRk op GRi s12)
3516 (set GRk (operation GRi s12))
3517 ((fr400 (unit u-integer))
3518 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3519 )
3520 )
3521
3522 (int-logic-r-simm addi add OP_10 "add reg/immed")
3523 (int-logic-r-simm subi sub OP_14 "sub reg/immed")
3524 (int-logic-r-simm andi and OP_20 "and reg/immed")
3525 (int-logic-r-simm ori or OP_22 "or reg/immed")
3526 (int-logic-r-simm xori xor OP_24 "xor reg/immed")
3527
3528 (dni sdivi
3529 "signed division reg/immed"
3530 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3531 "sdivi$pack $GRi,$s12,$GRk"
3532 (+ pack GRk OP_1E GRi s12)
3533 (sequence ()
3534 (c-call VOID "@cpu@_signed_integer_divide"
3535 GRi s12 (index-of GRk) 0)
3536 (clobber GRk))
3537 ((fr400 (unit u-idiv))
3538 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3539 )
3540
3541 (dni nsdivi
3542 "non excepting signed division reg/immed"
3543 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3544 (MACH simple,tomcat,fr500,fr550,frv))
3545 "nsdivi$pack $GRi,$s12,$GRk"
3546 (+ pack GRk OP_2E GRi s12)
3547 (sequence ()
3548 (c-call VOID "@cpu@_signed_integer_divide"
3549 GRi s12 (index-of GRk) 1)
3550 (clobber GRk))
3551 ((fr400 (unit u-idiv))
3552 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3553 )
3554
3555 (dni udivi
3556 "unsigned division reg/immed"
3557 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3558 "udivi$pack $GRi,$s12,$GRk"
3559 (+ pack GRk OP_1F GRi s12)
3560 (sequence ()
3561 (c-call VOID "@cpu@_unsigned_integer_divide"
3562 GRi s12 (index-of GRk) 0)
3563 (clobber GRk))
3564 ((fr400 (unit u-idiv))
3565 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3566 )
3567
3568 (dni nudivi
3569 "non excepting unsigned division reg/immed"
3570 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3571 (MACH simple,tomcat,fr500,fr550,frv))
3572 "nudivi$pack $GRi,$s12,$GRk"
3573 (+ pack GRk OP_2F GRi s12)
3574 (sequence ()
3575 (c-call VOID "@cpu@_unsigned_integer_divide"
3576 GRi s12 (index-of GRk) 1)
3577 (clobber GRk))
3578 ((fr400 (unit u-idiv))
3579 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
3580 )
3581
3582 (define-pmacro (multiply-r-simm name signop op comment)
3583 (dni name
3584 (comment)
3585 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3586 (.str name "$pack $GRi,$s12,$GRdoublek")
3587 (+ pack GRdoublek op GRi s12)
3588 (set GRdoublek (mul DI (signop DI GRi) (signop DI s12)))
3589 ((fr400 (unit u-imul))
3590 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3591 )
3592 )
3593
3594 (multiply-r-simm smuli ext OP_18 "signed multiply reg/immed")
3595 (multiply-r-simm umuli zext OP_1A "unsigned multiply reg/immed")
3596
3597 (define-pmacro (int-shift-r-simm name op comment)
3598 (dni (.sym name i)
3599 (comment)
3600 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3601 (.str (.sym name i) "$pack $GRi,$s12,$GRk")
3602 (+ pack GRk op GRi s12)
3603 (set GRk (name GRi (and s12 #x1f)))
3604 ((fr400 (unit u-integer))
3605 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3606 )
3607 )
3608
3609 (int-shift-r-simm sll OP_28 "shift left logical reg/immed")
3610 (int-shift-r-simm srl OP_2A "shift right logical reg/immed")
3611 (int-shift-r-simm sra OP_2C "shift right arith reg/immed")
3612
3613 (dni scani
3614 "scan immediate"
3615 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3616 "scani$pack $GRi,$s12,$GRk"
3617 (+ pack GRk OP_47 GRi s12)
3618 (scan-semantics GRi s12 GRk)
3619 ((fr400 (unit u-integer))
3620 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3621 )
3622
3623 ; Format: INT, Logic, Shift cc r-simm
3624 ;
3625 (define-pmacro (int-arith-cc-r-simm name operation op comment)
3626 (dni name
3627 (comment)
3628 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3629 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3630 (+ pack GRk op GRi ICCi_1 s10)
3631 (sequence ((BI tmp) (QI cc) (SI result))
3632 (set cc ICCi_1)
3633 (set tmp ((.sym operation -oflag) GRi s10 (const 0)))
3634 (set-v cc tmp)
3635 (set tmp ((.sym operation -cflag) GRi s10 (const 0)))
3636 (set-c cc tmp)
3637 (set result (operation GRi s10))
3638 (set-z-and-n cc result)
3639 (set GRk result)
3640 (set ICCi_1 cc))
3641 ((fr400 (unit u-integer))
3642 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3643 )
3644 )
3645
3646 (int-arith-cc-r-simm addicc add OP_11 "add reg/immed, set icc")
3647 (int-arith-cc-r-simm subicc sub OP_15 "sub reg/immed, set icc")
3648
3649 (define-pmacro (int-logic-cc-r-simm name op comment)
3650 (dni (.sym name icc)
3651 (comment)
3652 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3653 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3654 (+ pack GRk op GRi ICCi_1 s10)
3655 (sequence ((SI tmp))
3656 (set tmp (name GRi s10))
3657 (set GRk tmp)
3658 (set-z-and-n ICCi_1 tmp))
3659 ((fr400 (unit u-integer))
3660 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3661 )
3662 )
3663
3664 (int-logic-cc-r-simm and OP_21 "and reg/immed, set icc")
3665 (int-logic-cc-r-simm or OP_23 "or reg/immed, set icc")
3666 (int-logic-cc-r-simm xor OP_25 "xor reg/immed, set icc")
3667
3668 (define-pmacro (multiply-cc-r-simm name signop op comment)
3669 (dni name
3670 (comment)
3671 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
3672 (.str name "$pack $GRi,$s10,$GRdoublek,$ICCi_1")
3673 (+ pack GRdoublek op GRi ICCi_1 s10)
3674 (multiply-cc-semantics signop GRi s10 GRdoublek ICCi_1)
3675 ((fr400 (unit u-imul))
3676 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
3677 )
3678 )
3679
3680 (multiply-cc-r-simm smulicc ext OP_19 "signed multiply reg/immed")
3681 (multiply-cc-r-simm umulicc zext OP_1B "unsigned multiply reg/immed")
3682
3683 (define-pmacro (int-shift-cc-r-simm name l-r op comment)
3684 (dni (.sym name icc)
3685 (comment)
3686 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3687 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3688 (+ pack GRk op GRi ICCi_1 s10)
3689 (sequence ((WI shift) (SI tmp) (QI cc))
3690 (set shift (and s10 #x1f))
3691 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3692 GRi shift ICCi_1))
3693 (set tmp (name GRi shift))
3694 (set GRk tmp)
3695 (set-z-and-n cc tmp)
3696 (set ICCi_1 cc))
3697 ((fr400 (unit u-integer))
3698 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3699 )
3700 )
3701
3702 (int-shift-cc-r-simm sll left OP_29 "shift left logical reg/immed, set icc")
3703 (int-shift-cc-r-simm srl right OP_2B "shift right logical reg/immed, set icc")
3704 (int-shift-cc-r-simm sra right OP_2D "shift right arith reg/immed, set icc")
3705
3706 (define-pmacro (int-arith-x-r-simm name operation op comment)
3707 (dni name
3708 (comment)
3709 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3710 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3711 (+ pack GRk op GRi ICCi_1 s10)
3712 (set GRk ((.sym operation c) GRi s10 (cbit ICCi_1)))
3713 ((fr400 (unit u-integer))
3714 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3715 )
3716 )
3717
3718 (int-arith-x-r-simm addxi add OP_12 "Add reg/immed, with carry")
3719 (int-arith-x-r-simm subxi sub OP_16 "Sub reg/immed, with carry")
3720
3721 (define-pmacro (int-arith-x-cc-r-simm name operation op comment)
3722 (dni name
3723 (comment)
3724 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3725 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3726 (+ pack GRk op GRi ICCi_1 s10)
3727 (sequence ((WI tmp) (QI cc))
3728 (set cc ICCi_1)
3729 (set tmp ((.sym operation c) GRi s10 (cbit cc)))
3730 (set-v cc ((.sym operation -oflag) GRi s10 (cbit cc)))
3731 (set-c cc ((.sym operation -cflag) GRi s10 (cbit cc)))
3732 (set-z-and-n cc tmp)
3733 (set GRk tmp)
3734 (set ICCi_1 cc))
3735 ((fr400 (unit u-integer))
3736 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3737 )
3738 )
3739
3740 (int-arith-x-cc-r-simm addxicc add OP_13 "Add reg/immed, with carry")
3741 (int-arith-x-cc-r-simm subxicc sub OP_17 "Sub reg/immed, with carry")
3742
3743 ; Byte compare insns
3744
3745 (dni cmpb
3746 "Compare bytes"
3747 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
3748 "cmpb$pack $GRi,$GRj,$ICCi_1"
3749 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj)
3750 (sequence ((QI cc))
3751 (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000)))
3752 (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000)))
3753 (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00)))
3754 (set-c cc (eq (and GRi #x000000ff) (and GRj #x000000ff)))
3755 (set ICCi_1 cc))
3756 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
3757 )
3758
3759 (dni cmpba
3760 "OR of Compare bytes"
3761 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
3762 "cmpba$pack $GRi,$GRj,$ICCi_1"
3763 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0D GRj)
3764 (sequence ((QI cc))
3765 (set cc 0)
3766 (set-c cc
3767 (orif (eq (and GRi #xff000000) (and GRj #xff000000))
3768 (orif (eq (and GRi #x00ff0000) (and GRj #x00ff0000))
3769 (orif (eq (and GRi #x0000ff00)
3770 (and GRj #x0000ff00))
3771 (eq (and GRi #x000000ff)
3772 (and GRj #x000000ff))))))
3773 (set ICCi_1 cc))
3774 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
3775 )
3776
3777 ; Format: Load immediate
3778 ;
3779 (dni setlo
3780 "set low order bits"
3781 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3782 "setlo$pack $ulo16,$GRklo"
3783 (+ pack GRk OP_3D (misc-null-4) u16)
3784 (set GRklo u16)
3785 ((fr400 (unit u-set-hilo))
3786 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
3787 )
3788
3789 (dni sethi
3790 "set high order bits"
3791 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3792 "sethi$pack $uhi16,$GRkhi"
3793 (+ pack GRkhi OP_3E (misc-null-4) u16)
3794 (set GRkhi u16)
3795 ((fr400 (unit u-set-hilo))
3796 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
3797 )
3798
3799 (dni setlos
3800 "set low order bits and extend sign"
3801 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
3802 "setlos$pack $slo16,$GRk"
3803 (+ pack GRk OP_3F (misc-null-4) s16)
3804 (set GRk s16)
3805 ((fr400 (unit u-integer))
3806 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
3807 )
3808
3809 (define-pmacro (load-gr-r name mode op ope comment)
3810 (dni name
3811 (comment)
3812 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
3813 (.str name "$pack @($GRi,$GRj),$GRk")
3814 (+ pack GRk op GRi ope GRj)
3815 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3816 ((fr400 (unit u-gr-load))
3817 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3818 )
3819 )
3820
3821 (load-gr-r ldsb QI OP_02 OPE1_00 "Load signed byte")
3822 (load-gr-r ldub UQI OP_02 OPE1_01 "Load unsigned byte")
3823 (load-gr-r ldsh HI OP_02 OPE1_02 "Load signed half")
3824 (load-gr-r lduh UHI OP_02 OPE1_03 "Load unsigned half")
3825 (load-gr-r ld SI OP_02 OPE1_04 "Load word")
3826
3827 (define-pmacro (load-fr-r name mode op ope comment)
3828 (dni name
3829 (comment)
3830 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
3831 (.str name "$pack @($GRi,$GRj),$FRintk")
3832 (+ pack FRintk op GRi ope GRj)
3833 (set FRintk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3834 ((fr400 (unit u-fr-load))
3835 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3836 )
3837 )
3838
3839 (load-fr-r ldbf UQI OP_02 OPE1_08 "Load byte float")
3840 (load-fr-r ldhf UHI OP_02 OPE1_09 "Load half float")
3841 (load-fr-r ldf SI OP_02 OPE1_0A "Load word float")
3842
3843 (define-pmacro (load-cpr-r name mode op ope reg attr comment)
3844 (dni name
3845 (comment)
3846 ((UNIT LOAD) (FR500-MAJOR I-2) attr)
3847 (.str name "$pack @($GRi,$GRj),$" reg "k")
3848 (+ pack (.sym reg k) op GRi ope GRj)
3849 (set (.sym reg k)
3850 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3851 ()
3852 )
3853 )
3854
3855 (load-cpr-r ldc SI OP_02 OPE1_0D CPR (MACH frv) "Load coprocessor word")
3856
3857 ; These correspond to enumerators in frv-sim.h
3858 (define-pmacro (ne-UQI-size) 0)
3859 (define-pmacro (ne-QI-size) 1)
3860 (define-pmacro (ne-UHI-size) 2)
3861 (define-pmacro (ne-HI-size) 3)
3862 (define-pmacro (ne-SI-size) 4)
3863 (define-pmacro (ne-DI-size) 5)
3864 (define-pmacro (ne-XI-size) 6)
3865
3866 (define-pmacro (ne-load-semantics base dispix targ idisp size is_float action)
3867 (sequence ((BI do_op))
3868 (set do_op
3869 (c-call BI "@cpu@_check_non_excepting_load"
3870 (index-of base) dispix (index-of targ)
3871 idisp size is_float))
3872 (if do_op action))
3873 )
3874
3875 (define-pmacro (ne-load-gr-r name mode op ope size comment)
3876 (dni name
3877 (comment)
3878 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
3879 (MACH simple,tomcat,fr500,fr550,frv))
3880 (.str name "$pack @($GRi,$GRj),$GRk")
3881 (+ pack GRk op GRi ope GRj)
3882 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
3883 (set GRk
3884 (c-call mode (.str "@cpu@_read_mem_" mode)
3885 pc (add GRi GRj))))
3886 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3887 )
3888 )
3889
3890 (ne-load-gr-r nldsb QI OP_02 OPE1_20 (ne-QI-size) "Load signed byte")
3891 (ne-load-gr-r nldub UQI OP_02 OPE1_21 (ne-UQI-size) "Load unsigned byte")
3892 (ne-load-gr-r nldsh HI OP_02 OPE1_22 (ne-HI-size) "Load signed half")
3893 (ne-load-gr-r nlduh UHI OP_02 OPE1_23 (ne-UHI-size) "Load unsigned half")
3894 (ne-load-gr-r nld SI OP_02 OPE1_24 (ne-SI-size) "Load word")
3895
3896 (define-pmacro (ne-load-fr-r name mode op ope size comment)
3897 (dni name
3898 (comment)
3899 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
3900 (MACH simple,tomcat,fr500,fr550,frv))
3901 (.str name "$pack @($GRi,$GRj),$FRintk")
3902 (+ pack FRintk op GRi ope GRj)
3903 (ne-load-semantics GRi (index-of GRj) FRintk 0 size 1
3904 (set FRintk
3905 (c-call mode (.str "@cpu@_read_mem_" mode)
3906 pc (add GRi GRj))))
3907 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3908 )
3909 )
3910
3911 (ne-load-fr-r nldbf UQI OP_02 OPE1_28 (ne-UQI-size) "Load byte float")
3912 (ne-load-fr-r nldhf UHI OP_02 OPE1_29 (ne-UHI-size) "Load half float")
3913 (ne-load-fr-r nldf SI OP_02 OPE1_2A (ne-SI-size) "Load word float")
3914
3915 ; Semantics for a load-double insn
3916 ;
3917 (define-pmacro (load-double-semantics not_gr mode regtype address arg)
3918 (if (orif not_gr (ne (index-of (.sym regtype doublek)) 0))
3919 (sequence ()
3920 (set address (add GRi arg))
3921 (set (.sym regtype doublek)
3922 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))))
3923 )
3924
3925 (define-pmacro (load-double-r-r
3926 name not_gr mode op ope regtype attr profile comment)
3927 (dni name
3928 (comment)
3929 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
3930 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3931 (+ pack (.sym regtype doublek) op GRi ope GRj)
3932 (sequence ((WI address))
3933 (load-double-semantics not_gr mode regtype address GRj))
3934 profile
3935 )
3936 )
3937
3938 (load-double-r-r ldd 0 DI OP_02 OPE1_05 GR NA
3939 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
3940 "Load double word")
3941 (load-double-r-r lddf 1 DF OP_02 OPE1_0B FR FR-ACCESS
3942 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
3943 "Load double float")
3944 (load-double-r-r lddc 1 DI OP_02 OPE1_0E CPR (MACH frv) ()
3945 "Load coprocessor double")
3946
3947 (define-pmacro (ne-load-double-r-r
3948 name not_gr mode op ope regtype size is_float attr profile
3949 comment)
3950 (dni name
3951 (comment)
3952 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
3953 (MACH simple,tomcat,fr500,fr550,frv))
3954 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3955 (+ pack (.sym regtype doublek) op GRi ope GRj)
3956 (sequence ((WI address))
3957 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek)
3958 0 size is_float
3959 (load-double-semantics not_gr mode
3960 regtype
3961 address GRj)))
3962 profile
3963 )
3964 )
3965
3966 (ne-load-double-r-r nldd 0 DI OP_02 OPE1_25 GR (ne-DI-size) 0 NA
3967 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
3968 (ne-load-double-r-r nlddf 1 DF OP_02 OPE1_2B FR (ne-DI-size) 1 FR-ACCESS
3969 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
3970
3971 ; Semantics for a load-quad insn
3972 ;
3973 (define-pmacro (load-quad-semantics regtype address arg)
3974 (sequence ()
3975 (set address (add GRi arg))
3976 (c-call VOID (.str "@cpu@_load_quad_" regtype)
3977 pc address (index-of (.sym regtype k))))
3978 )
3979
3980 (define-pmacro (load-quad-r-r name op ope regtype attr profile comment)
3981 (dni name
3982 (comment)
3983 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
3984 (.str name "$pack @($GRi,$GRj),$" regtype "k")
3985 (+ pack (.sym regtype k) op GRi ope GRj)
3986 (sequence ((WI address))
3987 (load-quad-semantics regtype address GRj))
3988 ; TODO regtype-k not referenced for profiling
3989 profile
3990 )
3991 )
3992
3993 (load-quad-r-r ldq OP_02 OPE1_06 GR NA ((fr500 (unit u-gr-load)))
3994 "Load quad word")
3995 (load-quad-r-r ldqf OP_02 OPE1_0C FRint FR-ACCESS ((fr500 (unit u-fr-load)))
3996 "Load quad float")
3997 (load-quad-r-r ldqc OP_02 OPE1_0F CPR NA () "Load coprocessor quad")
3998
3999 (define-pmacro (ne-load-quad-r-r
4000 name op ope regtype size is_float attr profile comment)
4001 (dni name
4002 (comment)
4003 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4004 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4005 (+ pack (.sym regtype k) op GRi ope GRj)
4006 (sequence ((WI address))
4007 (ne-load-semantics GRi (index-of GRj) (.sym regtype k)
4008 0 size is_float
4009 (load-quad-semantics regtype address GRj)))
4010 ; TODO regtype-k not referenced for profiling
4011 profile
4012 )
4013 )
4014
4015 (ne-load-quad-r-r nldq OP_02 OPE1_26 GR (ne-XI-size) 0 NA
4016 ((fr500 (unit u-gr-load))) "Load quad word")
4017 (ne-load-quad-r-r nldqf OP_02 OPE1_2C FRint (ne-XI-size) 1 FR-ACCESS
4018 ((fr500 (unit u-fr-load))) "Load quad float")
4019
4020 (define-pmacro (load-gr-u-semantics mode)
4021 (sequence ((UWI address))
4022 (set address (add GRi GRj))
4023 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4024 (if (ne (index-of GRi) (index-of GRk))
4025 (sequence ()
4026 (set GRi address)
4027 (c-call VOID "@cpu@_force_update"))))
4028 )
4029
4030 (define-pmacro (load-gr-u name mode op ope comment)
4031 (dni name
4032 (comment)
4033 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
4034 (.str name "$pack @($GRi,$GRj),$GRk")
4035 (+ pack GRk op GRi ope GRj)
4036 (load-gr-u-semantics mode)
4037 ((fr400 (unit u-gr-load))
4038 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4039 )
4040 )
4041
4042 (load-gr-u ldsbu QI OP_02 OPE1_10 "Load signed byte, update index")
4043 (load-gr-u ldubu UQI OP_02 OPE1_11 "Load unsigned byte, update index")
4044 (load-gr-u ldshu HI OP_02 OPE1_12 "Load signed half, update index")
4045 (load-gr-u lduhu UHI OP_02 OPE1_13 "Load unsigned half, update index")
4046 (load-gr-u ldu SI OP_02 OPE1_14 "Load word, update index")
4047
4048 (define-pmacro (ne-load-gr-u name mode op ope size comment)
4049 (dni name
4050 (comment)
4051 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4052 (MACH simple,tomcat,fr500,fr550,frv))
4053 (.str name "$pack @($GRi,$GRj),$GRk")
4054 (+ pack GRk op GRi ope GRj)
4055 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 (load-gr-u-semantics mode))
4056 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4057 )
4058 )
4059
4060 (ne-load-gr-u nldsbu QI OP_02 OPE1_30 (ne-QI-size) "Load signed byte, update index")
4061 (ne-load-gr-u nldubu UQI OP_02 OPE1_31 (ne-UQI-size) "Load unsigned byte, update index")
4062 (ne-load-gr-u nldshu HI OP_02 OPE1_32 (ne-HI-size) "Load signed half, update index")
4063 (ne-load-gr-u nlduhu UHI OP_02 OPE1_33 (ne-UHI-size) "Load unsigned half, update index")
4064 (ne-load-gr-u nldu SI OP_02 OPE1_34 (ne-SI-size) "Load word, update index")
4065
4066 (define-pmacro (load-non-gr-u-semantics mode regtype)
4067 (sequence ((UWI address))
4068 (set address (add GRi GRj))
4069 (set (.sym regtype k)
4070 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4071 (set GRi address)
4072 (c-call VOID "@cpu@_force_update"))
4073 )
4074
4075 (define-pmacro (load-fr-u name mode op ope comment)
4076 (dni name
4077 (comment)
4078 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
4079 (.str name "$pack @($GRi,$GRj),$FRintk")
4080 (+ pack FRintk op GRi ope GRj)
4081 (load-non-gr-u-semantics mode FRint)
4082 ((fr400 (unit u-fr-load))
4083 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4084 )
4085 )
4086
4087 (load-fr-u ldbfu UQI OP_02 OPE1_18 "Load byte float, update index")
4088 (load-fr-u ldhfu UHI OP_02 OPE1_19 "Load half float, update index")
4089 (load-fr-u ldfu SI OP_02 OPE1_1A "Load word float, update index")
4090
4091 (define-pmacro (load-cpr-u name mode op ope comment)
4092 (dni name
4093 (comment)
4094 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4095 (.str name "$pack @($GRi,$GRj),$CPRk")
4096 (+ pack CPRk op GRi ope GRj)
4097 (load-non-gr-u-semantics mode CPR)
4098 ()
4099 )
4100 )
4101
4102 (load-cpr-u ldcu SI OP_02 OPE1_1D "Load coprocessor word float,update index")
4103
4104 (define-pmacro (ne-load-non-gr-u name mode op ope regtype size comment)
4105 (dni name
4106 (comment)
4107 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4108 (MACH simple,tomcat,fr500,fr550,frv))
4109 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4110 (+ pack (.sym regtype k) op GRi ope GRj)
4111 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4112 (load-non-gr-u-semantics mode regtype))
4113 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4114 )
4115 )
4116
4117 (ne-load-non-gr-u nldbfu UQI OP_02 OPE1_38 FRint (ne-UQI-size) "Load byte float, update index")
4118 (ne-load-non-gr-u nldhfu UHI OP_02 OPE1_39 FRint (ne-UHI-size) "Load half float, update index")
4119 (ne-load-non-gr-u nldfu SI OP_02 OPE1_3A FRint (ne-SI-size) "Load word float, update index")
4120
4121 (define-pmacro (load-double-gr-u-semantics)
4122 (sequence ((WI address))
4123 (load-double-semantics 0 DI GR address GRj)
4124 (if (ne (index-of GRi) (index-of GRdoublek))
4125 (sequence ()
4126 (set GRi address)
4127 (c-call VOID "@cpu@_force_update"))))
4128 )
4129
4130 (define-pmacro (load-double-gr-u name op ope comment)
4131 (dni name
4132 (comment)
4133 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
4134 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4135 (+ pack GRdoublek op GRi ope GRj)
4136 (load-double-gr-u-semantics)
4137 ((fr400 (unit u-gr-load))
4138 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4139 )
4140 )
4141
4142 (load-double-gr-u lddu OP_02 OPE1_15 "Load double word, update index")
4143
4144 (define-pmacro (ne-load-double-gr-u name op ope size comment)
4145 (dni name
4146 (comment)
4147 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4148 (MACH simple,tomcat,fr500,fr550,frv))
4149 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4150 (+ pack GRdoublek op GRi ope GRj)
4151 (ne-load-semantics GRi (index-of GRj) GRdoublek 0 size 0
4152 (load-double-gr-u-semantics))
4153 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4154
4155 )
4156 )
4157
4158 (ne-load-double-gr-u nlddu OP_02 OPE1_35 (ne-DI-size) "Load double word, update index")
4159
4160 (define-pmacro (load-double-non-gr-u-semantics mode regtype)
4161 (sequence ((WI address))
4162 (load-double-semantics 1 mode regtype address GRj)
4163 (set GRi address)
4164 (c-call VOID "@cpu@_force_update"))
4165 )
4166
4167 (define-pmacro (load-double-non-gr-u
4168 name mode op ope regtype attr profile comment)
4169 (dni name
4170 (comment)
4171 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4172 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4173 (+ pack (.sym regtype doublek) op GRi ope GRj)
4174 (load-double-non-gr-u-semantics mode regtype)
4175 profile
4176 )
4177 )
4178
4179 (load-double-non-gr-u lddfu DF OP_02 OPE1_1B FR FR-ACCESS
4180 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4181 "Load double float, update index")
4182 (load-double-non-gr-u lddcu DI OP_02 OPE1_1E CPR (MACH frv)
4183 () "Load coprocessor double float, update index")
4184
4185 (define-pmacro (ne-load-double-non-gr-u name mode op ope regtype size comment)
4186 (dni name
4187 (comment)
4188 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4189 (MACH simple,tomcat,fr500,fr550,frv))
4190 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4191 (+ pack (.sym regtype doublek) op GRi ope GRj)
4192 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) 0 size 1
4193 (load-double-non-gr-u-semantics mode regtype))
4194 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4195 )
4196 )
4197
4198 (ne-load-double-non-gr-u nlddfu DF OP_02 OPE1_3B FR (ne-DI-size) "Load double float, update index")
4199
4200 (define-pmacro (load-quad-gr-u-semantics)
4201 (sequence ((WI address))
4202 (load-quad-semantics GR address GRj)
4203 (if (ne (index-of GRi) (index-of GRk))
4204 (sequence ()
4205 (set GRi address)
4206 (c-call VOID "@cpu@_force_update"))))
4207 )
4208
4209 (define-pmacro (load-quad-gr-u name op ope comment)
4210 (dni name
4211 (comment)
4212 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4213 (.str name "$pack @($GRi,$GRj),$GRk")
4214 (+ pack GRk op GRi ope GRj)
4215 (load-quad-gr-u-semantics)
4216 ; TODO - GRk not referenced here for profiling
4217 ((fr500 (unit u-gr-load)))
4218 )
4219 )
4220
4221 (load-quad-gr-u ldqu OP_02 OPE1_16 "Load quad word, update index")
4222
4223 (define-pmacro (ne-load-quad-gr-u name op ope size comment)
4224 (dni name
4225 (comment)
4226 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING)
4227 (.str name "$pack @($GRi,$GRj),$GRk")
4228 (+ pack GRk op GRi ope GRj)
4229 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
4230 (load-quad-gr-u-semantics))
4231 ; TODO - GRk not referenced here for profiling
4232 ((fr500 (unit u-gr-load)))
4233 )
4234 )
4235
4236 (ne-load-quad-gr-u nldqu OP_02 OPE1_36 (ne-XI-size) "Load quad word, update index")
4237
4238 (define-pmacro (load-quad-non-gr-u-semantics regtype)
4239 (sequence ((WI address))
4240 (load-quad-semantics regtype address GRj)
4241 (set GRi address)
4242 (c-call VOID "@cpu@_force_update"))
4243 )
4244
4245 (define-pmacro (load-quad-non-gr-u name op ope regtype attr profile comment)
4246 (dni name
4247 (comment)
4248 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4249 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4250 (+ pack (.sym regtype k) op GRi ope GRj)
4251 (load-quad-non-gr-u-semantics regtype)
4252 profile
4253 )
4254 )
4255
4256 (load-quad-non-gr-u ldqfu OP_02 OPE1_1C FRint FR-ACCESS
4257 ((fr500 (unit u-fr-load))) "Load quad float, update index")
4258 (load-quad-non-gr-u ldqcu OP_02 OPE1_1F CPR NA
4259 () "Load coprocessor quad word, update index")
4260
4261 (define-pmacro (ne-load-quad-non-gr-u name op ope regtype size comment)
4262 (dni name
4263 (comment)
4264 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING FR-ACCESS)
4265 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4266 (+ pack (.sym regtype k) op GRi ope GRj)
4267 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4268 (load-quad-non-gr-u-semantics regtype))
4269 ((fr500 (unit u-fr-load)))
4270 )
4271 )
4272
4273 (ne-load-quad-non-gr-u nldqfu OP_02 OPE1_3C FRint (ne-XI-size) "Load quad float,update index")
4274
4275 (define-pmacro (load-r-simm name mode op regtype attr profile comment)
4276 (dni name
4277 (comment)
4278 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4279 (.str name "$pack @($GRi,$d12),$" regtype "k")
4280 (+ pack (.sym regtype k) op GRi d12)
4281 (set (.sym regtype k)
4282 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi d12)))
4283 profile
4284 )
4285 )
4286
4287 (load-r-simm ldsbi QI OP_30 GR NA
4288 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4289 "Load signed byte")
4290 (load-r-simm ldshi HI OP_31 GR NA
4291 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4292 "Load signed half")
4293 (load-r-simm ldi SI OP_32 GR NA
4294 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4295 "Load word")
4296 (load-r-simm ldubi UQI OP_35 GR NA
4297 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4298 "Load unsigned byte")
4299 (load-r-simm lduhi UHI OP_36 GR NA
4300 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4301 "Load unsigned half")
4302
4303 (load-r-simm ldbfi UQI OP_38 FRint FR-ACCESS
4304 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4305 "Load byte float")
4306 (load-r-simm ldhfi UHI OP_39 FRint FR-ACCESS
4307 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4308 "Load half float")
4309 (load-r-simm ldfi SI OP_3A FRint FR-ACCESS
4310 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4311 "Load word float")
4312
4313 (define-pmacro (ne-load-r-simm
4314 name mode op regtype size is_float attr profile comment)
4315 (dni name
4316 (comment)
4317 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4318 (MACH simple,tomcat,fr500,fr550,frv))
4319 (.str name "$pack @($GRi,$d12),$" regtype "k")
4320 (+ pack (.sym regtype k) op GRi d12)
4321 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4322 (set (.sym regtype k)
4323 (c-call mode (.str "@cpu@_read_mem_" mode)
4324 pc (add GRi d12))))
4325 profile
4326 )
4327 )
4328
4329 (ne-load-r-simm nldsbi QI OP_40 GR (ne-QI-size) 0 NA
4330 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed byte")
4331 (ne-load-r-simm nldubi UQI OP_41 GR (ne-UQI-size) 0 NA
4332 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned byte")
4333 (ne-load-r-simm nldshi HI OP_42 GR (ne-HI-size) 0 NA
4334 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed half")
4335 (ne-load-r-simm nlduhi UHI OP_43 GR (ne-UHI-size) 0 NA
4336 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned half")
4337 (ne-load-r-simm nldi SI OP_44 GR (ne-SI-size) 0 NA
4338 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load word")
4339
4340 (ne-load-r-simm nldbfi UQI OP_48 FRint (ne-UQI-size) 1 FR-ACCESS
4341 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load byte float")
4342 (ne-load-r-simm nldhfi UHI OP_49 FRint (ne-UHI-size) 1 FR-ACCESS
4343 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load half float")
4344 (ne-load-r-simm nldfi SI OP_4A FRint (ne-SI-size) 1 FR-ACCESS
4345 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load word float")
4346
4347 (define-pmacro (load-double-r-simm
4348 name not_gr mode op regtype attr profile comment)
4349 (dni name
4350 (comment)
4351 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
4352 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4353 (+ pack (.sym regtype doublek) op GRi d12)
4354 (sequence ((WI address))
4355 (load-double-semantics not_gr mode regtype address d12))
4356 profile
4357 )
4358 )
4359
4360 (load-double-r-simm lddi 0 DI OP_33 GR NA
4361 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4362 "Load double word")
4363 (load-double-r-simm lddfi 1 DF OP_3B FR FR-ACCESS
4364 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4365 "Load double float")
4366
4367 (define-pmacro (ne-load-double-r-simm
4368 name not_gr mode op regtype size is_float attr profile comment)
4369 (dni name
4370 (comment)
4371 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4372 (MACH simple,tomcat,fr500,fr550,frv))
4373 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4374 (+ pack (.sym regtype doublek) op GRi d12)
4375 (sequence ((WI address))
4376 (ne-load-semantics GRi -1 (.sym regtype doublek)
4377 d12 size is_float
4378 (load-double-semantics not_gr mode
4379 regtype
4380 address d12)))
4381 profile
4382 )
4383 )
4384
4385 (ne-load-double-r-simm nlddi 0 DI OP_45 GR (ne-DI-size) 0 NA
4386 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
4387 (ne-load-double-r-simm nlddfi 1 DF OP_4B FR (ne-DI-size) 1 FR-ACCESS
4388 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
4389
4390 (define-pmacro (load-quad-r-simm name op regtype attr profile comment)
4391 (dni name
4392 (comment)
4393 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4394 (.str name "$pack @($GRi,$d12),$" regtype "k")
4395 (+ pack (.sym regtype k) op GRi d12)
4396 (sequence ((WI address))
4397 (load-quad-semantics regtype address d12))
4398 profile
4399 )
4400 )
4401
4402 (load-quad-r-simm ldqi OP_34 GR NA
4403 ((fr500 (unit u-gr-load))) "Load quad word")
4404 (load-quad-r-simm ldqfi OP_3C FRint FR-ACCESS
4405 ((fr500 (unit u-fr-load))) "Load quad float")
4406
4407 (define-pmacro (ne-load-quad-r-simm
4408 name op regtype size is_float attr profile comment)
4409 (dni name
4410 (comment)
4411 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4412 (.str name "$pack @($GRi,$d12),$" regtype "k")
4413 (+ pack (.sym regtype k) op GRi d12)
4414 (sequence ((WI address))
4415 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4416 (load-quad-semantics regtype address d12)))
4417 profile
4418 )
4419 )
4420
4421 (ne-load-quad-r-simm nldqfi OP_4C FRint (ne-XI-size) 1 FR-ACCESS
4422 ((fr500 (unit u-fr-load))) "Load quad float")
4423
4424 (define-pmacro (store-r-r name mode op ope reg attr profile comment)
4425 (dni name
4426 (comment)
4427 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4428 (.str name "$pack $" reg "k,@($GRi,$GRj)")
4429 (+ pack (.sym reg k) op GRi ope GRj)
4430 (c-call VOID (.str "@cpu@_write_mem_" mode)
4431 pc (add GRi GRj) (.sym reg k))
4432 profile
4433 )
4434 )
4435
4436 (store-r-r stb QI OP_03 OPE1_00 GR NA
4437 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4438 "Store unsigned byte")
4439 (store-r-r sth HI OP_03 OPE1_01 GR NA
4440 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4441 "Store unsigned half")
4442 (store-r-r st SI OP_03 OPE1_02 GR NA
4443 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4444 "Store word")
4445
4446 (store-r-r stbf QI OP_03 OPE1_08 FRint FR-ACCESS
4447 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4448 "Store byte float")
4449 (store-r-r sthf HI OP_03 OPE1_09 FRint FR-ACCESS
4450 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4451 "Store half float")
4452 (store-r-r stf SI OP_03 OPE1_0A FRint FR-ACCESS
4453 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4454 "Store word float")
4455
4456 (store-r-r stc SI OP_03 OPE1_25 CPR (MACH frv) () "Store coprocessor word")
4457
4458 (define-pmacro (r-store name mode op ope reg size is_float profile comment)
4459 (dni name
4460 (comment)
4461 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv))
4462 (.str name "$pack $" reg "k,@($GRi,$GRj)")
4463 (+ pack (.sym reg k) op GRi ope GRj)
4464 (sequence ((WI address))
4465 (set address (add GRi GRj))
4466 (c-call VOID (.str "@cpu@_write_mem_" mode)
4467 pc address (.sym reg k))
4468 (c-call VOID "@cpu@_check_recovering_store"
4469 address (index-of (.sym reg k)) size is_float))
4470 profile
4471 )
4472 )
4473
4474 (r-store rstb QI OP_03 OPE1_20 GR 1 0
4475 ((fr500 (unit u-gr-r-store))) "Store unsigned byte")
4476 (r-store rsth HI OP_03 OPE1_21 GR 2 0
4477 ((fr500 (unit u-gr-r-store))) "Store unsigned half")
4478 (r-store rst SI OP_03 OPE1_22 GR 4 0
4479 ((fr500 (unit u-gr-r-store))) "Store word")
4480
4481 (r-store rstbf QI OP_03 OPE1_28 FRint 1 1
4482 ((fr500 (unit u-fr-r-store))) "Store byte float")
4483 (r-store rsthf HI OP_03 OPE1_29 FRint 2 1
4484 ((fr500 (unit u-fr-r-store))) "Store half float")
4485 (r-store rstf SI OP_03 OPE1_2A FRint 4 1
4486 ((fr500 (unit u-fr-r-store))) "Store word float")
4487
4488 ; Semantics for a store-double insn
4489 ;
4490 (define-pmacro (store-double-semantics mode regtype address arg)
4491 (sequence ()
4492 (set address (add GRi arg))
4493 (c-call VOID (.str "@cpu@_write_mem_" mode)
4494 pc address (.sym regtype doublek)))
4495 )
4496
4497 (define-pmacro (store-double-r-r name mode op ope regtype attr profile comment)
4498 (dni name
4499 (comment)
4500 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4501 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4502 (+ pack (.sym regtype k) op GRi ope GRj)
4503 (sequence ((WI address))
4504 (store-double-semantics mode regtype address GRj))
4505 profile
4506 )
4507 )
4508
4509 (store-double-r-r std DI OP_03 OPE1_03 GR NA
4510 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4511 "Store double word")
4512 (store-double-r-r stdf DF OP_03 OPE1_0B FR FR-ACCESS
4513 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4514 "Store double float")
4515
4516 (store-double-r-r stdc DI OP_03 OPE1_26 CPR (MACH frv)
4517 () "Store coprocessor double word")
4518
4519 (define-pmacro (r-store-double
4520 name mode op ope regtype is_float attr profile comment)
4521 (dni name
4522 (comment)
4523 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4524 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4525 (+ pack (.sym regtype k) op GRi ope GRj)
4526 (sequence ((WI address))
4527 (store-double-semantics mode regtype address GRj)
4528 (c-call VOID "@cpu@_check_recovering_store"
4529 address (index-of (.sym regtype k)) 8 is_float))
4530 profile
4531 )
4532 )
4533
4534 (r-store-double rstd DI OP_03 OPE1_23 GR 0 NA
4535 ((fr500 (unit u-gr-r-store))) "Store double word")
4536 (r-store-double rstdf DF OP_03 OPE1_2B FR 1 FR-ACCESS
4537 ((fr500 (unit u-fr-r-store))) "Store double float")
4538
4539 ; Semantics for a store-quad insn
4540 ;
4541 (define-pmacro (store-quad-semantics regtype address arg)
4542 (sequence ()
4543 (set address (add GRi arg))
4544 (c-call VOID (.str "@cpu@_store_quad_" regtype)
4545 pc address (index-of (.sym regtype k))))
4546 )
4547
4548 (define-pmacro (store-quad-r-r name op ope regtype attr profile comment)
4549 (dni name
4550 (comment)
4551 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4552 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4553 (+ pack (.sym regtype k) op GRi ope GRj)
4554 (sequence ((WI address))
4555 (store-quad-semantics regtype address GRj))
4556 profile
4557 )
4558 )
4559
4560 (store-quad-r-r stq OP_03 OPE1_04 GR NA
4561 ((fr500 (unit u-gr-store))) "Store quad word")
4562 (store-quad-r-r stqf OP_03 OPE1_0C FRint FR-ACCESS
4563 ((fr500 (unit u-fr-store)))
4564 "Store quad float")
4565 (store-quad-r-r stqc OP_03 OPE1_27 CPR NA
4566 () "Store coprocessor quad word")
4567
4568 (define-pmacro (r-store-quad name op ope regtype is_float attr profile comment)
4569 (dni name
4570 (comment)
4571 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4572 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4573 (+ pack (.sym regtype k) op GRi ope GRj)
4574 (sequence ((WI address))
4575 (store-quad-semantics regtype address GRj)
4576 (c-call VOID "@cpu@_check_recovering_store"
4577 address (index-of (.sym regtype k)) 16 is_float))
4578 profile
4579 )
4580 )
4581
4582 (r-store-quad rstq OP_03 OPE1_24 GR 0 NA
4583 ((fr500 (unit u-gr-r-store))) "Store quad word")
4584 (r-store-quad rstqf OP_03 OPE1_2C FRint 1 FR-ACCESS
4585 ((fr500 (unit u-fr-r-store))) "Store quad float")
4586
4587 (define-pmacro (store-r-r-u name mode op ope regtype attr profile comment)
4588 (dni name
4589 (comment)
4590 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4591 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4592 (+ pack (.sym regtype k) op GRi ope GRj)
4593 (sequence ((UWI address))
4594 (set address (add GRi GRj))
4595 (c-call VOID (.str "@cpu@_write_mem_" mode)
4596 pc address (.sym regtype k))
4597 (set GRi address))
4598 profile
4599 )
4600 )
4601
4602 (store-r-r-u stbu QI OP_03 OPE1_10 GR NA
4603 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4604 "Store unsigned byte, update index")
4605 (store-r-r-u sthu HI OP_03 OPE1_11 GR NA
4606 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4607 "Store unsigned half, update index")
4608 (store-r-r-u stu WI OP_03 OPE1_12 GR NA
4609 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4610 "Store word, update index")
4611
4612 (store-r-r-u stbfu QI OP_03 OPE1_18 FRint FR-ACCESS
4613 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4614 "Store byte float, update index")
4615 (store-r-r-u sthfu HI OP_03 OPE1_19 FRint FR-ACCESS
4616 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4617 "Store half float, update index")
4618 (store-r-r-u stfu SI OP_03 OPE1_1A FRint FR-ACCESS
4619 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4620 "Store word float, update index")
4621
4622 (store-r-r-u stcu SI OP_03 OPE1_2D CPR (MACH frv) ()
4623 "Store coprocessor word, update index")
4624
4625 (define-pmacro (store-double-r-r-u
4626 name mode op ope regtype attr profile comment)
4627 (dni name
4628 (comment)
4629 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4630 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4631 (+ pack (.sym regtype k) op GRi ope GRj)
4632 (sequence ((WI address))
4633 (store-double-semantics mode regtype address GRj)
4634 (set GRi address))
4635 profile
4636 )
4637 )
4638
4639 (store-double-r-r-u stdu DI OP_03 OPE1_13 GR NA
4640 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4641 "Store double word, update index")
4642 (store-double-r-r-u stdfu DF OP_03 OPE1_1B FR FR-ACCESS
4643 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4644 "Store double float,update index")
4645 (store-double-r-r-u stdcu DI OP_03 OPE1_2E CPR (MACH frv) ()
4646 "Store coprocessor double word, update index")
4647
4648 (define-pmacro (store-quad-r-r-u name op ope regtype attr profile comment)
4649 (dni name
4650 (comment)
4651 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
4652 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4653 (+ pack (.sym regtype k) op GRi ope GRj)
4654 (sequence ((WI address))
4655 (store-quad-semantics regtype address GRj)
4656 (set GRi address))
4657 profile
4658 )
4659 )
4660
4661 (store-quad-r-r-u stqu OP_03 OPE1_14 GR NA
4662 ((fr500 (unit u-gr-store)))
4663 "Store quad word, update index")
4664 (store-quad-r-r-u stqfu OP_03 OPE1_1C FRint FR-ACCESS
4665 ((fr500 (unit u-fr-store)))
4666 "Store quad float, update index")
4667 (store-quad-r-r-u stqcu OP_03 OPE1_2F CPR NA ()
4668 "Store coprocessor quad word, update index")
4669
4670 (define-pmacro (conditional-load name mode op ope regtype profile comment)
4671 (dni name
4672 (comment)
4673 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4674 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4675 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4676 (if (eq CCi (or cond 2))
4677 (set (.sym regtype k)
4678 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))))
4679 profile
4680 )
4681 )
4682
4683 (conditional-load cldsb QI OP_5E OPE4_0 GR
4684 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4685 "Load signed byte")
4686 (conditional-load cldub UQI OP_5E OPE4_1 GR
4687 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4688 "Load unsigned byte")
4689 (conditional-load cldsh HI OP_5E OPE4_2 GR
4690 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4691 "Load signed half")
4692 (conditional-load clduh UHI OP_5E OPE4_3 GR
4693 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4694 "Load unsigned half")
4695 (conditional-load cld SI OP_5F OPE4_0 GR
4696 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4697 "Load word")
4698
4699 (conditional-load cldbf UQI OP_60 OPE4_0 FRint
4700 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4701 "Load byte float")
4702 (conditional-load cldhf UHI OP_60 OPE4_1 FRint
4703 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4704 "Load half float")
4705 (conditional-load cldf SI OP_60 OPE4_2 FRint
4706 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4707 "Load word float")
4708
4709 (define-pmacro (conditional-load-double
4710 name not_gr mode op ope regtype attr profile comment)
4711 (dni name
4712 (comment)
4713 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL attr)
4714 (.str name "$pack @($GRi,$GRj),$" regtype "doublek,$CCi,$cond")
4715 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
4716 (if (eq CCi (or cond 2))
4717 (sequence ((WI address))
4718 (load-double-semantics not_gr mode regtype address GRj)))
4719 profile
4720 )
4721 )
4722
4723 (conditional-load-double cldd 0 DI OP_5F OPE4_1 GR NA
4724 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4725 "Load double word")
4726 (conditional-load-double clddf 1 DF OP_60 OPE4_3 FR FR-ACCESS
4727 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-fr-load)))
4728 "Load double float")
4729
4730 (dni cldq
4731 "conditional load quad integer"
4732 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4733 "cldq$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4734 (+ pack GRk OP_5F GRi CCi cond OPE4_2 GRj)
4735 (if (eq CCi (or cond 2))
4736 (sequence ((WI address))
4737 (load-quad-semantics GR address GRj)))
4738 ((fr500 (unit u-gr-load)))
4739 )
4740
4741 (define-pmacro (conditional-load-gr-u name mode op ope comment)
4742 (dni name
4743 (comment)
4744 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4745 (.str name "$pack @($GRi,$GRj),$GRk,$CCi,$cond")
4746 (+ pack GRk op GRi CCi cond ope GRj)
4747 (if (eq CCi (or cond 2))
4748 (sequence ((WI address))
4749 (set address (add GRi GRj))
4750 (set GRk
4751 (c-call mode (.str "@cpu@_read_mem_" mode)
4752 pc address))
4753 (if (ne (index-of GRi) (index-of GRk))
4754 (set GRi address))))
4755 ((fr400 (unit u-gr-load))
4756 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4757 )
4758 )
4759
4760 (conditional-load-gr-u cldsbu QI OP_61 OPE4_0 "Load signed byte, update")
4761 (conditional-load-gr-u cldubu UQI OP_61 OPE4_1 "Load unsigned byte, update")
4762 (conditional-load-gr-u cldshu HI OP_61 OPE4_2 "Load signed half, update")
4763 (conditional-load-gr-u clduhu UHI OP_61 OPE4_3 "Load unsigned half, update")
4764 (conditional-load-gr-u cldu SI OP_62 OPE4_0 "Load word, update")
4765
4766 (define-pmacro (conditional-load-non-gr-u name mode op ope regtype comment)
4767 (dni name
4768 (comment)
4769 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
4770 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4771 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4772 (if (eq CCi (or cond 2))
4773 (sequence ((WI address))
4774 (set address (add GRi GRj))
4775 (set (.sym regtype k)
4776 (c-call mode (.str "@cpu@_read_mem_" mode)
4777 pc address))
4778 (set GRi address)))
4779 ((fr400 (unit u-fr-load))
4780 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4781 )
4782 )
4783
4784 (conditional-load-non-gr-u cldbfu UQI OP_63 OPE4_0 FRint "Load byte float, update")
4785 (conditional-load-non-gr-u cldhfu UHI OP_63 OPE4_1 FRint "Load half float, update")
4786 (conditional-load-non-gr-u cldfu SI OP_63 OPE4_2 FRint "Load word float, update")
4787
4788
4789 (dni clddu
4790 "Load double word, update"
4791 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
4792 "clddu$pack @($GRi,$GRj),$GRdoublek,$CCi,$cond"
4793 (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj)
4794 (if (eq CCi (or cond 2))
4795 (sequence ((WI address))
4796 (load-double-semantics 0 DI GR address GRj)
4797 (if (ne (index-of GRi) (index-of GRdoublek))
4798 (set GRi address))))
4799 ((fr400 (unit u-gr-load))
4800 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
4801 )
4802
4803 (dni clddfu
4804 "Load double float, update"
4805 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
4806 "clddfu$pack @($GRi,$GRj),$FRdoublek,$CCi,$cond"
4807 (+ pack FRdoublek OP_63 GRi CCi cond OPE4_3 GRj)
4808 (if (eq CCi (or cond 2))
4809 (sequence ((WI address))
4810 (load-double-semantics 1 DF FR address GRj)
4811 (set GRi address)))
4812 ((fr400 (unit u-fr-load))
4813 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
4814 )
4815
4816 (dni cldqu
4817 "conditional load quad integer and update index"
4818 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4819 "cldqu$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4820 (+ pack GRk OP_62 GRi CCi cond OPE4_2 GRj)
4821 (if (eq CCi (or cond 2))
4822 (sequence ((WI address))
4823 (load-quad-semantics GR address GRj)
4824 (if (ne (index-of GRi) (index-of GRk))
4825 (set GRi address))))
4826 ((fr500 (unit u-gr-load)))
4827 )
4828
4829 (define-pmacro (conditional-store name mode op ope regtype profile comment)
4830 (dni name
4831 (comment)
4832 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL)
4833 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4834 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4835 (if (eq CCi (or cond 2))
4836 (c-call VOID (.str "@cpu@_write_mem_" mode)
4837 pc (add GRi GRj) (.sym regtype k)))
4838 profile
4839 )
4840 )
4841
4842 (conditional-store cstb QI OP_64 OPE4_0 GR
4843 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4844 "Store unsigned byte")
4845 (conditional-store csth HI OP_64 OPE4_1 GR
4846 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4847 "Store unsigned half")
4848 (conditional-store cst SI OP_64 OPE4_2 GR
4849 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4850 "Store word")
4851
4852 (conditional-store cstbf QI OP_66 OPE4_0 FRint
4853 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4854 "Store byte float")
4855 (conditional-store csthf HI OP_66 OPE4_1 FRint
4856 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4857 "Store half float")
4858 (conditional-store cstf SI OP_66 OPE4_2 FRint
4859 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4860 "Store word float")
4861
4862 (define-pmacro (conditional-store-double
4863 name mode op ope regtype attr profile comment)
4864 (dni name
4865 (comment)
4866 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4867 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4868 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4869 (if (eq CCi (or cond 2))
4870 (sequence ((WI address))
4871 (store-double-semantics mode regtype address GRj)))
4872 profile
4873 )
4874 )
4875
4876 (conditional-store-double cstd DI OP_64 OPE4_3 GR NA
4877 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4878 "Store double word")
4879 (conditional-store-double cstdf DF OP_66 OPE4_3 FR FR-ACCESS
4880 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4881 "Store double float")
4882
4883 (dni cstq
4884 "conditionally store quad word"
4885 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) CONDITIONAL)
4886 "cstq$pack $GRk,@($GRi,$GRj),$CCi,$cond"
4887 (+ pack GRk OP_65 GRi CCi cond OPE4_0 GRj)
4888 (if (eq CCi (or cond 2))
4889 (sequence ((WI address))
4890 (store-quad-semantics GR address GRj)))
4891 ((fr500 (unit u-gr-store)))
4892 )
4893
4894 (define-pmacro (conditional-store-u
4895 name mode op ope regtype attr profile comment)
4896 (dni name
4897 (comment)
4898 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4899 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4900 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4901 (if (eq CCi (or cond 2))
4902 (sequence ((WI address))
4903 (set address (add GRi GRj))
4904 (c-call VOID (.str "@cpu@_write_mem_" mode)
4905 pc address (.sym regtype k))
4906 (set GRi address)))
4907 profile
4908 )
4909 )
4910
4911 (conditional-store-u cstbu QI OP_67 OPE4_0 GR NA
4912 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4913 "Store unsigned byte, update index")
4914 (conditional-store-u csthu HI OP_67 OPE4_1 GR NA
4915 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4916 "Store unsigned half, update index")
4917 (conditional-store-u cstu SI OP_67 OPE4_2 GR NA
4918 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4919 "Store word, update index")
4920
4921 (conditional-store-u cstbfu QI OP_68 OPE4_0 FRint FR-ACCESS
4922 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4923 "Store byte float, update index")
4924 (conditional-store-u csthfu HI OP_68 OPE4_1 FRint FR-ACCESS
4925 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4926 "Store half float, update index")
4927 (conditional-store-u cstfu SI OP_68 OPE4_2 FRint FR-ACCESS
4928 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4929 "Store word float, update index")
4930
4931 (define-pmacro (conditional-store-double-u
4932 name mode op ope regtype attr profile comment)
4933 (dni name
4934 (comment)
4935 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
4936 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4937 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4938 (if (eq CCi (or cond 2))
4939 (sequence ((WI address))
4940 (store-double-semantics mode regtype address GRj)
4941 (set GRi address)))
4942 profile
4943 )
4944 )
4945
4946 (conditional-store-double-u cstdu DI OP_67 OPE4_3 GR NA
4947 ((fr400 (unit u-gr-store))
4948 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4949 "Store double word, update index")
4950 (conditional-store-double-u cstdfu DF OP_68 OPE4_3 FR FR-ACCESS
4951 ((fr400 (unit u-fr-store))
4952 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4953 "Store double float, update index")
4954
4955 (define-pmacro (store-r-simm name mode op regtype attr profile comment)
4956 (dni name
4957 (comment)
4958 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4959 (.str name "$pack $" regtype "k,@($GRi,$d12)")
4960 (+ pack (.sym regtype k) op GRi d12)
4961 (c-call VOID (.str "@cpu@_write_mem_" mode)
4962 pc (add GRi d12) (.sym regtype k))
4963 profile
4964 )
4965 )
4966
4967 (store-r-simm stbi QI OP_50 GR NA
4968 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4969 "Store unsigned byte")
4970 (store-r-simm sthi HI OP_51 GR NA
4971 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4972 "Store unsigned half")
4973 (store-r-simm sti SI OP_52 GR NA
4974 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
4975 "Store word")
4976
4977 (store-r-simm stbfi QI OP_4E FRint FR-ACCESS
4978 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4979 "Store byte float")
4980 (store-r-simm sthfi HI OP_4F FRint FR-ACCESS
4981 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4982 "Store half float")
4983 (store-r-simm stfi SI OP_55 FRint FR-ACCESS
4984 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
4985 "Store word float")
4986
4987 (define-pmacro (store-double-r-simm name mode op regtype attr profile comment)
4988 (dni name
4989 (comment)
4990 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
4991 (.str name "$pack $" regtype "k,@($GRi,$d12)")
4992 (+ pack (.sym regtype k) op GRi d12)
4993 (sequence ((WI address))
4994 (store-double-semantics mode regtype address d12))
4995 profile
4996 )
4997 )
4998
4999 (store-double-r-simm stdi DI OP_53 GR NA
5000 ((fr400 (unit u-gr-store))
5001 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
5002 "Store double word")
5003 (store-double-r-simm stdfi DF OP_56 FR FR-ACCESS
5004 ((fr400 (unit u-fr-store))
5005 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
5006 "Store double float")
5007
5008 (define-pmacro (store-quad-r-simm name op regtype attr profile comment)
5009 (dni name
5010 (comment)
5011 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
5012 (.str name "$pack $" regtype "k,@($GRi,$d12)")
5013 (+ pack (.sym regtype k) op GRi d12)
5014 (sequence ((WI address))
5015 (store-quad-semantics regtype address d12))
5016 profile
5017 )
5018 )
5019
5020 (store-quad-r-simm stqi OP_54 GR NA ((fr500 (unit u-gr-store)))
5021 "Store quad word")
5022 (store-quad-r-simm stqfi OP_57 FRint FR-ACCESS ()
5023 "Store quad float")
5024
5025 (define-pmacro (swap-semantics base offset arg)
5026 (sequence ((WI tmp) (WI address))
5027 (set tmp arg)
5028 (set address (add base offset))
5029 (c-call VOID "@cpu@_check_swap_address" address)
5030 (set arg (c-call WI "@cpu@_read_mem_WI" pc address))
5031 (c-call VOID "@cpu@_write_mem_WI" pc address tmp))
5032 )
5033
5034 (dni swap
5035 "Swap contents of memory with GR"
5036 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
5037 "swap$pack @($GRi,$GRj),$GRk"
5038 (+ pack GRk OP_03 GRi OPE1_05 GRj)
5039 (swap-semantics GRi GRj GRk)
5040 ((fr400 (unit u-swap))
5041 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
5042 )
5043
5044 (dni "swapi"
5045 "Swap contents of memory with GR"
5046 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
5047 ("swapi$pack @($GRi,$d12),$GRk")
5048 (+ pack GRk OP_4D GRi d12)
5049 (swap-semantics GRi d12 GRk)
5050 ((fr400 (unit u-swap))
5051 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
5052 )
5053
5054 (dni cswap
5055 "Conditionally swap contents of memory with GR"
5056 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) CONDITIONAL)
5057 "cswap$pack @($GRi,$GRj),$GRk,$CCi,$cond"
5058 (+ pack GRk OP_65 GRi CCi cond OPE4_2 GRj)
5059 (if (eq CCi (or cond 2))
5060 (swap-semantics GRi GRj GRk))
5061 ((fr400 (unit u-swap))
5062 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
5063 )
5064
5065 (define-pmacro (register-transfer
5066 name op ope reg_src reg_targ pipe attrs profile comment)
5067 (dni name
5068 (comment)
5069 (.splice (UNIT pipe) (.unsplice attrs))
5070 (.str name "$pack $" reg_src ",$" reg_targ)
5071 (+ pack reg_targ op (rs-null) ope reg_src)
5072 (set reg_targ reg_src)
5073 profile
5074 )
5075 )
5076
5077 (register-transfer movgf OP_03 OPE1_15
5078 GRj FRintk I0
5079 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5080 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5081 "transfer gr to fr")
5082 (register-transfer movfg OP_03 OPE1_0D
5083 FRintk GRj I0
5084 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5085 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5086 "transfer fr to gr")
5087
5088 (define-pmacro (nextreg hw r offset) (reg hw (add (index-of r) offset)))
5089
5090 (define-pmacro (register-transfer-double-from-gr-semantics cond)
5091 (if cond
5092 (if (eq (index-of GRj) 0)
5093 (sequence ()
5094 (set FRintk 0)
5095 (set (nextreg h-fr_int FRintk 1) 0))
5096 (sequence ()
5097 (set FRintk GRj)
5098 (set (nextreg h-fr_int FRintk 1) (nextreg h-gr GRj 1)))))
5099 )
5100
5101 (dni movgfd
5102 "move GR for FR double"
5103 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5104 "movgfd$pack $GRj,$FRintk"
5105 (+ pack FRintk OP_03 (rs-null) OPE1_16 GRj)
5106 (register-transfer-double-from-gr-semantics 1)
5107 ; TODO -- doesn't handle second register in the pair
5108 ((fr400 (unit u-gr2fr))
5109 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5110 )
5111
5112 (define-pmacro (register-transfer-double-to-gr-semantics cond)
5113 (if (andif (ne (index-of GRj) 0) cond)
5114 (sequence ()
5115 (set GRj FRintk)
5116 (set (nextreg h-gr GRj 1) (nextreg h-fr_int FRintk 1))))
5117 )
5118
5119 (dni movfgd
5120 "move FR for GR double"
5121 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5122 "movfgd$pack $FRintk,$GRj"
5123 (+ pack FRintk OP_03 (rs-null) OPE1_0E GRj)
5124 (register-transfer-double-to-gr-semantics 1)
5125 ; TODO -- doesn't handle second register in the pair
5126 ((fr400 (unit u-fr2gr))
5127 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5128 )
5129
5130 (dni movgfq
5131 "move GR for FR quad"
5132 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5133 "movgfq$pack $GRj,$FRintk"
5134 (+ pack FRintk OP_03 (rs-null) OPE1_17 GRj)
5135 (if (eq (index-of GRj) 0)
5136 (sequence ()
5137 (set FRintk 0)
5138 (set (reg h-fr_int (add (index-of FRintk) 1)) 0)
5139 (set (reg h-fr_int (add (index-of FRintk) 2)) 0)
5140 (set (reg h-fr_int (add (index-of FRintk) 3)) 0))
5141 (sequence ()
5142 (set FRintk GRj)
5143 (set (reg h-fr_int (add (index-of FRintk) 1))
5144 (reg h-gr (add (index-of GRj) 1)))
5145 (set (reg h-fr_int (add (index-of FRintk) 2))
5146 (reg h-gr (add (index-of GRj) 2)))
5147 (set (reg h-fr_int (add (index-of FRintk) 3))
5148 (reg h-gr (add (index-of GRj) 3)))))
5149 ()
5150 )
5151
5152 (dni movfgq
5153 "move FR for GR quad"
5154 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5155 "movfgq$pack $FRintk,$GRj"
5156 (+ pack FRintk OP_03 (rs-null) OPE1_0F GRj)
5157 (if (ne (index-of GRj) 0)
5158 (sequence ()
5159 (set GRj FRintk)
5160 (set (reg h-gr (add (index-of GRj) 1))
5161 (reg h-fr_int (add (index-of FRintk) 1)))
5162 (set (reg h-gr (add (index-of GRj) 2))
5163 (reg h-fr_int (add (index-of FRintk) 2)))
5164 (set (reg h-gr (add (index-of GRj) 3))
5165 (reg h-fr_int (add (index-of FRintk) 3)))))
5166 ()
5167 )
5168
5169 (define-pmacro (conditional-register-transfer
5170 name op ope reg_src reg_targ pipe attrs profile comment)
5171 (dni name
5172 (comment)
5173 (.splice (UNIT pipe) CONDITIONAL FR-ACCESS (.unsplice attrs))
5174 (.str name "$pack $" reg_src ",$" reg_targ ",$CCi,$cond")
5175 (+ pack reg_targ op (rs-null) CCi cond ope reg_src)
5176 (if (eq CCi (or cond 2))
5177 (set reg_targ reg_src))
5178 profile
5179 )
5180 )
5181
5182 (conditional-register-transfer cmovgf OP_69 OPE4_0 GRj FRintk I0
5183 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5184 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5185 "transfer gr to fr")
5186 (conditional-register-transfer cmovfg OP_69 OPE4_2 FRintk GRj I0
5187 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5188 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5189 "transfer fr to gr")
5190
5191
5192 (dni cmovgfd
5193 "Conditional move GR to FR double"
5194 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
5195 "cmovgfd$pack $GRj,$FRintk,$CCi,$cond"
5196 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_1 GRj)
5197 (register-transfer-double-from-gr-semantics (eq CCi (or cond 2)))
5198 ; TODO -- doesn't handle extra registers in double
5199 ((fr400 (unit u-gr2fr))
5200 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
5201 )
5202
5203 (dni cmovfgd
5204 "Conditional move FR to GR double"
5205 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
5206 "cmovfgd$pack $FRintk,$GRj,$CCi,$cond"
5207 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_3 GRj)
5208 (register-transfer-double-to-gr-semantics (eq CCi (or cond 2)))
5209 ; TODO -- doesn't handle second register in the pair
5210 ((fr400 (unit u-fr2gr))
5211 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
5212 )
5213
5214 (define-pmacro (register-transfer-spr
5215 name op ope reg_src reg_targ unitname comment)
5216 (dni name
5217 (comment)
5218 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
5219 (.str name "$pack $" reg_src ",$" reg_targ)
5220 (+ pack reg_targ op ope reg_src)
5221 (set reg_targ reg_src)
5222 ((fr400 (unit unitname))
5223 (fr500 (unit unitname)) (fr550 (unit unitname)))
5224 )
5225 )
5226
5227 (register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr "transfer gr->spr")
5228 (register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr "transfer spr->gr")
5229
5230 ; Integer Branch Conditions
5231 (define-pmacro (Inev cc) (const BI 0))
5232 (define-pmacro (Ira cc) (const BI 1))
5233 (define-pmacro (Ieq cc) ( zbit cc))
5234 (define-pmacro (Ine cc) (not (zbit cc)))
5235 (define-pmacro (Ile cc) ( orif (zbit cc) (xor (nbit cc) (vbit cc))))
5236 (define-pmacro (Igt cc) (not (orif (zbit cc) (xor (nbit cc) (vbit cc)))))
5237 (define-pmacro (Ilt cc) ( xor (nbit cc) (vbit cc)))
5238 (define-pmacro (Ige cc) (not (xor (nbit cc) (vbit cc))))
5239 (define-pmacro (Ils cc) ( orif (cbit cc) (zbit cc)))
5240 (define-pmacro (Ihi cc) (not (orif (cbit cc) (zbit cc))))
5241 (define-pmacro (Ic cc) ( cbit cc))
5242 (define-pmacro (Inc cc) (not (cbit cc)))
5243 (define-pmacro (In cc) ( nbit cc))
5244 (define-pmacro (Ip cc) (not (nbit cc)))
5245 (define-pmacro (Iv cc) ( vbit cc))
5246 (define-pmacro (Inv cc) (not (vbit cc)))
5247
5248 ; Float Branch Conditions
5249 (define-pmacro (Fnev cc) (const BI 0))
5250 (define-pmacro (Fra cc) (const BI 1))
5251 (define-pmacro (Fne cc) (orif (lbit cc) (orif (gbit cc) (ubit cc))))
5252 (define-pmacro (Feq cc) (ebit cc))
5253 (define-pmacro (Flg cc) (orif (lbit cc) (gbit cc)))
5254 (define-pmacro (Fue cc) (orif (ebit cc) (ubit cc)))
5255 (define-pmacro (Ful cc) (orif (lbit cc) (ubit cc)))
5256 (define-pmacro (Fge cc) (orif (ebit cc) (gbit cc)))
5257 (define-pmacro (Flt cc) (lbit cc))
5258 (define-pmacro (Fuge cc) (orif (ebit cc) (orif (gbit cc) (ubit cc))))
5259 (define-pmacro (Fug cc) (orif (gbit cc) (ubit cc)))
5260 (define-pmacro (Fle cc) (orif (ebit cc) (lbit cc)))
5261 (define-pmacro (Fgt cc) (gbit cc))
5262 (define-pmacro (Fule cc) (orif (ebit cc) (orif (lbit cc) (ubit cc))))
5263 (define-pmacro (Fu cc) (ubit cc))
5264 (define-pmacro (Fo cc) (orif (ebit cc) (orif (lbit cc) (gbit cc))))
5265
5266 (define-pmacro (conditional-branch-i prefix cc op cond comment)
5267 (dni (.sym prefix cc)
5268 (comment)
5269 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5270 (.str (.sym prefix cc) "$pack $ICCi_2,$hint,$label16")
5271 (+ pack (.sym ICC_ cc) ICCi_2 op hint label16)
5272 (sequence ()
5273 (c-call VOID "@cpu@_model_branch" label16 hint)
5274 (if (cond ICCi_2)
5275 (set pc label16)))
5276 ((fr400 (unit u-branch))
5277 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5278 )
5279 )
5280
5281 (dni bra
5282 "integer branch equal"
5283 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5284 "bra$pack $hint_taken$label16"
5285 (+ pack ICC_ra (ICCi_2-null) OP_06 hint_taken label16)
5286 (sequence ()
5287 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5288 (set pc label16))
5289 ((fr400 (unit u-branch))
5290 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5291 )
5292
5293 (dni bno
5294 "integer branch never"
5295 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
5296 "bno$pack$hint_not_taken"
5297 (+ pack ICC_nev (ICCi_2-null) OP_06 hint_not_taken (label16-null))
5298 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5299 ((fr400 (unit u-branch))
5300 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5301 )
5302
5303 (conditional-branch-i b eq OP_06 Ieq "integer branch equal")
5304 (conditional-branch-i b ne OP_06 Ine "integer branch not equal")
5305 (conditional-branch-i b le OP_06 Ile "integer branch less or equal")
5306 (conditional-branch-i b gt OP_06 Igt "integer branch greater")
5307 (conditional-branch-i b lt OP_06 Ilt "integer branch less")
5308 (conditional-branch-i b ge OP_06 Ige "integer branch greater or equal")
5309 (conditional-branch-i b ls OP_06 Ils "integer branch less or equal unsigned")
5310 (conditional-branch-i b hi OP_06 Ihi "integer branch greater unsigned")
5311 (conditional-branch-i b c OP_06 Ic "integer branch carry set")
5312 (conditional-branch-i b nc OP_06 Inc "integer branch carry clear")
5313 (conditional-branch-i b n OP_06 In "integer branch negative")
5314 (conditional-branch-i b p OP_06 Ip "integer branch positive")
5315 (conditional-branch-i b v OP_06 Iv "integer branch overflow set")
5316 (conditional-branch-i b nv OP_06 Inv "integer branch overflow clear")
5317
5318 (define-pmacro (conditional-branch-f prefix cc op cond comment)
5319 (dni (.sym prefix cc)
5320 (comment)
5321 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5322 (.str (.sym prefix cc) "$pack $FCCi_2,$hint,$label16")
5323 (+ pack (.sym FCC_ cc) FCCi_2 op hint label16)
5324 (sequence ()
5325 (c-call VOID "@cpu@_model_branch" label16 hint)
5326 (if (cond FCCi_2) (set pc label16)))
5327 ((fr400 (unit u-branch))
5328 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5329 )
5330 )
5331
5332 (dni fbra
5333 "float branch equal"
5334 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5335 "fbra$pack $hint_taken$label16"
5336 (+ pack FCC_ra (FCCi_2-null) OP_07 hint_taken label16)
5337 (sequence ()
5338 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5339 (set pc label16))
5340 ((fr400 (unit u-branch))
5341 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5342 )
5343
5344 (dni fbno
5345 "float branch never"
5346 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
5347 "fbno$pack$hint_not_taken"
5348 (+ pack FCC_nev (FCCi_2-null) OP_07 hint_not_taken (label16-null))
5349 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5350 ((fr400 (unit u-branch))
5351 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5352 )
5353
5354 (conditional-branch-f fb ne OP_07 Fne "float branch not equal")
5355 (conditional-branch-f fb eq OP_07 Feq "float branch equal")
5356 (conditional-branch-f fb lg OP_07 Flg "float branch less or greater")
5357 (conditional-branch-f fb ue OP_07 Fue "float branch unordered or equal")
5358 (conditional-branch-f fb ul OP_07 Ful "float branch unordered or less")
5359 (conditional-branch-f fb ge OP_07 Fge "float branch greater or equal")
5360 (conditional-branch-f fb lt OP_07 Flt "float branch less")
5361 (conditional-branch-f fb uge OP_07 Fuge "float branch unordered, greater,equal")
5362 (conditional-branch-f fb ug OP_07 Fug "float branch unordered or greater")
5363 (conditional-branch-f fb le OP_07 Fle "float branch less or equal")
5364 (conditional-branch-f fb gt OP_07 Fgt "float branch greater")
5365 (conditional-branch-f fb ule OP_07 Fule "float branch unordered, less or equal")
5366 (conditional-branch-f fb u OP_07 Fu "float branch unordered")
5367 (conditional-branch-f fb o OP_07 Fo "float branch ordered")
5368
5369 (define-pmacro (ctrlr-branch-semantics cond ccond)
5370 (sequence ((SI tmp))
5371 (set tmp (sub (spr-lcr) 1))
5372 (set (spr-lcr) tmp)
5373 (if cond
5374 (if (eq ccond 0)
5375 (if (ne tmp 0)
5376 (set pc (spr-lr)))
5377 (if (eq tmp 0)
5378 (set pc (spr-lr))))))
5379 )
5380
5381 (dni bctrlr
5382 "LCR conditional branch to lr"
5383 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5384 ("bctrlr$pack $ccond,$hint")
5385 (+ pack (cond-null) (ICCi_2-null) OP_0E hint OPE3_01 ccond (s12-null))
5386 (sequence ()
5387 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5388 (ctrlr-branch-semantics (const BI 1) ccond))
5389 ((fr400 (unit u-branch))
5390 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5391 )
5392
5393 (define-pmacro (conditional-branch-cclr prefix cc i-f op ope cond attr comment)
5394 (dni (.sym prefix cc lr)
5395 (comment)
5396 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) attr)
5397 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$hint")
5398 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope
5399 (ccond-null) (s12-null))
5400 (sequence ()
5401 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5402 (if (cond (.sym i-f CCi_2)) (set pc (spr-lr))))
5403 ((fr400 (unit u-branch))
5404 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5405 )
5406 )
5407
5408 (dni bralr
5409 "integer cclr branch always"
5410 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
5411 "bralr$pack$hint_taken"
5412 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_02 (ccond-null) (s12-null))
5413 (sequence ()
5414 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5415 (set pc (spr-lr)))
5416 ((fr400 (unit u-branch))
5417 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5418 )
5419
5420 (dni bnolr
5421 "integer cclr branch never"
5422 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
5423 "bnolr$pack$hint_not_taken"
5424 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_02 (ccond-null) (s12-null))
5425 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5426 ((fr400 (unit u-branch))
5427 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5428 )
5429
5430 (conditional-branch-cclr b eq I OP_0E OPE3_02 Ieq NA "integer cclr branch equal")
5431 (conditional-branch-cclr b ne I OP_0E OPE3_02 Ine NA "integer cclr branch not equal")
5432 (conditional-branch-cclr b le I OP_0E OPE3_02 Ile NA "integer cclr branch less or equal")
5433 (conditional-branch-cclr b gt I OP_0E OPE3_02 Igt NA "integer cclr branch greater")
5434 (conditional-branch-cclr b lt I OP_0E OPE3_02 Ilt NA "integer cclr branch less")
5435 (conditional-branch-cclr b ge I OP_0E OPE3_02 Ige NA "integer cclr branch greater or equal")
5436 (conditional-branch-cclr b ls I OP_0E OPE3_02 Ils NA "integer cclr branch less or equal unsigned")
5437 (conditional-branch-cclr b hi I OP_0E OPE3_02 Ihi NA "integer cclr branch greater unsigned")
5438 (conditional-branch-cclr b c I OP_0E OPE3_02 Ic NA "integer cclr branch carry set")
5439 (conditional-branch-cclr b nc I OP_0E OPE3_02 Inc NA "integer cclr branch carry clear")
5440 (conditional-branch-cclr b n I OP_0E OPE3_02 In NA "integer cclr branch negative")
5441 (conditional-branch-cclr b p I OP_0E OPE3_02 Ip NA "integer cclr branch positive")
5442 (conditional-branch-cclr b v I OP_0E OPE3_02 Iv NA "integer cclr branch overflow set")
5443 (conditional-branch-cclr b nv I OP_0E OPE3_02 Inv NA "integer cclr branch overflow clear")
5444
5445 (dni fbralr
5446 "float cclr branch always"
5447 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
5448 "fbralr$pack$hint_taken"
5449 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_06 (ccond-null) (s12-null))
5450 (sequence ()
5451 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5452 (set pc (spr-lr)))
5453 ((fr400 (unit u-branch))
5454 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5455 )
5456
5457 (dni fbnolr
5458 "float cclr branch never"
5459 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
5460 "fbnolr$pack$hint_not_taken"
5461 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_06 (ccond-null) (s12-null))
5462 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5463 ((fr400 (unit u-branch))
5464 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5465 )
5466
5467 (conditional-branch-cclr fb eq F OP_0E OPE3_06 Feq FR-ACCESS "float cclr branch equal")
5468 (conditional-branch-cclr fb ne F OP_0E OPE3_06 Fne FR-ACCESS "float cclr branch not equal")
5469 (conditional-branch-cclr fb lg F OP_0E OPE3_06 Flg FR-ACCESS "float branch less or greater")
5470 (conditional-branch-cclr fb ue F OP_0E OPE3_06 Fue FR-ACCESS "float branch unordered or equal")
5471 (conditional-branch-cclr fb ul F OP_0E OPE3_06 Ful FR-ACCESS "float branch unordered or less")
5472 (conditional-branch-cclr fb ge F OP_0E OPE3_06 Fge FR-ACCESS "float branch greater or equal")
5473 (conditional-branch-cclr fb lt F OP_0E OPE3_06 Flt FR-ACCESS "float branch less")
5474 (conditional-branch-cclr fb uge F OP_0E OPE3_06 Fuge FR-ACCESS "float branch unordered, greater, equal")
5475 (conditional-branch-cclr fb ug F OP_0E OPE3_06 Fug FR-ACCESS "float branch unordered or greater")
5476 (conditional-branch-cclr fb le F OP_0E OPE3_06 Fle FR-ACCESS "float branch less or equal")
5477 (conditional-branch-cclr fb gt F OP_0E OPE3_06 Fgt FR-ACCESS "float branch greater")
5478 (conditional-branch-cclr fb ule F OP_0E OPE3_06 Fule FR-ACCESS "float branch unordered, less or equal")
5479 (conditional-branch-cclr fb u F OP_0E OPE3_06 Fu FR-ACCESS "float branch unordered")
5480 (conditional-branch-cclr fb o F OP_0E OPE3_06 Fo FR-ACCESS "float branch ordered")
5481
5482 (define-pmacro (conditional-branch-ctrlr prefix cc i-f op ope cond attr comment)
5483 (dni (.sym prefix cc lr)
5484 (comment)
5485 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) attr)
5486 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$ccond,$hint")
5487 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope ccond (s12-null))
5488 (sequence ()
5489 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5490 (ctrlr-branch-semantics (cond (.sym i-f CCi_2)) ccond))
5491 ((fr400 (unit u-branch))
5492 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5493 )
5494 )
5495
5496 (dni bcralr
5497 "integer ctrlr branch always"
5498 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5499 "bcralr$pack $ccond$hint_taken"
5500 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_03 ccond (s12-null))
5501 (sequence ()
5502 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5503 (ctrlr-branch-semantics (const BI 1) ccond))
5504 ((fr400 (unit u-branch))
5505 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5506 )
5507
5508 (dni bcnolr
5509 "integer ctrlr branch never"
5510 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
5511 "bcnolr$pack$hint_not_taken"
5512 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_03 (ccond-null) (s12-null))
5513 (sequence ()
5514 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5515 (ctrlr-branch-semantics (const BI 0) ccond))
5516 ((fr400 (unit u-branch))
5517 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5518 )
5519
5520 (conditional-branch-ctrlr bc eq I OP_0E OPE3_03 Ieq NA "integer ctrlr branch equal")
5521 (conditional-branch-ctrlr bc ne I OP_0E OPE3_03 Ine NA "integer ctrlr branch not equal")
5522 (conditional-branch-ctrlr bc le I OP_0E OPE3_03 Ile NA "integer ctrlr branch less equal")
5523 (conditional-branch-ctrlr bc gt I OP_0E OPE3_03 Igt NA "integer ctrlr branch greater")
5524 (conditional-branch-ctrlr bc lt I OP_0E OPE3_03 Ilt NA "integer ctrlr branch less")
5525 (conditional-branch-ctrlr bc ge I OP_0E OPE3_03 Ige NA "integer ctrlr branch greater equal")
5526 (conditional-branch-ctrlr bc ls I OP_0E OPE3_03 Ils NA "integer ctrlr branch less equal unsigned")
5527 (conditional-branch-ctrlr bc hi I OP_0E OPE3_03 Ihi NA "integer ctrlr branch greater unsigned")
5528 (conditional-branch-ctrlr bc c I OP_0E OPE3_03 Ic NA "integer ctrlr branch carry set")
5529 (conditional-branch-ctrlr bc nc I OP_0E OPE3_03 Inc NA "integer ctrlr branch carry clear")
5530 (conditional-branch-ctrlr bc n I OP_0E OPE3_03 In NA "integer ctrlr branch negative")
5531 (conditional-branch-ctrlr bc p I OP_0E OPE3_03 Ip NA "integer ctrlr branch positive")
5532 (conditional-branch-ctrlr bc v I OP_0E OPE3_03 Iv NA "integer ctrlr branch overflow set")
5533 (conditional-branch-ctrlr bc nv I OP_0E OPE3_03 Inv NA "integer ctrlr branch overflow clear")
5534
5535 (dni fcbralr
5536 "float ctrlr branch always"
5537 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
5538 "fcbralr$pack $ccond$hint_taken"
5539 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_07 ccond (s12-null))
5540 (sequence ()
5541 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5542 (ctrlr-branch-semantics (const BI 1) ccond))
5543 ((fr400 (unit u-branch))
5544 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5545 )
5546
5547 (dni fcbnolr
5548 "float ctrlr branch never"
5549 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
5550 "fcbnolr$pack$hint_not_taken"
5551 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_07 (ccond-null) (s12-null))
5552 (sequence ()
5553 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5554 (ctrlr-branch-semantics (const BI 0) ccond))
5555 ((fr400 (unit u-branch))
5556 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5557 )
5558
5559 (conditional-branch-ctrlr fcb eq F OP_0E OPE3_07 Feq FR-ACCESS "float cclr branch equal")
5560 (conditional-branch-ctrlr fcb ne F OP_0E OPE3_07 Fne FR-ACCESS "float cclr branch not equal")
5561 (conditional-branch-ctrlr fcb lg F OP_0E OPE3_07 Flg FR-ACCESS "float branch less or greater")
5562 (conditional-branch-ctrlr fcb ue F OP_0E OPE3_07 Fue FR-ACCESS "float branch unordered or equal")
5563 (conditional-branch-ctrlr fcb ul F OP_0E OPE3_07 Ful FR-ACCESS "float branch unordered or less")
5564 (conditional-branch-ctrlr fcb ge F OP_0E OPE3_07 Fge FR-ACCESS "float branch greater or equal")
5565 (conditional-branch-ctrlr fcb lt F OP_0E OPE3_07 Flt FR-ACCESS "float branch less")
5566 (conditional-branch-ctrlr fcb uge F OP_0E OPE3_07 Fuge FR-ACCESS "float branch unordered, greater, equal")
5567 (conditional-branch-ctrlr fcb ug F OP_0E OPE3_07 Fug FR-ACCESS "float branch unordered or greater")
5568 (conditional-branch-ctrlr fcb le F OP_0E OPE3_07 Fle FR-ACCESS "float branch less or equal")
5569 (conditional-branch-ctrlr fcb gt F OP_0E OPE3_07 Fgt FR-ACCESS "float branch greater")
5570 (conditional-branch-ctrlr fcb ule F OP_0E OPE3_07 Fule FR-ACCESS "float branch unordered, less or equal")
5571 (conditional-branch-ctrlr fcb u F OP_0E OPE3_07 Fu FR-ACCESS "float branch unordered")
5572 (conditional-branch-ctrlr fcb o F OP_0E OPE3_07 Fo FR-ACCESS "float branch ordered")
5573
5574 (define-pmacro (jump-and-link-semantics base offset LI)
5575 (sequence ()
5576 (if (eq LI 1)
5577 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1))
5578 ; Target address gets aligned here
5579 (set pc (and (add base offset) #xfffffffc))
5580 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5581 )
5582
5583 (dni jmpl
5584 "jump and link"
5585 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
5586 "jmpl$pack @($GRi,$GRj)"
5587 (+ pack (misc-null-1) (LI-off) OP_0C GRi (misc-null-2) GRj)
5588 (jump-and-link-semantics GRi GRj LI)
5589 ((fr400 (unit u-branch))
5590 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5591 )
5592
5593 (dni calll
5594 "call and link"
5595 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5596 "calll$pack @($GRi,$GRj)"
5597 (+ pack (misc-null-1) (LI-on) OP_0C GRi (misc-null-2) GRj)
5598 (jump-and-link-semantics GRi GRj LI)
5599 ((fr400 (unit u-branch))
5600 (fr500 (unit u-branch)))
5601 )
5602
5603 (dni jmpil
5604 "jump immediate and link"
5605 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
5606 "jmpil$pack @($GRi,$s12)"
5607 (+ pack (misc-null-1) (LI-off) OP_0D GRi s12)
5608 (jump-and-link-semantics GRi s12 LI)
5609 ((fr400 (unit u-branch))
5610 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5611 )
5612
5613 (dni callil
5614 "call immediate and link"
5615 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5616 "callil$pack @($GRi,$s12)"
5617 (+ pack (misc-null-1) (LI-on) OP_0D GRi s12)
5618 (jump-and-link-semantics GRi s12 LI)
5619 ((fr400 (unit u-branch))
5620 (fr500 (unit u-branch)))
5621 )
5622
5623 (dni call
5624 "call and link"
5625 ((UNIT B0) (FR500-MAJOR B-4) (FR550-MAJOR B-4) (FR400-MAJOR B-4))
5626 "call$pack $label24"
5627 (+ pack OP_0F label24)
5628 (sequence ()
5629 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1)
5630 (set pc label24)
5631 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5632 ((fr400 (unit u-branch))
5633 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
5634 )
5635
5636 (dni rett
5637 "return from trap"
5638 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) PRIVILEGED)
5639 "rett$pack $debug"
5640 (+ pack (misc-null-1) debug OP_05 (rs-null) (s12-null))
5641 ; frv_rett handles operating vs user mode
5642 (sequence ()
5643 (set pc (c-call UWI "frv_rett" pc debug))
5644 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5645 ()
5646 )
5647
5648 (dni rei
5649 "run exception instruction"
5650 ((UNIT C) (FR500-MAJOR C-1) (MACH frv) PRIVILEGED)
5651 "rei$pack $eir"
5652 (+ pack (rd-null) OP_37 eir (s12-null))
5653 (nop) ; for now
5654 ()
5655 )
5656
5657 (define-pmacro (trap-semantics cond base offset)
5658 (if cond
5659 (sequence ()
5660 ; This is defered to frv_itrap because for the breakpoint
5661 ; case we want to change as little of the machine state as
5662 ; possible.
5663 ;
5664 ; PCSR=PC
5665 ; PSR.PS=PSR.S
5666 ; PSR.ET=0
5667 ; if PSR.ESR==1
5668 ; SR0 through SR3=GR4 through GR7
5669 ; TBR.TT=0x80 + ((GRi + s12) & 0x7f)
5670 ; PC=TBR
5671 ; We still should indicate what is modified by this insn.
5672 (clobber (spr-pcsr))
5673 (clobber psr_ps)
5674 (clobber psr_et)
5675 (clobber tbr_tt)
5676 (if (ne psr_esr (const 0))
5677 (sequence ()
5678 (clobber (spr-sr0))
5679 (clobber (spr-sr1))
5680 (clobber (spr-sr2))
5681 (clobber (spr-sr3))))
5682 ; frv_itrap handles operating vs user mode
5683 (c-call VOID "frv_itrap" pc base offset)))
5684 )
5685
5686 (define-pmacro (trap-r prefix cc i-f op ope cond attr comment)
5687 (dni (.sym prefix cc)
5688 (comment)
5689 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
5690 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$GRj")
5691 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi (misc-null-3) ope GRj)
5692 (trap-semantics (cond (.sym i-f CCi_2)) GRi GRj)
5693 ((fr400 (unit u-trap))
5694 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5695 )
5696 )
5697
5698 (dni tra
5699 "integer trap always"
5700 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5701 "tra$pack $GRi,$GRj"
5702 (+ pack ICC_ra (ICCi_2-null) OP_04 GRi (misc-null-3) OPE4_0 GRj)
5703 (trap-semantics (const BI 1) GRi GRj)
5704 ((fr400 (unit u-trap))
5705 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5706 )
5707
5708 (dni tno
5709 "integer trap never"
5710 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5711 "tno$pack"
5712 (+ pack ICC_nev (ICCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_0 (GRj-null))
5713 (trap-semantics (const BI 0) GRi GRj)
5714 ((fr400 (unit u-trap))
5715 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5716 )
5717
5718 (trap-r t eq I OP_04 OPE4_0 Ieq NA "integer trap equal")
5719 (trap-r t ne I OP_04 OPE4_0 Ine NA "integer trap not equal")
5720 (trap-r t le I OP_04 OPE4_0 Ile NA "integer trap less or equal")
5721 (trap-r t gt I OP_04 OPE4_0 Igt NA "integer trap greater")
5722 (trap-r t lt I OP_04 OPE4_0 Ilt NA "integer trap less")
5723 (trap-r t ge I OP_04 OPE4_0 Ige NA "integer trap greater or equal")
5724 (trap-r t ls I OP_04 OPE4_0 Ils NA "integer trap less or equal unsigned")
5725 (trap-r t hi I OP_04 OPE4_0 Ihi NA "integer trap greater unsigned")
5726 (trap-r t c I OP_04 OPE4_0 Ic NA "integer trap carry set")
5727 (trap-r t nc I OP_04 OPE4_0 Inc NA "integer trap carry clear")
5728 (trap-r t n I OP_04 OPE4_0 In NA "integer trap negative")
5729 (trap-r t p I OP_04 OPE4_0 Ip NA "integer trap positive")
5730 (trap-r t v I OP_04 OPE4_0 Iv NA "integer trap overflow set")
5731 (trap-r t nv I OP_04 OPE4_0 Inv NA "integer trap overflow clear")
5732
5733 (dni ftra
5734 "float trap always"
5735 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5736 "ftra$pack $GRi,$GRj"
5737 (+ pack FCC_ra (FCCi_2-null) OP_04 GRi (misc-null-3) OPE4_1 GRj)
5738 (trap-semantics (const BI 1) GRi GRj)
5739 ((fr400 (unit u-trap))
5740 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5741 )
5742
5743 (dni ftno
5744 "flost trap never"
5745 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5746 "ftno$pack"
5747 (+ pack FCC_nev (FCCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_1 (GRj-null))
5748 (trap-semantics (const BI 0) GRi GRj)
5749 ((fr400 (unit u-trap))
5750 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5751 )
5752
5753 (trap-r ft ne F OP_04 OPE4_1 Fne FR-ACCESS "float trap not equal")
5754 (trap-r ft eq F OP_04 OPE4_1 Feq FR-ACCESS "float trap equal")
5755 (trap-r ft lg F OP_04 OPE4_1 Flg FR-ACCESS "float trap greater or less")
5756 (trap-r ft ue F OP_04 OPE4_1 Fue FR-ACCESS "float trap unordered or equal")
5757 (trap-r ft ul F OP_04 OPE4_1 Ful FR-ACCESS "float trap unordered or less")
5758 (trap-r ft ge F OP_04 OPE4_1 Fge FR-ACCESS "float trap greater or equal")
5759 (trap-r ft lt F OP_04 OPE4_1 Flt FR-ACCESS "float trap less")
5760 (trap-r ft uge F OP_04 OPE4_1 Fuge FR-ACCESS "float trap unordered greater or equal")
5761 (trap-r ft ug F OP_04 OPE4_1 Fug FR-ACCESS "float trap unordered or greater")
5762 (trap-r ft le F OP_04 OPE4_1 Fle FR-ACCESS "float trap less or equal")
5763 (trap-r ft gt F OP_04 OPE4_1 Fgt FR-ACCESS "float trap greater")
5764 (trap-r ft ule F OP_04 OPE4_1 Fule FR-ACCESS "float trap unordered less or equal")
5765 (trap-r ft u F OP_04 OPE4_1 Fu FR-ACCESS "float trap unordered")
5766 (trap-r ft o F OP_04 OPE4_1 Fo FR-ACCESS "float trap ordered")
5767
5768 (define-pmacro (trap-immed prefix cc i-f op cond attr comment)
5769 (dni (.sym prefix cc)
5770 (comment)
5771 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
5772 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$s12")
5773 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi s12)
5774 (trap-semantics (cond (.sym i-f CCi_2)) GRi s12)
5775 ((fr400 (unit u-trap))
5776 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5777 )
5778 )
5779
5780 (dni tira
5781 "integer trap always"
5782 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5783 "tira$pack $GRi,$s12"
5784 (+ pack ICC_ra (ICCi_2-null) OP_1C GRi s12)
5785 (trap-semantics (const BI 1) GRi s12)
5786 ((fr400 (unit u-trap))
5787 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5788 )
5789
5790 (dni tino
5791 "integer trap never"
5792 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5793 "tino$pack"
5794 (+ pack ICC_nev (ICCi_2-null) OP_1C (GRi-null) (s12-null))
5795 (trap-semantics (const BI 0) GRi s12)
5796 ((fr400 (unit u-trap))
5797 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5798 )
5799
5800 (trap-immed ti eq I OP_1C Ieq NA "integer trap equal")
5801 (trap-immed ti ne I OP_1C Ine NA "integer trap not equal")
5802 (trap-immed ti le I OP_1C Ile NA "integer trap less or equal")
5803 (trap-immed ti gt I OP_1C Igt NA "integer trap greater")
5804 (trap-immed ti lt I OP_1C Ilt NA "integer trap less")
5805 (trap-immed ti ge I OP_1C Ige NA "integer trap greater or equal")
5806 (trap-immed ti ls I OP_1C Ils NA "integer trap less or equal unsigned")
5807 (trap-immed ti hi I OP_1C Ihi NA "integer trap greater unsigned")
5808 (trap-immed ti c I OP_1C Ic NA "integer trap carry set")
5809 (trap-immed ti nc I OP_1C Inc NA "integer trap carry clear")
5810 (trap-immed ti n I OP_1C In NA "integer trap negative")
5811 (trap-immed ti p I OP_1C Ip NA "integer trap positive")
5812 (trap-immed ti v I OP_1C Iv NA "integer trap overflow set")
5813 (trap-immed ti nv I OP_1C Inv NA "integer trap overflow clear")
5814
5815 (dni ftira
5816 "float trap always"
5817 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5818 "ftira$pack $GRi,$s12"
5819 (+ pack FCC_ra (ICCi_2-null) OP_1D GRi s12)
5820 (trap-semantics (const BI 1) GRi s12)
5821 ((fr400 (unit u-trap))
5822 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5823 )
5824
5825 (dni ftino
5826 "float trap never"
5827 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5828 "ftino$pack"
5829 (+ pack FCC_nev (FCCi_2-null) OP_1D (GRi-null) (s12-null))
5830 (trap-semantics (const BI 0) GRi s12)
5831 ((fr400 (unit u-trap))
5832 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
5833 )
5834
5835 (trap-immed fti ne F OP_1D Fne FR-ACCESS "float trap not equal")
5836 (trap-immed fti eq F OP_1D Feq FR-ACCESS "float trap equal")
5837 (trap-immed fti lg F OP_1D Flg FR-ACCESS "float trap greater or less")
5838 (trap-immed fti ue F OP_1D Fue FR-ACCESS "float trap unordered or equal")
5839 (trap-immed fti ul F OP_1D Ful FR-ACCESS "float trap unordered or less")
5840 (trap-immed fti ge F OP_1D Fge FR-ACCESS "float trap greater or equal")
5841 (trap-immed fti lt F OP_1D Flt FR-ACCESS "float trap less")
5842 (trap-immed fti uge F OP_1D Fuge FR-ACCESS "float trap unordered greater or equal")
5843 (trap-immed fti ug F OP_1D Fug FR-ACCESS "float trap unordered or greater")
5844 (trap-immed fti le F OP_1D Fle FR-ACCESS "float trap less or equal")
5845 (trap-immed fti gt F OP_1D Fgt FR-ACCESS "float trap greater")
5846 (trap-immed fti ule F OP_1D Fule FR-ACCESS "float trap unordered less or equal")
5847 (trap-immed fti u F OP_1D Fu FR-ACCESS "float trap unordered")
5848 (trap-immed fti o F OP_1D Fo FR-ACCESS "float trap ordered")
5849
5850 (dni break
5851 "break trap"
5852 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
5853 "break$pack"
5854 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_3 (GRj-null))
5855 (sequence ()
5856 ; This is defered to frv_break because for the breakpoint
5857 ; case we want to change as little of the machine state as
5858 ; possible.
5859 ;
5860 ; BPCSR=PC
5861 ; BPSR.BS=PSR.S
5862 ; BPSR.BET=PSR.ET
5863 ; PSR.S=1
5864 ; PSR.ET=0
5865 ; TBR.TT=0xff
5866 ; PC=TBR
5867 ; We still should indicate what is modified by this insn.
5868 (clobber (spr-bpcsr))
5869 (clobber bpsr_bs)
5870 (clobber bpsr_bet)
5871 (clobber psr_s)
5872 (clobber psr_et)
5873 (clobber tbr_tt)
5874 (c-call VOID "frv_break"))
5875 ()
5876 )
5877
5878 (dni mtrap
5879 "media trap"
5880 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
5881 "mtrap$pack"
5882 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_2 (GRj-null))
5883 (c-call VOID "frv_mtrap")
5884 ()
5885 )
5886
5887 (define-pmacro (condition-code-logic name operation ope comment)
5888 (dni name
5889 (comment)
5890 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
5891 (.str name "$pack $CRi,$CRj,$CRk")
5892 (+ pack (misc-null-6) CRk OP_0A (misc-null-7) CRi ope (misc-null-8) CRj)
5893 (set CRk (c-call UQI "@cpu@_cr_logic" operation CRi CRj))
5894 ()
5895 )
5896 )
5897 (define-pmacro (op-andcr) 0)
5898 (define-pmacro (op-orcr) 1)
5899 (define-pmacro (op-xorcr) 2)
5900 (define-pmacro (op-nandcr) 3)
5901 (define-pmacro (op-norcr) 4)
5902 (define-pmacro (op-andncr) 5)
5903 (define-pmacro (op-orncr) 6)
5904 (define-pmacro (op-nandncr) 7)
5905 (define-pmacro (op-norncr) 8)
5906
5907 (define-pmacro (cr-true) 3)
5908 (define-pmacro (cr-false) 2)
5909 (define-pmacro (cr-undefined) 0)
5910
5911 (condition-code-logic andcr (op-andcr) OPE1_08 "and condition code regs")
5912 (condition-code-logic orcr (op-orcr) OPE1_09 "or condition code regs")
5913 (condition-code-logic xorcr (op-xorcr) OPE1_0A "xor condition code regs")
5914 (condition-code-logic nandcr (op-nandcr) OPE1_0C "nand condition code regs")
5915 (condition-code-logic norcr (op-norcr) OPE1_0D "nor condition code regs")
5916 (condition-code-logic andncr (op-andncr) OPE1_10 "andn condition code regs")
5917 (condition-code-logic orncr (op-orncr) OPE1_11 "orn condition code regs")
5918 (condition-code-logic nandncr (op-nandncr) OPE1_14 "nandn condition code regs")
5919 (condition-code-logic norncr (op-norncr) OPE1_15 "norn condition code regs")
5920
5921 (dni notcr
5922 ("not cccr register")
5923 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
5924 (.str notcr "$pack $CRj,$CRk")
5925 (+ pack (misc-null-6) CRk OP_0A (rs-null) OPE1_0B (misc-null-8) CRj)
5926 (set CRk (xor CRj 1))
5927 ()
5928 )
5929
5930 (define-pmacro (check-semantics cond cr)
5931 (if cond (set cr (cr-true)) (set cr (cr-false)))
5932 )
5933
5934 (define-pmacro (check-int-condition-code prefix cc op cond comment)
5935 (dni (.sym prefix cc)
5936 (comment)
5937 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5938 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int")
5939 (+ pack (.sym ICC_ cc) CRj_int op (misc-null-5) ICCi_3)
5940 (check-semantics (cond ICCi_3) CRj_int)
5941 ((fr400 (unit u-check))
5942 (fr500 (unit u-check)) (fr550 (unit u-check)))
5943 )
5944 )
5945
5946 (dni ckra
5947 "check integer cc always"
5948 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5949 "ckra$pack $CRj_int"
5950 (+ pack ICC_ra CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5951 (check-semantics (const BI 1) CRj_int)
5952 ((fr400 (unit u-check))
5953 (fr500 (unit u-check)) (fr550 (unit u-check)))
5954 )
5955
5956 (dni ckno
5957 "check integer cc never"
5958 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
5959 "ckno$pack $CRj_int"
5960 (+ pack ICC_nev CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5961 (check-semantics (const BI 0) CRj_int)
5962 ((fr400 (unit u-check))
5963 (fr500 (unit u-check)) (fr550 (unit u-check)))
5964 )
5965
5966 (check-int-condition-code ck eq OP_08 Ieq "check integer cc equal")
5967 (check-int-condition-code ck ne OP_08 Ine "check integer cc not equal")
5968 (check-int-condition-code ck le OP_08 Ile "check integer cc less or equal")
5969 (check-int-condition-code ck gt OP_08 Igt "check integer cc greater")
5970 (check-int-condition-code ck lt OP_08 Ilt "check integer cc less")
5971 (check-int-condition-code ck ge OP_08 Ige "check integer cc greater or equal")
5972 (check-int-condition-code ck ls OP_08 Ils "check integer cc less or equal unsigned")
5973 (check-int-condition-code ck hi OP_08 Ihi "check integer cc greater unsigned")
5974 (check-int-condition-code ck c OP_08 Ic "check integer cc carry set")
5975 (check-int-condition-code ck nc OP_08 Inc "check integer cc carry clear")
5976 (check-int-condition-code ck n OP_08 In "check integer cc negative")
5977 (check-int-condition-code ck p OP_08 Ip "check integer cc positive")
5978 (check-int-condition-code ck v OP_08 Iv "check integer cc overflow set")
5979 (check-int-condition-code ck nv OP_08 Inv "check integer cc overflow clear")
5980
5981 (define-pmacro (check-float-condition-code prefix cc op cond comment)
5982 (dni (.sym prefix cc)
5983 (comment)
5984 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
5985 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float")
5986 (+ pack (.sym FCC_ cc) CRj_float op (misc-null-5) FCCi_3)
5987 (check-semantics (cond FCCi_3) CRj_float)
5988 ((fr400 (unit u-check))
5989 (fr500 (unit u-check)) (fr550 (unit u-check)))
5990 )
5991 )
5992
5993 (dni fckra
5994 "check float cc always"
5995 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
5996 "fckra$pack $CRj_float"
5997 (+ pack FCC_ra CRj_float OP_09 (misc-null-5) FCCi_3)
5998 (check-semantics (const BI 1) CRj_float)
5999 ((fr400 (unit u-check))
6000 (fr500 (unit u-check)) (fr550 (unit u-check)))
6001 )
6002
6003 (dni fckno
6004 "check float cc never"
6005 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
6006 "fckno$pack $CRj_float"
6007 (+ pack FCC_nev CRj_float OP_09 (misc-null-5) FCCi_3)
6008 (check-semantics (const BI 0) CRj_float)
6009 ((fr400 (unit u-check))
6010 (fr500 (unit u-check)) (fr550 (unit u-check)))
6011 )
6012
6013 (check-float-condition-code fck ne OP_09 Fne "check float cc not equal")
6014 (check-float-condition-code fck eq OP_09 Feq "check float cc equal")
6015 (check-float-condition-code fck lg OP_09 Flg "check float cc greater or less")
6016 (check-float-condition-code fck ue OP_09 Fue "check float cc unordered or equal")
6017 (check-float-condition-code fck ul OP_09 Ful "check float cc unordered or less")
6018 (check-float-condition-code fck ge OP_09 Fge "check float cc greater or equal")
6019 (check-float-condition-code fck lt OP_09 Flt "check float cc less")
6020 (check-float-condition-code fck uge OP_09 Fuge "check float cc unordered greater or equal")
6021 (check-float-condition-code fck ug OP_09 Fug "check float cc unordered or greater")
6022 (check-float-condition-code fck le OP_09 Fle "check float cc less or equal")
6023 (check-float-condition-code fck gt OP_09 Fgt "check float cc greater")
6024 (check-float-condition-code fck ule OP_09 Fule "check float cc unordered less or equal")
6025 (check-float-condition-code fck u OP_09 Fu "check float cc unordered")
6026 (check-float-condition-code fck o OP_09 Fo "check float cc ordered")
6027
6028 (define-pmacro (conditional-check-int-condition-code prefix cc op ope test comment)
6029 (dni (.sym prefix cc)
6030 (comment)
6031 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
6032 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int,$CCi,$cond")
6033 (+ pack (.sym ICC_ cc) CRj_int op (rs-null) CCi cond ope
6034 (misc-null-9) ICCi_3)
6035 (if (eq CCi (or cond 2))
6036 (check-semantics (test ICCi_3) CRj_int)
6037 (set CRj_int (cr-undefined)))
6038 ((fr400 (unit u-check))
6039 (fr500 (unit u-check)) (fr550 (unit u-check)))
6040 )
6041 )
6042
6043 (dni cckra
6044 "conditional check integer cc always"
6045 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
6046 "cckra$pack $CRj_int,$CCi,$cond"
6047 (+ pack ICC_ra CRj_int OP_6A (rs-null) CCi cond OPE4_0
6048 (misc-null-9) (ICCi_3-null))
6049 (if (eq CCi (or cond 2))
6050 (check-semantics (const BI 1) CRj_int)
6051 (set CRj_int (cr-undefined)))
6052 ((fr400 (unit u-check))
6053 (fr500 (unit u-check)) (fr550 (unit u-check)))
6054 )
6055
6056 (dni cckno
6057 "conditional check integer cc never"
6058 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
6059 "cckno$pack $CRj_int,$CCi,$cond"
6060 (+ pack ICC_nev CRj_int OP_6A (rs-null) CCi cond OPE4_0
6061 (misc-null-9) (ICCi_3-null))
6062 (if (eq CCi (or cond 2))
6063 (check-semantics (const BI 0) CRj_int)
6064 (set CRj_int (cr-undefined)))
6065 ((fr400 (unit u-check))
6066 (fr500 (unit u-check)) (fr550 (unit u-check)))
6067 )
6068
6069 (conditional-check-int-condition-code cck eq OP_6A OPE4_0 Ieq "check integer cc equal")
6070 (conditional-check-int-condition-code cck ne OP_6A OPE4_0 Ine "check integer cc not equal")
6071 (conditional-check-int-condition-code cck le OP_6A OPE4_0 Ile "check integer cc less or equal")
6072 (conditional-check-int-condition-code cck gt OP_6A OPE4_0 Igt "check integer cc greater")
6073 (conditional-check-int-condition-code cck lt OP_6A OPE4_0 Ilt "check integer cc less")
6074 (conditional-check-int-condition-code cck ge OP_6A OPE4_0 Ige "check integer cc greater or equal")
6075 (conditional-check-int-condition-code cck ls OP_6A OPE4_0 Ils "check integer cc less or equal unsigned")
6076 (conditional-check-int-condition-code cck hi OP_6A OPE4_0 Ihi "check integer cc greater unsigned")
6077 (conditional-check-int-condition-code cck c OP_6A OPE4_0 Ic "check integer cc carry set")
6078 (conditional-check-int-condition-code cck nc OP_6A OPE4_0 Inc "check integer cc carry clear")
6079 (conditional-check-int-condition-code cck n OP_6A OPE4_0 In "check integer cc negative")
6080 (conditional-check-int-condition-code cck p OP_6A OPE4_0 Ip "check integer cc positive")
6081 (conditional-check-int-condition-code cck v OP_6A OPE4_0 Iv "check integer cc overflow set")
6082 (conditional-check-int-condition-code cck nv OP_6A OPE4_0 Inv "check integer cc overflow clear")
6083
6084 (define-pmacro (conditional-check-float-condition-code prefix cc op ope test comment)
6085 (dni (.sym prefix cc)
6086 (comment)
6087 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6088 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float,$CCi,$cond")
6089 (+ pack (.sym FCC_ cc) CRj_float op (rs-null) CCi cond ope
6090 (misc-null-9) FCCi_3)
6091 (if (eq CCi (or cond 2))
6092 (check-semantics (test FCCi_3) CRj_float)
6093 (set CRj_float (cr-undefined)))
6094 ((fr400 (unit u-check))
6095 (fr500 (unit u-check)) (fr550 (unit u-check)))
6096 )
6097 )
6098
6099 (dni cfckra
6100 "conditional check float cc always"
6101 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6102 "cfckra$pack $CRj_float,$CCi,$cond"
6103 (+ pack FCC_ra CRj_float OP_6A (rs-null) CCi cond OPE4_1
6104 (misc-null-9) (FCCi_3-null))
6105 (if (eq CCi (or cond 2))
6106 (check-semantics (const BI 1) CRj_float)
6107 (set CRj_float (cr-undefined)))
6108 ((fr400 (unit u-check))
6109 (fr500 (unit u-check)) (fr550 (unit u-check)))
6110 )
6111
6112 (dni cfckno
6113 "conditional check float cc never"
6114 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
6115 "cfckno$pack $CRj_float,$CCi,$cond"
6116 (+ pack FCC_nev CRj_float OP_6A (rs-null) CCi cond OPE4_1
6117 (misc-null-9) (FCCi_3-null))
6118 (if (eq CCi (or cond 2))
6119 (check-semantics (const BI 0) CRj_float)
6120 (set CRj_float (cr-undefined)))
6121 ((fr400 (unit u-check))
6122 (fr500 (unit u-check)) (fr550 (unit u-check)))
6123 )
6124
6125 (conditional-check-float-condition-code cfck ne OP_6A OPE4_1 Fne "check float cc not equal")
6126 (conditional-check-float-condition-code cfck eq OP_6A OPE4_1 Feq "check float cc equal")
6127 (conditional-check-float-condition-code cfck lg OP_6A OPE4_1 Flg "check float cc greater or less")
6128 (conditional-check-float-condition-code cfck ue OP_6A OPE4_1 Fue "check float cc unordered or equal")
6129 (conditional-check-float-condition-code cfck ul OP_6A OPE4_1 Ful "check float cc unordered or less")
6130 (conditional-check-float-condition-code cfck ge OP_6A OPE4_1 Fge "check float cc greater or equal")
6131 (conditional-check-float-condition-code cfck lt OP_6A OPE4_1 Flt "check float cc less")
6132 (conditional-check-float-condition-code cfck uge OP_6A OPE4_1 Fuge "check float cc unordered greater or equal")
6133 (conditional-check-float-condition-code cfck ug OP_6A OPE4_1 Fug "check float cc unordered or greater")
6134 (conditional-check-float-condition-code cfck le OP_6A OPE4_1 Fle "check float cc less or equal")
6135 (conditional-check-float-condition-code cfck gt OP_6A OPE4_1 Fgt "check float cc greater")
6136 (conditional-check-float-condition-code cfck ule OP_6A OPE4_1 Fule "check float cc unordered less or equal")
6137 (conditional-check-float-condition-code cfck u OP_6A OPE4_1 Fu "check float cc unordered")
6138 (conditional-check-float-condition-code cfck o OP_6A OPE4_1 Fo "check float cc ordered")
6139
6140 (dni cjmpl
6141 "conditional jump and link"
6142 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5) CONDITIONAL)
6143 "cjmpl$pack @($GRi,$GRj),$CCi,$cond"
6144 (+ pack (misc-null-1) (LI-off) OP_6A GRi CCi cond OPE4_2 GRj)
6145 (if (eq CCi (or cond 2))
6146 (jump-and-link-semantics GRi GRj LI))
6147 ((fr400 (unit u-branch))
6148 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
6149 )
6150
6151 (dni ccalll
6152 "conditional call and link"
6153 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5) CONDITIONAL)
6154 "ccalll$pack @($GRi,$GRj),$CCi,$cond"
6155 (+ pack (misc-null-1) (LI-on) OP_6A GRi CCi cond OPE4_2 GRj)
6156 (if (eq CCi (or cond 2))
6157 (jump-and-link-semantics GRi GRj LI))
6158 ((fr400 (unit u-branch))
6159 (fr500 (unit u-branch)))
6160 )
6161
6162 (define-pmacro (cache-invalidate name cache all op ope profile comment)
6163 (dni name
6164 (comment)
6165 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6166 (.str name "$pack @($GRi,$GRj)")
6167 (+ pack (rd-null) op GRi ope GRj)
6168 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) all)
6169 profile
6170 )
6171 )
6172
6173 (cache-invalidate ici insn 0 OP_03 OPE1_38
6174 ((fr400 (unit u-ici)) (fr500 (unit u-ici)) (fr550 (unit u-ici)))
6175 "invalidate insn cache")
6176 (cache-invalidate dci data 0 OP_03 OPE1_3C
6177 ((fr400 (unit u-dci)) (fr500 (unit u-dci)) (fr550 (unit u-dci)))
6178 "invalidate data cache")
6179
6180 (define-pmacro (cache-invalidate-entry name cache op ope profile comment)
6181 (dni name
6182 (comment)
6183 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
6184 (.str name "$pack @($GRi,$GRj),$ae")
6185 (+ pack (misc-null-1) ae op GRi ope GRj)
6186 (if (eq ae 0)
6187 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) -1) ; Invalid ae setting for this insn
6188 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) ae))
6189 profile
6190 )
6191 )
6192
6193 (cache-invalidate-entry icei insn OP_03 OPE1_39
6194 ((fr400 (unit u-ici)) (fr550 (unit u-ici)))
6195 "invalidate insn cache entry")
6196 (cache-invalidate-entry dcei data OP_03 OPE1_3A
6197 ((fr400 (unit u-dci)) (fr550 (unit u-dci)))
6198 "invalidate data cache entry")
6199
6200 (dni dcf
6201 "Data cache flush"
6202 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6203 "dcf$pack @($GRi,$GRj)"
6204 (+ pack (rd-null) OP_03 GRi OPE1_3D GRj)
6205 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) 0)
6206 ((fr400 (unit u-dcf))
6207 (fr500 (unit u-dcf)) (fr550 (unit u-dcf)))
6208 )
6209
6210 (dni dcef
6211 "Data cache entry flush"
6212 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
6213 "dcef$pack @($GRi,$GRj),$ae"
6214 (+ pack (misc-null-1) ae OP_03 GRi OPE1_3B GRj)
6215 (if (eq ae 0)
6216 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) -1)
6217 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) ae))
6218 ((fr400 (unit u-dcf)) (fr550 (unit u-dcf)))
6219 )
6220
6221 (define-pmacro (write-TLB name insn op ope comment)
6222 (dni name
6223 (comment)
6224 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6225 (.str insn "$pack $GRk,@($GRi,$GRj)")
6226 (+ pack GRk op GRi ope GRj)
6227 (nop) ; for now
6228 ()
6229 )
6230 )
6231
6232 (write-TLB witlb witlb OP_03 OPE1_32 "write for insn TLB")
6233 (write-TLB wdtlb wdtlb OP_03 OPE1_36 "write for data TLB")
6234
6235 (define-pmacro (invalidate-TLB name insn op ope comment)
6236 (dni name
6237 (comment)
6238 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6239 (.str insn "$pack @($GRi,$GRj)")
6240 (+ pack (rd-null) op GRi ope GRj)
6241 (nop) ; for now
6242 ()
6243 )
6244 )
6245
6246 (invalidate-TLB itlbi itlbi OP_03 OPE1_33 "invalidate insn TLB")
6247 (invalidate-TLB dtlbi dtlbi OP_03 OPE1_37 "invalidate data TLB")
6248
6249 (define-pmacro (cache-preload name cache pipe attrs op ope profile comment)
6250 (dni name
6251 (comment)
6252 (.splice (UNIT pipe) (FR500-MAJOR C-2) (FR400-MAJOR C-2) (.unsplice attrs))
6253 (.str name "$pack $GRi,$GRj,$lock")
6254 (+ pack (misc-null-1) lock op GRi ope GRj)
6255 (c-call VOID (.str "@cpu@_" cache "_cache_preload") GRi GRj lock)
6256 profile
6257 )
6258 )
6259
6260 (cache-preload icpl insn C ((FR550-MAJOR C-2)) OP_03 OPE1_30
6261 ((fr400 (unit u-icpl)) (fr500 (unit u-icpl)) (fr550 (unit u-icpl)))
6262 "preload insn cache")
6263 (cache-preload dcpl data DCPL ((FR550-MAJOR I-8)) OP_03 OPE1_34
6264 ((fr400 (unit u-dcpl)) (fr500 (unit u-dcpl)) (fr550 (unit u-dcpl)))
6265 "preload data cache")
6266
6267 (define-pmacro (cache-unlock name cache op ope profile comment)
6268 (dni name
6269 (comment)
6270 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6271 (.str name "$pack $GRi")
6272 (+ pack (rd-null) op GRi ope (GRj-null))
6273 (c-call VOID (.str "@cpu@_" cache "_cache_unlock") GRi)
6274 profile
6275 )
6276 )
6277
6278 (cache-unlock icul insn OP_03 OPE1_31
6279 ((fr400 (unit u-icul)) (fr500 (unit u-icul)) (fr550 (unit u-icul)))
6280 "unlock insn cache")
6281 (cache-unlock dcul data OP_03 OPE1_35
6282 ((fr400 (unit u-dcul)) (fr500 (unit u-dcul)) (fr550 (unit u-dcul)))
6283 "unlock data cache")
6284
6285 (define-pmacro (barrier name insn op ope profile comment)
6286 (dni name
6287 (comment)
6288 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
6289 (.str insn "$pack")
6290 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6291 (nop) ; sufficient implementation
6292 profile
6293 )
6294 )
6295
6296 (barrier bar bar OP_03 OPE1_3E
6297 ((fr400 (unit u-barrier)) (fr500 (unit u-barrier)))
6298 "barrier")
6299 (barrier membar membar OP_03 OPE1_3F
6300 ((fr400 (unit u-membar)) (fr500 (unit u-membar)))
6301 "memory barrier")
6302
6303 ; Coprocessor operations
6304 (define-pmacro (cop-op num op)
6305 (dni (.sym cop num)
6306 "Coprocessor operation"
6307 ((UNIT C) (FR500-MAJOR C-2) (MACH frv))
6308 (.str "cop" num "$pack $s6_1,$CPRi,$CPRj,$CPRk")
6309 (+ pack CPRk op CPRi s6_1 CPRj)
6310 (nop) ; sufficient implementation
6311 ()
6312 )
6313 )
6314
6315 (cop-op 1 OP_7E)
6316 (cop-op 2 OP_7F)
6317
6318 (define-pmacro (clear-ne-flag-semantics target_index is_float)
6319 (c-call VOID "@cpu@_clear_ne_flags" target_index is_float)
6320 )
6321
6322 (define-pmacro (clear-ne-flag-r name op ope reg is_float attr profile comment)
6323 (dni name
6324 (comment)
6325 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
6326 (.str name "$pack $" reg "k")
6327 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
6328 (sequence ()
6329 ; hack to get this referenced for profiling
6330 (c-raw-call VOID "frv_ref_SI" (.sym reg k))
6331 (clear-ne-flag-semantics (index-of (.sym reg k)) is_float))
6332 profile
6333 )
6334 )
6335
6336 (clear-ne-flag-r clrgr OP_0A OPE1_00 GR 0 NA
6337 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
6338 "Clear GR NE flag")
6339 (clear-ne-flag-r clrfr OP_0A OPE1_02 FR 1 FR-ACCESS
6340 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
6341 "Clear FR NE flag")
6342
6343 (define-pmacro (clear-ne-flag-all name op ope is_float attr profile comment)
6344 (dni name
6345 (comment)
6346 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
6347 (.str name "$pack")
6348 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6349 (clear-ne-flag-semantics -1 is_float)
6350 profile
6351 )
6352 )
6353
6354 (clear-ne-flag-all clrga OP_0A OPE1_01 0 NA
6355 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
6356 "Clear GR NE flag ALL")
6357 (clear-ne-flag-all clrfa OP_0A OPE1_03 1 FR-ACCESS
6358 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
6359 "Clear FR NE flag ALL")
6360
6361 (define-pmacro (commit-semantics target_index is_float)
6362 (c-call VOID "@cpu@_commit" target_index is_float)
6363 )
6364
6365 (define-pmacro (commit-r name op ope reg is_float attr comment)
6366 (dni name
6367 (comment)
6368 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
6369 (.str name "$pack $" reg "k")
6370 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
6371 (commit-semantics (index-of (.sym reg k)) is_float)
6372 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
6373 )
6374 )
6375
6376 (commit-r commitgr OP_0A OPE1_04 GR 0 NA "commit exceptions, specific GR")
6377 (commit-r commitfr OP_0A OPE1_06 FR 1 FR-ACCESS "commit exceptions, specific FR")
6378
6379 (define-pmacro (commit name op ope is_float attr comment)
6380 (dni name
6381 (comment)
6382 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
6383 (.str name "$pack")
6384 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6385 (commit-semantics -1 is_float)
6386 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
6387 )
6388 )
6389
6390 (commit commitga OP_0A OPE1_05 0 NA "commit exceptions, any GR")
6391 (commit commitfa OP_0A OPE1_07 1 FR-ACCESS "commit exceptions, any FR")
6392
6393 (define-pmacro (floating-point-conversion
6394 name op ope conv mode src targ attr comment)
6395 (dni name
6396 (comment)
6397 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6398 (.str name "$pack $" src ",$" targ)
6399 (+ pack targ op (rs-null) ope src)
6400 (set targ (conv mode src))
6401 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6402 )
6403 )
6404
6405 (floating-point-conversion fitos OP_79 OPE1_00 float SF FRintj FRk
6406 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6407 "Convert Integer to Single")
6408 (floating-point-conversion fstoi OP_79 OPE1_01 fix SI FRj FRintk
6409 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6410 "Convert Single to Integer")
6411 (floating-point-conversion fitod OP_7A OPE1_00 float DF FRintj FRdoublek
6412 ((MACH frv))
6413 "Convert Integer to Double")
6414 (floating-point-conversion fdtoi OP_7A OPE1_01 fix SI FRdoublej FRintk
6415 ((MACH frv))
6416 "Convert Double to Integer")
6417
6418 (define-pmacro (floating-point-dual-conversion
6419 name op ope conv mode src src_hw targ targ_hw attr comment)
6420 (dni name
6421 (comment)
6422 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) attr)
6423 (.str name "$pack $" src ",$" targ)
6424 (+ pack targ op (rs-null) ope src)
6425 (sequence ()
6426 (set targ (conv mode src))
6427 (set (nextreg targ_hw targ 1)
6428 (conv mode (nextreg src_hw src 1))))
6429 ((fr500 (unit u-float-dual-convert)))
6430 )
6431 )
6432
6433 (floating-point-dual-conversion fditos OP_79 OPE1_10 float SF FRintj h-fr_int FRk h-fr NA "Dual Convert Integer to Single")
6434 (floating-point-dual-conversion fdstoi OP_79 OPE1_11 fix SI FRj h-fr FRintk h-fr_int NA "Dual Convert Single to Integer")
6435
6436 (define-pmacro (ne-floating-point-dual-conversion
6437 name op ope conv mode src src_hw targ targ_hw attr comment)
6438 (dni name
6439 (comment)
6440 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) NON-EXCEPTING attr)
6441 (.str name "$pack $" src ",$" targ)
6442 (+ pack targ op (rs-null) ope src)
6443 (sequence ()
6444 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6445 (set targ (conv mode src))
6446 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6447 (set (nextreg targ_hw targ 1)
6448 (conv mode (nextreg src_hw src 1))))
6449 ((fr500 (unit u-float-dual-convert)))
6450 )
6451 )
6452
6453 (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")
6454 (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")
6455
6456 (define-pmacro (conditional-floating-point-conversion
6457 name op ope conv mode src targ comment)
6458 (dni name
6459 (comment)
6460 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6461 (.str name "$pack $" src ",$" targ ",$CCi,$cond")
6462 (+ pack targ op (rs-null) CCi cond ope src)
6463 (if (eq CCi (or cond 2))
6464 (set targ (conv mode src)))
6465 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6466 )
6467 )
6468
6469 (conditional-floating-point-conversion cfitos OP_6B OPE4_0 float SF FRintj FRk "Conditional convert Integer to Single")
6470 (conditional-floating-point-conversion cfstoi OP_6B OPE4_1 fix SI FRj FRintk "Conditional convert Single to Integer")
6471
6472 (define-pmacro (ne-floating-point-conversion
6473 name op ope conv mode src targ comment)
6474 (dni name
6475 (comment)
6476 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6477 (.str name "$pack $" src ",$" targ)
6478 (+ pack targ op (rs-null) ope src)
6479 (sequence ()
6480 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6481 (set targ (conv mode src)))
6482 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
6483 )
6484 )
6485
6486 (ne-floating-point-conversion nfitos OP_79 OPE1_20 float SF FRintj FRk "NE convert Integer to Single")
6487 (ne-floating-point-conversion nfstoi OP_79 OPE1_21 fix SI FRj FRintk "NE convert Single to Integer")
6488
6489 (register-transfer fmovs OP_79 OPE1_02
6490 FRj FRk FM01
6491 ((FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6492 ((fr500 (unit u-fr2fr)))
6493 "Move Single Float")
6494 (register-transfer fmovd OP_7A OPE1_02
6495 ; TODO -- unit doesn't handle extra register
6496 FRdoublej FRdoublek FM01
6497 ((FR500-MAJOR F-1) (MACH frv))
6498 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
6499 "Move Double Float")
6500
6501 (dni fdmovs
6502 "Dual move single float"
6503 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6504 "fdmovs$pack $FRj,$FRk"
6505 (+ pack FRk OP_79 (rs-null) OPE1_12 FRj)
6506 (sequence ()
6507 (set FRk FRj)
6508 (set (nextreg h-fr FRk 1) (nextreg h-fr FRj 1)))
6509 ; TODO -- unit doesn't handle extra register
6510 ((fr500 (unit u-fr2fr)))
6511 )
6512
6513 (conditional-register-transfer cfmovs OP_6C OPE4_0 FRj FRk FM01
6514 ((FR500-MAJOR F-1) (FR550-MAJOR F-2)
6515 (MACH simple,tomcat,fr500,fr550,frv))
6516 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
6517 "Conditional move Single Float")
6518
6519 (define-pmacro (floating-point-neg name src targ op ope attr comment)
6520 (dni name
6521 (comment)
6522 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6523 (.str name "$pack $" src ",$" targ)
6524 (+ pack src op (rs-null) ope targ)
6525 (set targ (neg src))
6526 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6527 )
6528 )
6529
6530 (floating-point-neg fnegs FRj FRk OP_79 OPE1_03 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Floating point negate, single")
6531 (floating-point-neg fnegd FRdoublej FRdoublek OP_7A OPE1_03 ((MACH frv)) "Floating point negate, double")
6532
6533 (dni fdnegs
6534 "Floating point dual negate, single"
6535 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6536 "fdnegs$pack $FRj,$FRk"
6537 (+ pack FRk OP_79 (rs-null) OPE1_13 FRj)
6538 (sequence ()
6539 (set FRk (neg FRj))
6540 (set (nextreg h-fr FRk 1) (neg (nextreg h-fr FRj 1))))
6541 ((fr500 (unit u-float-dual-arith)))
6542 )
6543
6544 (dni cfnegs
6545 "Conditional floating point negate, single"
6546 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6547 "cfnegs$pack $FRj,$FRk,$CCi,$cond"
6548 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_1 FRk)
6549 (if (eq CCi (or cond 2))
6550 (set FRk (neg FRj)))
6551 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6552 )
6553
6554 (define-pmacro (float-abs name src targ op ope attr comment)
6555 (dni name
6556 (comment)
6557 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
6558 (.str name "$pack $" src ",$" targ )
6559 (+ pack targ op (rs-null) ope src)
6560 (set targ (abs src))
6561 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6562 )
6563 )
6564
6565 (float-abs fabss FRj FRk OP_79 OPE1_04 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Float absolute value, single")
6566 (float-abs fabsd FRdoublej FRdoublek OP_7A OPE1_04 ((MACH frv)) "Float absolute value, double")
6567
6568 (dni fdabss
6569 "Floating point dual absolute value, single"
6570 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
6571 "fdabss$pack $FRj,$FRk"
6572 (+ pack FRk OP_79 (rs-null) OPE1_14 FRj)
6573 (sequence ()
6574 (set FRk (abs FRj))
6575 (set (nextreg h-fr FRk 1) (abs (nextreg h-fr FRj 1))))
6576 ((fr500 (unit u-float-dual-arith)))
6577 )
6578
6579 (dni cfabss
6580 "Conditional floating point absolute value, single"
6581 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6582 "cfabss$pack $FRj,$FRk,$CCi,$cond"
6583 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_2 FRk)
6584 (if (eq CCi (or cond 2))
6585 (set FRk (abs FRj)))
6586 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6587 )
6588
6589 (dni fsqrts
6590 "Square root single"
6591 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6592 "fsqrts$pack $FRj,$FRk"
6593 (+ pack FRk OP_79 (rs-null) OPE1_05 FRj)
6594 (set FRk (sqrt SF FRj))
6595 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6596 )
6597
6598 (dni fdsqrts
6599 "Dual square root single"
6600 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4))
6601 "fdsqrts$pack $FRj,$FRk"
6602 (+ pack FRk OP_79 (rs-null) OPE1_15 FRj)
6603 (sequence ()
6604 (set FRk (sqrt SF FRj))
6605 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6606 ((fr500 (unit u-float-dual-sqrt)))
6607 )
6608
6609 (dni nfdsqrts
6610 "Non excepting Dual square root single"
6611 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4) NON-EXCEPTING)
6612 "nfdsqrts$pack $FRj,$FRk"
6613 (+ pack FRk OP_79 (rs-null) OPE1_35 FRj)
6614 (sequence ()
6615 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6616 (set FRk (sqrt SF FRj))
6617 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6618 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6619 ((fr500 (unit u-float-dual-sqrt)))
6620 )
6621
6622 (dni fsqrtd
6623 "Square root double"
6624 ((UNIT FM01) (FR500-MAJOR F-4) (MACH frv))
6625 "fsqrtd$pack $FRdoublej,$FRdoublek"
6626 (+ pack FRdoublek OP_7A (rs-null) OPE1_05 FRdoublej)
6627 (set FRdoublek (sqrt DF FRdoublej))
6628 ((fr500 (unit u-float-sqrt)))
6629 )
6630
6631 (dni cfsqrts
6632 "Conditional square root single"
6633 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6634 "cfsqrts$pack $FRj,$FRk,$CCi,$cond"
6635 (+ pack FRk OP_6E (rs-null) CCi cond OPE4_2 FRj)
6636 (if (eq CCi (or cond 2))
6637 (set FRk (sqrt SF FRj)))
6638 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6639 )
6640
6641 (dni nfsqrts
6642 "Non exception square root, single"
6643 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6644 "nfsqrts$pack $FRj,$FRk"
6645 (+ pack FRk OP_79 (rs-null) OPE1_25 FRj)
6646 (sequence ()
6647 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6648 (set FRk (sqrt SF FRj)))
6649 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
6650 )
6651
6652 (define-pmacro (float-binary-op-s name pipe attr operation op ope comment)
6653 (dni name
6654 (comment)
6655 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) (.unsplice attr))
6656 (.str name "$pack $FRi,$FRj,$FRk")
6657 (+ pack FRk op FRi ope FRj)
6658 (set FRk (operation FRi FRj))
6659 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6660 )
6661 )
6662
6663 (float-binary-op-s fadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_06 "add single float")
6664 (float-binary-op-s fsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_07 "sub single float")
6665 (float-binary-op-s fmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_08 "mul single float")
6666
6667 (dni fdivs
6668 "div single float"
6669 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
6670 "fdivs$pack $FRi,$FRj,$FRk"
6671 (+ pack FRk OP_79 FRi OPE1_09 FRj)
6672 (set FRk (div FRi FRj))
6673 ((fr500 (unit u-float-div))
6674 (fr550 (unit u-float-div)))
6675 )
6676
6677 (define-pmacro (float-binary-op-d name operation op ope major comment)
6678 (dni name
6679 (comment)
6680 ((UNIT FMALL) (FR500-MAJOR major) (MACH frv))
6681 (.str name "$pack $FRdoublei,$FRdoublej,$FRdoublek")
6682 (+ pack FRdoublek op FRdoublei ope FRdoublej)
6683 (set FRdoublek (operation FRdoublei FRdoublej))
6684 ((fr500 (unit u-float-arith)))
6685 )
6686 )
6687
6688 (float-binary-op-d faddd add OP_7A OPE1_06 F-2 "add double float")
6689 (float-binary-op-d fsubd sub OP_7A OPE1_07 F-2 "sub double float")
6690 (float-binary-op-d fmuld mul OP_7A OPE1_08 F-3 "mul double float")
6691 (float-binary-op-d fdivd div OP_7A OPE1_09 F-4 "div double float")
6692
6693 (define-pmacro (conditional-float-binary-op name pipe attr operation op ope profile comment)
6694 (dni name
6695 (comment)
6696 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
6697 (.unsplice attr))
6698 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6699 (+ pack FRk op FRi CCi cond ope FRj)
6700 (if (eq CCi (or cond 2))
6701 (set FRk (operation FRi FRj)))
6702 profile
6703 )
6704 )
6705
6706 (conditional-float-binary-op cfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_6D OPE4_0
6707 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6708 "cond add single")
6709 (conditional-float-binary-op cfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_6D OPE4_1
6710 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6711 "cond sub single")
6712 (conditional-float-binary-op cfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_6E OPE4_0
6713 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6714 "cond mul single")
6715 (conditional-float-binary-op cfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_6E OPE4_1
6716 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
6717 "cond div single")
6718
6719 (define-pmacro (ne-float-binary-op name pipe attr operation op ope profile comment)
6720 (dni name
6721 (comment)
6722 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
6723 (.unsplice attr))
6724 (.str name "$pack $FRi,$FRj,$FRk")
6725 (+ pack FRk op FRi ope FRj)
6726 (sequence ()
6727 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6728 (set FRk (operation FRi FRj)))
6729 profile
6730 )
6731 )
6732
6733 (ne-float-binary-op nfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_26
6734 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6735 "ne add single")
6736 (ne-float-binary-op nfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_27
6737 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6738 "ne sub single")
6739 (ne-float-binary-op nfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_28
6740 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
6741 "ne mul single")
6742 (ne-float-binary-op nfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_79 OPE1_29
6743 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
6744 "ne div single")
6745
6746 (define-pmacro (fcc-eq) 8)
6747 (define-pmacro (fcc-lt) 4)
6748 (define-pmacro (fcc-gt) 2)
6749 (define-pmacro (fcc-uo) 1)
6750
6751 (define-pmacro (compare-and-set-fcc arg1 arg2 fcc)
6752 (if (gt arg1 arg2)
6753 (set fcc (fcc-gt))
6754 (if (eq arg1 arg2)
6755 (set fcc (fcc-eq))
6756 (if (lt arg1 arg2)
6757 (set fcc (fcc-lt))
6758 (set fcc (fcc-uo)))))
6759 )
6760
6761 (dni fcmps
6762 "compare single float"
6763 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6764 "fcmps$pack $FRi,$FRj,$FCCi_2"
6765 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_0A FRj)
6766 (compare-and-set-fcc FRi FRj FCCi_2)
6767 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
6768 )
6769
6770 (dni fcmpd
6771 "compare double float"
6772 ((UNIT FMALL) (FR500-MAJOR F-2) (MACH frv))
6773 "fcmpd$pack $FRdoublei,$FRdoublej,$FCCi_2"
6774 (+ pack (cond-null) FCCi_2 OP_7A FRdoublei OPE1_0A FRdoublej)
6775 (compare-and-set-fcc FRdoublei FRdoublej FCCi_2)
6776 ((fr500 (unit u-float-compare)))
6777 )
6778
6779 (dni cfcmps
6780 "Conditional compare single, float"
6781 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
6782 "cfcmps$pack $FRi,$FRj,$FCCi_2,$CCi,$cond"
6783 (+ pack (cond-null) FCCi_2 OP_6D FRi CCi cond OPE4_2 FRj)
6784 (if (eq CCi (or cond 2))
6785 (compare-and-set-fcc FRi FRj FCCi_2))
6786 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
6787 )
6788
6789 (dni fdcmps
6790 "float dual compare single"
6791 ((UNIT FMALL) (FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6792 "fdcmps$pack $FRi,$FRj,$FCCi_2"
6793 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_1A FRj)
6794 (sequence ()
6795 (compare-and-set-fcc FRi FRj FCCi_2)
6796 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
6797 (nextreg h-fccr FCCi_2 1)))
6798 ((fr500 (unit u-float-dual-compare)) (fr550 (unit u-float-dual-compare)))
6799 )
6800
6801 (define-pmacro (float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6802 (dni name
6803 (comment)
6804 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6805 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6806 (+ pack targ op arg1 ope arg2)
6807 (set targ (add_sub (mul arg1 arg2) targ))
6808 ((fr500 (unit u-float-dual-arith)))
6809 )
6810 )
6811
6812 (float-mul-with-add fmadds add FRi FRj FRk OP_79 OPE1_0B "mul with add, single")
6813 (float-mul-with-add fmsubs sub FRi FRj FRk OP_79 OPE1_0C "mul with sub, single")
6814
6815 (float-mul-with-add fmaddd add FRdoublei FRdoublej FRdoublek OP_7A OPE1_0B "mul with add, double")
6816 (float-mul-with-add fmsubd sub FRdoublei FRdoublej FRdoublek OP_7A OPE1_0C "mul with sub, double")
6817
6818 (dni fdmadds
6819 "Float dual multiply with add"
6820 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6821 "fdmadds$pack $FRi,$FRj,$FRk"
6822 (+ pack FRk OP_79 FRi OPE1_1B FRj)
6823 (sequence ()
6824 (set FRk (add (mul FRi FRj) FRk))
6825 (set (nextreg h-fr FRk 1)
6826 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6827 (nextreg h-fr FRk 1))))
6828 ; TODO dual registers not referenced for profiling
6829 ((fr500 (unit u-float-dual-arith)))
6830 )
6831
6832 (dni nfdmadds
6833 "Non excepting float dual multiply with add"
6834 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
6835 "nfdmadds$pack $FRi,$FRj,$FRk"
6836 (+ pack FRk OP_79 FRi OPE1_3B FRj)
6837 (sequence ()
6838 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6839 (set FRk (add (mul FRi FRj) FRk))
6840 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6841 (set (nextreg h-fr FRk 1)
6842 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6843 (nextreg h-fr FRk 1))))
6844 ; TODO dual registers not referenced for profiling
6845 ((fr500 (unit u-float-dual-arith)))
6846 )
6847
6848 (define-pmacro (conditional-float-mul-with-add
6849 name add_sub arg1 arg2 targ op ope comment)
6850 (dni name
6851 (comment)
6852 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) CONDITIONAL)
6853 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6854 (+ pack FRk op FRi CCi cond ope FRj)
6855 (if (eq CCi (or cond 2))
6856 (set targ (add_sub (mul arg1 arg2) targ)))
6857 ((fr500 (unit u-float-dual-arith)))
6858 )
6859 )
6860
6861 (conditional-float-mul-with-add cfmadds add FRi FRj FRk OP_6F OPE4_0 "conditional mul with add, single")
6862 (conditional-float-mul-with-add cfmsubs sub FRi FRj FRk OP_6F OPE4_1 "conditional mul with sub, single")
6863
6864 (define-pmacro (ne-float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6865 (dni name
6866 (comment)
6867 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) NON-EXCEPTING)
6868 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6869 (+ pack targ op arg1 ope arg2)
6870 (sequence ()
6871 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6872 (set targ (add_sub (mul arg1 arg2) targ)))
6873 ((fr500 (unit u-float-dual-arith)))
6874 )
6875 )
6876
6877 (ne-float-mul-with-add nfmadds add FRi FRj FRk OP_79 OPE1_2B "non excepting mul with add, single")
6878 (ne-float-mul-with-add nfmsubs sub FRi FRj FRk OP_79 OPE1_2C "non excepting mul with sub, single")
6879
6880 (define-pmacro (float-parallel-mul-add-semantics cond add_sub arg1 arg2 targ)
6881 (if cond
6882 (sequence ()
6883 (set targ (mul arg1 arg2))
6884 (set (nextreg h-fr targ 1)
6885 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))))
6886 )
6887
6888 (define-pmacro (float-parallel-mul-add
6889 name add_sub arg1 arg2 targ op ope comment)
6890 (dni name
6891 (comment)
6892 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
6893 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6894 (+ pack targ op arg1 ope arg2)
6895 (float-parallel-mul-add-semantics 1 add_sub arg1 arg2 targ)
6896 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6897 )
6898 )
6899
6900 (float-parallel-mul-add fmas add FRi FRj FRk OP_79 OPE1_0E "parallel mul/add, single")
6901 (float-parallel-mul-add fmss sub FRi FRj FRk OP_79 OPE1_0F "parallel mul/sub, single")
6902
6903 (define-pmacro (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6904 (sequence ()
6905 (set targ (mul arg1 arg2))
6906 (set (nextreg h-fr targ 1)
6907 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6908 (set (nextreg h-fr targ 2)
6909 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6910 (set (nextreg h-fr targ 3)
6911 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6912 )
6913
6914 (define-pmacro (float-dual-parallel-mul-add
6915 name add_sub arg1 arg2 targ op ope comment)
6916 (dni name
6917 (comment)
6918 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6919 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6920 (+ pack targ op arg1 ope arg2)
6921 (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6922 ()
6923 )
6924 )
6925
6926 (float-dual-parallel-mul-add fdmas add FRi FRj FRk OP_79 OPE1_1C "dual parallel mul/add, single")
6927 (float-dual-parallel-mul-add fdmss sub FRi FRj FRk OP_79 OPE1_1D "dual parallel mul/sub, single")
6928
6929 (define-pmacro (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6930 (sequence ()
6931 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6932 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6933 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 2))
6934 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 3))
6935 (set targ (mul arg1 arg2))
6936 (set (nextreg h-fr targ 1)
6937 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6938 (set (nextreg h-fr targ 2)
6939 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6940 (set (nextreg h-fr targ 3)
6941 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6942 )
6943
6944 (define-pmacro (ne-float-dual-parallel-mul-add
6945 name add_sub arg1 arg2 targ op ope comment)
6946 (dni name
6947 (comment)
6948 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6949 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6950 (+ pack targ op arg1 ope arg2)
6951 (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6952 ()
6953 )
6954 )
6955
6956 (ne-float-dual-parallel-mul-add nfdmas add FRi FRj FRk OP_79 OPE1_3C "non excepting dual parallel mul/add, single")
6957 (ne-float-dual-parallel-mul-add nfdmss sub FRi FRj FRk OP_79 OPE1_3D "non excepting dual parallel mul/sub, single")
6958
6959 (define-pmacro (conditional-float-parallel-mul-add name add_sub op ope comment)
6960 (dni name
6961 (comment)
6962 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) CONDITIONAL (MACH simple,tomcat,fr500,fr550,frv))
6963 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6964 (+ pack FRk op FRi CCi cond ope FRj)
6965 (float-parallel-mul-add-semantics (eq CCi (or cond 2))
6966 add_sub FRi FRj FRk)
6967 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
6968 )
6969 )
6970
6971 (conditional-float-parallel-mul-add cfmas add OP_6F OPE4_2 "conditional parallel mul/add, single")
6972 (conditional-float-parallel-mul-add cfmss sub OP_6F OPE4_3 "conditional parallel mul/sub, single")
6973
6974 (define-pmacro (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
6975 (sequence ()
6976 (set targ (ftrunc SF (mul DF (fext DF arg1) (fext DF arg2))))
6977 (set (nextreg h-fr targ 1)
6978 (ftrunc SF (add_sub DF
6979 (fext DF (nextreg h-fr arg1 1))
6980 (fext DF (nextreg h-fr arg2 1))))))
6981 )
6982
6983 (define-pmacro (float-parallel-mul-add-double
6984 name add_sub arg1 arg2 targ op ope comment)
6985 (dni name
6986 (comment)
6987 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6988 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6989 (+ pack targ op arg1 ope arg2)
6990 (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
6991 ()
6992 )
6993 )
6994
6995 (float-parallel-mul-add-double fmad add FRi FRj FRk OP_7A OPE1_0E "parallel mul/add, double")
6996 (float-parallel-mul-add-double fmsd sub FRi FRj FRk OP_7A OPE1_0F "parallel mul/sub, double")
6997
6998 (define-pmacro (ne-float-parallel-mul-add name add_sub op ope comment)
6999 (dni name
7000 (comment)
7001 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
7002 (.str name "$pack $FRi,$FRj,$FRk")
7003 (+ pack FRk op FRi ope FRj)
7004 (sequence ()
7005 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7006 (set FRk (mul FRi FRj))
7007 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7008 (set (nextreg h-fr FRk 1)
7009 (add_sub (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
7010 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7011 )
7012 )
7013
7014 (ne-float-parallel-mul-add nfmas add OP_79 OPE1_2E "ne parallel mul/add,single")
7015 (ne-float-parallel-mul-add nfmss sub OP_79 OPE1_2F "ne parallel mul/sub,single")
7016
7017 (define-pmacro (float-dual-arith name attr oper1 oper2 op ope comment)
7018 (dni name
7019 (comment)
7020 (.splice (UNIT FM01) (.unsplice attr))
7021 (.str name "$pack $FRi,$FRj,$FRk")
7022 (+ pack FRk op FRi ope FRj)
7023 (sequence ()
7024 (set FRk (oper1 FRi FRj))
7025 (set (nextreg h-fr FRk 1)
7026 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
7027 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7028 )
7029 )
7030
7031 (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")
7032 (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")
7033 (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")
7034 (float-dual-arith fddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_19 "dual div,single")
7035 (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")
7036
7037 (dni fdmulcs
7038 "Float dual cross multiply single"
7039 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
7040 "fdmulcs$pack $FRi,$FRj,$FRk"
7041 (+ pack FRk OP_79 FRi OPE1_1F FRj)
7042 (sequence ()
7043 (set FRk (mul FRi (nextreg h-fr FRj 1)))
7044 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
7045 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7046 )
7047
7048 (dni nfdmulcs
7049 "NE float dual cross multiply single"
7050 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
7051 "nfdmulcs$pack $FRi,$FRj,$FRk"
7052 (+ pack FRk OP_79 FRi OPE1_3F FRj)
7053 (sequence ()
7054 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7055 (set FRk (mul FRi (nextreg h-fr FRj 1)))
7056 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7057 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
7058 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7059 )
7060
7061 (define-pmacro (ne-float-dual-arith name attr oper1 oper2 op ope comment)
7062 (dni name
7063 (comment)
7064 (.splice (UNIT FM01) (.unsplice attr))
7065 (.str name "$pack $FRi,$FRj,$FRk")
7066 (+ pack FRk op FRi ope FRj)
7067 (sequence ()
7068 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7069 (set FRk (oper1 FRi FRj))
7070 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7071 (set (nextreg h-fr FRk 1)
7072 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
7073 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
7074 )
7075 )
7076
7077 (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")
7078 (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")
7079 (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")
7080 (ne-float-dual-arith nfddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_39 "ne dual div,single")
7081 (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")
7082
7083 (dni nfdcmps
7084 "non-excepting dual float compare"
7085 ((UNIT FM01) (FR500-MAJOR F-6) (MACH simple,tomcat,frv))
7086 "nfdcmps$pack $FRi,$FRj,$FCCi_2"
7087 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_3A FRj)
7088 (sequence ()
7089 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7090 (compare-and-set-fcc FRi FRj FCCi_2)
7091 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7092 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
7093 (nextreg h-fccr FCCi_2 1)))
7094 ((fr500 (unit u-float-dual-compare)))
7095 )
7096
7097 ; Media Instructions
7098 ;
7099 (define-pmacro (halfword hilo arg offset)
7100 (reg (.sym h-fr_ hilo) (add (index-of arg) offset)))
7101
7102 (dni mhsetlos
7103 "Media set lower signed 12 bits"
7104 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7105 "mhsetlos$pack $u12,$FRklo"
7106 (+ pack FRklo OP_78 OPE1_20 u12)
7107 (set FRklo u12)
7108 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRklo))))
7109 )
7110
7111 (dni mhsethis
7112 "Media set upper signed 12 bits"
7113 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7114 "mhsethis$pack $u12,$FRkhi"
7115 (+ pack FRkhi OP_78 OPE1_22 u12)
7116 (set FRkhi u12)
7117 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRkhi))))
7118 )
7119
7120 (dni mhdsets
7121 "Media dual set halfword signed 12 bits"
7122 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7123 "mhdsets$pack $u12,$FRintk"
7124 (+ pack FRintk OP_78 OPE1_24 u12)
7125 (sequence ()
7126 ; hack to get FRintk passed to modelling functions
7127 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7128 (set (halfword hi FRintk 0) u12)
7129 (set (halfword lo FRintk 0) u12))
7130 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
7131 )
7132
7133 (define-pmacro (set-5-semantics target value)
7134 (sequence ((HI tmp))
7135 (set tmp target)
7136 (set tmp (and tmp #x07ff))
7137 (set tmp (or tmp (sll (and s5 #x1f) 11)))
7138 (set target tmp))
7139 )
7140
7141 (define-pmacro (media-set-5 name hilo op ope comment)
7142 (dni name
7143 (comment)
7144 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7145 (.str name "$pack $s5,$FRk" hilo)
7146 (+ pack (.sym FRk hilo) op (FRi-null) ope (misc-null-11) s5)
7147 (set-5-semantics (.sym FRk hilo) s5)
7148 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk (.sym FRk hilo)))))
7149 )
7150 )
7151
7152 (media-set-5 mhsetloh lo OP_78 OPE1_21 "Media set upper 5 bits lo")
7153 (media-set-5 mhsethih hi OP_78 OPE1_23 "Media set upper 5 bits hi")
7154
7155 (dni mhdseth
7156 "Media dual set halfword upper 5 bits"
7157 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
7158 "mhdseth$pack $s5,$FRintk"
7159 (+ pack FRintk OP_78 (FRi-null) OPE1_25 (misc-null-11) s5)
7160 (sequence ()
7161 ; hack to get FRintk passed to modelling functions
7162 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7163 (set-5-semantics (halfword hi FRintk 0) s5)
7164 (set-5-semantics (halfword lo FRintk 0) s5))
7165 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
7166 )
7167
7168 (define-pmacro (media-logic-r-r name operation op ope comment)
7169 (dni name
7170 (comment)
7171 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7172 (.str name "$pack $FRinti,$FRintj,$FRintk")
7173 (+ pack FRintk op FRinti ope FRintj)
7174 (set FRintk (operation FRinti FRintj))
7175 ((fr400 (unit u-media-1))
7176 (fr500 (unit u-media)) (fr550 (unit u-media)))
7177 )
7178 )
7179
7180 (media-logic-r-r mand and OP_7B OPE1_00 "and reg/reg")
7181 (media-logic-r-r mor or OP_7B OPE1_01 "or reg/reg")
7182 (media-logic-r-r mxor xor OP_7B OPE1_02 "xor reg/reg")
7183
7184 (define-pmacro (conditional-media-logic name operation op ope comment)
7185 (dni name
7186 (comment)
7187 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7188 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7189 (+ pack FRintk op FRinti CCi cond ope FRintj)
7190 (if (eq CCi (or cond 2))
7191 (set FRintk (operation FRinti FRintj)))
7192 ((fr400 (unit u-media-1))
7193 (fr500 (unit u-media)) (fr550 (unit u-media)))
7194 )
7195 )
7196
7197 (conditional-media-logic cmand and OP_70 OPE4_0 "conditional and reg/reg")
7198 (conditional-media-logic cmor or OP_70 OPE4_1 "conditional or reg/reg")
7199 (conditional-media-logic cmxor xor OP_70 OPE4_2 "conditional xor reg/reg")
7200
7201 (dni mnot
7202 ("mnot")
7203 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7204 ("mnot$pack $FRintj,$FRintk")
7205 (+ pack FRintk OP_7B (rs-null) OPE1_03 FRintj)
7206 (set FRintk (inv FRintj))
7207 ((fr400 (unit u-media-1))
7208 (fr500 (unit u-media)) (fr550 (unit u-media)))
7209 )
7210
7211 (dni cmnot
7212 ("cmnot")
7213 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7214 ("cmnot$pack $FRintj,$FRintk,$CCi,$cond")
7215 (+ pack FRintk OP_70 (rs-null) CCi cond OPE4_3 FRintj)
7216 (if (eq CCi (or cond 2))
7217 (set FRintk (inv FRintj)))
7218 ((fr400 (unit u-media-1))
7219 (fr500 (unit u-media)) (fr550 (unit u-media)))
7220 )
7221
7222 (define-pmacro (media-rotate-r-r name operation op ope comment)
7223 (dni name
7224 (comment)
7225 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7226 (.str name "$pack $FRinti,$u6,$FRintk")
7227 (+ pack FRintk op FRinti ope u6)
7228 (set FRintk (operation FRinti (and u6 #x1f)))
7229 ((fr400 (unit u-media-3))
7230 (fr500 (unit u-media)) (fr550 (unit u-media)))
7231 )
7232 )
7233
7234 (media-rotate-r-r mrotli rol OP_7B OPE1_04 "rotate left reg/reg")
7235 (media-rotate-r-r mrotri ror OP_7B OPE1_05 "rotate right reg/reg")
7236
7237 (define-pmacro (media-cut-r-r name arg op ope comment)
7238 (dni name
7239 (comment)
7240 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7241 (.str name "$pack $FRinti,$" arg ",$FRintk")
7242 (+ pack FRintk op FRinti ope arg)
7243 (set FRintk (c-call SI "@cpu@_cut" FRinti (nextreg h-fr_int FRinti 1) arg))
7244 ((fr400 (unit u-media-3))
7245 (fr500 (unit u-media)) (fr550 (unit u-media)))
7246 )
7247 )
7248
7249 (media-cut-r-r mwcut FRintj OP_7B OPE1_06 "media cut")
7250 (media-cut-r-r mwcuti u6 OP_7B OPE1_07 "media cut")
7251
7252 (define-pmacro (media-cut-acc name arg op ope comment)
7253 (dni name
7254 (comment)
7255 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7256 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7257 (+ pack FRintk op ACC40Si ope arg)
7258 (set FRintk (c-call SI "@cpu@_media_cut" ACC40Si arg))
7259 ((fr400 (unit u-media-4))
7260 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
7261 )
7262 )
7263
7264 (media-cut-acc mcut FRintj OP_7B OPE1_2C "media accumulator cut reg")
7265 (media-cut-acc mcuti s6 OP_7B OPE1_2E "media accumulator cut immed")
7266
7267 (define-pmacro (media-cut-acc-ss name arg op ope comment)
7268 (dni name
7269 (comment)
7270 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7271 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7272 (+ pack FRintk op ACC40Si ope arg)
7273 (set FRintk (c-call SI "@cpu@_media_cut_ss" ACC40Si arg))
7274 ((fr400 (unit u-media-4))
7275 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
7276 )
7277 )
7278
7279 (media-cut-acc-ss mcutss FRintj OP_7B OPE1_2D "media accumulator cut reg with saturation")
7280 (media-cut-acc-ss mcutssi s6 OP_7B OPE1_2F "media accumulator cut immed with saturation")
7281
7282 ; Dual Media Instructions
7283 ;
7284 (define-pmacro (register-unaligned register alignment)
7285 (and (index-of register) (sub alignment 1))
7286 )
7287
7288 (dni mdcutssi
7289 "Media dual cut with signed saturation"
7290 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7291 "mdcutssi$pack $ACC40Si,$s6,$FRintkeven"
7292 (+ pack FRintkeven OP_78 ACC40Si OPE1_0E s6)
7293 (if (register-unaligned ACC40Si 2)
7294 (c-call VOID "@cpu@_media_acc_not_aligned")
7295 (if (register-unaligned FRintkeven 2)
7296 (c-call VOID "@cpu@_media_register_not_aligned")
7297 (sequence ()
7298 (set FRintkeven (c-call SI "@cpu@_media_cut_ss" ACC40Si s6))
7299 (set (nextreg h-fr_int FRintkeven 1)
7300 (c-call SI "@cpu@_media_cut_ss"
7301 (nextreg h-acc40S ACC40Si 1) s6)))))
7302 ((fr400 (unit u-media-4-acc-dual
7303 (out FRintk FRintkeven))) (fr550 (unit u-media-3-acc-dual)))
7304 )
7305
7306 ; The (add (xxxx) (mul arg 0)) is a hack to get a reference to arg generated
7307 ; so it will be passed to the unit modelers. YUCK!!!!!
7308 (define-pmacro (extract-hilo reg1 off1 reg2 off2 arg1hi arg1lo arg2hi arg2lo)
7309 (sequence ()
7310 (set arg1hi (add (halfword hi reg1 off1) (mul reg1 0)))
7311 (set arg1lo (add (halfword lo reg1 off1) (mul reg1 0)))
7312 (set arg2hi (add (halfword hi reg2 off2) (mul reg2 0)))
7313 (set arg2lo (add (halfword lo reg2 off2) (mul reg2 0))))
7314 )
7315
7316 (dni maveh
7317 "Media dual average"
7318 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7319 "maveh$pack $FRinti,$FRintj,$FRintk"
7320 (+ pack FRintk OP_7B FRinti OPE1_08 FRintj)
7321 (set FRintk (c-call SI "@cpu@_media_average" FRinti FRintj))
7322 ((fr400 (unit u-media-1))
7323 (fr500 (unit u-media)) (fr550 (unit u-media)))
7324 )
7325
7326 (define-pmacro (media-dual-shift name operation op ope profile comment)
7327 (dni name
7328 (comment)
7329 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
7330 (.str name "$pack $FRinti,$u6,$FRintk")
7331 (+ pack FRintk op FRinti ope u6)
7332 (sequence ()
7333 ; hack to get these referenced for profiling
7334 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7335 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7336 (set (halfword hi FRintk 0)
7337 (operation (halfword hi FRinti 0) (and u6 #xf)))
7338 (set (halfword lo FRintk 0)
7339 (operation (halfword lo FRinti 0) (and u6 #xf))))
7340 profile
7341 )
7342 )
7343
7344 (media-dual-shift msllhi sll OP_7B OPE1_09
7345 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7346 "Media dual shift left logical")
7347 (media-dual-shift msrlhi srl OP_7B OPE1_0A
7348 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7349 "Media dual shift right logical")
7350 (media-dual-shift msrahi sra OP_7B OPE1_0B
7351 ((fr400 (unit u-media-6)) (fr500 (unit u-media)) (fr550 (unit u-media)))
7352 "Media dual shift right arithmetic")
7353
7354 (define-pmacro (media-dual-word-rotate-r-r name operation op ope comment)
7355 (dni name
7356 (comment)
7357 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7358 (.str name "$pack $FRintieven,$s6,$FRintkeven")
7359 (+ pack FRintkeven op FRintieven ope s6)
7360 (if (orif (register-unaligned FRintieven 2)
7361 (register-unaligned FRintkeven 2))
7362 (c-call VOID "@cpu@_media_register_not_aligned")
7363 (sequence ()
7364 (set FRintkeven (operation FRintieven (and s6 #x1f)))
7365 (set (nextreg h-fr_int FRintkeven 1)
7366 (operation (nextreg h-fr_int FRintieven 1)
7367 (and s6 #x1f)))))
7368 ((fr400 (unit u-media-3-quad
7369 (in FRinti FRintieven)
7370 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7371 )
7372 )
7373
7374 (media-dual-word-rotate-r-r mdrotli rol OP_78 OPE1_0B "rotate left reg/reg")
7375
7376 (dni mcplhi
7377 "Media bit concatenate, halfword"
7378 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7379 "mcplhi$pack $FRinti,$u6,$FRintk"
7380 (+ pack FRintk OP_78 FRinti OPE1_0C u6)
7381 (sequence ((HI arg1) (HI arg2) (HI shift))
7382 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7383 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7384 (set shift (and u6 #xf))
7385 (set arg1 (sll (halfword hi FRinti 0) shift))
7386 (if (ne shift 0)
7387 (sequence ()
7388 (set arg2 (halfword hi FRinti 1))
7389 (set arg2 (srl HI (sll HI arg2 (sub 15 shift))
7390 (sub 15 shift)))
7391 (set arg1 (or HI arg1 arg2))))
7392 (set (halfword hi FRintk 0) arg1))
7393 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
7394 )
7395
7396 (dni mcpli
7397 "Media bit concatenate, word"
7398 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
7399 "mcpli$pack $FRinti,$u6,$FRintk"
7400 (+ pack FRintk OP_78 FRinti OPE1_0D u6)
7401 (sequence ((SI tmp) (SI shift))
7402 (set shift (and u6 #x1f))
7403 (set tmp (sll FRinti shift))
7404 (if (ne shift 0)
7405 (sequence ((SI tmp1))
7406 (set tmp1 (srl (sll (nextreg h-fr_int FRinti 1)
7407 (sub 31 shift))
7408 (sub 31 shift)))
7409 (set tmp (or tmp tmp1))))
7410 (set FRintk tmp))
7411 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
7412 )
7413
7414 (define-pmacro (saturate arg max min result)
7415 (if (gt arg max)
7416 (set result max)
7417 (if (lt arg min)
7418 (set result min)
7419 (set result arg)))
7420 )
7421
7422 (dni msaths
7423 "Media dual saturation signed"
7424 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7425 "msaths$pack $FRinti,$FRintj,$FRintk"
7426 (+ pack FRintk OP_7B FRinti OPE1_0C FRintj)
7427 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
7428 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7429 (saturate argihi argjhi (inv argjhi) (halfword hi FRintk 0))
7430 (saturate argilo argjlo (inv argjlo) (halfword lo FRintk 0)))
7431 ((fr400 (unit u-media-1))
7432 (fr500 (unit u-media)) (fr550 (unit u-media)))
7433 )
7434
7435 (dni mqsaths
7436 "Media quad saturation signed"
7437 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7438 "mqsaths$pack $FRintieven,$FRintjeven,$FRintkeven"
7439 (+ pack FRintkeven OP_78 FRintieven OPE1_0F FRintjeven)
7440 (if (orif (register-unaligned FRintieven 2)
7441 (orif (register-unaligned FRintjeven 2)
7442 (register-unaligned FRintkeven 2)))
7443 (c-call VOID "@cpu@_media_register_not_aligned")
7444 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
7445 ; hack to get FRintkeven referenced as a target for profiling
7446 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7447 (extract-hilo FRintieven 0 FRintjeven 0 argihi argilo argjhi argjlo)
7448 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 0))
7449 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 0))
7450 (extract-hilo FRintieven 1 FRintjeven 1 argihi argilo argjhi argjlo)
7451 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 1))
7452 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 1))))
7453 ((fr400 (unit u-media-1-quad
7454 (in FRinti FRintieven)
7455 (in FRintj FRintjeven)
7456 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7457 )
7458
7459 (define-pmacro (saturate-unsigned arg max result)
7460 (if (gt arg max)
7461 (set result max)
7462 (set result arg))
7463 )
7464
7465 (dni msathu
7466 "Media dual saturation unsigned"
7467 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7468 "msathu$pack $FRinti,$FRintj,$FRintk"
7469 (+ pack FRintk OP_7B FRinti OPE1_0D FRintj)
7470 (sequence ((UHI argihi) (UHI argilo) (UHI argjhi) (UHI argjlo))
7471 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7472 (saturate-unsigned argihi argjhi (halfword hi FRintk 0))
7473 (saturate-unsigned argilo argjlo (halfword lo FRintk 0)))
7474 ((fr400 (unit u-media-1))
7475 (fr500 (unit u-media)) (fr550 (unit u-media)))
7476 )
7477
7478 (define-pmacro (media-dual-compare name mode op ope comment)
7479 (dni name
7480 (comment)
7481 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7482 (.str name "$pack $FRinti,$FRintj,$FCCk")
7483 (+ pack (cond-null) FCCk op FRinti ope FRintj)
7484 (if (register-unaligned FCCk 2)
7485 (c-call VOID "@cpu@_media_cr_not_aligned")
7486 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7487 (extract-hilo FRinti 0 FRintj 0
7488 argihi argilo argjhi argjlo)
7489 (compare-and-set-fcc argihi argjhi FCCk)
7490 (compare-and-set-fcc argilo argjlo (nextreg h-fccr FCCk 1))))
7491 ; TODO - doesn't handle second FCC
7492 ((fr400 (unit u-media-7))
7493 (fr500 (unit u-media)) (fr550 (unit u-media)))
7494 )
7495 )
7496
7497 (media-dual-compare mcmpsh HI OP_7B OPE1_0E "Media dual compare signed")
7498 (media-dual-compare mcmpuh UHI OP_7B OPE1_0F "Media dual compare unsigned")
7499
7500 ; Bits for the MSR.SIE field
7501 (define-pmacro (msr-sie-nil) 0)
7502 (define-pmacro (msr-sie-fri-hi) 8)
7503 (define-pmacro (msr-sie-fri-lo) 4)
7504 (define-pmacro (msr-sie-fri-1-hi) 2)
7505 (define-pmacro (msr-sie-fri-1-lo) 1)
7506 (define-pmacro (msr-sie-acci) 8)
7507 (define-pmacro (msr-sie-acci-1) 4)
7508 (define-pmacro (msr-sie-acci-2) 2)
7509 (define-pmacro (msr-sie-acci-3) 1)
7510
7511 (define-pmacro (saturate-v arg max min sie result)
7512 (if (gt DI arg max)
7513 (sequence ()
7514 (set result max)
7515 (c-call VOID "@cpu@_media_overflow" sie))
7516 (if (lt DI arg min)
7517 (sequence ()
7518 (set result min)
7519 (c-call VOID "@cpu@_media_overflow" sie))
7520 (set result arg)))
7521 )
7522
7523 (dni mabshs
7524 "Media dual absolute value, halfword"
7525 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7526 "mabshs$pack $FRintj,$FRintk"
7527 (+ pack FRintk OP_78 (FRi-null) OPE1_0A FRintj)
7528 (sequence ((HI arghi) (HI arglo))
7529 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
7530 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7531 (set arghi (halfword hi FRintj 0))
7532 (set arglo (halfword lo FRintj 0))
7533 (saturate-v (abs arghi) 32767 -32768 (msr-sie-fri-hi)
7534 (halfword hi FRintk 0))
7535 (saturate-v (abs arglo) 32767 -32768 (msr-sie-fri-lo)
7536 (halfword lo FRintk 0)))
7537 ((fr400 (unit u-media-1)) (fr550 (unit u-media)))
7538 )
7539
7540 (define-pmacro (media-arith-sat-semantics
7541 operation arg1 arg2 res mode max min sie)
7542 (sequence ((DI tmp))
7543 (set tmp (operation arg1 arg2))
7544 (saturate-v tmp max min sie res))
7545 )
7546
7547 (define-pmacro (media-dual-arith-sat-semantics operation mode max min)
7548 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7549 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7550 (media-arith-sat-semantics operation argihi argjhi
7551 (halfword hi FRintk 0) mode max min
7552 (msr-sie-fri-hi))
7553 (media-arith-sat-semantics operation argilo argjlo
7554 (halfword lo FRintk 0) mode max min
7555 (msr-sie-fri-lo)))
7556 )
7557
7558 (define-pmacro (media-dual-arith-sat name operation mode max min op ope comment)
7559 (dni name
7560 (comment)
7561 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
7562 (.str name "$pack $FRinti,$FRintj,$FRintk")
7563 (+ pack FRintk op FRinti ope FRintj)
7564 (media-dual-arith-sat-semantics operation mode max min)
7565 ((fr400 (unit u-media-1))
7566 (fr500 (unit u-media)) (fr550 (unit u-media)))
7567 )
7568 )
7569
7570 (media-dual-arith-sat maddhss add HI 32767 -32768 OP_7B OPE1_10 "Media dual add signed with saturation")
7571 (media-dual-arith-sat maddhus add UHI 65535 0 OP_7B OPE1_11 "Media dual add unsigned with saturation")
7572
7573 (media-dual-arith-sat msubhss sub HI 32767 -32768 OP_7B OPE1_12 "Media dual sub signed with saturation")
7574 (media-dual-arith-sat msubhus sub UHI 65535 0 OP_7B OPE1_13 "Media dual sub unsigned with saturation")
7575
7576 (define-pmacro (conditional-media-dual-arith-sat
7577 name operation mode max min op ope comment)
7578 (dni name
7579 (comment)
7580 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
7581 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7582 (+ pack FRintk op FRinti CCi cond ope FRintj)
7583 (if (eq CCi (or cond 2))
7584 (media-dual-arith-sat-semantics operation mode max min))
7585 ((fr400 (unit u-media-1))
7586 (fr500 (unit u-media)) (fr550 (unit u-media)))
7587 )
7588 )
7589
7590 (conditional-media-dual-arith-sat cmaddhss add HI 32767 -32768 OP_71 OPE4_0 "Conditional Media dual add signed with saturation")
7591 (conditional-media-dual-arith-sat cmaddhus add UHI 65535 0 OP_71 OPE4_1 "Conditional Media dual add unsigned with saturation")
7592
7593 (conditional-media-dual-arith-sat cmsubhss sub HI 32767 -32768 OP_71 OPE4_2 "Conditional Media dual sub signed with saturation")
7594 (conditional-media-dual-arith-sat cmsubhus sub UHI 65535 0 OP_71 OPE4_3 "Conditional Media dual sub unsigned with saturation")
7595
7596 (define-pmacro (media-quad-arith-sat-semantics cond operation mode max min)
7597 (if (orif (register-unaligned FRintieven 2)
7598 (orif (register-unaligned FRintjeven 2)
7599 (register-unaligned FRintkeven 2)))
7600 (c-call VOID "@cpu@_media_register_not_aligned")
7601 (if cond
7602 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7603 ; hack to get FRintkeven referenced as a target for profiling
7604 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7605 (extract-hilo FRintieven 0 FRintjeven 0
7606 argihi argilo argjhi argjlo)
7607 (media-arith-sat-semantics operation argihi argjhi
7608 (halfword hi FRintkeven 0) mode
7609 max min (msr-sie-fri-hi))
7610 (media-arith-sat-semantics operation argilo argjlo
7611 (halfword lo FRintkeven 0) mode
7612 max min (msr-sie-fri-lo))
7613 (extract-hilo FRintieven 1 FRintjeven 1
7614 argihi argilo argjhi argjlo)
7615 (media-arith-sat-semantics operation argihi argjhi
7616 (halfword hi FRintkeven 1) mode
7617 max min (msr-sie-fri-1-hi))
7618 (media-arith-sat-semantics operation argilo argjlo
7619 (halfword lo FRintkeven 1) mode
7620 max min (msr-sie-fri-1-lo)))))
7621 )
7622
7623 (define-pmacro (media-quad-arith-sat name operation mode max min op ope comment)
7624 (dni name
7625 (comment)
7626 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2))
7627 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven")
7628 (+ pack FRintkeven op FRintieven ope FRintjeven)
7629 (media-quad-arith-sat-semantics 1 operation mode max min)
7630 ((fr400 (unit u-media-1-quad
7631 (in FRinti FRintieven)
7632 (in FRintj FRintjeven)
7633 (out FRintk FRintkeven)))
7634 (fr500 (unit u-media-quad-arith
7635 (in FRinti FRintieven)
7636 (in FRintj FRintjeven)
7637 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7638 )
7639 )
7640
7641 (media-quad-arith-sat mqaddhss add HI 32767 -32768 OP_7B OPE1_18 "Media quad add signed with saturation")
7642 (media-quad-arith-sat mqaddhus add UHI 65535 0 OP_7B OPE1_19 "Media quad add unsigned with saturation")
7643
7644 (media-quad-arith-sat mqsubhss sub HI 32767 -32768 OP_7B OPE1_1A "Media quad sub signed with saturation")
7645 (media-quad-arith-sat mqsubhus sub UHI 65535 0 OP_7B OPE1_1B "Media quad sub unsigned with saturation")
7646
7647 (define-pmacro (conditional-media-quad-arith-sat
7648 name operation mode max min op ope comment)
7649 (dni name
7650 (comment)
7651 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2) CONDITIONAL)
7652 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven,$CCi,$cond")
7653 (+ pack FRintkeven op FRintieven CCi cond ope FRintjeven)
7654 (media-quad-arith-sat-semantics (eq CCi (or cond 2))
7655 operation mode max min)
7656 ((fr400 (unit u-media-1-quad
7657 (in FRinti FRintieven)
7658 (in FRintj FRintjeven)
7659 (out FRintk FRintkeven)))
7660 (fr500 (unit u-media-quad-arith
7661 (in FRinti FRintieven)
7662 (in FRintj FRintjeven)
7663 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
7664 )
7665 )
7666
7667 (conditional-media-quad-arith-sat cmqaddhss add HI 32767 -32768 OP_73 OPE4_0 "Conditional Media quad add signed with saturation")
7668 (conditional-media-quad-arith-sat cmqaddhus add UHI 65535 0 OP_73 OPE4_1 "Conditional Media quad add unsigned with saturation")
7669
7670 (conditional-media-quad-arith-sat cmqsubhss sub HI 32767 -32768 OP_73 OPE4_2 "Conditional Media quad sub signed with saturation")
7671 (conditional-media-quad-arith-sat cmqsubhus sub UHI 65535 0 OP_73 OPE4_3 "Conditional Media quad sub unsigned with saturation")
7672
7673 (define-pmacro (media-acc-arith-sat name operation mode max min op ope comment)
7674 (dni name
7675 (comment)
7676 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7677 (.str name "$pack $ACC40Si,$ACC40Sk")
7678 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
7679 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7680 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7681 (if (register-unaligned ACC40Si 2)
7682 (c-call VOID "@cpu@_media_acc_not_aligned")
7683 (media-arith-sat-semantics operation ACC40Si
7684 (nextreg h-acc40S ACC40Si 1)
7685 ACC40Sk mode max min (msr-sie-acci)))))
7686 ((fr400 (unit u-media-2-acc)) (fr550 (unit u-media-4-acc)))
7687 )
7688 )
7689
7690 (media-acc-arith-sat maddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7691 OP_78 OPE1_04 "Media accumulator addition")
7692 (media-acc-arith-sat msubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7693 OP_78 OPE1_05 "Media accumulator subtraction")
7694
7695 (define-pmacro (media-dual-acc-arith-sat name operation mode max min op ope
7696 comment)
7697 (dni name
7698 (comment)
7699 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
7700 (.str name "$pack $ACC40Si,$ACC40Sk")
7701 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
7702 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7703 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7704 (if (register-unaligned ACC40Si 4)
7705 (c-call VOID "@cpu@_media_acc_not_aligned")
7706 (if (register-unaligned ACC40Sk 2)
7707 (c-call VOID "@cpu@_media_acc_not_aligned")
7708 (sequence ()
7709 (media-arith-sat-semantics operation ACC40Si
7710 (nextreg h-acc40S ACC40Si 1)
7711 ACC40Sk mode max min
7712 (msr-sie-acci))
7713 (media-arith-sat-semantics operation
7714 (nextreg h-acc40S ACC40Si 2)
7715 (nextreg h-acc40S ACC40Si 3)
7716 (nextreg h-acc40S ACC40Sk 1)
7717 mode max min
7718 (msr-sie-acci-1)))))))
7719 ((fr400 (unit u-media-2-acc-dual)) (fr550 (unit u-media-4-acc-dual)))
7720 )
7721 )
7722
7723 (media-dual-acc-arith-sat mdaddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7724 OP_78 OPE1_06 "Media accumulator addition")
7725 (media-dual-acc-arith-sat mdsubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7726 OP_78 OPE1_07 "Media accumulator subtraction")
7727
7728 (dni masaccs
7729 "Media add and subtract signed accumulator with saturation"
7730 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7731 "masaccs$pack $ACC40Si,$ACC40Sk"
7732 (+ pack ACC40Sk OP_78 ACC40Si OPE1_08 (ACCj-null))
7733 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7734 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7735 (if (register-unaligned ACC40Si 2)
7736 (c-call VOID "@cpu@_media_acc_not_aligned")
7737 (if (register-unaligned ACC40Sk 2)
7738 (c-call VOID "@cpu@_media_acc_not_aligned")
7739 (sequence ()
7740 (media-arith-sat-semantics add ACC40Si
7741 (nextreg h-acc40S ACC40Si 1)
7742 ACC40Sk DI
7743 #x7fffffffff
7744 (inv DI #x7fffffffff)
7745 (msr-sie-acci))
7746 (media-arith-sat-semantics sub ACC40Si
7747 (nextreg h-acc40S ACC40Si 1)
7748 (nextreg h-acc40S ACC40Sk 1)
7749 DI
7750 #x7fffffffff
7751 (inv DI #x7fffffffff)
7752 (msr-sie-acci-1)))))))
7753 ((fr400 (unit u-media-2-add-sub)) (fr550 (unit u-media-4-add-sub)))
7754 )
7755
7756 (dni mdasaccs
7757 "Media add and subtract signed accumulator with saturation"
7758 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
7759 "mdasaccs$pack $ACC40Si,$ACC40Sk"
7760 (+ pack ACC40Sk OP_78 ACC40Si OPE1_09 (ACCj-null))
7761 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7762 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7763 (if (register-unaligned ACC40Si 4)
7764 (c-call VOID "@cpu@_media_acc_not_aligned")
7765 (if (register-unaligned ACC40Sk 4)
7766 (c-call VOID "@cpu@_media_acc_not_aligned")
7767 (sequence ()
7768 (media-arith-sat-semantics add ACC40Si
7769 (nextreg h-acc40S ACC40Si 1)
7770 ACC40Sk DI
7771 #x7fffffffff
7772 (inv DI #x7fffffffff)
7773 (msr-sie-acci))
7774 (media-arith-sat-semantics sub ACC40Si
7775 (nextreg h-acc40S ACC40Si 1)
7776 (nextreg h-acc40S ACC40Sk 1)
7777 DI
7778 #x7fffffffff
7779 (inv DI #x7fffffffff)
7780 (msr-sie-acci-1))
7781 (media-arith-sat-semantics add
7782 (nextreg h-acc40S ACC40Si 2)
7783 (nextreg h-acc40S ACC40Si 3)
7784 (nextreg h-acc40S ACC40Sk 2)
7785 DI
7786 #x7fffffffff
7787 (inv DI #x7fffffffff)
7788 (msr-sie-acci-2))
7789 (media-arith-sat-semantics sub
7790 (nextreg h-acc40S ACC40Si 2)
7791 (nextreg h-acc40S ACC40Si 3)
7792 (nextreg h-acc40S ACC40Sk 3)
7793 DI
7794 #x7fffffffff
7795 (inv DI #x7fffffffff)
7796 (msr-sie-acci-3)))))))
7797 ((fr400 (unit u-media-2-add-sub-dual)) (fr550 (unit u-media-4-add-sub-dual)))
7798 )
7799
7800 (define-pmacro (media-multiply-semantics conv arg1 arg2 res)
7801 (set res (mul DI (conv DI arg1) (conv DI arg2)))
7802 )
7803
7804 (define-pmacro (media-dual-multiply-semantics cond mode conv rhs1 rhs2)
7805 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7806 (if (register-unaligned ACC40Sk 2)
7807 (c-call VOID "@cpu@_media_acc_not_aligned")
7808 (if cond
7809 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7810 (extract-hilo FRinti 0 FRintj 0
7811 argihi argilo argjhi argjlo)
7812 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7813 (media-multiply-semantics conv argilo rhs2
7814 (nextreg h-acc40S ACC40Sk 1))))))
7815 )
7816
7817 (define-pmacro (media-dual-multiply name mode conv rhs1 rhs2 op ope comment)
7818 (dni name
7819 (comment)
7820 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) PRESERVE-OVF)
7821 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
7822 (+ pack ACC40Sk op FRinti ope FRintj)
7823 (media-dual-multiply-semantics 1 mode conv rhs1 rhs2)
7824 ((fr400 (unit u-media-2))
7825 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7826 )
7827 )
7828
7829 (media-dual-multiply mmulhs HI ext argjhi argjlo OP_7B OPE1_14 "Media dual multiply signed")
7830 (media-dual-multiply mmulhu UHI zext argjhi argjlo OP_7B OPE1_15 "Media dual multiply unsigned")
7831
7832 (media-dual-multiply mmulxhs HI ext argjlo argjhi OP_7B OPE1_28 "Media dual cross multiply signed")
7833 (media-dual-multiply mmulxhu UHI zext argjlo argjhi OP_7B OPE1_29 "Media dual cross multiply unsigned")
7834
7835 (define-pmacro (conditional-media-dual-multiply
7836 name mode conv rhs1 rhs2 op ope comment)
7837 (dni name
7838 (comment)
7839 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)
7840 PRESERVE-OVF CONDITIONAL)
7841 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
7842 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
7843 (media-dual-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
7844 ((fr400 (unit u-media-2))
7845 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7846 )
7847 )
7848
7849 (conditional-media-dual-multiply cmmulhs HI ext argjhi argjlo OP_72 OPE4_0 "Conditional Media dual multiply signed")
7850 (conditional-media-dual-multiply cmmulhu UHI zext argjhi argjlo OP_72 OPE4_1 "Conditional Media dual multiply unsigned")
7851
7852 (define-pmacro (media-quad-multiply-semantics cond mode conv rhs1 rhs2)
7853 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7854 (if (register-unaligned ACC40Sk 4)
7855 (c-call VOID "@cpu@_media_acc_not_aligned")
7856 (if (orif (register-unaligned FRintieven 2)
7857 (register-unaligned FRintjeven 2))
7858 (c-call VOID "@cpu@_media_register_not_aligned")
7859 (if cond
7860 (sequence ((mode argihi) (mode argilo)
7861 (mode argjhi) (mode argjlo))
7862 (extract-hilo FRintieven 0 FRintjeven 0
7863 argihi argilo argjhi argjlo)
7864 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7865 (media-multiply-semantics conv argilo rhs2
7866 (nextreg h-acc40S ACC40Sk 1))
7867 (extract-hilo FRintieven 1 FRintjeven 1
7868 argihi argilo argjhi argjlo)
7869 (media-multiply-semantics conv argihi rhs1
7870 (nextreg h-acc40S ACC40Sk 2))
7871 (media-multiply-semantics conv argilo rhs2
7872 (nextreg h-acc40S ACC40Sk 3)))))))
7873 )
7874
7875 (define-pmacro (media-quad-multiply name mode conv rhs1 rhs2 op ope comment)
7876 (dni name
7877 (comment)
7878 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) PRESERVE-OVF)
7879 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
7880 (+ pack ACC40Sk op FRintieven ope FRintjeven)
7881 (media-quad-multiply-semantics 1 mode conv rhs1 rhs2)
7882 ((fr400 (unit u-media-2-quad
7883 (in FRinti FRintieven)
7884 (in FRintj FRintjeven)))
7885 (fr500 (unit u-media-quad-mul
7886 (in FRinti FRintieven)
7887 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
7888 )
7889 )
7890
7891 (media-quad-multiply mqmulhs HI ext argjhi argjlo OP_7B OPE1_1C "Media quad multiply signed")
7892 (media-quad-multiply mqmulhu UHI zext argjhi argjlo OP_7B OPE1_1D "Media quad multiply unsigned")
7893
7894 (media-quad-multiply mqmulxhs HI ext argjlo argjhi OP_7B OPE1_2A "Media quad cross multiply signed")
7895 (media-quad-multiply mqmulxhu UHI zext argjlo argjhi OP_7B OPE1_2B "Media quad cross multiply unsigned")
7896
7897 (define-pmacro (conditional-media-quad-multiply
7898 name mode conv rhs1 rhs2 op ope comment)
7899 (dni name
7900 (comment)
7901 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)
7902 PRESERVE-OVF CONDITIONAL)
7903 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk,$CCi,$cond")
7904 (+ pack ACC40Sk op FRintieven CCi cond ope FRintjeven)
7905 (media-quad-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
7906 ((fr400 (unit u-media-2-quad
7907 (in FRinti FRintieven)
7908 (in FRintj FRintjeven)))
7909 (fr500 (unit u-media-quad-mul
7910 (in FRinti FRintieven)
7911 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
7912 )
7913 )
7914
7915 (conditional-media-quad-multiply cmqmulhs HI ext argjhi argjlo OP_74 OPE4_0 "Conditional Media quad multiply signed")
7916 (conditional-media-quad-multiply cmqmulhu UHI zext argjhi argjlo OP_74 OPE4_1 "Conditional Media quad multiply unsigned")
7917
7918 (define-pmacro (media-multiply-acc-semantics
7919 conv arg1 addop arg2 res max min sie)
7920 (sequence ((DI tmp))
7921 (set tmp (addop res (mul DI (conv DI arg1) (conv DI arg2))))
7922 (saturate-v tmp max min sie res))
7923 )
7924
7925 (define-pmacro (media-dual-multiply-acc-semantics
7926 cond mode conv addop rhw res max min)
7927 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
7928 (if (register-unaligned res 2)
7929 (c-call VOID "@cpu@_media_acc_not_aligned")
7930 (if cond
7931 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7932 (extract-hilo FRinti 0 FRintj 0
7933 argihi argilo argjhi argjlo)
7934 (media-multiply-acc-semantics conv argihi addop argjhi
7935 res
7936 max min (msr-sie-acci))
7937 (media-multiply-acc-semantics conv argilo addop argjlo
7938 (nextreg rhw res 1)
7939 max min (msr-sie-acci-1))))))
7940 )
7941
7942 (define-pmacro (media-dual-multiply-acc
7943 name mode conv addop rhw res max min op ope comment)
7944 (dni name
7945 (comment)
7946 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
7947 (.str name "$pack $FRinti,$FRintj,$" res)
7948 (+ pack res op FRinti ope FRintj)
7949 (media-dual-multiply-acc-semantics 1 mode conv addop rhw res max min)
7950 ((fr400 (unit u-media-2))
7951 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7952 )
7953 )
7954
7955 (media-dual-multiply-acc mmachs HI ext add h-acc40S ACC40Sk
7956 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7957 OP_7B OPE1_16
7958 "Media dual multiply and accumulate signed")
7959
7960 (media-dual-multiply-acc mmachu UHI zext add h-acc40U ACC40Uk
7961 (const DI #xffffffffff) (const DI 0)
7962 OP_7B OPE1_17
7963 "Media dual multiply and accumulate unsigned")
7964
7965 (media-dual-multiply-acc mmrdhs HI ext sub h-acc40S ACC40Sk
7966 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7967 OP_7B OPE1_30
7968 "Media dual multiply and reduce signed")
7969
7970 (media-dual-multiply-acc mmrdhu UHI zext sub h-acc40U ACC40Uk
7971 (const DI #xffffffffff) (const DI 0)
7972 OP_7B OPE1_31
7973 "Media dual multiply and reduce unsigned")
7974
7975 (define-pmacro (conditional-media-dual-multiply-acc
7976 name mode conv addop rhw res max min op ope comment)
7977 (dni name
7978 (comment)
7979 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
7980 (.str name "$pack $FRinti,$FRintj,$" res ",$CCi,$cond")
7981 (+ pack res op FRinti CCi cond ope FRintj)
7982 (media-dual-multiply-acc-semantics (eq CCi (or cond 2))
7983 mode conv addop rhw res max min)
7984 ((fr400 (unit u-media-2))
7985 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
7986 )
7987 )
7988
7989 (conditional-media-dual-multiply-acc cmmachs HI ext add h-acc40S ACC40Sk
7990 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7991 OP_72 OPE4_2
7992 "Conditional Media dual multiply and accumulate signed")
7993
7994 (conditional-media-dual-multiply-acc cmmachu UHI zext add h-acc40U ACC40Uk
7995 (const DI #xffffffffff) (const DI 0)
7996 OP_72 OPE4_3
7997 "Conditional Media dual multiply and accumulate unsigned")
7998
7999 (define-pmacro (media-quad-multiply-acc-semantics
8000 cond mode conv addop rhw res max min)
8001 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8002 (if (register-unaligned res 4)
8003 (c-call VOID "@cpu@_media_acc_not_aligned")
8004 (if (orif (register-unaligned FRintieven 2)
8005 (register-unaligned FRintjeven 2))
8006 (c-call VOID "@cpu@_media_register_not_aligned")
8007 (if cond
8008 (sequence ((mode argihi) (mode argilo)
8009 (mode argjhi) (mode argjlo))
8010 (extract-hilo FRintieven 0 FRintjeven 0
8011 argihi argilo argjhi argjlo)
8012 (media-multiply-acc-semantics conv argihi addop argjhi
8013 res
8014 max min (msr-sie-acci))
8015 (media-multiply-acc-semantics conv argilo addop argjlo
8016 (nextreg rhw res 1)
8017 max min (msr-sie-acci-1))
8018 (extract-hilo FRintieven 1 FRintjeven 1
8019 argihi argilo argjhi argjlo)
8020 (media-multiply-acc-semantics conv argihi addop argjhi
8021 (nextreg rhw res 2)
8022 max min (msr-sie-acci-2))
8023 (media-multiply-acc-semantics conv argilo addop argjlo
8024 (nextreg rhw res 3)
8025 max min
8026 (msr-sie-acci-3)))))))
8027 )
8028
8029 (define-pmacro (media-quad-multiply-acc
8030 name mode conv addop rhw res max min op ope comment)
8031 (dni name
8032 (comment)
8033 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8034 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8035 (+ pack res op FRintieven ope FRintjeven)
8036 (media-quad-multiply-acc-semantics 1 mode conv addop rhw res max min)
8037 ((fr400 (unit u-media-2-quad
8038 (in FRinti FRintieven)
8039 (in FRintj FRintjeven)))
8040 (fr500 (unit u-media-quad-mul
8041 (in FRinti FRintieven)
8042 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8043 )
8044 )
8045
8046 (media-quad-multiply-acc mqmachs HI ext add h-acc40S ACC40Sk
8047 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8048 OP_7B OPE1_1E
8049 "Media quad multiply and accumulate signed")
8050
8051 (media-quad-multiply-acc mqmachu UHI zext add h-acc40U ACC40Uk
8052 (const DI #xffffffffff) (const DI 0)
8053 OP_7B OPE1_1F
8054 "Media quad multiply and accumulate unsigned")
8055
8056 (define-pmacro (conditional-media-quad-multiply-acc
8057 name mode conv addop rhw res max min op ope comment)
8058 (dni name
8059 (comment)
8060 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) CONDITIONAL)
8061 (.str name "$pack $FRintieven,$FRintjeven,$" res ",$CCi,$cond")
8062 (+ pack res op FRintieven CCi cond ope FRintjeven)
8063 (media-quad-multiply-acc-semantics (eq CCi (or cond 2))
8064 mode conv addop rhw res max min)
8065 ((fr400 (unit u-media-2-quad
8066 (in FRinti FRintieven)
8067 (in FRintj FRintjeven)))
8068 (fr500 (unit u-media-quad-mul
8069 (in FRinti FRintieven)
8070 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8071 )
8072 )
8073
8074 (conditional-media-quad-multiply-acc cmqmachs HI ext add h-acc40S ACC40Sk
8075 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8076 OP_74 OPE4_2
8077 "Conditional Media quad multiply and accumulate signed")
8078
8079 (conditional-media-quad-multiply-acc cmqmachu UHI zext add h-acc40U ACC40Uk
8080 (const DI #xffffffffff) (const DI 0)
8081 OP_74 OPE4_3
8082 "Conditional media quad multiply and accumulate unsigned")
8083
8084 (define-pmacro (media-quad-multiply-cross-acc-semantics
8085 cond mode conv addop rhw res max min)
8086 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8087 (if (register-unaligned res 4)
8088 (c-call VOID "@cpu@_media_acc_not_aligned")
8089 (if (orif (register-unaligned FRintieven 2)
8090 (register-unaligned FRintjeven 2))
8091 (c-call VOID "@cpu@_media_register_not_aligned")
8092 (if cond
8093 (sequence ((mode argihi) (mode argilo)
8094 (mode argjhi) (mode argjlo))
8095 (extract-hilo FRintieven 0 FRintjeven 0
8096 argihi argilo argjhi argjlo)
8097 (media-multiply-acc-semantics conv argihi addop argjhi
8098 (nextreg rhw res 2)
8099 max min (msr-sie-acci-2))
8100 (media-multiply-acc-semantics conv argilo addop argjlo
8101 (nextreg rhw res 3)
8102 max min (msr-sie-acci-3))
8103 (extract-hilo FRintieven 1 FRintjeven 1
8104 argihi argilo argjhi argjlo)
8105 (media-multiply-acc-semantics conv argihi addop argjhi
8106 res
8107 max min (msr-sie-acci))
8108 (media-multiply-acc-semantics conv argilo addop argjlo
8109 (nextreg rhw res 1)
8110 max min
8111 (msr-sie-acci-1)))))))
8112 )
8113
8114 (define-pmacro (media-quad-multiply-cross-acc
8115 name mode conv addop rhw res max min op ope comment)
8116 (dni name
8117 (comment)
8118 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8119 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8120 (+ pack res op FRintieven ope FRintjeven)
8121 (media-quad-multiply-cross-acc-semantics 1 mode conv addop rhw res
8122 max min)
8123 ((fr400 (unit u-media-2-quad
8124 (in FRinti FRintieven)
8125 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8126 )
8127 )
8128
8129 (media-quad-multiply-cross-acc mqxmachs HI ext add h-acc40S ACC40Sk
8130 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8131 OP_78 OPE1_00
8132 "Media quad multiply and cross accumulate signed")
8133
8134 (define-pmacro (media-quad-cross-multiply-cross-acc-semantics
8135 cond mode conv addop rhw res max min)
8136 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8137 (if (register-unaligned res 4)
8138 (c-call VOID "@cpu@_media_acc_not_aligned")
8139 (if (orif (register-unaligned FRintieven 2)
8140 (register-unaligned FRintjeven 2))
8141 (c-call VOID "@cpu@_media_register_not_aligned")
8142 (if cond
8143 (sequence ((mode argihi) (mode argilo)
8144 (mode argjhi) (mode argjlo))
8145 (extract-hilo FRintieven 0 FRintjeven 0
8146 argihi argilo argjhi argjlo)
8147 (media-multiply-acc-semantics conv argihi addop argjlo
8148 (nextreg rhw res 2)
8149 max min (msr-sie-acci-2))
8150 (media-multiply-acc-semantics conv argilo addop argjhi
8151 (nextreg rhw res 3)
8152 max min (msr-sie-acci-3))
8153 (extract-hilo FRintieven 1 FRintjeven 1
8154 argihi argilo argjhi argjlo)
8155 (media-multiply-acc-semantics conv argihi addop argjlo
8156 res
8157 max min (msr-sie-acci))
8158 (media-multiply-acc-semantics conv argilo addop argjhi
8159 (nextreg rhw res 1)
8160 max min
8161 (msr-sie-acci-1)))))))
8162 )
8163
8164 (define-pmacro (media-quad-cross-multiply-cross-acc
8165 name mode conv addop rhw res max min op ope comment)
8166 (dni name
8167 (comment)
8168 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8169 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8170 (+ pack res op FRintieven ope FRintjeven)
8171 (media-quad-cross-multiply-cross-acc-semantics 1 mode conv addop rhw res
8172 max min)
8173 ((fr400 (unit u-media-2-quad
8174 (in FRinti FRintieven)
8175 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8176 )
8177 )
8178
8179 (media-quad-cross-multiply-cross-acc mqxmacxhs HI ext add h-acc40S ACC40Sk
8180 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8181 OP_78 OPE1_01
8182 "Media quad cross multiply and cross accumulate signed")
8183
8184 (define-pmacro (media-quad-cross-multiply-acc-semantics
8185 cond mode conv addop rhw res max min)
8186 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8187 (if (register-unaligned res 4)
8188 (c-call VOID "@cpu@_media_acc_not_aligned")
8189 (if (orif (register-unaligned FRintieven 2)
8190 (register-unaligned FRintjeven 2))
8191 (c-call VOID "@cpu@_media_register_not_aligned")
8192 (if cond
8193 (sequence ((mode argihi) (mode argilo)
8194 (mode argjhi) (mode argjlo))
8195 (extract-hilo FRintieven 0 FRintjeven 0
8196 argihi argilo argjhi argjlo)
8197 (media-multiply-acc-semantics conv argihi addop argjlo
8198 res
8199 max min (msr-sie-acci))
8200 (media-multiply-acc-semantics conv argilo addop argjhi
8201 (nextreg rhw res 1)
8202 max min (msr-sie-acci-1))
8203 (extract-hilo FRintieven 1 FRintjeven 1
8204 argihi argilo argjhi argjlo)
8205 (media-multiply-acc-semantics conv argihi addop argjlo
8206 (nextreg rhw res 2)
8207 max min (msr-sie-acci-2))
8208 (media-multiply-acc-semantics conv argilo addop argjhi
8209 (nextreg rhw res 3)
8210 max min
8211 (msr-sie-acci-3)))))))
8212 )
8213
8214 (define-pmacro (media-quad-cross-multiply-acc
8215 name mode conv addop rhw res max min op ope comment)
8216 (dni name
8217 (comment)
8218 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8219 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8220 (+ pack res op FRintieven ope FRintjeven)
8221 (media-quad-cross-multiply-acc-semantics 1 mode conv addop rhw res
8222 max min)
8223 ((fr400 (unit u-media-2-quad
8224 (in FRinti FRintieven)
8225 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8226 )
8227 )
8228
8229 (media-quad-cross-multiply-acc mqmacxhs HI ext add h-acc40S ACC40Sk
8230 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8231 OP_78 OPE1_02
8232 "Media quad cross multiply and accumulate signed")
8233
8234 (define-pmacro (media-complex-semantics
8235 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8236 (sequence ((DI tmp1) (DI tmp2))
8237 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8238 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8239 (set tmp1 (sub tmp1 tmp2))
8240 (saturate-v tmp1 max min sie res))
8241 )
8242
8243 (define-pmacro (media-complex-semantics-i
8244 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8245 (sequence ((DI tmp1) (DI tmp2))
8246 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8247 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8248 (set tmp1 (add tmp1 tmp2))
8249 (saturate-v tmp1 max min sie res))
8250 )
8251
8252 (define-pmacro (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
8253 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8254 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8255 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8256 (media-complex-semantics conv argihi rhs1 argilo rhs2 ACC40Sk
8257 max min (msr-sie-acci))))
8258 )
8259
8260 (define-pmacro (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
8261 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8262 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8263 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8264 (media-complex-semantics-i conv argihi rhs1 argilo rhs2 ACC40Sk
8265 max min (msr-sie-acci))))
8266 )
8267
8268 (define-pmacro (media-dual-complex
8269 name mode conv rhs1 rhs2 max min op ope comment)
8270 (dni name
8271 (comment)
8272 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
8273 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8274 (+ pack ACC40Sk op FRinti ope FRintj)
8275 (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
8276 ((fr400 (unit u-media-2))
8277 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8278 )
8279 )
8280
8281 (define-pmacro (media-dual-complex-i
8282 name mode conv rhs1 rhs2 max min op ope comment)
8283 (dni name
8284 (comment)
8285 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
8286 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8287 (+ pack ACC40Sk op FRinti ope FRintj)
8288 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
8289 ((fr400 (unit u-media-2))
8290 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8291 )
8292 )
8293
8294 (media-dual-complex mcpxrs HI ext argjhi argjlo
8295 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8296 OP_7B OPE1_20
8297 "Media dual complex real signed with saturation")
8298
8299 (media-dual-complex mcpxru UHI zext argjhi argjlo
8300 (const DI #xffffffffff) (const DI 0)
8301 OP_7B OPE1_21
8302 "Media dual complex real unsigned with saturation")
8303
8304 (media-dual-complex-i mcpxis HI ext argjlo argjhi
8305 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8306 OP_7B OPE1_22
8307 "Media dual complex imaginary signed with saturation")
8308
8309 (media-dual-complex-i mcpxiu UHI zext argjlo argjhi
8310 (const DI #xffffffffff) (const DI 0)
8311 OP_7B OPE1_23
8312 "Media dual complex imaginary unsigned with saturation")
8313
8314 (define-pmacro (conditional-media-dual-complex
8315 name mode conv rhs1 rhs2 max min op ope comment)
8316 (dni name
8317 (comment)
8318 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
8319 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8320 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8321 (if (eq CCi (or cond 2))
8322 (media-dual-complex-semantics mode conv rhs1 rhs2 max min))
8323 ((fr400 (unit u-media-2))
8324 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8325 )
8326 )
8327
8328 (define-pmacro (conditional-media-dual-complex-i
8329 name mode conv rhs1 rhs2 max min op ope comment)
8330 (dni name
8331 (comment)
8332 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
8333 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8334 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8335 (if (eq CCi (or cond 2))
8336 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min))
8337 ((fr400 (unit u-media-2))
8338 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
8339 )
8340 )
8341
8342 (conditional-media-dual-complex cmcpxrs HI ext argjhi argjlo
8343 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8344 OP_75 OPE4_0
8345 "Conditional Media dual complex real signed with saturation")
8346
8347 (conditional-media-dual-complex cmcpxru UHI zext argjhi argjlo
8348 (const DI #xffffffffff) (const DI 0)
8349 OP_75 OPE4_1
8350 "Conditional Media dual complex real unsigned with saturation")
8351
8352 (conditional-media-dual-complex-i cmcpxis HI ext argjlo argjhi
8353 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8354 OP_75 OPE4_2
8355 "Conditional Media dual complex imaginary signed with saturation")
8356
8357 (conditional-media-dual-complex-i cmcpxiu UHI zext argjlo argjhi
8358 (const DI #xffffffffff) (const DI 0)
8359 OP_75 OPE4_3
8360 "Conditional Media dual complex imaginary unsigned with saturation")
8361
8362 (define-pmacro (media-quad-complex
8363 name mode conv rhs1 rhs2 max min op ope comment)
8364 (dni name
8365 (comment)
8366 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8367 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8368 (+ pack ACC40Sk op FRintieven ope FRintjeven)
8369 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8370 (if (register-unaligned ACC40Sk 2)
8371 (c-call VOID "@cpu@_media_acc_not_aligned")
8372 (if (orif (register-unaligned FRintieven 2)
8373 (register-unaligned FRintjeven 2))
8374 (c-call VOID "@cpu@_media_register_not_aligned")
8375 (sequence ((mode argihi) (mode argilo)
8376 (mode argjhi) (mode argjlo))
8377 (extract-hilo FRintieven 0 FRintjeven 0
8378 argihi argilo argjhi argjlo)
8379 (media-complex-semantics conv argihi rhs1 argilo rhs2
8380 ACC40Sk
8381 max min (msr-sie-acci))
8382 (extract-hilo FRintieven 1 FRintjeven 1
8383 argihi argilo argjhi argjlo)
8384 (media-complex-semantics conv argihi rhs1 argilo rhs2
8385 (nextreg h-acc40S ACC40Sk 1)
8386 max min (msr-sie-acci-1))))))
8387 ((fr400 (unit u-media-2-quad
8388 (in FRinti FRintieven)
8389 (in FRintj FRintjeven)))
8390 (fr500 (unit u-media-quad-complex
8391 (in FRinti FRintieven)
8392 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8393 )
8394 )
8395
8396 (define-pmacro (media-quad-complex-i
8397 name mode conv rhs1 rhs2 max min op ope comment)
8398 (dni name
8399 (comment)
8400 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
8401 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8402 (+ pack ACC40Sk op FRintieven ope FRintjeven)
8403 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8404 (if (register-unaligned ACC40Sk 2)
8405 (c-call VOID "@cpu@_media_acc_not_aligned")
8406 (if (orif (register-unaligned FRintieven 2)
8407 (register-unaligned FRintjeven 2))
8408 (c-call VOID "@cpu@_media_register_not_aligned")
8409 (sequence ((mode argihi) (mode argilo)
8410 (mode argjhi) (mode argjlo))
8411 (extract-hilo FRintieven 0 FRintjeven 0
8412 argihi argilo argjhi argjlo)
8413 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8414 ACC40Sk
8415 max min (msr-sie-acci))
8416 (extract-hilo FRintieven 1 FRintjeven 1
8417 argihi argilo argjhi argjlo)
8418 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8419 (nextreg h-acc40S ACC40Sk 1)
8420 max min (msr-sie-acci-1))))))
8421 ((fr400 (unit u-media-2-quad
8422 (in FRinti FRintieven)
8423 (in FRintj FRintjeven)))
8424 (fr500 (unit u-media-quad-complex
8425 (in FRinti FRintieven)
8426 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
8427 )
8428 )
8429
8430 (media-quad-complex mqcpxrs HI ext argjhi argjlo
8431 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8432 OP_7B OPE1_24
8433 "Media quad complex real signed with saturation")
8434
8435 (media-quad-complex mqcpxru UHI zext argjhi argjlo
8436 (const DI #xffffffffff) (const DI 0)
8437 OP_7B OPE1_25
8438 "Media quad complex real unsigned with saturation")
8439
8440 (media-quad-complex-i mqcpxis HI ext argjlo argjhi
8441 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8442 OP_7B OPE1_26
8443 "Media quad complex imaginary signed with saturation")
8444
8445 (media-quad-complex-i mqcpxiu UHI zext argjlo argjhi
8446 (const DI #xffffffffff) (const DI 0)
8447 OP_7B OPE1_27
8448 "Media quad complex imaginary unsigned with saturation")
8449
8450 (define-pmacro (media-pack src1 src2 targ offset)
8451 (sequence ()
8452 (set (halfword hi targ offset) (halfword lo src1 offset))
8453 (set (halfword lo targ offset) (halfword lo src2 offset)))
8454 )
8455
8456 (define-pmacro (media-expand-halfword-to-word-semantics cond)
8457 (if cond
8458 (sequence ((UHI tmp))
8459 (if (and u6 1)
8460 (set tmp (halfword lo FRinti 0))
8461 (set tmp (halfword hi FRinti 0)))
8462 (set (halfword hi FRintk 0) tmp)
8463 (set (halfword lo FRintk 0) tmp)))
8464 )
8465
8466 (dni mexpdhw
8467 "Media expand halfword to word"
8468 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8469 "mexpdhw$pack $FRinti,$u6,$FRintk"
8470 (+ pack FRintk OP_7B FRinti OPE1_32 u6)
8471 (media-expand-halfword-to-word-semantics 1)
8472 ((fr400 (unit u-media-3))
8473 (fr500 (unit u-media)) (fr550 (unit u-media)))
8474 )
8475
8476 (dni cmexpdhw
8477 "Conditional media expand halfword to word"
8478 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1) CONDITIONAL)
8479 "cmexpdhw$pack $FRinti,$u6,$FRintk,$CCi,$cond"
8480 (+ pack FRintk OP_76 FRinti CCi cond OPE4_2 u6)
8481 (media-expand-halfword-to-word-semantics (eq CCi (or cond 2)))
8482 ((fr400 (unit u-media-3))
8483 (fr500 (unit u-media)) (fr550 (unit u-media)))
8484 )
8485
8486 (define-pmacro (media-expand-halfword-to-double-semantics cond)
8487 (if (register-unaligned FRintkeven 2)
8488 (c-call VOID "@cpu@_media_register_not_aligned")
8489 (if cond
8490 (sequence ((UHI tmp))
8491 ; a hack to get FRintkeven referenced for profiling
8492 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8493 (if (and u6 1)
8494 (set tmp (halfword lo FRinti 0))
8495 (set tmp (halfword hi FRinti 0)))
8496 (set (halfword hi FRintkeven 0) tmp)
8497 (set (halfword lo FRintkeven 0) tmp)
8498 (set (halfword hi FRintkeven 1) tmp)
8499 (set (halfword lo FRintkeven 1) tmp))))
8500 )
8501
8502 (dni mexpdhd
8503 "Media expand halfword to double"
8504 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8505 "mexpdhd$pack $FRinti,$u6,$FRintkeven"
8506 (+ pack FRintkeven OP_7B FRinti OPE1_33 u6)
8507 (media-expand-halfword-to-double-semantics 1)
8508 ((fr400 (unit u-media-dual-expand
8509 (out FRintk FRintkeven)))
8510 (fr500 (unit u-media-dual-expand
8511 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8512 )
8513
8514 (dni cmexpdhd
8515 "Conditional media expand halfword to double"
8516 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8517 "cmexpdhd$pack $FRinti,$u6,$FRintkeven,$CCi,$cond"
8518 (+ pack FRintkeven OP_76 FRinti CCi cond OPE4_3 u6)
8519 (media-expand-halfword-to-double-semantics (eq CCi (or cond 2)))
8520 ((fr400 (unit u-media-dual-expand
8521 (out FRintk FRintkeven)))
8522 (fr500 (unit u-media-dual-expand
8523 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8524 )
8525
8526 (dni mpackh
8527 "Media halfword pack"
8528 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8529 "mpackh$pack $FRinti,$FRintj,$FRintk"
8530 (+ pack FRintk OP_7B FRinti OPE1_34 FRintj)
8531 (media-pack FRinti FRintj FRintk 0)
8532 ((fr400 (unit u-media-3))
8533 (fr500 (unit u-media)) (fr550 (unit u-media)))
8534 )
8535
8536 (dni mdpackh
8537 "Media dual pack"
8538 ((UNIT FM01) (FR500-MAJOR M-5) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8539 "mdpackh$pack $FRintieven,$FRintjeven,$FRintkeven"
8540 (+ pack FRintkeven OP_7B FRintieven OPE1_36 FRintjeven)
8541 (if (orif (register-unaligned FRintieven 2)
8542 (orif (register-unaligned FRintjeven 2)
8543 (register-unaligned FRintkeven 2)))
8544 (c-call VOID "@cpu@_media_register_not_aligned")
8545 (sequence ()
8546 ; hack to get these referenced for profiling
8547 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
8548 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8549 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8550 (media-pack FRintieven FRintjeven FRintkeven 0)
8551 (media-pack FRintieven FRintjeven FRintkeven 1)))
8552 ((fr400 (unit u-media-3-quad
8553 (in FRinti FRintieven)
8554 (in FRintj FRintjeven)
8555 (out FRintk FRintkeven)))
8556 (fr500 (unit u-media-quad-arith
8557 (in FRinti FRintieven)
8558 (in FRintj FRintjeven)
8559 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
8560 )
8561
8562 (define-pmacro (media-unpack src soff targ toff)
8563 (sequence ()
8564 (set (halfword hi targ toff) (halfword hi src soff))
8565 (set (halfword lo targ toff) (halfword hi src soff))
8566 (set (halfword hi targ (add toff 1)) (halfword lo src soff))
8567 (set (halfword lo targ (add toff 1)) (halfword lo src soff)))
8568 )
8569
8570 (dni munpackh
8571 "Media halfword unpack"
8572 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8573 "munpackh$pack $FRinti,$FRintkeven"
8574 (+ pack FRintkeven OP_7B FRinti OPE1_35 (FRj-null))
8575 (if (register-unaligned FRintkeven 2)
8576 (c-call VOID "@cpu@_media_register_not_aligned")
8577 (sequence ()
8578 ; hack to get these referenced for profiling
8579 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
8580 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8581 (media-unpack FRinti 0 FRintkeven 0)))
8582 ((fr400 (unit u-media-dual-expand
8583 (out FRintk FRintkeven)))
8584 (fr500 (unit u-media-dual-expand
8585 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8586 )
8587
8588 (dni mdunpackh
8589 "Media dual unpack"
8590 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
8591 "mdunpackh$pack $FRintieven,$FRintk"
8592 (+ pack FRintk OP_7B FRintieven OPE1_37 (FRj-null))
8593 (if (orif (register-unaligned FRintieven 2) (register-unaligned FRintk 4))
8594 (c-call VOID "@cpu@_media_register_not_aligned")
8595 (sequence ()
8596 ; hack to get these referenced for profiling
8597 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
8598 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8599 (media-unpack FRintieven 0 FRintk 0)
8600 (media-unpack FRintieven 1 FRintk 2)))
8601 ((fr500 (unit u-media-dual-unpack
8602 (in FRinti FRintieven))))
8603 )
8604
8605 (define-pmacro (ubyte num arg offset)
8606 (reg (.sym h-fr_ num) (add (index-of arg) offset)))
8607
8608 (define-pmacro (mbtoh-semantics cond)
8609 (if (register-unaligned FRintkeven 2)
8610 (c-call VOID "@cpu@_media_register_not_aligned")
8611 (if cond
8612 (sequence ()
8613 (set (halfword hi FRintkeven 0) (ubyte 3 FRintj 0))
8614 (set (halfword lo FRintkeven 0) (ubyte 2 FRintj 0))
8615 (set (halfword hi FRintkeven 1) (ubyte 1 FRintj 0))
8616 (set (halfword lo FRintkeven 1) (ubyte 0 FRintj 0)))))
8617 )
8618
8619 (dni mbtoh
8620 "Media convert byte to halfword"
8621 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8622 "mbtoh$pack $FRintj,$FRintkeven"
8623 (+ pack FRintkeven OP_7B (FRi-null) OPE1_38 FRintj)
8624 (sequence ()
8625 ; hack to get these referenced for profiling
8626 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8627 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8628 (mbtoh-semantics 1))
8629 ((fr400 (unit u-media-dual-expand
8630 (out FRintk FRintkeven)))
8631 (fr500 (unit u-media-dual-btoh
8632 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
8633 )
8634
8635 (dni cmbtoh
8636 "Conditional media convert byte to halfword"
8637 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8638 "cmbtoh$pack $FRintj,$FRintkeven,$CCi,$cond"
8639 (+ pack FRintkeven OP_77 (FRi-null) CCi cond OPE4_0 FRintj)
8640 (sequence ()
8641 ; hack to get these referenced for profiling
8642 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8643 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8644 (mbtoh-semantics (eq CCi (or cond 2))))
8645 ((fr400 (unit u-media-dual-expand
8646 (out FRintk FRintkeven)))
8647 (fr500 (unit u-media-dual-btoh
8648 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand (in FRinti FRintj))))
8649 )
8650
8651 (define-pmacro (mhtob-semantics cond)
8652 (if (register-unaligned FRintjeven 2)
8653 (c-call VOID "@cpu@_media_register_not_aligned")
8654 (if cond
8655 (sequence ()
8656 (set (ubyte 3 FRintk 0) (halfword hi FRintjeven 0))
8657 (set (ubyte 2 FRintk 0) (halfword lo FRintjeven 0))
8658 (set (ubyte 1 FRintk 0) (halfword hi FRintjeven 1))
8659 (set (ubyte 0 FRintk 0) (halfword lo FRintjeven 1)))))
8660 )
8661
8662 (dni mhtob
8663 "Media convert halfword to byte"
8664 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8665 "mhtob$pack $FRintjeven,$FRintk"
8666 (+ pack FRintk OP_7B (FRi-null) OPE1_39 FRintjeven)
8667 (sequence ()
8668 ; hack to get these referenced for profiling
8669 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8670 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8671 (mhtob-semantics 1))
8672 ((fr400 (unit u-media-dual-htob
8673 (in FRintj FRintjeven)))
8674 (fr500 (unit u-media-dual-htob
8675 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
8676 )
8677
8678 (dni cmhtob
8679 "Conditional media convert halfword to byte"
8680 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
8681 "cmhtob$pack $FRintjeven,$FRintk,$CCi,$cond"
8682 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_1 FRintjeven)
8683 (sequence ()
8684 ; hack to get these referenced for profiling
8685 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8686 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8687 (mhtob-semantics (eq CCi (or cond 2))))
8688 ((fr400 (unit u-media-dual-htob
8689 (in FRintj FRintjeven)))
8690 (fr500 (unit u-media-dual-htob
8691 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
8692 )
8693
8694 (define-pmacro (mbtohe-semantics cond)
8695 (if (register-unaligned FRintk 4)
8696 (c-call VOID "@cpu@_media_register_not_aligned")
8697 (if cond
8698 (sequence ()
8699 (set (halfword hi FRintk 0) (ubyte 3 FRintj 0))
8700 (set (halfword lo FRintk 0) (ubyte 3 FRintj 0))
8701 (set (halfword hi FRintk 1) (ubyte 2 FRintj 0))
8702 (set (halfword lo FRintk 1) (ubyte 2 FRintj 0))
8703 (set (halfword hi FRintk 2) (ubyte 1 FRintj 0))
8704 (set (halfword lo FRintk 2) (ubyte 1 FRintj 0))
8705 (set (halfword hi FRintk 3) (ubyte 0 FRintj 0))
8706 (set (halfword lo FRintk 3) (ubyte 0 FRintj 0)))))
8707 )
8708
8709 (dni mbtohe
8710 "Media convert byte to halfword extended"
8711 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
8712 "mbtohe$pack $FRintj,$FRintk"
8713 (+ pack FRintk OP_7B (FRi-null) OPE1_3A FRintj)
8714 (sequence ()
8715 ; hack to get these referenced for profiling
8716 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8717 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8718 (mbtohe-semantics 1))
8719 ((fr500 (unit u-media-dual-btohe)))
8720 )
8721
8722 (dni cmbtohe
8723 "Conditional media convert byte to halfword extended"
8724 ((UNIT FM01) (FR500-MAJOR M-7) CONDITIONAL (MACH simple,tomcat,frv))
8725 "cmbtohe$pack $FRintj,$FRintk,$CCi,$cond"
8726 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_2 FRintj)
8727 (sequence ()
8728 ; hack to get these referenced for profiling
8729 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8730 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8731 (mbtohe-semantics (eq CCi (or cond 2))))
8732 ((fr500 (unit u-media-dual-btohe)))
8733 )
8734
8735 ; Media NOP
8736 ; A special case of mclracc
8737 (dni mnop "Media nop"
8738 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-1) (FR400-MAJOR M-1))
8739 "mnop$pack"
8740 (+ pack (f-ACC40Sk 63) OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8741 (nop)
8742 ()
8743 )
8744
8745 ; mclracc with #A==0
8746 (dni mclracc-0
8747 "Media clear accumulator(s)"
8748 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8749 "mclracc$pack $ACC40Sk,$A0"
8750 (+ pack ACC40Sk OP_7B (f-A 0) (misc-null-10) OPE1_3B (FRj-null))
8751 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 0)
8752 ((fr400 (unit u-media-4))
8753 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
8754 )
8755
8756 ; mclracc with #A==1
8757 (dni mclracc-1
8758 "Media clear accumulator(s)"
8759 ((UNIT MCLRACC-1) (FR500-MAJOR M-6) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8760 "mclracc$pack $ACC40Sk,$A1"
8761 (+ pack ACC40Sk OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8762 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 1)
8763 ((fr400 (unit u-media-4))
8764 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
8765 )
8766
8767 (dni mrdacc
8768 "Media read accumulator"
8769 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8770 "mrdacc$pack $ACC40Si,$FRintk"
8771 (+ pack FRintk OP_7B ACC40Si OPE1_3C (FRj-null))
8772 (set FRintk ACC40Si)
8773 ((fr400 (unit u-media-4))
8774 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
8775 )
8776
8777 (dni mrdaccg
8778 "Media read accumulator guard"
8779 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8780 "mrdaccg$pack $ACCGi,$FRintk"
8781 (+ pack FRintk OP_7B ACCGi OPE1_3E (FRj-null))
8782 (set FRintk ACCGi)
8783 ((fr400 (unit u-media-4-accg))
8784 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc (in ACC40Si ACCGi))))
8785 )
8786
8787 (dni mwtacc
8788 "Media write accumulator"
8789 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8790 "mwtacc$pack $FRinti,$ACC40Sk"
8791 (+ pack ACC40Sk OP_7B FRinti OPE1_3D (FRj-null))
8792 (set ACC40Sk (or (and ACC40Sk (const DI #xffffffff00000000))
8793 FRinti))
8794 ((fr400 (unit u-media-4))
8795 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc)))
8796 )
8797
8798 (dni mwtaccg
8799 "Media write accumulator guard"
8800 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8801 "mwtaccg$pack $FRinti,$ACCGk"
8802 (+ pack ACCGk OP_7B FRinti OPE1_3F (FRj-null))
8803 (sequence ()
8804 ; hack to get these referenced for profiling
8805 (c-raw-call VOID "frv_ref_SI" ACCGk)
8806 (set ACCGk FRinti))
8807 ((fr400 (unit u-media-4-accg))
8808 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc (in ACC40Sk ACCGk))))
8809 )
8810
8811 (define-pmacro (media-cop num op)
8812 (dni (.sym mcop num)
8813 "Media custom instruction"
8814 ((UNIT FM01) (FR500-MAJOR M-1) (MACH frv))
8815 (.str "mcop" num "$pack $FRi,$FRj,$FRk")
8816 (+ pack FRk op FRi OPE1_00 FRj)
8817 (c-call VOID "@cpu@_media_cop" num)
8818 ()
8819 )
8820 )
8821
8822 (media-cop 1 OP_7C)
8823 (media-cop 2 OP_7D)
8824
8825 ; nop
8826 ; A nop is defined to be a "ori gr0,0,gr0"
8827 ; This needn't be a macro-insn, but making it one greatly simplifies decode.c
8828 ; On the other hand spending a little time in the decoder is often worth it.
8829 ;
8830 (dnmi nop "nop"
8831 ((UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8832 "nop$pack"
8833 (emit ori pack (GRi 0) (s12 0) (GRk 0))
8834 )
8835
8836 ; Floating point NOP
8837 (dni fnop
8838 "Floating point nop"
8839 ((UNIT FMALL) (FR500-MAJOR F-8) (FR550-MAJOR F-1) (MACH simple,tomcat,fr500,fr550,frv))
8840 "fnop$pack"
8841 (+ pack (rd-null) OP_79 (FRi-null) OPE1_0D (FRj-null))
8842 (nop)
8843 ()
8844 )
8845
8846 ; A return instruction
8847 (dnmi ret "return"
8848 (NO-DIS (UNIT B01) (FR500-MAJOR B-3) (FR400-MAJOR B-3))
8849 "ret$pack"
8850 (emit bralr pack (hint_taken 2))
8851 )
8852
8853 (dnmi cmp "compare"
8854 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8855 "cmp$pack $GRi,$GRj,$ICCi_1"
8856 (emit subcc pack GRi GRj (GRk 0) ICCi_1)
8857 )
8858
8859 (dnmi cmpi "compare immediate"
8860 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8861 "cmpi$pack $GRi,$s10,$ICCi_1"
8862 (emit subicc pack GRi s10 (GRk 0) ICCi_1)
8863 )
8864
8865 (dnmi ccmp "conditional compare"
8866 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
8867 "ccmp$pack $GRi,$GRj,$CCi,$cond"
8868 (emit csubcc pack GRi GRj (GRk 0) CCi cond)
8869 )
8870
8871 (dnmi mov "move"
8872 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
8873 "mov$pack $GRi,$GRk"
8874 (emit ori pack GRi (s12 0) GRk)
8875 )
8876
8877 (dnmi cmov "conditional move"
8878 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
8879 "cmov$pack $GRi,$GRk,$CCi,$cond"
8880 (emit cor pack GRi (GRj 0) GRk CCi cond)
8881 )
This page took 0.236632 seconds and 5 git commands to generate.