2003-10-28 Jeff Johnston <jjohnstn@redhat.com>
[deliverable/binutils-gdb.git] / cpu / frv.cpu
CommitLineData
9aab5aa3
AC
1; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*-
2;
23600bb3 3; Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
9aab5aa3
AC
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)
ac7c07ac 31 (machs frv fr550 fr500 fr400 tomcat simple)
9aab5aa3
AC
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.
ac7c07ac 41 (parallel-insns 8) ; The frv executes up to 8 insns at a time.
9aab5aa3
AC
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
ac7c07ac
DB
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
9aab5aa3
AC
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 )
23600bb3
DB
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 )
9aab5aa3
AC
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 )
d0312406
DB
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 )
9aab5aa3
AC
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")
8caa9169
DB
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.
9aab5aa3 1385 (values NIL
ac7c07ac
DB
1386 I0 I1 I01 I2 I3 IALL
1387 FM0 FM1 FM01 FM2 FM3 FMALL FMLOW
9aab5aa3
AC
1388 B0 B1 B01
1389 C
1390 MULT-DIV ; multiply/division slotted differently on different machines
1391 LOAD ; loads slotted differently on different machines
8caa9169
DB
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
9aab5aa3
AC
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)
ac7c07ac
DB
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)
9aab5aa3
AC
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)
6f18ad70 1480; null attribute -- used as a place holder for where an attribue is required.
9aab5aa3
AC
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)
5b5b78da
DE
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)
9aab5aa3
AC
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
ac7c07ac 2050 (ccr 256) (cccr 263) (lr 272) (lcr 273) (iacc0h 280) (iacc0l 281) (isr 288)
9aab5aa3
AC
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))
ac7c07ac
DB
2395(define-pmacro (spr-iacc0h) (reg h-spr 280))
2396(define-pmacro (spr-iacc0l) (reg h-spr 281))
9aab5aa3
AC
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)
ac7c07ac
DB
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)
9aab5aa3
AC
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)
6f18ad70 2567 (comment "Floating point condition code registers")
9aab5aa3
AC
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
1340b9a9
DB
2655; dnpmop: define-normal-parsed-mode-operand: Normal mode operand with parse handler
2656(define-pmacro (dnpmop xname xcomment xattrs xtype xindex xmode xparse)
2657 (define-operand
2658 (name xname)
2659 (comment xcomment)
2660 (.splice attrs (.unsplice xattrs))
2661 (type xtype)
2662 (index xindex)
2663 (mode xmode)
2664 (handlers (parse xparse))
2665 )
2666)
2667
9aab5aa3
AC
2668(dnop pack "packing bit" () h-pack f-pack)
2669
2670(dnmop GRi "source register 1" () h-gr f-GRi SI)
2671(dnmop GRj "source register 2" () h-gr f-GRj SI)
2672(dnmop GRk "destination register" () h-gr f-GRk SI)
2673(dnmop GRkhi "destination register" () h-gr_hi f-GRk UHI)
2674(dnmop GRklo "destination register" () h-gr_lo f-GRk UHI)
1340b9a9 2675(dnpmop GRdoublek "destination register" () h-gr_double f-GRk DI "even_register")
9aab5aa3
AC
2676(dnmop ACC40Si "signed accumulator" () h-acc40S f-ACC40Si DI)
2677(dnmop ACC40Ui "unsigned accumulator" () h-acc40U f-ACC40Ui UDI)
2678(dnmop ACC40Sk "target accumulator" () h-acc40S f-ACC40Sk DI)
2679(dnmop ACC40Uk "target accumulator" () h-acc40U f-ACC40Uk UDI)
2680(dnmop ACCGi "source register" () h-accg f-ACCGi UWI)
2681(dnmop ACCGk "target register" () h-accg f-ACCGk UWI)
2682
2683(dnmop CPRi "source register" ((MACH frv)) h-cpr f-CPRi SI)
2684(dnmop CPRj "source register" ((MACH frv)) h-cpr f-CPRj SI)
2685(dnmop CPRk "destination register" ((MACH frv)) h-cpr f-CPRk SI)
1340b9a9 2686(dnpmop CPRdoublek "destination register" ((MACH frv)) h-cpr_double f-CPRk DI "even_register")
9aab5aa3
AC
2687
2688; floating point operands
36c3ae24
NC
2689(dnmop FRinti "source register 1" () h-fr_int f-FRi SI)
2690(dnmop FRintj "source register 2" () h-fr_int f-FRj SI)
2691(dnmop FRintk "target register" () h-fr_int f-FRk SI)
9aab5aa3
AC
2692(dnmop FRi "source register 1" () h-fr f-FRi SF)
2693(dnmop FRj "source register 2" () h-fr f-FRj SF)
2694(dnmop FRk "destination register" () h-fr f-FRk SF)
2695(dnmop FRkhi "destination register" () h-fr_hi f-FRk UHI)
2696(dnmop FRklo "destination register" () h-fr_lo f-FRk UHI)
1340b9a9
DB
2697(dnpmop FRdoublei "source register 1" () h-fr_double f-FRi DF "even_register")
2698(dnpmop FRdoublej "source register 2" () h-fr_double f-FRj DF "even_register")
2699(dnpmop FRdoublek "target register" () h-fr_double f-FRk DF "even_register")
9aab5aa3
AC
2700
2701(dnop CRi "source register 1" () h-cccr f-CRi)
2702(dnop CRj "source register 2" () h-cccr f-CRj)
2703(dnop CRj_int "destination register" () h-cccr f-CRj_int)
2704(dnop CRj_float "destination register" () h-cccr f-CRj_float)
2705(dnop CRk "destination register" () h-cccr f-CRk)
2706(dnop CCi "condition register" () h-cccr f-CCi)
2707
2708(dnop ICCi_1 "condition register" () h-iccr f-ICCi_1)
2709(dnop ICCi_2 "condition register" () h-iccr f-ICCi_2)
2710(dnop ICCi_3 "condition register" () h-iccr f-ICCi_3)
2711(dnop FCCi_1 "condition register" () h-fccr f-FCCi_1)
2712(dnop FCCi_2 "condition register" () h-fccr f-FCCi_2)
2713(dnop FCCi_3 "condition register" () h-fccr f-FCCi_3)
2714(dnop FCCk "condition register" () h-fccr f-FCCk)
2715
2716(dnop eir "exception insn reg" () h-uint f-eir)
2717(dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10)
2718(dnop u16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-u16)
2719(dnop s16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-s16)
2720(dnop s6 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6)
2721(dnop s6_1 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6_1)
2722(dnop u6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-u6)
2723(dnop s5 "5 bit signed immediate" (HASH-PREFIX) h-sint f-s5)
2724(dnop cond "conditional arithmetic" (HASH-PREFIX) h-uint f-cond)
2725(dnop ccond "lr branch condition" (HASH-PREFIX) h-uint f-ccond)
2726(dnop hint "2 bit branch predictor" (HASH-PREFIX) h-uint f-hint)
2727(dnop hint_taken "2 bit branch predictor" () h-hint-taken f-hint)
2728(dnop hint_not_taken "2 bit branch predictor" () h-hint-not-taken f-hint)
2729
2730(dnop LI "link indicator" () h-uint f-LI)
2731(dnop lock "cache lock indicator" (HASH-PREFIX) h-uint f-lock)
2732(dnop debug "debug mode indicator" (HASH-PREFIX) h-uint f-debug)
9aab5aa3
AC
2733(dnop ae "all entries indicator" (HASH-PREFIX) h-uint f-ae)
2734
2735(dnop label16 "18 bit pc relative address" () h-iaddr f-label16)
2736(dnop label24 "26 bit pc relative address" () h-iaddr f-label24)
2737
8caa9169
DB
2738(define-operand
2739 (name A0)
2740 (comment "A==0 operand of mclracc")
2741 (attrs)
2742 (type h-uint)
2743 (index f-A)
2744 (mode USI)
2745 (handlers (parse "A0"))
2746)
2747
2748(define-operand
2749 (name A1)
2750 (comment "A==1 operand of mclracc")
2751 (attrs)
2752 (type h-uint)
2753 (index f-A)
2754 (mode USI)
2755 (handlers (parse "A1"))
2756)
2757
36c3ae24
NC
2758(define-operand
2759 (name FRintieven)
2760 (comment "(even) source register 1")
2761 (attrs)
2762 (type h-fr_int)
2763 (index f-FRi)
2764 (mode SI)
2765 (handlers (parse "even_register"))
2766)
2767
2768(define-operand
2769 (name FRintjeven)
2770 (comment "(even) source register 2")
2771 (attrs)
2772 (type h-fr_int)
2773 (index f-FRj)
2774 (mode SI)
2775 (handlers (parse "even_register"))
2776)
2777
2778(define-operand
2779 (name FRintkeven)
2780 (comment "(even) target register")
2781 (attrs)
2782 (type h-fr_int)
2783 (index f-FRk)
2784 (mode SI)
2785 (handlers (parse "even_register"))
2786)
2787
9aab5aa3
AC
2788(define-operand
2789 (name d12)
2790 (comment "12 bit signed immediate")
2791 (attrs)
2792 (type h-sint)
2793 (index f-d12)
2794 (handlers (parse "d12"))
2795)
2796
2797(define-operand
2798 (name s12)
2799 (comment "12 bit signed immediate")
2800 (attrs HASH-PREFIX)
2801 (type h-sint)
2802 (index f-d12)
2803 (handlers (parse "s12"))
2804)
2805
2806(define-operand
2807 (name u12)
2808 (comment "12 bit signed immediate")
2809 (attrs HASH-PREFIX)
2810 (type h-sint)
2811 (index f-u12)
2812 (handlers (parse "u12"))
2813)
2814
2815(define-operand
2816 (name spr)
2817 (comment "special purpose register")
2818 (attrs)
2819 (type h-spr)
2820 (index f-spr)
2821 (handlers (parse "spr") (print "spr"))
2822)
2823
2824(define-operand
2825 (name ulo16)
2826 (comment "16 bit unsigned immediate, for #lo()")
2827 (attrs)
2828 (type h-uint)
2829 (index f-u16)
2830 (handlers (parse "ulo16") (print "lo"))
2831)
2832
2833(define-operand
2834 (name slo16)
2835 (comment "16 bit unsigned immediate, for #lo()")
2836 (attrs)
2837 (type h-sint)
2838 (index f-s16)
2839 (handlers (parse "uslo16") (print "lo"))
2840)
2841
2842(define-operand
2843 (name uhi16)
2844 (comment "16 bit unsigned immediate, for #hi()")
2845 (attrs)
2846 (type h-uint)
2847 (index f-u16)
2848 (handlers (parse "uhi16") (print "hi"))
2849)
2850
2851; operands representing hardware
2852;
2853(dnop psr_esr "PSR.ESR bit" (SEM-ONLY) h-psr_esr f-nil)
2854(dnop psr_s "PSR.S bit" (SEM-ONLY) h-psr_s f-nil)
2855(dnop psr_ps "PSR.PS bit" (SEM-ONLY) h-psr_ps f-nil)
2856(dnop psr_et "PSR.ET bit" (SEM-ONLY) h-psr_et f-nil)
2857
2858(dnop bpsr_bs "BPSR.BS bit" (SEM-ONLY) h-bpsr_bs f-nil)
2859(dnop bpsr_bet "BPSR.BET bit" (SEM-ONLY) h-bpsr_bet f-nil)
2860
2861(dnop tbr_tba "TBR.TBA" (SEM-ONLY) h-tbr_tba f-nil)
2862(dnop tbr_tt "TBR.TT" (SEM-ONLY) h-tbr_tt f-nil)
2863
2864; Null operands
2865;
2866(define-pmacro (ICCi_1-null) (f-ICCi_1-null 0))
2867(define-pmacro (ICCi_2-null) (f-ICCi_2-null 0))
2868(define-pmacro (ICCi_3-null) (f-ICCi_3-null 0))
2869(define-pmacro (FCCi_1-null) (f-FCCi_1-null 0))
2870(define-pmacro (FCCi_2-null) (f-FCCi_2-null 0))
2871(define-pmacro (FCCi_3-null) (f-FCCi_3-null 0))
2872(define-pmacro (rs-null) (f-rs-null 0))
2873(define-pmacro (GRi-null) (f-GRi-null 0))
2874(define-pmacro (GRj-null) (f-GRj-null 0))
2875(define-pmacro (GRk-null) (f-GRk-null 0))
2876(define-pmacro (FRi-null) (f-FRi-null 0))
2877(define-pmacro (FRj-null) (f-FRj-null 0))
2878(define-pmacro (ACCj-null) (f-ACCj-null 0))
2879(define-pmacro (rd-null) (f-rd-null 0))
2880(define-pmacro (cond-null) (f-cond-null 0))
2881(define-pmacro (ccond-null) (f-ccond-null 0))
2882(define-pmacro (s12-null) (f-s12-null 0))
2883(define-pmacro (label16-null) (f-label16-null 0))
2884(define-pmacro (misc-null-1) (f-misc-null-1 0))
2885(define-pmacro (misc-null-2) (f-misc-null-2 0))
2886(define-pmacro (misc-null-3) (f-misc-null-3 0))
2887(define-pmacro (misc-null-4) (f-misc-null-4 0))
2888(define-pmacro (misc-null-5) (f-misc-null-5 0))
2889(define-pmacro (misc-null-6) (f-misc-null-6 0))
2890(define-pmacro (misc-null-7) (f-misc-null-7 0))
2891(define-pmacro (misc-null-8) (f-misc-null-8 0))
2892(define-pmacro (misc-null-9) (f-misc-null-9 0))
2893(define-pmacro (misc-null-10) (f-misc-null-10 0))
2894(define-pmacro (misc-null-11) (f-misc-null-11 0))
2895
2896(define-pmacro (LI-on) (f-LI-on 1))
2897(define-pmacro (LI-off) (f-LI-off 0))
2898\f
2899; Instruction definitions.
2900;
2901; Notes:
2902; - dni is short for "define-normal-instruction"
2903; - Macros are used to represent each insn format. These should be used as much
2904; as possible unless an insn has exceptional behaviour
2905;
2906
2907; Commonly used Macros
2908;
2909; Specific registers
2910;
2911
2912; Integer condition code manipulation
2913;
2914(define-pmacro (set-z-and-n icc x)
2915 (if (eq x 0)
2916 (set icc (or (and icc #x7) #x4))
2917 (if (lt x 0)
2918 (set icc (or (and icc #xb) #x8))
2919 (set icc (and icc #x3))))
2920)
2921
2922(define-pmacro (set-n icc val)
2923 (if (eq val 0)
2924 (set icc (and icc #x7))
2925 (set icc (or icc #x8)))
2926)
2927
2928(define-pmacro (set-z icc val)
2929 (if (eq val 0)
2930 (set icc (and icc #xb))
2931 (set icc (or icc #x4)))
2932)
2933
2934(define-pmacro (set-v icc val)
2935 (if (eq val 0)
2936 (set icc (and icc #xd))
2937 (set icc (or icc #x2)))
2938)
2939
2940(define-pmacro (set-c icc val)
2941 (if (eq val 0)
2942 (set icc (and icc #xe))
2943 (set icc (or icc #x1)))
2944)
2945
2946(define-pmacro (nbit icc)
2947 (trunc BI (srl (and icc #x8) 3))
2948)
2949
2950(define-pmacro (zbit icc)
2951 (trunc BI (srl (and icc #x4) 2))
2952)
2953
2954(define-pmacro (vbit icc)
2955 (trunc BI (srl (and icc #x2) 1))
2956)
2957
2958(define-pmacro (cbit icc)
2959 (trunc BI (and icc #x1))
2960)
2961
2962(define-pmacro (ebit icc)
2963 (trunc BI (srl (and icc #x8) 3))
2964)
2965
2966(define-pmacro (lbit icc)
2967 (trunc BI (srl (and icc #x4) 2))
2968)
2969
2970(define-pmacro (gbit icc)
2971 (trunc BI (srl (and icc #x2) 1))
2972)
2973
2974(define-pmacro (ubit icc)
2975 (trunc BI (and icc #x1))
2976)
2977
8caa9169
DB
2978; FRV insns
2979;
9aab5aa3 2980;
9aab5aa3
AC
2981; Format: INT, Logic, Shift r-r
2982;
2983(define-pmacro (int-logic-r-r name operation op ope comment)
2984 (dni name
2985 (comment)
ac7c07ac 2986 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
2987 (.str name "$pack $GRi,$GRj,$GRk")
2988 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
2989 (set GRk (operation GRi GRj))
2990 ((fr400 (unit u-integer))
ac7c07ac 2991 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
2992 )
2993)
2994
2995(int-logic-r-r add add OP_00 OPE2_00 "add reg/reg")
2996(int-logic-r-r sub sub OP_00 OPE2_04 "sub reg/reg")
2997(int-logic-r-r and and OP_01 OPE2_00 "and reg/reg")
2998(int-logic-r-r or or OP_01 OPE2_02 "or reg/reg")
2999(int-logic-r-r xor xor OP_01 OPE2_04 "xor reg/reg")
3000
3001(dni not
3002 ("not")
ac7c07ac 3003 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3004 ("not$pack $GRj,$GRk")
3005 (+ pack GRk OP_01 (rs-null) (ICCi_1-null) OPE2_06 GRj)
3006 (set GRk (inv GRj))
3007 ((fr400 (unit u-integer))
ac7c07ac 3008 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3009)
3010
3011(dni sdiv
3012 "signed division"
ac7c07ac 3013 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3014 "sdiv$pack $GRi,$GRj,$GRk"
3015 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0E GRj)
3016 (sequence ()
3017 (c-call VOID "@cpu@_signed_integer_divide"
3018 GRi GRj (index-of GRk) 0)
3019 (clobber GRk))
3020 ((fr400 (unit u-idiv))
ac7c07ac 3021 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3022)
3023
3024(dni nsdiv
3025 "non excepting signed division"
ac7c07ac
DB
3026 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3027 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3028 "nsdiv$pack $GRi,$GRj,$GRk"
3029 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0E GRj)
3030 (sequence ()
3031 (c-call VOID "@cpu@_signed_integer_divide"
3032 GRi GRj (index-of GRk) 1)
3033 (clobber GRk))
3034 ((fr400 (unit u-idiv))
ac7c07ac 3035 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3036)
3037
3038(dni udiv
3039 "unsigned division reg/reg"
ac7c07ac 3040 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3041 "udiv$pack $GRi,$GRj,$GRk"
3042 (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0F GRj)
3043 (sequence ()
3044 (c-call VOID "@cpu@_unsigned_integer_divide"
3045 GRi GRj (index-of GRk) 0)
3046 (clobber GRk))
3047 ((fr400 (unit u-idiv))
ac7c07ac 3048 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3049)
3050
3051(dni nudiv
3052 "non excepting unsigned division"
ac7c07ac
DB
3053 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3054 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3055 "nudiv$pack $GRi,$GRj,$GRk"
3056 (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0F GRj)
3057 (sequence ()
3058 (c-call VOID "@cpu@_unsigned_integer_divide"
3059 GRi GRj (index-of GRk) 1)
3060 (clobber GRk))
3061 ((fr400 (unit u-idiv))
ac7c07ac 3062 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3063)
3064
3065; Multiplication
3066;
3067(define-pmacro (multiply-r-r name signop op ope comment)
3068 (dni name
3069 (comment)
ac7c07ac 3070 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3071 (.str name "$pack $GRi,$GRj,$GRdoublek")
3072 (+ pack GRdoublek op GRi (ICCi_1-null) ope GRj)
3073 (set GRdoublek (mul DI (signop DI GRi) (signop DI GRj)))
3074 ((fr400 (unit u-imul))
ac7c07ac 3075 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3076 )
3077)
3078
3079(multiply-r-r smul ext OP_00 OPE2_08 "signed multiply reg/reg")
3080(multiply-r-r umul zext OP_00 OPE2_0A "unsigned multiply reg/reg")
3081
ac7c07ac
DB
3082; Multiplication with integer accumulator IACC
3083;
3084
3085(define-pmacro (iacc-set value)
3086 (set (reg h-iacc0 0) value))
3087
3088(define-pmacro (iacc-add value)
3089 (set (reg h-iacc0 0)
3090 (cond DI
3091 ((andif (andif (gt value 0) (gt (reg h-iacc0 0) 0))
3092 (lt (sub DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3093 ; Positive overflow
3094 (const DI #x7fffffffffffffff))
3095 ((andif (andif (lt value 0) (lt (reg h-iacc0 0) 0))
3096 (gt (sub DI #x8000000000000000 value) (reg h-iacc0 0)))
3097 ; Negative overflow
3098 (const DI #x8000000000000000))
3099 (else
3100 (add DI (reg h-iacc0 0) value))))
3101)
3102
3103(define-pmacro (iacc-sub value)
3104 (set (reg h-iacc0 0)
3105 (cond DI
3106 ((andif (andif (lt value 0) (gt (reg h-iacc0 0) 0))
3107 (lt (add DI #x7fffffffffffffff value) (reg h-iacc0 0)))
3108 ; Positive overflow
3109 (const DI #x7fffffffffffffff))
3110 ((andif (andif (gt value 0) (lt (reg h-iacc0 0) 0))
3111 (gt (add DI #x8000000000000000 value) (reg h-iacc0 0)))
3112 ; Negative overflow
3113 (const DI #x8000000000000000))
3114 (else
3115 (sub DI (reg h-iacc0 0) value))))
3116)
3117
3118(define-pmacro (iacc-multiply-r-r name operation op ope comment)
3119 (dni name
3120 (comment)
3121 ((UNIT MULT-DIV) (FR400-MAJOR I-1) (MACH fr400))
3122 (.str name "$pack $GRi,$GRj")
3123 (+ pack (rd-null) op GRi ope GRj)
3124 ((.sym iacc- operation) (mul DI (ext DI GRi) (ext DI GRj)))
3125 ((fr400 (unit u-integer)))
3126 )
3127)
3128
3129(iacc-multiply-r-r smu set OP_46 OPE1_05 "Signed multiply reg/reg/iacc")
3130(iacc-multiply-r-r smass add OP_46 OPE1_06 "Signed multiply/add reg/reg/iacc")
3131(iacc-multiply-r-r smsss sub OP_46 OPE1_07 "Signed multiply/sub reg/reg/iacc")
3132
9aab5aa3
AC
3133(define-pmacro (int-shift-r-r name op ope comment)
3134 (dni name
3135 (comment)
ac7c07ac 3136 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3137 (.str name "$pack $GRi,$GRj,$GRk")
3138 (+ pack GRk op GRi (ICCi_1-null) ope GRj)
3139 (set GRk (name GRi (and GRj #x1f)))
3140 ((fr400 (unit u-integer))
ac7c07ac 3141 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3142 )
3143)
3144
3145(int-shift-r-r sll OP_01 OPE2_08 "shift left logical reg/reg")
3146(int-shift-r-r srl OP_01 OPE2_0A "shift right logical reg/reg")
3147(int-shift-r-r sra OP_01 OPE2_0C "shift right arith reg/reg")
3148
ac7c07ac
DB
3149(dni slass
3150 "shift left arith reg/reg with saturation"
3151 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3152 "slass$pack $GRi,$GRj,$GRk"
3153 (+ pack GRk OP_46 GRi OPE1_02 GRj)
3154 (set GRk (c-call SI "@cpu@_shift_left_arith_saturate" GRi GRj))
3155 ()
3156)
3157
3158(dni scutss
3159 "Integer accumulator cut with saturation"
3160 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3161 "scutss$pack $GRj,$GRk"
3162 (+ pack GRk OP_46 (rs-null) OPE1_04 GRj)
3163 (set GRk (c-call SI "@cpu@_iacc_cut" (reg h-iacc0 0) GRj))
3164 ()
3165)
3166
9aab5aa3
AC
3167(define-pmacro (scan-semantics arg1 arg2 targ)
3168 (sequence ((WI tmp1) (WI tmp2))
3169 (set tmp1 arg1)
3170 (set tmp2 (sra arg2 1))
3171 (set targ (c-call WI "@cpu@_scan_result" (xor tmp1 tmp2))))
3172)
3173
3174(dni scan
3175 "scan"
ac7c07ac 3176 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3177 "scan$pack $GRi,$GRj,$GRk"
3178 (+ pack GRk OP_0B GRi (ICCi_1-null) OPE2_00 GRj)
3179 (scan-semantics GRi GRj GRk)
3180 ((fr400 (unit u-integer))
ac7c07ac 3181 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3182)
3183
3184; Format: conditional INT, Logic, Shift r-r
3185;
3186(define-pmacro (conditional-int-logic name operation op ope comment)
3187 (dni name
3188 (comment)
ac7c07ac 3189 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3190 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3191 (+ pack GRk op GRi CCi cond ope GRj)
3192 (if (eq CCi (or cond 2))
3193 (set GRk (operation GRi GRj)))
3194 ((fr400 (unit u-integer))
ac7c07ac 3195 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3196 )
3197)
3198
3199(conditional-int-logic cadd add OP_58 OPE4_0 "conditional add")
3200(conditional-int-logic csub sub OP_58 OPE4_1 "conditional sub")
3201(conditional-int-logic cand and OP_5A OPE4_0 "conditional and")
3202(conditional-int-logic cor or OP_5A OPE4_1 "conditional or")
3203(conditional-int-logic cxor xor OP_5A OPE4_2 "conditional xor")
3204
3205(dni cnot
3206 "conditional not"
ac7c07ac 3207 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3208 "cnot$pack $GRj,$GRk,$CCi,$cond"
3209 (+ pack GRk OP_5A (rs-null) CCi cond OPE4_3 GRj)
3210 (if (eq CCi (or cond 2))
3211 (set GRk (inv GRj)))
3212 ((fr400 (unit u-integer))
ac7c07ac 3213 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3214)
3215
3216(dni csmul
3217 "conditional signed multiply"
ac7c07ac 3218 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3219 "csmul$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3220 (+ pack GRdoublek OP_58 GRi CCi cond OPE4_2 GRj)
3221 (if (eq CCi (or cond 2))
3222 (set GRdoublek (mul DI (ext DI GRi) (ext DI GRj))))
3223 ((fr400 (unit u-imul))
ac7c07ac 3224 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3225)
3226
3227(dni csdiv
3228 "conditional signed division"
ac7c07ac 3229 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3230 "csdiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3231 (+ pack GRk OP_58 GRi CCi cond OPE4_3 GRj)
3232 (if (eq CCi (or cond 2))
3233 (sequence ()
3234 (c-call VOID "@cpu@_signed_integer_divide"
3235 GRi GRj (index-of GRk) 0)
3236 (clobber GRk)))
3237 ((fr400 (unit u-idiv))
ac7c07ac 3238 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3239)
3240
3241(dni cudiv
3242 "conditional unsigned division"
ac7c07ac 3243 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3244 "cudiv$pack $GRi,$GRj,$GRk,$CCi,$cond"
3245 (+ pack GRk OP_59 GRi CCi cond OPE4_3 GRj)
3246 (if (eq CCi (or cond 2))
3247 (sequence ()
3248 (c-call VOID "@cpu@_unsigned_integer_divide"
3249 GRi GRj (index-of GRk) 0)
3250 (clobber GRk)))
3251 ((fr400 (unit u-idiv))
ac7c07ac 3252 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3253)
3254
3255(define-pmacro (conditional-shift name operation op ope comment)
3256 (dni name
3257 (comment)
ac7c07ac 3258 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3259 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3260 (+ pack GRk op GRi CCi cond ope GRj)
3261 (if (eq CCi (or cond 2))
3262 (set GRk (operation GRi (and GRj #x1f))))
3263 ((fr400 (unit u-integer))
ac7c07ac 3264 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3265 )
3266)
3267
3268(conditional-shift csll sll OP_5C OPE4_0 "conditional shift left logical")
3269(conditional-shift csrl srl OP_5C OPE4_1 "conditional shift right logical")
3270(conditional-shift csra sra OP_5C OPE4_2 "conditional shift right arith")
3271
3272(dni cscan
3273 "conditional scan"
ac7c07ac 3274 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3275 "cscan$pack $GRi,$GRj,$GRk,$CCi,$cond"
3276 (+ pack GRk OP_65 GRi CCi cond OPE4_3 GRj)
3277 (if (eq CCi (or cond 2))
3278 (scan-semantics GRi GRj GRk))
3279 ((fr400 (unit u-integer))
ac7c07ac 3280 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3281)
3282
3283; Format: INT, Logic, Shift, cc r-r
3284;
3285(define-pmacro (int-arith-cc-semantics operation icc)
3286 (sequence ((BI tmp) (QI cc) (SI result))
3287 (set cc icc)
3288 (set tmp ((.sym operation -oflag) GRi GRj (const 0)))
3289 (set-v cc tmp)
3290 (set tmp ((.sym operation -cflag) GRi GRj (const 0)))
3291 (set-c cc tmp)
3292 (set result (operation GRi GRj))
3293 (set-z-and-n cc result)
3294 (set GRk result)
3295 (set icc cc))
3296)
3297
3298(define-pmacro (int-arith-cc-r-r name operation op ope comment)
3299 (dni name
3300 (comment)
ac7c07ac 3301 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3302 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3303 (+ pack GRk op GRi ICCi_1 ope GRj)
3304 (int-arith-cc-semantics operation ICCi_1)
3305 ((fr400 (unit u-integer))
ac7c07ac 3306 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3307 )
3308)
3309
3310(int-arith-cc-r-r addcc add OP_00 OPE2_01 "add reg/reg, set icc")
3311(int-arith-cc-r-r subcc sub OP_00 OPE2_05 "sub reg/reg, set icc")
3312
3313(define-pmacro (int-logic-cc-semantics op icc)
3314 (sequence ((SI tmp))
3315 (set tmp (op GRi GRj))
3316 (set GRk tmp)
3317 (set-z-and-n icc tmp))
3318)
3319
3320(define-pmacro (int-logic-cc-r-r name op ope comment)
3321 (dni (.sym name cc)
3322 (comment)
ac7c07ac 3323 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3324 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3325 (+ pack GRk op GRi ICCi_1 ope GRj)
3326 (int-logic-cc-semantics name ICCi_1)
3327 ((fr400 (unit u-integer))
ac7c07ac 3328 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3329 )
3330)
3331
3332(int-logic-cc-r-r and OP_01 OPE2_01 "and reg/reg, set icc")
3333(int-logic-cc-r-r or OP_01 OPE2_03 "or reg/reg, set icc")
3334(int-logic-cc-r-r xor OP_01 OPE2_05 "xor reg/reg, set icc")
3335
3336(define-pmacro (int-shift-cc-semantics op l-r icc)
3337 (sequence ((WI shift) (SI tmp) (QI cc))
3338 (set shift (and GRj #x1f))
3339 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3340 GRi shift icc))
3341 (set tmp (op GRi shift))
3342 (set GRk tmp)
3343 (set-z-and-n cc tmp)
3344 (set icc cc))
3345)
3346
3347(define-pmacro (int-shift-cc-r-r name l-r op ope comment)
3348 (dni (.sym name cc)
3349 (comment)
ac7c07ac 3350 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3351 (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1")
3352 (+ pack GRk op GRi ICCi_1 ope GRj)
3353 (int-shift-cc-semantics name l-r ICCi_1)
3354 ((fr400 (unit u-integer))
ac7c07ac 3355 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3356 )
3357)
3358
3359(int-shift-cc-r-r sll left OP_01 OPE2_09 "shift left logical reg/reg,set icc")
3360(int-shift-cc-r-r srl right OP_01 OPE2_0B "shift right logical reg/reg,set icc")
3361(int-shift-cc-r-r sra right OP_01 OPE2_0D "shift right arith reg/reg,set icc")
3362
3363(define-pmacro (multiply-cc-semantics signop arg1 arg2 targ icc)
3364 (sequence ((DI tmp) (QI cc))
3365 (set cc icc)
3366 (set tmp (mul DI (signop DI arg1) (signop DI arg2)))
3367 (set-n cc (srl DI tmp 63))
3368 (set-z cc (eq tmp 0))
3369 (set targ tmp)
3370 (set icc cc))
3371)
3372
3373(define-pmacro (multiply-cc-r-r name signop op ope comment)
3374 (dni name
3375 (comment)
ac7c07ac 3376 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3377 (.str name "$pack $GRi,$GRj,$GRdoublek,$ICCi_1")
3378 (+ pack GRdoublek op GRi ICCi_1 ope GRj)
3379 (multiply-cc-semantics signop GRi GRj GRdoublek ICCi_1)
3380 ((fr400 (unit u-imul))
ac7c07ac 3381 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3382 )
3383)
3384
3385(multiply-cc-r-r smulcc ext OP_00 OPE2_09 "signed multiply reg/reg")
3386(multiply-cc-r-r umulcc zext OP_00 OPE2_0B "unsigned multiply reg/reg")
3387
3388
3389; Format: conditional INT, Logic, Shift, cc r-r
3390;
3391(define-pmacro (conditional-int-arith-cc name operation op ope comment)
3392 (dni name
3393 (comment)
ac7c07ac 3394 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3395 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3396 (+ pack GRk op GRi CCi cond ope GRj)
3397 (if (eq CCi (or cond 2))
3398 (int-arith-cc-semantics operation
3399 (reg h-iccr (and (index-of CCi) 3))))
3400 ((fr400 (unit u-integer))
ac7c07ac 3401 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3402 )
3403)
3404
3405(conditional-int-arith-cc caddcc add OP_59 OPE4_0 "add, set icc")
3406(conditional-int-arith-cc csubcc sub OP_59 OPE4_1 "sub, set icc")
3407
3408(dni csmulcc
3409 "conditional signed multiply and set condition code"
ac7c07ac 3410 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3411 "csmulcc$pack $GRi,$GRj,$GRdoublek,$CCi,$cond"
3412 (+ pack GRdoublek OP_59 GRi CCi cond OPE4_2 GRj)
3413 (if (eq CCi (or cond 2))
3414 (multiply-cc-semantics ext GRi GRj GRdoublek
3415 (reg h-iccr (and (index-of CCi) 3))))
3416 ((fr400 (unit u-imul))
ac7c07ac 3417 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3418)
3419
3420(define-pmacro (conditional-int-logic-cc name operation op ope comment)
3421 (dni name
3422 (comment)
ac7c07ac 3423 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3424 (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3425 (+ pack GRk op GRi CCi cond ope GRj)
3426 (if (eq CCi (or cond 2))
3427 (int-logic-cc-semantics operation
3428 (reg h-iccr (and (index-of CCi) 3))))
3429 ((fr400 (unit u-integer))
ac7c07ac 3430 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3431 )
3432)
3433
3434(conditional-int-logic-cc candcc and OP_5B OPE4_0 "conditional and, set icc")
3435(conditional-int-logic-cc corcc or OP_5B OPE4_1 "conditional or , set icc")
3436(conditional-int-logic-cc cxorcc xor OP_5B OPE4_2 "conditional xor, set icc")
3437
3438(define-pmacro (conditional-int-shift-cc name l-r op ope comment)
3439 (dni (.sym c name cc)
3440 (comment)
ac7c07ac 3441 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
3442 (.str (.sym c name cc) "$pack $GRi,$GRj,$GRk,$CCi,$cond")
3443 (+ pack GRk op GRi CCi cond ope GRj)
3444 (if (eq CCi (or cond 2))
3445 (int-shift-cc-semantics name l-r
3446 (reg h-iccr (and (index-of CCi) 3))))
3447 ((fr400 (unit u-integer))
ac7c07ac 3448 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3449 )
3450)
3451
3452(conditional-int-shift-cc sll left OP_5D OPE4_0 "shift left logical, set icc")
3453(conditional-int-shift-cc srl right OP_5D OPE4_1 "shift right logical, set icc")
3454(conditional-int-shift-cc sra right OP_5D OPE4_2 "shift right arith , set icc")
3455
3456; Add and subtract with carry
3457;
3458(define-pmacro (int-arith-x-r-r name operation op ope comment)
3459 (dni name
3460 (comment)
ac7c07ac 3461 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3462 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3463 (+ pack GRk op GRi ICCi_1 ope GRj)
3464 (set GRk ((.sym operation c) GRi GRj (cbit ICCi_1)))
3465 ((fr400 (unit u-integer))
ac7c07ac 3466 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3467 )
3468)
3469
3470(int-arith-x-r-r addx add OP_00 OPE2_02 "Add reg/reg, with carry")
3471(int-arith-x-r-r subx sub OP_00 OPE2_06 "Sub reg/reg, with carry")
3472
3473(define-pmacro (int-arith-x-cc-r-r name operation op ope comment)
3474 (dni name
3475 (comment)
ac7c07ac 3476 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3477 (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1")
3478 (+ pack GRk op GRi ICCi_1 ope GRj)
3479 (sequence ((WI tmp) (QI cc))
3480 (set cc ICCi_1)
3481 (set tmp ((.sym operation c) GRi GRj (cbit cc)))
3482 (set-v cc ((.sym operation -oflag) GRi GRj (cbit cc)))
3483 (set-c cc ((.sym operation -cflag) GRi GRj (cbit cc)))
3484 (set-z-and-n cc tmp)
3485 (set GRk tmp)
3486 (set ICCi_1 cc))
3487 ((fr400 (unit u-integer))
ac7c07ac 3488 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3489 )
3490)
3491
3492(int-arith-x-cc-r-r addxcc add OP_00 OPE2_03 "Add reg/reg, use/set carry")
3493(int-arith-x-cc-r-r subxcc sub OP_00 OPE2_07 "Sub reg/reg, use/set carry")
ac7c07ac
DB
3494; Add and subtract with saturation
3495;
3496(define-pmacro (int-arith-ss-r-r name operation op ope comment)
3497 (dni name
3498 (comment)
3499 ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400))
3500 (.str name "$pack $GRi,$GRj,$GRk")
3501 (+ pack GRk op GRi ope GRj)
3502 (sequence ()
3503 (set GRk (operation GRi GRj))
3504 (if ((.sym operation -oflag) GRi GRj (const 0))
3505 ; Overflow, saturate.
3506 ; Sign of result will be
3507 ; same as sign of first operand.
3508 (set GRk
3509 (cond SI
3510 ((gt GRi 0) (const #x7fffffff))
3511 ((lt GRi 0) (const #x80000000))
3512 (else (const 0)))))
3513 )
3514 ((fr400 (unit u-integer)))
3515 )
3516)
3517
3518(int-arith-ss-r-r addss add OP_46 OPE1_00 "add reg/reg, with saturation")
3519(int-arith-ss-r-r subss sub OP_46 OPE1_01 "sub reg/reg, with saturation")
9aab5aa3
AC
3520
3521; Format: INT, Logic, Shift r-simm
3522;
3523(define-pmacro (int-logic-r-simm name operation op comment)
3524 (dni name
3525 (comment)
ac7c07ac 3526 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3527 (.str name "$pack $GRi,$s12,$GRk")
3528 (+ pack GRk op GRi s12)
3529 (set GRk (operation GRi s12))
3530 ((fr400 (unit u-integer))
ac7c07ac 3531 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3532 )
3533)
3534
3535(int-logic-r-simm addi add OP_10 "add reg/immed")
3536(int-logic-r-simm subi sub OP_14 "sub reg/immed")
3537(int-logic-r-simm andi and OP_20 "and reg/immed")
3538(int-logic-r-simm ori or OP_22 "or reg/immed")
3539(int-logic-r-simm xori xor OP_24 "xor reg/immed")
3540
3541(dni sdivi
3542 "signed division reg/immed"
ac7c07ac 3543 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3544 "sdivi$pack $GRi,$s12,$GRk"
3545 (+ pack GRk OP_1E GRi s12)
3546 (sequence ()
3547 (c-call VOID "@cpu@_signed_integer_divide"
3548 GRi s12 (index-of GRk) 0)
3549 (clobber GRk))
3550 ((fr400 (unit u-idiv))
ac7c07ac 3551 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3552)
3553
3554(dni nsdivi
3555 "non excepting signed division reg/immed"
ac7c07ac
DB
3556 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3557 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3558 "nsdivi$pack $GRi,$s12,$GRk"
3559 (+ pack GRk OP_2E GRi s12)
3560 (sequence ()
3561 (c-call VOID "@cpu@_signed_integer_divide"
3562 GRi s12 (index-of GRk) 1)
3563 (clobber GRk))
3564 ((fr400 (unit u-idiv))
ac7c07ac 3565 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3566)
3567
3568(dni udivi
3569 "unsigned division reg/immed"
ac7c07ac 3570 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3571 "udivi$pack $GRi,$s12,$GRk"
3572 (+ pack GRk OP_1F GRi s12)
3573 (sequence ()
3574 (c-call VOID "@cpu@_unsigned_integer_divide"
3575 GRi s12 (index-of GRk) 0)
3576 (clobber GRk))
3577 ((fr400 (unit u-idiv))
ac7c07ac 3578 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3579)
3580
3581(dni nudivi
3582 "non excepting unsigned division reg/immed"
ac7c07ac
DB
3583 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING
3584 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3585 "nudivi$pack $GRi,$s12,$GRk"
3586 (+ pack GRk OP_2F GRi s12)
3587 (sequence ()
3588 (c-call VOID "@cpu@_unsigned_integer_divide"
3589 GRi s12 (index-of GRk) 1)
3590 (clobber GRk))
3591 ((fr400 (unit u-idiv))
ac7c07ac 3592 (fr500 (unit u-idiv)) (fr550 (unit u-idiv)))
9aab5aa3
AC
3593)
3594
3595(define-pmacro (multiply-r-simm name signop op comment)
3596 (dni name
3597 (comment)
ac7c07ac 3598 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3599 (.str name "$pack $GRi,$s12,$GRdoublek")
3600 (+ pack GRdoublek op GRi s12)
3601 (set GRdoublek (mul DI (signop DI GRi) (signop DI s12)))
3602 ((fr400 (unit u-imul))
ac7c07ac 3603 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3604 )
3605)
3606
3607(multiply-r-simm smuli ext OP_18 "signed multiply reg/immed")
3608(multiply-r-simm umuli zext OP_1A "unsigned multiply reg/immed")
3609
3610(define-pmacro (int-shift-r-simm name op comment)
3611 (dni (.sym name i)
3612 (comment)
ac7c07ac 3613 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3614 (.str (.sym name i) "$pack $GRi,$s12,$GRk")
3615 (+ pack GRk op GRi s12)
3616 (set GRk (name GRi (and s12 #x1f)))
3617 ((fr400 (unit u-integer))
ac7c07ac 3618 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3619 )
3620)
3621
3622(int-shift-r-simm sll OP_28 "shift left logical reg/immed")
3623(int-shift-r-simm srl OP_2A "shift right logical reg/immed")
3624(int-shift-r-simm sra OP_2C "shift right arith reg/immed")
3625
3626(dni scani
3627 "scan immediate"
ac7c07ac 3628 ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3629 "scani$pack $GRi,$s12,$GRk"
3630 (+ pack GRk OP_47 GRi s12)
3631 (scan-semantics GRi s12 GRk)
3632 ((fr400 (unit u-integer))
ac7c07ac 3633 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3634)
3635
3636; Format: INT, Logic, Shift cc r-simm
3637;
3638(define-pmacro (int-arith-cc-r-simm name operation op comment)
3639 (dni name
3640 (comment)
ac7c07ac 3641 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3642 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3643 (+ pack GRk op GRi ICCi_1 s10)
3644 (sequence ((BI tmp) (QI cc) (SI result))
3645 (set cc ICCi_1)
3646 (set tmp ((.sym operation -oflag) GRi s10 (const 0)))
3647 (set-v cc tmp)
3648 (set tmp ((.sym operation -cflag) GRi s10 (const 0)))
3649 (set-c cc tmp)
3650 (set result (operation GRi s10))
3651 (set-z-and-n cc result)
3652 (set GRk result)
3653 (set ICCi_1 cc))
3654 ((fr400 (unit u-integer))
ac7c07ac 3655 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3656 )
3657)
3658
3659(int-arith-cc-r-simm addicc add OP_11 "add reg/immed, set icc")
3660(int-arith-cc-r-simm subicc sub OP_15 "sub reg/immed, set icc")
3661
3662(define-pmacro (int-logic-cc-r-simm name op comment)
3663 (dni (.sym name icc)
3664 (comment)
ac7c07ac 3665 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3666 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3667 (+ pack GRk op GRi ICCi_1 s10)
3668 (sequence ((SI tmp))
3669 (set tmp (name GRi s10))
3670 (set GRk tmp)
3671 (set-z-and-n ICCi_1 tmp))
3672 ((fr400 (unit u-integer))
ac7c07ac 3673 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3674 )
3675)
3676
3677(int-logic-cc-r-simm and OP_21 "and reg/immed, set icc")
3678(int-logic-cc-r-simm or OP_23 "or reg/immed, set icc")
3679(int-logic-cc-r-simm xor OP_25 "xor reg/immed, set icc")
3680
3681(define-pmacro (multiply-cc-r-simm name signop op comment)
3682 (dni name
3683 (comment)
ac7c07ac 3684 ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1))
9aab5aa3
AC
3685 (.str name "$pack $GRi,$s10,$GRdoublek,$ICCi_1")
3686 (+ pack GRdoublek op GRi ICCi_1 s10)
3687 (multiply-cc-semantics signop GRi s10 GRdoublek ICCi_1)
3688 ((fr400 (unit u-imul))
ac7c07ac 3689 (fr500 (unit u-imul)) (fr550 (unit u-imul)))
9aab5aa3
AC
3690 )
3691)
3692
3693(multiply-cc-r-simm smulicc ext OP_19 "signed multiply reg/immed")
3694(multiply-cc-r-simm umulicc zext OP_1B "unsigned multiply reg/immed")
3695
3696(define-pmacro (int-shift-cc-r-simm name l-r op comment)
3697 (dni (.sym name icc)
3698 (comment)
ac7c07ac 3699 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3700 (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1")
3701 (+ pack GRk op GRi ICCi_1 s10)
3702 (sequence ((WI shift) (SI tmp) (QI cc))
3703 (set shift (and s10 #x1f))
3704 (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r)
3705 GRi shift ICCi_1))
3706 (set tmp (name GRi shift))
3707 (set GRk tmp)
3708 (set-z-and-n cc tmp)
3709 (set ICCi_1 cc))
3710 ((fr400 (unit u-integer))
ac7c07ac 3711 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3712 )
3713)
3714
3715(int-shift-cc-r-simm sll left OP_29 "shift left logical reg/immed, set icc")
3716(int-shift-cc-r-simm srl right OP_2B "shift right logical reg/immed, set icc")
3717(int-shift-cc-r-simm sra right OP_2D "shift right arith reg/immed, set icc")
3718
3719(define-pmacro (int-arith-x-r-simm name operation op comment)
3720 (dni name
3721 (comment)
ac7c07ac 3722 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3723 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3724 (+ pack GRk op GRi ICCi_1 s10)
3725 (set GRk ((.sym operation c) GRi s10 (cbit ICCi_1)))
3726 ((fr400 (unit u-integer))
ac7c07ac 3727 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3728 )
3729)
3730
3731(int-arith-x-r-simm addxi add OP_12 "Add reg/immed, with carry")
3732(int-arith-x-r-simm subxi sub OP_16 "Sub reg/immed, with carry")
3733
3734(define-pmacro (int-arith-x-cc-r-simm name operation op comment)
3735 (dni name
3736 (comment)
ac7c07ac 3737 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3738 (.str name "$pack $GRi,$s10,$GRk,$ICCi_1")
3739 (+ pack GRk op GRi ICCi_1 s10)
3740 (sequence ((WI tmp) (QI cc))
3741 (set cc ICCi_1)
3742 (set tmp ((.sym operation c) GRi s10 (cbit cc)))
3743 (set-v cc ((.sym operation -oflag) GRi s10 (cbit cc)))
3744 (set-c cc ((.sym operation -cflag) GRi s10 (cbit cc)))
3745 (set-z-and-n cc tmp)
3746 (set GRk tmp)
3747 (set ICCi_1 cc))
3748 ((fr400 (unit u-integer))
ac7c07ac 3749 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3750 )
3751)
3752
3753(int-arith-x-cc-r-simm addxicc add OP_13 "Add reg/immed, with carry")
3754(int-arith-x-cc-r-simm subxicc sub OP_17 "Sub reg/immed, with carry")
3755
3756; Byte compare insns
3757
3758(dni cmpb
3759 "Compare bytes"
ac7c07ac 3760 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
9aab5aa3
AC
3761 "cmpb$pack $GRi,$GRj,$ICCi_1"
3762 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj)
3763 (sequence ((QI cc))
3764 (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000)))
3765 (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000)))
3766 (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00)))
3767 (set-c cc (eq (and GRi #x000000ff) (and GRj #x000000ff)))
3768 (set ICCi_1 cc))
ac7c07ac 3769 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3770)
3771
3772(dni cmpba
3773 "OR of Compare bytes"
ac7c07ac 3774 ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550))
9aab5aa3
AC
3775 "cmpba$pack $GRi,$GRj,$ICCi_1"
3776 (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0D GRj)
3777 (sequence ((QI cc))
3778 (set cc 0)
3779 (set-c cc
3780 (orif (eq (and GRi #xff000000) (and GRj #xff000000))
3781 (orif (eq (and GRi #x00ff0000) (and GRj #x00ff0000))
3782 (orif (eq (and GRi #x0000ff00)
3783 (and GRj #x0000ff00))
3784 (eq (and GRi #x000000ff)
3785 (and GRj #x000000ff))))))
3786 (set ICCi_1 cc))
ac7c07ac 3787 ((fr400 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3788)
3789
3790; Format: Load immediate
3791;
3792(dni setlo
3793 "set low order bits"
ac7c07ac 3794 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3795 "setlo$pack $ulo16,$GRklo"
3796 (+ pack GRk OP_3D (misc-null-4) u16)
3797 (set GRklo u16)
3798 ((fr400 (unit u-set-hilo))
ac7c07ac 3799 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
9aab5aa3
AC
3800)
3801
3802(dni sethi
3803 "set high order bits"
ac7c07ac 3804 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3805 "sethi$pack $uhi16,$GRkhi"
3806 (+ pack GRkhi OP_3E (misc-null-4) u16)
3807 (set GRkhi u16)
3808 ((fr400 (unit u-set-hilo))
ac7c07ac 3809 (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo)))
9aab5aa3
AC
3810)
3811
3812(dni setlos
3813 "set low order bits and extend sign"
ac7c07ac 3814 ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
3815 "setlos$pack $slo16,$GRk"
3816 (+ pack GRk OP_3F (misc-null-4) s16)
3817 (set GRk s16)
3818 ((fr400 (unit u-integer))
ac7c07ac 3819 (fr500 (unit u-integer)) (fr550 (unit u-integer)))
9aab5aa3
AC
3820)
3821
3822(define-pmacro (load-gr-r name mode op ope comment)
3823 (dni name
3824 (comment)
ac7c07ac 3825 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
9aab5aa3
AC
3826 (.str name "$pack @($GRi,$GRj),$GRk")
3827 (+ pack GRk op GRi ope GRj)
3828 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3829 ((fr400 (unit u-gr-load))
ac7c07ac 3830 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
3831 )
3832)
3833
3834(load-gr-r ldsb QI OP_02 OPE1_00 "Load signed byte")
3835(load-gr-r ldub UQI OP_02 OPE1_01 "Load unsigned byte")
3836(load-gr-r ldsh HI OP_02 OPE1_02 "Load signed half")
3837(load-gr-r lduh UHI OP_02 OPE1_03 "Load unsigned half")
3838(load-gr-r ld SI OP_02 OPE1_04 "Load word")
3839
3840(define-pmacro (load-fr-r name mode op ope comment)
3841 (dni name
3842 (comment)
ac7c07ac 3843 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
9aab5aa3
AC
3844 (.str name "$pack @($GRi,$GRj),$FRintk")
3845 (+ pack FRintk op GRi ope GRj)
3846 (set FRintk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3847 ((fr400 (unit u-fr-load))
ac7c07ac 3848 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
3849 )
3850)
3851
3852(load-fr-r ldbf UQI OP_02 OPE1_08 "Load byte float")
3853(load-fr-r ldhf UHI OP_02 OPE1_09 "Load half float")
3854(load-fr-r ldf SI OP_02 OPE1_0A "Load word float")
3855
3856(define-pmacro (load-cpr-r name mode op ope reg attr comment)
3857 (dni name
3858 (comment)
3859 ((UNIT LOAD) (FR500-MAJOR I-2) attr)
3860 (.str name "$pack @($GRi,$GRj),$" reg "k")
3861 (+ pack (.sym reg k) op GRi ope GRj)
3862 (set (.sym reg k)
3863 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))
3864 ()
3865 )
3866)
3867
3868(load-cpr-r ldc SI OP_02 OPE1_0D CPR (MACH frv) "Load coprocessor word")
3869
3870; These correspond to enumerators in frv-sim.h
3871(define-pmacro (ne-UQI-size) 0)
3872(define-pmacro (ne-QI-size) 1)
3873(define-pmacro (ne-UHI-size) 2)
3874(define-pmacro (ne-HI-size) 3)
3875(define-pmacro (ne-SI-size) 4)
3876(define-pmacro (ne-DI-size) 5)
3877(define-pmacro (ne-XI-size) 6)
3878
3879(define-pmacro (ne-load-semantics base dispix targ idisp size is_float action)
3880 (sequence ((BI do_op))
3881 (set do_op
3882 (c-call BI "@cpu@_check_non_excepting_load"
3883 (index-of base) dispix (index-of targ)
3884 idisp size is_float))
3885 (if do_op action))
3886)
3887
3888(define-pmacro (ne-load-gr-r name mode op ope size comment)
3889 (dni name
3890 (comment)
ac7c07ac
DB
3891 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
3892 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3893 (.str name "$pack @($GRi,$GRj),$GRk")
3894 (+ pack GRk op GRi ope GRj)
3895 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
3896 (set GRk
3897 (c-call mode (.str "@cpu@_read_mem_" mode)
3898 pc (add GRi GRj))))
ac7c07ac 3899 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
3900 )
3901)
3902
3903(ne-load-gr-r nldsb QI OP_02 OPE1_20 (ne-QI-size) "Load signed byte")
3904(ne-load-gr-r nldub UQI OP_02 OPE1_21 (ne-UQI-size) "Load unsigned byte")
3905(ne-load-gr-r nldsh HI OP_02 OPE1_22 (ne-HI-size) "Load signed half")
3906(ne-load-gr-r nlduh UHI OP_02 OPE1_23 (ne-UHI-size) "Load unsigned half")
3907(ne-load-gr-r nld SI OP_02 OPE1_24 (ne-SI-size) "Load word")
3908
3909(define-pmacro (ne-load-fr-r name mode op ope size comment)
3910 (dni name
3911 (comment)
ac7c07ac
DB
3912 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
3913 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3914 (.str name "$pack @($GRi,$GRj),$FRintk")
3915 (+ pack FRintk op GRi ope GRj)
3916 (ne-load-semantics GRi (index-of GRj) FRintk 0 size 1
3917 (set FRintk
3918 (c-call mode (.str "@cpu@_read_mem_" mode)
3919 pc (add GRi GRj))))
ac7c07ac 3920 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
3921 )
3922)
3923
3924(ne-load-fr-r nldbf UQI OP_02 OPE1_28 (ne-UQI-size) "Load byte float")
3925(ne-load-fr-r nldhf UHI OP_02 OPE1_29 (ne-UHI-size) "Load half float")
3926(ne-load-fr-r nldf SI OP_02 OPE1_2A (ne-SI-size) "Load word float")
3927
3928; Semantics for a load-double insn
3929;
3930(define-pmacro (load-double-semantics not_gr mode regtype address arg)
3931 (if (orif not_gr (ne (index-of (.sym regtype doublek)) 0))
3932 (sequence ()
3933 (set address (add GRi arg))
3934 (set (.sym regtype doublek)
3935 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))))
3936)
3937
3938(define-pmacro (load-double-r-r
3939 name not_gr mode op ope regtype attr profile comment)
3940 (dni name
3941 (comment)
ac7c07ac 3942 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
9aab5aa3
AC
3943 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3944 (+ pack (.sym regtype doublek) op GRi ope GRj)
3945 (sequence ((WI address))
3946 (load-double-semantics not_gr mode regtype address GRj))
3947 profile
3948 )
3949)
3950
3951(load-double-r-r ldd 0 DI OP_02 OPE1_05 GR NA
ac7c07ac 3952 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
3953 "Load double word")
3954(load-double-r-r lddf 1 DF OP_02 OPE1_0B FR FR-ACCESS
ac7c07ac 3955 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
3956 "Load double float")
3957(load-double-r-r lddc 1 DI OP_02 OPE1_0E CPR (MACH frv) ()
3958 "Load coprocessor double")
3959
3960(define-pmacro (ne-load-double-r-r
3961 name not_gr mode op ope regtype size is_float attr profile
3962 comment)
3963 (dni name
3964 (comment)
ac7c07ac
DB
3965 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
3966 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
3967 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
3968 (+ pack (.sym regtype doublek) op GRi ope GRj)
3969 (sequence ((WI address))
3970 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek)
3971 0 size is_float
3972 (load-double-semantics not_gr mode
3973 regtype
3974 address GRj)))
3975 profile
3976 )
3977)
3978
3979(ne-load-double-r-r nldd 0 DI OP_02 OPE1_25 GR (ne-DI-size) 0 NA
ac7c07ac 3980 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
9aab5aa3 3981(ne-load-double-r-r nlddf 1 DF OP_02 OPE1_2B FR (ne-DI-size) 1 FR-ACCESS
ac7c07ac 3982 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
9aab5aa3
AC
3983
3984; Semantics for a load-quad insn
3985;
3986(define-pmacro (load-quad-semantics regtype address arg)
3987 (sequence ()
3988 (set address (add GRi arg))
3989 (c-call VOID (.str "@cpu@_load_quad_" regtype)
3990 pc address (index-of (.sym regtype k))))
3991)
3992
3993(define-pmacro (load-quad-r-r name op ope regtype attr profile comment)
3994 (dni name
3995 (comment)
3996 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
3997 (.str name "$pack @($GRi,$GRj),$" regtype "k")
3998 (+ pack (.sym regtype k) op GRi ope GRj)
3999 (sequence ((WI address))
4000 (load-quad-semantics regtype address GRj))
4001 ; TODO regtype-k not referenced for profiling
4002 profile
4003 )
4004)
4005
4006(load-quad-r-r ldq OP_02 OPE1_06 GR NA ((fr500 (unit u-gr-load)))
4007 "Load quad word")
4008(load-quad-r-r ldqf OP_02 OPE1_0C FRint FR-ACCESS ((fr500 (unit u-fr-load)))
4009 "Load quad float")
4010(load-quad-r-r ldqc OP_02 OPE1_0F CPR NA () "Load coprocessor quad")
4011
4012(define-pmacro (ne-load-quad-r-r
4013 name op ope regtype size is_float attr profile comment)
4014 (dni name
4015 (comment)
4016 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4017 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4018 (+ pack (.sym regtype k) op GRi ope GRj)
4019 (sequence ((WI address))
4020 (ne-load-semantics GRi (index-of GRj) (.sym regtype k)
4021 0 size is_float
4022 (load-quad-semantics regtype address GRj)))
4023 ; TODO regtype-k not referenced for profiling
4024 profile
4025 )
4026)
4027
4028(ne-load-quad-r-r nldq OP_02 OPE1_26 GR (ne-XI-size) 0 NA
4029 ((fr500 (unit u-gr-load))) "Load quad word")
4030(ne-load-quad-r-r nldqf OP_02 OPE1_2C FRint (ne-XI-size) 1 FR-ACCESS
4031 ((fr500 (unit u-fr-load))) "Load quad float")
4032
4033(define-pmacro (load-gr-u-semantics mode)
4034 (sequence ((UWI address))
4035 (set address (add GRi GRj))
4036 (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4037 (if (ne (index-of GRi) (index-of GRk))
4038 (sequence ()
4039 (set GRi address)
4040 (c-call VOID "@cpu@_force_update"))))
4041)
4042
4043(define-pmacro (load-gr-u name mode op ope comment)
4044 (dni name
4045 (comment)
ac7c07ac 4046 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
9aab5aa3
AC
4047 (.str name "$pack @($GRi,$GRj),$GRk")
4048 (+ pack GRk op GRi ope GRj)
4049 (load-gr-u-semantics mode)
4050 ((fr400 (unit u-gr-load))
ac7c07ac 4051 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4052 )
4053)
4054
4055(load-gr-u ldsbu QI OP_02 OPE1_10 "Load signed byte, update index")
4056(load-gr-u ldubu UQI OP_02 OPE1_11 "Load unsigned byte, update index")
4057(load-gr-u ldshu HI OP_02 OPE1_12 "Load signed half, update index")
4058(load-gr-u lduhu UHI OP_02 OPE1_13 "Load unsigned half, update index")
4059(load-gr-u ldu SI OP_02 OPE1_14 "Load word, update index")
4060
4061(define-pmacro (ne-load-gr-u name mode op ope size comment)
4062 (dni name
4063 (comment)
ac7c07ac
DB
4064 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4065 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4066 (.str name "$pack @($GRi,$GRj),$GRk")
4067 (+ pack GRk op GRi ope GRj)
4068 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 (load-gr-u-semantics mode))
ac7c07ac 4069 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4070 )
4071)
4072
4073(ne-load-gr-u nldsbu QI OP_02 OPE1_30 (ne-QI-size) "Load signed byte, update index")
4074(ne-load-gr-u nldubu UQI OP_02 OPE1_31 (ne-UQI-size) "Load unsigned byte, update index")
4075(ne-load-gr-u nldshu HI OP_02 OPE1_32 (ne-HI-size) "Load signed half, update index")
4076(ne-load-gr-u nlduhu UHI OP_02 OPE1_33 (ne-UHI-size) "Load unsigned half, update index")
4077(ne-load-gr-u nldu SI OP_02 OPE1_34 (ne-SI-size) "Load word, update index")
4078
4079(define-pmacro (load-non-gr-u-semantics mode regtype)
4080 (sequence ((UWI address))
4081 (set address (add GRi GRj))
4082 (set (.sym regtype k)
4083 (c-call mode (.str "@cpu@_read_mem_" mode) pc address))
4084 (set GRi address)
4085 (c-call VOID "@cpu@_force_update"))
4086)
4087
4088(define-pmacro (load-fr-u name mode op ope comment)
4089 (dni name
4090 (comment)
ac7c07ac 4091 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS)
9aab5aa3
AC
4092 (.str name "$pack @($GRi,$GRj),$FRintk")
4093 (+ pack FRintk op GRi ope GRj)
4094 (load-non-gr-u-semantics mode FRint)
4095 ((fr400 (unit u-fr-load))
ac7c07ac 4096 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4097 )
4098)
4099
4100(load-fr-u ldbfu UQI OP_02 OPE1_18 "Load byte float, update index")
4101(load-fr-u ldhfu UHI OP_02 OPE1_19 "Load half float, update index")
4102(load-fr-u ldfu SI OP_02 OPE1_1A "Load word float, update index")
4103
4104(define-pmacro (load-cpr-u name mode op ope comment)
4105 (dni name
4106 (comment)
4107 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4108 (.str name "$pack @($GRi,$GRj),$CPRk")
4109 (+ pack CPRk op GRi ope GRj)
4110 (load-non-gr-u-semantics mode CPR)
4111 ()
4112 )
4113)
4114
4115(load-cpr-u ldcu SI OP_02 OPE1_1D "Load coprocessor word float,update index")
4116
4117(define-pmacro (ne-load-non-gr-u name mode op ope regtype size comment)
4118 (dni name
4119 (comment)
ac7c07ac
DB
4120 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4121 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4122 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4123 (+ pack (.sym regtype k) op GRi ope GRj)
4124 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4125 (load-non-gr-u-semantics mode regtype))
ac7c07ac 4126 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4127 )
4128)
4129
4130(ne-load-non-gr-u nldbfu UQI OP_02 OPE1_38 FRint (ne-UQI-size) "Load byte float, update index")
4131(ne-load-non-gr-u nldhfu UHI OP_02 OPE1_39 FRint (ne-UHI-size) "Load half float, update index")
4132(ne-load-non-gr-u nldfu SI OP_02 OPE1_3A FRint (ne-SI-size) "Load word float, update index")
4133
4134(define-pmacro (load-double-gr-u-semantics)
4135 (sequence ((WI address))
4136 (load-double-semantics 0 DI GR address GRj)
4137 (if (ne (index-of GRi) (index-of GRdoublek))
4138 (sequence ()
4139 (set GRi address)
4140 (c-call VOID "@cpu@_force_update"))))
4141)
4142
4143(define-pmacro (load-double-gr-u name op ope comment)
4144 (dni name
4145 (comment)
ac7c07ac 4146 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2))
9aab5aa3
AC
4147 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4148 (+ pack GRdoublek op GRi ope GRj)
4149 (load-double-gr-u-semantics)
4150 ((fr400 (unit u-gr-load))
ac7c07ac 4151 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4152 )
4153)
4154
4155(load-double-gr-u lddu OP_02 OPE1_15 "Load double word, update index")
4156
4157(define-pmacro (ne-load-double-gr-u name op ope size comment)
4158 (dni name
4159 (comment)
ac7c07ac
DB
4160 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING
4161 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4162 (.str name "$pack @($GRi,$GRj),$GRdoublek")
4163 (+ pack GRdoublek op GRi ope GRj)
4164 (ne-load-semantics GRi (index-of GRj) GRdoublek 0 size 0
4165 (load-double-gr-u-semantics))
ac7c07ac 4166 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4167
4168 )
4169)
4170
4171(ne-load-double-gr-u nlddu OP_02 OPE1_35 (ne-DI-size) "Load double word, update index")
4172
4173(define-pmacro (load-double-non-gr-u-semantics mode regtype)
4174 (sequence ((WI address))
4175 (load-double-semantics 1 mode regtype address GRj)
4176 (set GRi address)
4177 (c-call VOID "@cpu@_force_update"))
4178)
4179
4180(define-pmacro (load-double-non-gr-u
4181 name mode op ope regtype attr profile comment)
4182 (dni name
4183 (comment)
ac7c07ac 4184 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
9aab5aa3
AC
4185 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4186 (+ pack (.sym regtype doublek) op GRi ope GRj)
4187 (load-double-non-gr-u-semantics mode regtype)
4188 profile
4189 )
4190)
4191
4192(load-double-non-gr-u lddfu DF OP_02 OPE1_1B FR FR-ACCESS
ac7c07ac 4193 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4194 "Load double float, update index")
4195(load-double-non-gr-u lddcu DI OP_02 OPE1_1E CPR (MACH frv)
4196 () "Load coprocessor double float, update index")
4197
4198(define-pmacro (ne-load-double-non-gr-u name mode op ope regtype size comment)
4199 (dni name
4200 (comment)
ac7c07ac
DB
4201 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS
4202 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4203 (.str name "$pack @($GRi,$GRj),$" regtype "doublek")
4204 (+ pack (.sym regtype doublek) op GRi ope GRj)
4205 (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) 0 size 1
4206 (load-double-non-gr-u-semantics mode regtype))
ac7c07ac 4207 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4208 )
4209)
4210
4211(ne-load-double-non-gr-u nlddfu DF OP_02 OPE1_3B FR (ne-DI-size) "Load double float, update index")
4212
4213(define-pmacro (load-quad-gr-u-semantics)
4214 (sequence ((WI address))
4215 (load-quad-semantics GR address GRj)
4216 (if (ne (index-of GRi) (index-of GRk))
4217 (sequence ()
4218 (set GRi address)
4219 (c-call VOID "@cpu@_force_update"))))
4220)
4221
4222(define-pmacro (load-quad-gr-u name op ope comment)
4223 (dni name
4224 (comment)
4225 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv))
4226 (.str name "$pack @($GRi,$GRj),$GRk")
4227 (+ pack GRk op GRi ope GRj)
4228 (load-quad-gr-u-semantics)
4229 ; TODO - GRk not referenced here for profiling
4230 ((fr500 (unit u-gr-load)))
4231 )
4232)
4233
4234(load-quad-gr-u ldqu OP_02 OPE1_16 "Load quad word, update index")
4235
4236(define-pmacro (ne-load-quad-gr-u name op ope size comment)
4237 (dni name
4238 (comment)
4239 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING)
4240 (.str name "$pack @($GRi,$GRj),$GRk")
4241 (+ pack GRk op GRi ope GRj)
4242 (ne-load-semantics GRi (index-of GRj) GRk 0 size 0
4243 (load-quad-gr-u-semantics))
4244 ; TODO - GRk not referenced here for profiling
4245 ((fr500 (unit u-gr-load)))
4246 )
4247)
4248
4249(ne-load-quad-gr-u nldqu OP_02 OPE1_36 (ne-XI-size) "Load quad word, update index")
4250
4251(define-pmacro (load-quad-non-gr-u-semantics regtype)
4252 (sequence ((WI address))
4253 (load-quad-semantics regtype address GRj)
4254 (set GRi address)
4255 (c-call VOID "@cpu@_force_update"))
4256)
4257
4258(define-pmacro (load-quad-non-gr-u name op ope regtype attr profile comment)
4259 (dni name
4260 (comment)
4261 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4262 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4263 (+ pack (.sym regtype k) op GRi ope GRj)
4264 (load-quad-non-gr-u-semantics regtype)
4265 profile
4266 )
4267)
4268
4269(load-quad-non-gr-u ldqfu OP_02 OPE1_1C FRint FR-ACCESS
4270 ((fr500 (unit u-fr-load))) "Load quad float, update index")
4271(load-quad-non-gr-u ldqcu OP_02 OPE1_1F CPR NA
4272 () "Load coprocessor quad word, update index")
4273
4274(define-pmacro (ne-load-quad-non-gr-u name op ope regtype size comment)
4275 (dni name
4276 (comment)
4277 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING FR-ACCESS)
4278 (.str name "$pack @($GRi,$GRj),$" regtype "k")
4279 (+ pack (.sym regtype k) op GRi ope GRj)
4280 (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1
4281 (load-quad-non-gr-u-semantics regtype))
4282 ((fr500 (unit u-fr-load)))
4283 )
4284)
4285
4286(ne-load-quad-non-gr-u nldqfu OP_02 OPE1_3C FRint (ne-XI-size) "Load quad float,update index")
4287
4288(define-pmacro (load-r-simm name mode op regtype attr profile comment)
4289 (dni name
4290 (comment)
ac7c07ac 4291 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
9aab5aa3
AC
4292 (.str name "$pack @($GRi,$d12),$" regtype "k")
4293 (+ pack (.sym regtype k) op GRi d12)
4294 (set (.sym regtype k)
4295 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi d12)))
4296 profile
4297 )
4298)
4299
4300(load-r-simm ldsbi QI OP_30 GR NA
ac7c07ac 4301 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4302 "Load signed byte")
4303(load-r-simm ldshi HI OP_31 GR NA
ac7c07ac 4304 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4305 "Load signed half")
4306(load-r-simm ldi SI OP_32 GR NA
ac7c07ac 4307 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4308 "Load word")
4309(load-r-simm ldubi UQI OP_35 GR NA
ac7c07ac 4310 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4311 "Load unsigned byte")
4312(load-r-simm lduhi UHI OP_36 GR NA
ac7c07ac 4313 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4314 "Load unsigned half")
4315
4316(load-r-simm ldbfi UQI OP_38 FRint FR-ACCESS
ac7c07ac 4317 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4318 "Load byte float")
4319(load-r-simm ldhfi UHI OP_39 FRint FR-ACCESS
ac7c07ac 4320 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4321 "Load half float")
4322(load-r-simm ldfi SI OP_3A FRint FR-ACCESS
ac7c07ac 4323 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4324 "Load word float")
4325
4326(define-pmacro (ne-load-r-simm
4327 name mode op regtype size is_float attr profile comment)
4328 (dni name
4329 (comment)
ac7c07ac
DB
4330 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4331 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4332 (.str name "$pack @($GRi,$d12),$" regtype "k")
4333 (+ pack (.sym regtype k) op GRi d12)
4334 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4335 (set (.sym regtype k)
4336 (c-call mode (.str "@cpu@_read_mem_" mode)
4337 pc (add GRi d12))))
4338 profile
4339 )
4340)
4341
4342(ne-load-r-simm nldsbi QI OP_40 GR (ne-QI-size) 0 NA
ac7c07ac 4343 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed byte")
9aab5aa3 4344(ne-load-r-simm nldubi UQI OP_41 GR (ne-UQI-size) 0 NA
ac7c07ac 4345 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned byte")
9aab5aa3 4346(ne-load-r-simm nldshi HI OP_42 GR (ne-HI-size) 0 NA
ac7c07ac 4347 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed half")
9aab5aa3 4348(ne-load-r-simm nlduhi UHI OP_43 GR (ne-UHI-size) 0 NA
ac7c07ac 4349 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned half")
9aab5aa3 4350(ne-load-r-simm nldi SI OP_44 GR (ne-SI-size) 0 NA
ac7c07ac 4351 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load word")
9aab5aa3
AC
4352
4353(ne-load-r-simm nldbfi UQI OP_48 FRint (ne-UQI-size) 1 FR-ACCESS
ac7c07ac 4354 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load byte float")
9aab5aa3 4355(ne-load-r-simm nldhfi UHI OP_49 FRint (ne-UHI-size) 1 FR-ACCESS
ac7c07ac 4356 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load half float")
9aab5aa3 4357(ne-load-r-simm nldfi SI OP_4A FRint (ne-SI-size) 1 FR-ACCESS
ac7c07ac 4358 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load word float")
9aab5aa3
AC
4359
4360(define-pmacro (load-double-r-simm
4361 name not_gr mode op regtype attr profile comment)
4362 (dni name
4363 (comment)
ac7c07ac 4364 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr)
9aab5aa3
AC
4365 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4366 (+ pack (.sym regtype doublek) op GRi d12)
4367 (sequence ((WI address))
4368 (load-double-semantics not_gr mode regtype address d12))
4369 profile
4370 )
4371)
4372
4373(load-double-r-simm lddi 0 DI OP_33 GR NA
ac7c07ac 4374 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4375 "Load double word")
4376(load-double-r-simm lddfi 1 DF OP_3B FR FR-ACCESS
ac7c07ac 4377 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4378 "Load double float")
4379
4380(define-pmacro (ne-load-double-r-simm
4381 name not_gr mode op regtype size is_float attr profile comment)
4382 (dni name
4383 (comment)
ac7c07ac
DB
4384 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr
4385 (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
4386 (.str name "$pack @($GRi,$d12),$" regtype "doublek")
4387 (+ pack (.sym regtype doublek) op GRi d12)
4388 (sequence ((WI address))
4389 (ne-load-semantics GRi -1 (.sym regtype doublek)
4390 d12 size is_float
4391 (load-double-semantics not_gr mode
4392 regtype
4393 address d12)))
4394 profile
4395 )
4396)
4397
4398(ne-load-double-r-simm nlddi 0 DI OP_45 GR (ne-DI-size) 0 NA
ac7c07ac 4399 ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word")
9aab5aa3 4400(ne-load-double-r-simm nlddfi 1 DF OP_4B FR (ne-DI-size) 1 FR-ACCESS
ac7c07ac 4401 ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float")
9aab5aa3
AC
4402
4403(define-pmacro (load-quad-r-simm name op regtype attr profile comment)
4404 (dni name
4405 (comment)
4406 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr)
4407 (.str name "$pack @($GRi,$d12),$" regtype "k")
4408 (+ pack (.sym regtype k) op GRi d12)
4409 (sequence ((WI address))
4410 (load-quad-semantics regtype address d12))
4411 profile
4412 )
4413)
4414
4415(load-quad-r-simm ldqi OP_34 GR NA
4416 ((fr500 (unit u-gr-load))) "Load quad word")
4417(load-quad-r-simm ldqfi OP_3C FRint FR-ACCESS
4418 ((fr500 (unit u-fr-load))) "Load quad float")
4419
4420(define-pmacro (ne-load-quad-r-simm
4421 name op regtype size is_float attr profile comment)
4422 (dni name
4423 (comment)
4424 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr)
4425 (.str name "$pack @($GRi,$d12),$" regtype "k")
4426 (+ pack (.sym regtype k) op GRi d12)
4427 (sequence ((WI address))
4428 (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float
4429 (load-quad-semantics regtype address d12)))
4430 profile
4431 )
4432)
4433
9aab5aa3
AC
4434(ne-load-quad-r-simm nldqfi OP_4C FRint (ne-XI-size) 1 FR-ACCESS
4435 ((fr500 (unit u-fr-load))) "Load quad float")
4436
4437(define-pmacro (store-r-r name mode op ope reg attr profile comment)
4438 (dni name
4439 (comment)
ac7c07ac 4440 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
9aab5aa3
AC
4441 (.str name "$pack $" reg "k,@($GRi,$GRj)")
4442 (+ pack (.sym reg k) op GRi ope GRj)
4443 (c-call VOID (.str "@cpu@_write_mem_" mode)
4444 pc (add GRi GRj) (.sym reg k))
4445 profile
4446 )
4447)
4448
4449(store-r-r stb QI OP_03 OPE1_00 GR NA
ac7c07ac 4450 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4451 "Store unsigned byte")
4452(store-r-r sth HI OP_03 OPE1_01 GR NA
ac7c07ac 4453 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4454 "Store unsigned half")
4455(store-r-r st SI OP_03 OPE1_02 GR NA
ac7c07ac 4456 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4457 "Store word")
4458
4459(store-r-r stbf QI OP_03 OPE1_08 FRint FR-ACCESS
ac7c07ac 4460 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4461 "Store byte float")
4462(store-r-r sthf HI OP_03 OPE1_09 FRint FR-ACCESS
ac7c07ac 4463 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4464 "Store half float")
4465(store-r-r stf SI OP_03 OPE1_0A FRint FR-ACCESS
ac7c07ac 4466 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4467 "Store word float")
4468
4469(store-r-r stc SI OP_03 OPE1_25 CPR (MACH frv) () "Store coprocessor word")
4470
4471(define-pmacro (r-store name mode op ope reg size is_float profile comment)
4472 (dni name
4473 (comment)
8caa9169 4474 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv))
9aab5aa3
AC
4475 (.str name "$pack $" reg "k,@($GRi,$GRj)")
4476 (+ pack (.sym reg k) op GRi ope GRj)
4477 (sequence ((WI address))
4478 (set address (add GRi GRj))
4479 (c-call VOID (.str "@cpu@_write_mem_" mode)
4480 pc address (.sym reg k))
4481 (c-call VOID "@cpu@_check_recovering_store"
4482 address (index-of (.sym reg k)) size is_float))
4483 profile
4484 )
4485)
4486
4487(r-store rstb QI OP_03 OPE1_20 GR 1 0
4488 ((fr500 (unit u-gr-r-store))) "Store unsigned byte")
4489(r-store rsth HI OP_03 OPE1_21 GR 2 0
4490 ((fr500 (unit u-gr-r-store))) "Store unsigned half")
4491(r-store rst SI OP_03 OPE1_22 GR 4 0
4492 ((fr500 (unit u-gr-r-store))) "Store word")
4493
4494(r-store rstbf QI OP_03 OPE1_28 FRint 1 1
4495 ((fr500 (unit u-fr-r-store))) "Store byte float")
4496(r-store rsthf HI OP_03 OPE1_29 FRint 2 1
4497 ((fr500 (unit u-fr-r-store))) "Store half float")
4498(r-store rstf SI OP_03 OPE1_2A FRint 4 1
4499 ((fr500 (unit u-fr-r-store))) "Store word float")
4500
4501; Semantics for a store-double insn
4502;
4503(define-pmacro (store-double-semantics mode regtype address arg)
4504 (sequence ()
4505 (set address (add GRi arg))
4506 (c-call VOID (.str "@cpu@_write_mem_" mode)
4507 pc address (.sym regtype doublek)))
4508)
4509
4510(define-pmacro (store-double-r-r name mode op ope regtype attr profile comment)
4511 (dni name
4512 (comment)
ac7c07ac 4513 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
1340b9a9
DB
4514 (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
4515 (+ pack (.sym regtype doublek) op GRi ope GRj)
9aab5aa3
AC
4516 (sequence ((WI address))
4517 (store-double-semantics mode regtype address GRj))
4518 profile
4519 )
4520)
4521
4522(store-double-r-r std DI OP_03 OPE1_03 GR NA
ac7c07ac 4523 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4524 "Store double word")
4525(store-double-r-r stdf DF OP_03 OPE1_0B FR FR-ACCESS
ac7c07ac 4526 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4527 "Store double float")
4528
4529(store-double-r-r stdc DI OP_03 OPE1_26 CPR (MACH frv)
4530 () "Store coprocessor double word")
4531
4532(define-pmacro (r-store-double
4533 name mode op ope regtype is_float attr profile comment)
4534 (dni name
4535 (comment)
8caa9169 4536 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
1340b9a9
DB
4537 (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
4538 (+ pack (.sym regtype doublek) op GRi ope GRj)
9aab5aa3
AC
4539 (sequence ((WI address))
4540 (store-double-semantics mode regtype address GRj)
4541 (c-call VOID "@cpu@_check_recovering_store"
1340b9a9 4542 address (index-of (.sym regtype doublek)) 8 is_float))
9aab5aa3
AC
4543 profile
4544 )
4545)
4546
4547(r-store-double rstd DI OP_03 OPE1_23 GR 0 NA
4548 ((fr500 (unit u-gr-r-store))) "Store double word")
4549(r-store-double rstdf DF OP_03 OPE1_2B FR 1 FR-ACCESS
4550 ((fr500 (unit u-fr-r-store))) "Store double float")
4551
4552; Semantics for a store-quad insn
4553;
4554(define-pmacro (store-quad-semantics regtype address arg)
4555 (sequence ()
4556 (set address (add GRi arg))
4557 (c-call VOID (.str "@cpu@_store_quad_" regtype)
4558 pc address (index-of (.sym regtype k))))
4559)
4560
4561(define-pmacro (store-quad-r-r name op ope regtype attr profile comment)
4562 (dni name
4563 (comment)
8caa9169 4564 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
9aab5aa3
AC
4565 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4566 (+ pack (.sym regtype k) op GRi ope GRj)
4567 (sequence ((WI address))
4568 (store-quad-semantics regtype address GRj))
4569 profile
4570 )
4571)
4572
4573(store-quad-r-r stq OP_03 OPE1_04 GR NA
4574 ((fr500 (unit u-gr-store))) "Store quad word")
4575(store-quad-r-r stqf OP_03 OPE1_0C FRint FR-ACCESS
4576 ((fr500 (unit u-fr-store)))
4577 "Store quad float")
4578(store-quad-r-r stqc OP_03 OPE1_27 CPR NA
4579 () "Store coprocessor quad word")
4580
4581(define-pmacro (r-store-quad name op ope regtype is_float attr profile comment)
4582 (dni name
4583 (comment)
8caa9169 4584 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
9aab5aa3
AC
4585 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4586 (+ pack (.sym regtype k) op GRi ope GRj)
4587 (sequence ((WI address))
4588 (store-quad-semantics regtype address GRj)
4589 (c-call VOID "@cpu@_check_recovering_store"
4590 address (index-of (.sym regtype k)) 16 is_float))
4591 profile
4592 )
4593)
4594
4595(r-store-quad rstq OP_03 OPE1_24 GR 0 NA
4596 ((fr500 (unit u-gr-r-store))) "Store quad word")
4597(r-store-quad rstqf OP_03 OPE1_2C FRint 1 FR-ACCESS
4598 ((fr500 (unit u-fr-r-store))) "Store quad float")
4599
4600(define-pmacro (store-r-r-u name mode op ope regtype attr profile comment)
4601 (dni name
4602 (comment)
ac7c07ac 4603 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
9aab5aa3
AC
4604 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4605 (+ pack (.sym regtype k) op GRi ope GRj)
4606 (sequence ((UWI address))
4607 (set address (add GRi GRj))
4608 (c-call VOID (.str "@cpu@_write_mem_" mode)
4609 pc address (.sym regtype k))
4610 (set GRi address))
4611 profile
4612 )
4613)
4614
4615(store-r-r-u stbu QI OP_03 OPE1_10 GR NA
ac7c07ac 4616 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4617 "Store unsigned byte, update index")
4618(store-r-r-u sthu HI OP_03 OPE1_11 GR NA
ac7c07ac 4619 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4620 "Store unsigned half, update index")
4621(store-r-r-u stu WI OP_03 OPE1_12 GR NA
ac7c07ac 4622 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4623 "Store word, update index")
4624
4625(store-r-r-u stbfu QI OP_03 OPE1_18 FRint FR-ACCESS
ac7c07ac 4626 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4627 "Store byte float, update index")
4628(store-r-r-u sthfu HI OP_03 OPE1_19 FRint FR-ACCESS
ac7c07ac 4629 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4630 "Store half float, update index")
4631(store-r-r-u stfu SI OP_03 OPE1_1A FRint FR-ACCESS
ac7c07ac 4632 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4633 "Store word float, update index")
4634
4635(store-r-r-u stcu SI OP_03 OPE1_2D CPR (MACH frv) ()
4636 "Store coprocessor word, update index")
4637
4638(define-pmacro (store-double-r-r-u
4639 name mode op ope regtype attr profile comment)
4640 (dni name
4641 (comment)
ac7c07ac 4642 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
1340b9a9
DB
4643 (.str name "$pack $" regtype "doublek,@($GRi,$GRj)")
4644 (+ pack (.sym regtype doublek) op GRi ope GRj)
9aab5aa3
AC
4645 (sequence ((WI address))
4646 (store-double-semantics mode regtype address GRj)
4647 (set GRi address))
4648 profile
4649 )
4650)
4651
4652(store-double-r-r-u stdu DI OP_03 OPE1_13 GR NA
ac7c07ac 4653 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4654 "Store double word, update index")
4655(store-double-r-r-u stdfu DF OP_03 OPE1_1B FR FR-ACCESS
ac7c07ac 4656 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4657 "Store double float,update index")
4658(store-double-r-r-u stdcu DI OP_03 OPE1_2E CPR (MACH frv) ()
4659 "Store coprocessor double word, update index")
4660
4661(define-pmacro (store-quad-r-r-u name op ope regtype attr profile comment)
4662 (dni name
4663 (comment)
8caa9169 4664 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
9aab5aa3
AC
4665 (.str name "$pack $" regtype "k,@($GRi,$GRj)")
4666 (+ pack (.sym regtype k) op GRi ope GRj)
4667 (sequence ((WI address))
4668 (store-quad-semantics regtype address GRj)
4669 (set GRi address))
4670 profile
4671 )
4672)
4673
4674(store-quad-r-r-u stqu OP_03 OPE1_14 GR NA
4675 ((fr500 (unit u-gr-store)))
4676 "Store quad word, update index")
4677(store-quad-r-r-u stqfu OP_03 OPE1_1C FRint FR-ACCESS
4678 ((fr500 (unit u-fr-store)))
4679 "Store quad float, update index")
4680(store-quad-r-r-u stqcu OP_03 OPE1_2F CPR NA ()
4681 "Store coprocessor quad word, update index")
4682
4683(define-pmacro (conditional-load name mode op ope regtype profile comment)
4684 (dni name
4685 (comment)
ac7c07ac 4686 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
9aab5aa3
AC
4687 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4688 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4689 (if (eq CCi (or cond 2))
4690 (set (.sym regtype k)
4691 (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))))
4692 profile
4693 )
4694)
4695
4696(conditional-load cldsb QI OP_5E OPE4_0 GR
ac7c07ac 4697 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4698 "Load signed byte")
4699(conditional-load cldub UQI OP_5E OPE4_1 GR
ac7c07ac 4700 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4701 "Load unsigned byte")
4702(conditional-load cldsh HI OP_5E OPE4_2 GR
ac7c07ac 4703 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4704 "Load signed half")
4705(conditional-load clduh UHI OP_5E OPE4_3 GR
ac7c07ac 4706 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4707 "Load unsigned half")
4708(conditional-load cld SI OP_5F OPE4_0 GR
ac7c07ac 4709 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4710 "Load word")
4711
4712(conditional-load cldbf UQI OP_60 OPE4_0 FRint
ac7c07ac 4713 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4714 "Load byte float")
4715(conditional-load cldhf UHI OP_60 OPE4_1 FRint
ac7c07ac 4716 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4717 "Load half float")
4718(conditional-load cldf SI OP_60 OPE4_2 FRint
ac7c07ac 4719 ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4720 "Load word float")
4721
4722(define-pmacro (conditional-load-double
4723 name not_gr mode op ope regtype attr profile comment)
4724 (dni name
4725 (comment)
ac7c07ac 4726 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL attr)
9aab5aa3
AC
4727 (.str name "$pack @($GRi,$GRj),$" regtype "doublek,$CCi,$cond")
4728 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
4729 (if (eq CCi (or cond 2))
4730 (sequence ((WI address))
4731 (load-double-semantics not_gr mode regtype address GRj)))
4732 profile
4733 )
4734)
4735
4736(conditional-load-double cldd 0 DI OP_5F OPE4_1 GR NA
ac7c07ac 4737 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4738 "Load double word")
4739(conditional-load-double clddf 1 DF OP_60 OPE4_3 FR FR-ACCESS
ac7c07ac 4740 ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4741 "Load double float")
4742
4743(dni cldq
4744 "conditional load quad integer"
4745 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4746 "cldq$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4747 (+ pack GRk OP_5F GRi CCi cond OPE4_2 GRj)
4748 (if (eq CCi (or cond 2))
4749 (sequence ((WI address))
4750 (load-quad-semantics GR address GRj)))
4751 ((fr500 (unit u-gr-load)))
4752)
4753
4754(define-pmacro (conditional-load-gr-u name mode op ope comment)
4755 (dni name
4756 (comment)
ac7c07ac 4757 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
9aab5aa3
AC
4758 (.str name "$pack @($GRi,$GRj),$GRk,$CCi,$cond")
4759 (+ pack GRk op GRi CCi cond ope GRj)
4760 (if (eq CCi (or cond 2))
4761 (sequence ((WI address))
4762 (set address (add GRi GRj))
4763 (set GRk
4764 (c-call mode (.str "@cpu@_read_mem_" mode)
4765 pc address))
4766 (if (ne (index-of GRi) (index-of GRk))
4767 (set GRi address))))
4768 ((fr400 (unit u-gr-load))
ac7c07ac 4769 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4770 )
4771)
4772
4773(conditional-load-gr-u cldsbu QI OP_61 OPE4_0 "Load signed byte, update")
4774(conditional-load-gr-u cldubu UQI OP_61 OPE4_1 "Load unsigned byte, update")
4775(conditional-load-gr-u cldshu HI OP_61 OPE4_2 "Load signed half, update")
4776(conditional-load-gr-u clduhu UHI OP_61 OPE4_3 "Load unsigned half, update")
4777(conditional-load-gr-u cldu SI OP_62 OPE4_0 "Load word, update")
4778
4779(define-pmacro (conditional-load-non-gr-u name mode op ope regtype comment)
4780 (dni name
4781 (comment)
ac7c07ac 4782 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
4783 (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond")
4784 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4785 (if (eq CCi (or cond 2))
4786 (sequence ((WI address))
4787 (set address (add GRi GRj))
4788 (set (.sym regtype k)
4789 (c-call mode (.str "@cpu@_read_mem_" mode)
4790 pc address))
4791 (set GRi address)))
4792 ((fr400 (unit u-fr-load))
ac7c07ac 4793 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4794 )
4795)
4796
4797(conditional-load-non-gr-u cldbfu UQI OP_63 OPE4_0 FRint "Load byte float, update")
4798(conditional-load-non-gr-u cldhfu UHI OP_63 OPE4_1 FRint "Load half float, update")
4799(conditional-load-non-gr-u cldfu SI OP_63 OPE4_2 FRint "Load word float, update")
4800
4801
4802(dni clddu
4803 "Load double word, update"
ac7c07ac 4804 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL)
9aab5aa3
AC
4805 "clddu$pack @($GRi,$GRj),$GRdoublek,$CCi,$cond"
4806 (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj)
4807 (if (eq CCi (or cond 2))
4808 (sequence ((WI address))
4809 (load-double-semantics 0 DI GR address GRj)
4810 (if (ne (index-of GRi) (index-of GRdoublek))
4811 (set GRi address))))
4812 ((fr400 (unit u-gr-load))
ac7c07ac 4813 (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load)))
9aab5aa3
AC
4814)
4815
4816(dni clddfu
4817 "Load double float, update"
ac7c07ac 4818 ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
4819 "clddfu$pack @($GRi,$GRj),$FRdoublek,$CCi,$cond"
4820 (+ pack FRdoublek OP_63 GRi CCi cond OPE4_3 GRj)
4821 (if (eq CCi (or cond 2))
4822 (sequence ((WI address))
4823 (load-double-semantics 1 DF FR address GRj)
4824 (set GRi address)))
4825 ((fr400 (unit u-fr-load))
ac7c07ac 4826 (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load)))
9aab5aa3
AC
4827)
4828
4829(dni cldqu
4830 "conditional load quad integer and update index"
4831 ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL)
4832 "cldqu$pack @($GRi,$GRj),$GRk,$CCi,$cond"
4833 (+ pack GRk OP_62 GRi CCi cond OPE4_2 GRj)
4834 (if (eq CCi (or cond 2))
4835 (sequence ((WI address))
4836 (load-quad-semantics GR address GRj)
4837 (if (ne (index-of GRi) (index-of GRk))
4838 (set GRi address))))
4839 ((fr500 (unit u-gr-load)))
4840)
4841
4842(define-pmacro (conditional-store name mode op ope regtype profile comment)
4843 (dni name
4844 (comment)
ac7c07ac 4845 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL)
9aab5aa3
AC
4846 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4847 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4848 (if (eq CCi (or cond 2))
4849 (c-call VOID (.str "@cpu@_write_mem_" mode)
4850 pc (add GRi GRj) (.sym regtype k)))
4851 profile
4852 )
4853)
4854
4855(conditional-store cstb QI OP_64 OPE4_0 GR
ac7c07ac 4856 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4857 "Store unsigned byte")
4858(conditional-store csth HI OP_64 OPE4_1 GR
ac7c07ac 4859 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4860 "Store unsigned half")
4861(conditional-store cst SI OP_64 OPE4_2 GR
ac7c07ac 4862 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4863 "Store word")
4864
4865(conditional-store cstbf QI OP_66 OPE4_0 FRint
ac7c07ac 4866 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4867 "Store byte float")
4868(conditional-store csthf HI OP_66 OPE4_1 FRint
ac7c07ac 4869 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4870 "Store half float")
4871(conditional-store cstf SI OP_66 OPE4_2 FRint
ac7c07ac 4872 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4873 "Store word float")
4874
4875(define-pmacro (conditional-store-double
4876 name mode op ope regtype attr profile comment)
4877 (dni name
4878 (comment)
ac7c07ac 4879 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
1340b9a9
DB
4880 (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
4881 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
9aab5aa3
AC
4882 (if (eq CCi (or cond 2))
4883 (sequence ((WI address))
4884 (store-double-semantics mode regtype address GRj)))
4885 profile
4886 )
4887)
4888
4889(conditional-store-double cstd DI OP_64 OPE4_3 GR NA
ac7c07ac 4890 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4891 "Store double word")
4892(conditional-store-double cstdf DF OP_66 OPE4_3 FR FR-ACCESS
ac7c07ac 4893 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4894 "Store double float")
4895
4896(dni cstq
4897 "conditionally store quad word"
8caa9169 4898 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) CONDITIONAL)
9aab5aa3
AC
4899 "cstq$pack $GRk,@($GRi,$GRj),$CCi,$cond"
4900 (+ pack GRk OP_65 GRi CCi cond OPE4_0 GRj)
4901 (if (eq CCi (or cond 2))
4902 (sequence ((WI address))
4903 (store-quad-semantics GR address GRj)))
4904 ((fr500 (unit u-gr-store)))
4905)
4906
4907(define-pmacro (conditional-store-u
4908 name mode op ope regtype attr profile comment)
4909 (dni name
4910 (comment)
ac7c07ac 4911 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
9aab5aa3
AC
4912 (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond")
4913 (+ pack (.sym regtype k) op GRi CCi cond ope GRj)
4914 (if (eq CCi (or cond 2))
4915 (sequence ((WI address))
4916 (set address (add GRi GRj))
4917 (c-call VOID (.str "@cpu@_write_mem_" mode)
4918 pc address (.sym regtype k))
4919 (set GRi address)))
4920 profile
4921 )
4922)
4923
4924(conditional-store-u cstbu QI OP_67 OPE4_0 GR NA
ac7c07ac 4925 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4926 "Store unsigned byte, update index")
4927(conditional-store-u csthu HI OP_67 OPE4_1 GR NA
ac7c07ac 4928 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4929 "Store unsigned half, update index")
4930(conditional-store-u cstu SI OP_67 OPE4_2 GR NA
ac7c07ac 4931 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4932 "Store word, update index")
4933
4934(conditional-store-u cstbfu QI OP_68 OPE4_0 FRint FR-ACCESS
ac7c07ac 4935 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4936 "Store byte float, update index")
4937(conditional-store-u csthfu HI OP_68 OPE4_1 FRint FR-ACCESS
ac7c07ac 4938 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4939 "Store half float, update index")
4940(conditional-store-u cstfu SI OP_68 OPE4_2 FRint FR-ACCESS
ac7c07ac 4941 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4942 "Store word float, update index")
4943
4944(define-pmacro (conditional-store-double-u
4945 name mode op ope regtype attr profile comment)
4946 (dni name
4947 (comment)
ac7c07ac 4948 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr)
1340b9a9
DB
4949 (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond")
4950 (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj)
9aab5aa3
AC
4951 (if (eq CCi (or cond 2))
4952 (sequence ((WI address))
4953 (store-double-semantics mode regtype address GRj)
4954 (set GRi address)))
4955 profile
4956 )
4957)
4958
4959(conditional-store-double-u cstdu DI OP_67 OPE4_3 GR NA
4960 ((fr400 (unit u-gr-store))
ac7c07ac 4961 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4962 "Store double word, update index")
4963(conditional-store-double-u cstdfu DF OP_68 OPE4_3 FR FR-ACCESS
ac7c07ac
DB
4964 ((fr400 (unit u-fr-store))
4965 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4966 "Store double float, update index")
4967
4968(define-pmacro (store-r-simm name mode op regtype attr profile comment)
4969 (dni name
4970 (comment)
ac7c07ac 4971 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
9aab5aa3
AC
4972 (.str name "$pack $" regtype "k,@($GRi,$d12)")
4973 (+ pack (.sym regtype k) op GRi d12)
4974 (c-call VOID (.str "@cpu@_write_mem_" mode)
4975 pc (add GRi d12) (.sym regtype k))
4976 profile
4977 )
4978)
4979
4980(store-r-simm stbi QI OP_50 GR NA
ac7c07ac 4981 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4982 "Store unsigned byte")
4983(store-r-simm sthi HI OP_51 GR NA
ac7c07ac 4984 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4985 "Store unsigned half")
4986(store-r-simm sti SI OP_52 GR NA
ac7c07ac 4987 ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
4988 "Store word")
4989
4990(store-r-simm stbfi QI OP_4E FRint FR-ACCESS
ac7c07ac 4991 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4992 "Store byte float")
4993(store-r-simm sthfi HI OP_4F FRint FR-ACCESS
ac7c07ac 4994 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4995 "Store half float")
4996(store-r-simm stfi SI OP_55 FRint FR-ACCESS
ac7c07ac 4997 ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
4998 "Store word float")
4999
5000(define-pmacro (store-double-r-simm name mode op regtype attr profile comment)
5001 (dni name
5002 (comment)
ac7c07ac 5003 ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr)
1340b9a9
DB
5004 (.str name "$pack $" regtype "doublek,@($GRi,$d12)")
5005 (+ pack (.sym regtype doublek) op GRi d12)
9aab5aa3
AC
5006 (sequence ((WI address))
5007 (store-double-semantics mode regtype address d12))
5008 profile
5009 )
5010)
5011
5012(store-double-r-simm stdi DI OP_53 GR NA
ac7c07ac
DB
5013 ((fr400 (unit u-gr-store))
5014 (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store)))
9aab5aa3
AC
5015 "Store double word")
5016(store-double-r-simm stdfi DF OP_56 FR FR-ACCESS
ac7c07ac
DB
5017 ((fr400 (unit u-fr-store))
5018 (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store)))
9aab5aa3
AC
5019 "Store double float")
5020
5021(define-pmacro (store-quad-r-simm name op regtype attr profile comment)
5022 (dni name
5023 (comment)
8caa9169 5024 ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr)
9aab5aa3
AC
5025 (.str name "$pack $" regtype "k,@($GRi,$d12)")
5026 (+ pack (.sym regtype k) op GRi d12)
5027 (sequence ((WI address))
5028 (store-quad-semantics regtype address d12))
5029 profile
5030 )
5031)
5032
5033(store-quad-r-simm stqi OP_54 GR NA ((fr500 (unit u-gr-store)))
5034 "Store quad word")
5035(store-quad-r-simm stqfi OP_57 FRint FR-ACCESS ()
5036 "Store quad float")
5037
5038(define-pmacro (swap-semantics base offset arg)
5039 (sequence ((WI tmp) (WI address))
5040 (set tmp arg)
5041 (set address (add base offset))
ac7c07ac 5042 (c-call VOID "@cpu@_check_swap_address" address)
9aab5aa3
AC
5043 (set arg (c-call WI "@cpu@_read_mem_WI" pc address))
5044 (c-call VOID "@cpu@_write_mem_WI" pc address tmp))
5045)
5046
5047(dni swap
5048 "Swap contents of memory with GR"
ac7c07ac 5049 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
5050 "swap$pack @($GRi,$GRj),$GRk"
5051 (+ pack GRk OP_03 GRi OPE1_05 GRj)
5052 (swap-semantics GRi GRj GRk)
5053 ((fr400 (unit u-swap))
ac7c07ac 5054 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
9aab5aa3
AC
5055)
5056
5057(dni "swapi"
5058 "Swap contents of memory with GR"
ac7c07ac 5059 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
5060 ("swapi$pack @($GRi,$d12),$GRk")
5061 (+ pack GRk OP_4D GRi d12)
5062 (swap-semantics GRi d12 GRk)
5063 ((fr400 (unit u-swap))
ac7c07ac 5064 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
9aab5aa3
AC
5065)
5066
5067(dni cswap
5068 "Conditionally swap contents of memory with GR"
ac7c07ac 5069 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) CONDITIONAL)
9aab5aa3
AC
5070 "cswap$pack @($GRi,$GRj),$GRk,$CCi,$cond"
5071 (+ pack GRk OP_65 GRi CCi cond OPE4_2 GRj)
5072 (if (eq CCi (or cond 2))
5073 (swap-semantics GRi GRj GRk))
5074 ((fr400 (unit u-swap))
ac7c07ac 5075 (fr500 (unit u-swap)) (fr550 (unit u-swap)))
9aab5aa3
AC
5076)
5077
5078(define-pmacro (register-transfer
0457efce 5079 name op ope reg_src reg_targ pipe attrs profile comment)
9aab5aa3
AC
5080 (dni name
5081 (comment)
0457efce 5082 (.splice (UNIT pipe) (.unsplice attrs))
9aab5aa3
AC
5083 (.str name "$pack $" reg_src ",$" reg_targ)
5084 (+ pack reg_targ op (rs-null) ope reg_src)
5085 (set reg_targ reg_src)
5086 profile
5087 )
5088)
5089
5090(register-transfer movgf OP_03 OPE1_15
0457efce 5091 GRj FRintk I0
ac7c07ac
DB
5092 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5093 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
9aab5aa3
AC
5094 "transfer gr to fr")
5095(register-transfer movfg OP_03 OPE1_0D
0457efce 5096 FRintk GRj I0
ac7c07ac
DB
5097 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
5098 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
9aab5aa3
AC
5099 "transfer fr to gr")
5100
5101(define-pmacro (nextreg hw r offset) (reg hw (add (index-of r) offset)))
5102
5103(define-pmacro (register-transfer-double-from-gr-semantics cond)
5104 (if cond
5105 (if (eq (index-of GRj) 0)
5106 (sequence ()
5107 (set FRintk 0)
5108 (set (nextreg h-fr_int FRintk 1) 0))
5109 (sequence ()
5110 (set FRintk GRj)
5111 (set (nextreg h-fr_int FRintk 1) (nextreg h-gr GRj 1)))))
5112)
5113
5114(dni movgfd
5115 "move GR for FR double"
ac7c07ac 5116 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
9aab5aa3
AC
5117 "movgfd$pack $GRj,$FRintk"
5118 (+ pack FRintk OP_03 (rs-null) OPE1_16 GRj)
5119 (register-transfer-double-from-gr-semantics 1)
5120 ; TODO -- doesn't handle second register in the pair
5121 ((fr400 (unit u-gr2fr))
ac7c07ac 5122 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
9aab5aa3
AC
5123)
5124
5125(define-pmacro (register-transfer-double-to-gr-semantics cond)
5126 (if (andif (ne (index-of GRj) 0) cond)
5127 (sequence ()
5128 (set GRj FRintk)
5129 (set (nextreg h-gr GRj 1) (nextreg h-fr_int FRintk 1))))
5130)
5131
5132(dni movfgd
5133 "move FR for GR double"
ac7c07ac 5134 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS)
9aab5aa3
AC
5135 "movfgd$pack $FRintk,$GRj"
5136 (+ pack FRintk OP_03 (rs-null) OPE1_0E GRj)
5137 (register-transfer-double-to-gr-semantics 1)
5138 ; TODO -- doesn't handle second register in the pair
5139 ((fr400 (unit u-fr2gr))
ac7c07ac 5140 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
9aab5aa3
AC
5141)
5142
5143(dni movgfq
5144 "move GR for FR quad"
5145 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5146 "movgfq$pack $GRj,$FRintk"
5147 (+ pack FRintk OP_03 (rs-null) OPE1_17 GRj)
5148 (if (eq (index-of GRj) 0)
5149 (sequence ()
5150 (set FRintk 0)
5151 (set (reg h-fr_int (add (index-of FRintk) 1)) 0)
5152 (set (reg h-fr_int (add (index-of FRintk) 2)) 0)
5153 (set (reg h-fr_int (add (index-of FRintk) 3)) 0))
5154 (sequence ()
5155 (set FRintk GRj)
5156 (set (reg h-fr_int (add (index-of FRintk) 1))
5157 (reg h-gr (add (index-of GRj) 1)))
5158 (set (reg h-fr_int (add (index-of FRintk) 2))
5159 (reg h-gr (add (index-of GRj) 2)))
5160 (set (reg h-fr_int (add (index-of FRintk) 3))
5161 (reg h-gr (add (index-of GRj) 3)))))
5162 ()
5163)
5164
5165(dni movfgq
5166 "move FR for GR quad"
5167 ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS)
5168 "movfgq$pack $FRintk,$GRj"
5169 (+ pack FRintk OP_03 (rs-null) OPE1_0F GRj)
5170 (if (ne (index-of GRj) 0)
5171 (sequence ()
5172 (set GRj FRintk)
5173 (set (reg h-gr (add (index-of GRj) 1))
5174 (reg h-fr_int (add (index-of FRintk) 1)))
5175 (set (reg h-gr (add (index-of GRj) 2))
5176 (reg h-fr_int (add (index-of FRintk) 2)))
5177 (set (reg h-gr (add (index-of GRj) 3))
5178 (reg h-fr_int (add (index-of FRintk) 3)))))
5179 ()
5180)
5181
5182(define-pmacro (conditional-register-transfer
0457efce 5183 name op ope reg_src reg_targ pipe attrs profile comment)
9aab5aa3
AC
5184 (dni name
5185 (comment)
0457efce 5186 (.splice (UNIT pipe) CONDITIONAL FR-ACCESS (.unsplice attrs))
9aab5aa3
AC
5187 (.str name "$pack $" reg_src ",$" reg_targ ",$CCi,$cond")
5188 (+ pack reg_targ op (rs-null) CCi cond ope reg_src)
5189 (if (eq CCi (or cond 2))
5190 (set reg_targ reg_src))
5191 profile
5192 )
5193)
5194
5195(conditional-register-transfer cmovgf OP_69 OPE4_0 GRj FRintk I0
ac7c07ac
DB
5196 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5197 ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
9aab5aa3
AC
5198 "transfer gr to fr")
5199(conditional-register-transfer cmovfg OP_69 OPE4_2 FRintk GRj I0
ac7c07ac
DB
5200 ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4))
5201 ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
9aab5aa3
AC
5202 "transfer fr to gr")
5203
5204
5205(dni cmovgfd
5206 "Conditional move GR to FR double"
ac7c07ac 5207 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
5208 "cmovgfd$pack $GRj,$FRintk,$CCi,$cond"
5209 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_1 GRj)
5210 (register-transfer-double-from-gr-semantics (eq CCi (or cond 2)))
5211 ; TODO -- doesn't handle extra registers in double
5212 ((fr400 (unit u-gr2fr))
ac7c07ac 5213 (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr)))
9aab5aa3
AC
5214)
5215
5216(dni cmovfgd
5217 "Conditional move FR to GR double"
ac7c07ac 5218 ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
5219 "cmovfgd$pack $FRintk,$GRj,$CCi,$cond"
5220 (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_3 GRj)
5221 (register-transfer-double-to-gr-semantics (eq CCi (or cond 2)))
5222 ; TODO -- doesn't handle second register in the pair
5223 ((fr400 (unit u-fr2gr))
ac7c07ac 5224 (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr)))
9aab5aa3
AC
5225)
5226
5227(define-pmacro (register-transfer-spr
5228 name op ope reg_src reg_targ unitname comment)
5229 (dni name
5230 (comment)
ac7c07ac 5231 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
5232 (.str name "$pack $" reg_src ",$" reg_targ)
5233 (+ pack reg_targ op ope reg_src)
5234 (set reg_targ reg_src)
5235 ((fr400 (unit unitname))
ac7c07ac 5236 (fr500 (unit unitname)) (fr550 (unit unitname)))
9aab5aa3
AC
5237 )
5238)
5239
5240(register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr "transfer gr->spr")
5241(register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr "transfer spr->gr")
5242
5243; Integer Branch Conditions
5244(define-pmacro (Inev cc) (const BI 0))
5245(define-pmacro (Ira cc) (const BI 1))
5246(define-pmacro (Ieq cc) ( zbit cc))
5247(define-pmacro (Ine cc) (not (zbit cc)))
5248(define-pmacro (Ile cc) ( orif (zbit cc) (xor (nbit cc) (vbit cc))))
5249(define-pmacro (Igt cc) (not (orif (zbit cc) (xor (nbit cc) (vbit cc)))))
5250(define-pmacro (Ilt cc) ( xor (nbit cc) (vbit cc)))
5251(define-pmacro (Ige cc) (not (xor (nbit cc) (vbit cc))))
5252(define-pmacro (Ils cc) ( orif (cbit cc) (zbit cc)))
5253(define-pmacro (Ihi cc) (not (orif (cbit cc) (zbit cc))))
5254(define-pmacro (Ic cc) ( cbit cc))
5255(define-pmacro (Inc cc) (not (cbit cc)))
5256(define-pmacro (In cc) ( nbit cc))
5257(define-pmacro (Ip cc) (not (nbit cc)))
5258(define-pmacro (Iv cc) ( vbit cc))
5259(define-pmacro (Inv cc) (not (vbit cc)))
5260
5261; Float Branch Conditions
5262(define-pmacro (Fnev cc) (const BI 0))
5263(define-pmacro (Fra cc) (const BI 1))
5264(define-pmacro (Fne cc) (orif (lbit cc) (orif (gbit cc) (ubit cc))))
5265(define-pmacro (Feq cc) (ebit cc))
5266(define-pmacro (Flg cc) (orif (lbit cc) (gbit cc)))
5267(define-pmacro (Fue cc) (orif (ebit cc) (ubit cc)))
5268(define-pmacro (Ful cc) (orif (lbit cc) (ubit cc)))
5269(define-pmacro (Fge cc) (orif (ebit cc) (gbit cc)))
5270(define-pmacro (Flt cc) (lbit cc))
5271(define-pmacro (Fuge cc) (orif (ebit cc) (orif (gbit cc) (ubit cc))))
5272(define-pmacro (Fug cc) (orif (gbit cc) (ubit cc)))
5273(define-pmacro (Fle cc) (orif (ebit cc) (lbit cc)))
5274(define-pmacro (Fgt cc) (gbit cc))
5275(define-pmacro (Fule cc) (orif (ebit cc) (orif (lbit cc) (ubit cc))))
5276(define-pmacro (Fu cc) (ubit cc))
5277(define-pmacro (Fo cc) (orif (ebit cc) (orif (lbit cc) (gbit cc))))
5278
5279(define-pmacro (conditional-branch-i prefix cc op cond comment)
5280 (dni (.sym prefix cc)
5281 (comment)
ac7c07ac 5282 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
9aab5aa3
AC
5283 (.str (.sym prefix cc) "$pack $ICCi_2,$hint,$label16")
5284 (+ pack (.sym ICC_ cc) ICCi_2 op hint label16)
5285 (sequence ()
5286 (c-call VOID "@cpu@_model_branch" label16 hint)
5287 (if (cond ICCi_2)
5288 (set pc label16)))
5289 ((fr400 (unit u-branch))
ac7c07ac 5290 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5291 )
5292)
5293
5294(dni bra
5295 "integer branch equal"
ac7c07ac 5296 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
9aab5aa3
AC
5297 "bra$pack $hint_taken$label16"
5298 (+ pack ICC_ra (ICCi_2-null) OP_06 hint_taken label16)
5299 (sequence ()
5300 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5301 (set pc label16))
5302 ((fr400 (unit u-branch))
ac7c07ac 5303 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5304)
5305
5306(dni bno
5307 "integer branch never"
ac7c07ac 5308 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1))
9aab5aa3
AC
5309 "bno$pack$hint_not_taken"
5310 (+ pack ICC_nev (ICCi_2-null) OP_06 hint_not_taken (label16-null))
5311 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5312 ((fr400 (unit u-branch))
ac7c07ac 5313 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5314)
5315
5316(conditional-branch-i b eq OP_06 Ieq "integer branch equal")
5317(conditional-branch-i b ne OP_06 Ine "integer branch not equal")
5318(conditional-branch-i b le OP_06 Ile "integer branch less or equal")
5319(conditional-branch-i b gt OP_06 Igt "integer branch greater")
5320(conditional-branch-i b lt OP_06 Ilt "integer branch less")
5321(conditional-branch-i b ge OP_06 Ige "integer branch greater or equal")
5322(conditional-branch-i b ls OP_06 Ils "integer branch less or equal unsigned")
5323(conditional-branch-i b hi OP_06 Ihi "integer branch greater unsigned")
5324(conditional-branch-i b c OP_06 Ic "integer branch carry set")
5325(conditional-branch-i b nc OP_06 Inc "integer branch carry clear")
5326(conditional-branch-i b n OP_06 In "integer branch negative")
5327(conditional-branch-i b p OP_06 Ip "integer branch positive")
5328(conditional-branch-i b v OP_06 Iv "integer branch overflow set")
5329(conditional-branch-i b nv OP_06 Inv "integer branch overflow clear")
5330
5331(define-pmacro (conditional-branch-f prefix cc op cond comment)
5332 (dni (.sym prefix cc)
5333 (comment)
ac7c07ac 5334 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
9aab5aa3
AC
5335 (.str (.sym prefix cc) "$pack $FCCi_2,$hint,$label16")
5336 (+ pack (.sym FCC_ cc) FCCi_2 op hint label16)
5337 (sequence ()
5338 (c-call VOID "@cpu@_model_branch" label16 hint)
5339 (if (cond FCCi_2) (set pc label16)))
5340 ((fr400 (unit u-branch))
ac7c07ac 5341 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5342 )
5343)
5344
5345(dni fbra
5346 "float branch equal"
ac7c07ac 5347 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
9aab5aa3
AC
5348 "fbra$pack $hint_taken$label16"
5349 (+ pack FCC_ra (FCCi_2-null) OP_07 hint_taken label16)
5350 (sequence ()
5351 (c-call VOID "@cpu@_model_branch" label16 hint_taken)
5352 (set pc label16))
5353 ((fr400 (unit u-branch))
ac7c07ac 5354 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5355)
5356
5357(dni fbno
5358 "float branch never"
ac7c07ac 5359 ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS)
9aab5aa3
AC
5360 "fbno$pack$hint_not_taken"
5361 (+ pack FCC_nev (FCCi_2-null) OP_07 hint_not_taken (label16-null))
5362 (c-call VOID "@cpu@_model_branch" label16 hint_not_taken)
5363 ((fr400 (unit u-branch))
ac7c07ac 5364 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5365)
5366
5367(conditional-branch-f fb ne OP_07 Fne "float branch not equal")
5368(conditional-branch-f fb eq OP_07 Feq "float branch equal")
5369(conditional-branch-f fb lg OP_07 Flg "float branch less or greater")
5370(conditional-branch-f fb ue OP_07 Fue "float branch unordered or equal")
5371(conditional-branch-f fb ul OP_07 Ful "float branch unordered or less")
5372(conditional-branch-f fb ge OP_07 Fge "float branch greater or equal")
5373(conditional-branch-f fb lt OP_07 Flt "float branch less")
5374(conditional-branch-f fb uge OP_07 Fuge "float branch unordered, greater,equal")
5375(conditional-branch-f fb ug OP_07 Fug "float branch unordered or greater")
5376(conditional-branch-f fb le OP_07 Fle "float branch less or equal")
5377(conditional-branch-f fb gt OP_07 Fgt "float branch greater")
5378(conditional-branch-f fb ule OP_07 Fule "float branch unordered, less or equal")
5379(conditional-branch-f fb u OP_07 Fu "float branch unordered")
5380(conditional-branch-f fb o OP_07 Fo "float branch ordered")
5381
5382(define-pmacro (ctrlr-branch-semantics cond ccond)
5383 (sequence ((SI tmp))
5384 (set tmp (sub (spr-lcr) 1))
5385 (set (spr-lcr) tmp)
5386 (if cond
5387 (if (eq ccond 0)
5388 (if (ne tmp 0)
5389 (set pc (spr-lr)))
5390 (if (eq tmp 0)
5391 (set pc (spr-lr))))))
5392)
5393
5394(dni bctrlr
5395 "LCR conditional branch to lr"
ac7c07ac 5396 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
9aab5aa3
AC
5397 ("bctrlr$pack $ccond,$hint")
5398 (+ pack (cond-null) (ICCi_2-null) OP_0E hint OPE3_01 ccond (s12-null))
5399 (sequence ()
5400 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5401 (ctrlr-branch-semantics (const BI 1) ccond))
5402 ((fr400 (unit u-branch))
ac7c07ac 5403 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5404)
5405
5406(define-pmacro (conditional-branch-cclr prefix cc i-f op ope cond attr comment)
5407 (dni (.sym prefix cc lr)
5408 (comment)
ac7c07ac 5409 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) attr)
9aab5aa3
AC
5410 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$hint")
5411 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope
5412 (ccond-null) (s12-null))
5413 (sequence ()
5414 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5415 (if (cond (.sym i-f CCi_2)) (set pc (spr-lr))))
5416 ((fr400 (unit u-branch))
ac7c07ac 5417 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5418 )
5419)
5420
5421(dni bralr
5422 "integer cclr branch always"
ac7c07ac 5423 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
9aab5aa3
AC
5424 "bralr$pack$hint_taken"
5425 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_02 (ccond-null) (s12-null))
5426 (sequence ()
5427 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5428 (set pc (spr-lr)))
5429 ((fr400 (unit u-branch))
ac7c07ac 5430 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5431)
5432
5433(dni bnolr
5434 "integer cclr branch never"
ac7c07ac 5435 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3))
9aab5aa3
AC
5436 "bnolr$pack$hint_not_taken"
5437 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_02 (ccond-null) (s12-null))
5438 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5439 ((fr400 (unit u-branch))
ac7c07ac 5440 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5441)
5442
5443(conditional-branch-cclr b eq I OP_0E OPE3_02 Ieq NA "integer cclr branch equal")
5444(conditional-branch-cclr b ne I OP_0E OPE3_02 Ine NA "integer cclr branch not equal")
5445(conditional-branch-cclr b le I OP_0E OPE3_02 Ile NA "integer cclr branch less or equal")
5446(conditional-branch-cclr b gt I OP_0E OPE3_02 Igt NA "integer cclr branch greater")
5447(conditional-branch-cclr b lt I OP_0E OPE3_02 Ilt NA "integer cclr branch less")
5448(conditional-branch-cclr b ge I OP_0E OPE3_02 Ige NA "integer cclr branch greater or equal")
5449(conditional-branch-cclr b ls I OP_0E OPE3_02 Ils NA "integer cclr branch less or equal unsigned")
5450(conditional-branch-cclr b hi I OP_0E OPE3_02 Ihi NA "integer cclr branch greater unsigned")
5451(conditional-branch-cclr b c I OP_0E OPE3_02 Ic NA "integer cclr branch carry set")
5452(conditional-branch-cclr b nc I OP_0E OPE3_02 Inc NA "integer cclr branch carry clear")
5453(conditional-branch-cclr b n I OP_0E OPE3_02 In NA "integer cclr branch negative")
5454(conditional-branch-cclr b p I OP_0E OPE3_02 Ip NA "integer cclr branch positive")
5455(conditional-branch-cclr b v I OP_0E OPE3_02 Iv NA "integer cclr branch overflow set")
5456(conditional-branch-cclr b nv I OP_0E OPE3_02 Inv NA "integer cclr branch overflow clear")
5457
5458(dni fbralr
5459 "float cclr branch always"
ac7c07ac 5460 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
9aab5aa3
AC
5461 "fbralr$pack$hint_taken"
5462 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_06 (ccond-null) (s12-null))
5463 (sequence ()
5464 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5465 (set pc (spr-lr)))
5466 ((fr400 (unit u-branch))
ac7c07ac 5467 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5468)
5469
5470(dni fbnolr
5471 "float cclr branch never"
ac7c07ac 5472 ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS)
9aab5aa3
AC
5473 "fbnolr$pack$hint_not_taken"
5474 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_06 (ccond-null) (s12-null))
5475 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5476 ((fr400 (unit u-branch))
ac7c07ac 5477 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5478)
5479
5480(conditional-branch-cclr fb eq F OP_0E OPE3_06 Feq FR-ACCESS "float cclr branch equal")
5481(conditional-branch-cclr fb ne F OP_0E OPE3_06 Fne FR-ACCESS "float cclr branch not equal")
5482(conditional-branch-cclr fb lg F OP_0E OPE3_06 Flg FR-ACCESS "float branch less or greater")
5483(conditional-branch-cclr fb ue F OP_0E OPE3_06 Fue FR-ACCESS "float branch unordered or equal")
5484(conditional-branch-cclr fb ul F OP_0E OPE3_06 Ful FR-ACCESS "float branch unordered or less")
5485(conditional-branch-cclr fb ge F OP_0E OPE3_06 Fge FR-ACCESS "float branch greater or equal")
5486(conditional-branch-cclr fb lt F OP_0E OPE3_06 Flt FR-ACCESS "float branch less")
5487(conditional-branch-cclr fb uge F OP_0E OPE3_06 Fuge FR-ACCESS "float branch unordered, greater, equal")
5488(conditional-branch-cclr fb ug F OP_0E OPE3_06 Fug FR-ACCESS "float branch unordered or greater")
5489(conditional-branch-cclr fb le F OP_0E OPE3_06 Fle FR-ACCESS "float branch less or equal")
5490(conditional-branch-cclr fb gt F OP_0E OPE3_06 Fgt FR-ACCESS "float branch greater")
5491(conditional-branch-cclr fb ule F OP_0E OPE3_06 Fule FR-ACCESS "float branch unordered, less or equal")
5492(conditional-branch-cclr fb u F OP_0E OPE3_06 Fu FR-ACCESS "float branch unordered")
5493(conditional-branch-cclr fb o F OP_0E OPE3_06 Fo FR-ACCESS "float branch ordered")
5494
5495(define-pmacro (conditional-branch-ctrlr prefix cc i-f op ope cond attr comment)
5496 (dni (.sym prefix cc lr)
5497 (comment)
ac7c07ac 5498 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) attr)
9aab5aa3
AC
5499 (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$ccond,$hint")
5500 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope ccond (s12-null))
5501 (sequence ()
5502 (c-call VOID "@cpu@_model_branch" (spr-lr) hint)
5503 (ctrlr-branch-semantics (cond (.sym i-f CCi_2)) ccond))
5504 ((fr400 (unit u-branch))
ac7c07ac 5505 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5506 )
5507)
5508
5509(dni bcralr
5510 "integer ctrlr branch always"
ac7c07ac 5511 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
9aab5aa3
AC
5512 "bcralr$pack $ccond$hint_taken"
5513 (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_03 ccond (s12-null))
5514 (sequence ()
5515 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5516 (ctrlr-branch-semantics (const BI 1) ccond))
5517 ((fr400 (unit u-branch))
ac7c07ac 5518 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5519)
5520
5521(dni bcnolr
5522 "integer ctrlr branch never"
ac7c07ac 5523 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2))
9aab5aa3
AC
5524 "bcnolr$pack$hint_not_taken"
5525 (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_03 (ccond-null) (s12-null))
5526 (sequence ()
5527 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5528 (ctrlr-branch-semantics (const BI 0) ccond))
5529 ((fr400 (unit u-branch))
ac7c07ac 5530 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5531)
5532
5533(conditional-branch-ctrlr bc eq I OP_0E OPE3_03 Ieq NA "integer ctrlr branch equal")
5534(conditional-branch-ctrlr bc ne I OP_0E OPE3_03 Ine NA "integer ctrlr branch not equal")
5535(conditional-branch-ctrlr bc le I OP_0E OPE3_03 Ile NA "integer ctrlr branch less equal")
5536(conditional-branch-ctrlr bc gt I OP_0E OPE3_03 Igt NA "integer ctrlr branch greater")
5537(conditional-branch-ctrlr bc lt I OP_0E OPE3_03 Ilt NA "integer ctrlr branch less")
5538(conditional-branch-ctrlr bc ge I OP_0E OPE3_03 Ige NA "integer ctrlr branch greater equal")
5539(conditional-branch-ctrlr bc ls I OP_0E OPE3_03 Ils NA "integer ctrlr branch less equal unsigned")
5540(conditional-branch-ctrlr bc hi I OP_0E OPE3_03 Ihi NA "integer ctrlr branch greater unsigned")
5541(conditional-branch-ctrlr bc c I OP_0E OPE3_03 Ic NA "integer ctrlr branch carry set")
5542(conditional-branch-ctrlr bc nc I OP_0E OPE3_03 Inc NA "integer ctrlr branch carry clear")
5543(conditional-branch-ctrlr bc n I OP_0E OPE3_03 In NA "integer ctrlr branch negative")
5544(conditional-branch-ctrlr bc p I OP_0E OPE3_03 Ip NA "integer ctrlr branch positive")
5545(conditional-branch-ctrlr bc v I OP_0E OPE3_03 Iv NA "integer ctrlr branch overflow set")
5546(conditional-branch-ctrlr bc nv I OP_0E OPE3_03 Inv NA "integer ctrlr branch overflow clear")
5547
5548(dni fcbralr
5549 "float ctrlr branch always"
ac7c07ac 5550 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
9aab5aa3
AC
5551 "fcbralr$pack $ccond$hint_taken"
5552 (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_07 ccond (s12-null))
5553 (sequence ()
5554 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken)
5555 (ctrlr-branch-semantics (const BI 1) ccond))
5556 ((fr400 (unit u-branch))
ac7c07ac 5557 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5558)
5559
5560(dni fcbnolr
5561 "float ctrlr branch never"
ac7c07ac 5562 ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS)
9aab5aa3
AC
5563 "fcbnolr$pack$hint_not_taken"
5564 (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_07 (ccond-null) (s12-null))
5565 (sequence ()
5566 (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken)
5567 (ctrlr-branch-semantics (const BI 0) ccond))
5568 ((fr400 (unit u-branch))
ac7c07ac 5569 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5570)
5571
5572(conditional-branch-ctrlr fcb eq F OP_0E OPE3_07 Feq FR-ACCESS "float cclr branch equal")
5573(conditional-branch-ctrlr fcb ne F OP_0E OPE3_07 Fne FR-ACCESS "float cclr branch not equal")
5574(conditional-branch-ctrlr fcb lg F OP_0E OPE3_07 Flg FR-ACCESS "float branch less or greater")
5575(conditional-branch-ctrlr fcb ue F OP_0E OPE3_07 Fue FR-ACCESS "float branch unordered or equal")
5576(conditional-branch-ctrlr fcb ul F OP_0E OPE3_07 Ful FR-ACCESS "float branch unordered or less")
5577(conditional-branch-ctrlr fcb ge F OP_0E OPE3_07 Fge FR-ACCESS "float branch greater or equal")
5578(conditional-branch-ctrlr fcb lt F OP_0E OPE3_07 Flt FR-ACCESS "float branch less")
5579(conditional-branch-ctrlr fcb uge F OP_0E OPE3_07 Fuge FR-ACCESS "float branch unordered, greater, equal")
5580(conditional-branch-ctrlr fcb ug F OP_0E OPE3_07 Fug FR-ACCESS "float branch unordered or greater")
5581(conditional-branch-ctrlr fcb le F OP_0E OPE3_07 Fle FR-ACCESS "float branch less or equal")
5582(conditional-branch-ctrlr fcb gt F OP_0E OPE3_07 Fgt FR-ACCESS "float branch greater")
5583(conditional-branch-ctrlr fcb ule F OP_0E OPE3_07 Fule FR-ACCESS "float branch unordered, less or equal")
5584(conditional-branch-ctrlr fcb u F OP_0E OPE3_07 Fu FR-ACCESS "float branch unordered")
5585(conditional-branch-ctrlr fcb o F OP_0E OPE3_07 Fo FR-ACCESS "float branch ordered")
5586
5587(define-pmacro (jump-and-link-semantics base offset LI)
5588 (sequence ()
5589 (if (eq LI 1)
5590 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1))
5591 ; Target address gets aligned here
5592 (set pc (and (add base offset) #xfffffffc))
5593 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5594)
5595
5596(dni jmpl
5597 "jump and link"
ac7c07ac 5598 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
9aab5aa3
AC
5599 "jmpl$pack @($GRi,$GRj)"
5600 (+ pack (misc-null-1) (LI-off) OP_0C GRi (misc-null-2) GRj)
5601 (jump-and-link-semantics GRi GRj LI)
5602 ((fr400 (unit u-branch))
ac7c07ac 5603 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5604)
5605
5606(dni calll
5607 "call and link"
5608 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5609 "calll$pack @($GRi,$GRj)"
5610 (+ pack (misc-null-1) (LI-on) OP_0C GRi (misc-null-2) GRj)
5611 (jump-and-link-semantics GRi GRj LI)
5612 ((fr400 (unit u-branch))
5613 (fr500 (unit u-branch)))
5614)
5615
5616(dni jmpil
5617 "jump immediate and link"
ac7c07ac 5618 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5))
9aab5aa3
AC
5619 "jmpil$pack @($GRi,$s12)"
5620 (+ pack (misc-null-1) (LI-off) OP_0D GRi s12)
5621 (jump-and-link-semantics GRi s12 LI)
5622 ((fr400 (unit u-branch))
ac7c07ac 5623 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5624)
5625
5626(dni callil
5627 "call immediate and link"
5628 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5))
5629 "callil$pack @($GRi,$s12)"
5630 (+ pack (misc-null-1) (LI-on) OP_0D GRi s12)
5631 (jump-and-link-semantics GRi s12 LI)
5632 ((fr400 (unit u-branch))
5633 (fr500 (unit u-branch)))
5634)
5635
5636(dni call
5637 "call and link"
ac7c07ac 5638 ((UNIT B0) (FR500-MAJOR B-4) (FR550-MAJOR B-4) (FR400-MAJOR B-4))
9aab5aa3
AC
5639 "call$pack $label24"
5640 (+ pack OP_0F label24)
5641 (sequence ()
5642 (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1)
5643 (set pc label24)
5644 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5645 ((fr400 (unit u-branch))
ac7c07ac 5646 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
5647)
5648
5649(dni rett
5650 "return from trap"
ac7c07ac 5651 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) PRIVILEGED)
9aab5aa3
AC
5652 "rett$pack $debug"
5653 (+ pack (misc-null-1) debug OP_05 (rs-null) (s12-null))
5654 ; frv_rett handles operating vs user mode
5655 (sequence ()
5656 (set pc (c-call UWI "frv_rett" pc debug))
5657 (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken
5658 ()
5659)
5660
5661(dni rei
5662 "run exception instruction"
5663 ((UNIT C) (FR500-MAJOR C-1) (MACH frv) PRIVILEGED)
5664 "rei$pack $eir"
5665 (+ pack (rd-null) OP_37 eir (s12-null))
5666 (nop) ; for now
5667 ()
5668)
5669
5670(define-pmacro (trap-semantics cond base offset)
5671 (if cond
5672 (sequence ()
5673 ; This is defered to frv_itrap because for the breakpoint
5674 ; case we want to change as little of the machine state as
5675 ; possible.
5676 ;
5677 ; PCSR=PC
5678 ; PSR.PS=PSR.S
5679 ; PSR.ET=0
5680 ; if PSR.ESR==1
5681 ; SR0 through SR3=GR4 through GR7
5682 ; TBR.TT=0x80 + ((GRi + s12) & 0x7f)
5683 ; PC=TBR
5684 ; We still should indicate what is modified by this insn.
5685 (clobber (spr-pcsr))
5686 (clobber psr_ps)
5687 (clobber psr_et)
5688 (clobber tbr_tt)
5689 (if (ne psr_esr (const 0))
5690 (sequence ()
5691 (clobber (spr-sr0))
5692 (clobber (spr-sr1))
5693 (clobber (spr-sr2))
5694 (clobber (spr-sr3))))
5695 ; frv_itrap handles operating vs user mode
5696 (c-call VOID "frv_itrap" pc base offset)))
5697)
5698
5699(define-pmacro (trap-r prefix cc i-f op ope cond attr comment)
5700 (dni (.sym prefix cc)
5701 (comment)
ac7c07ac 5702 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
9aab5aa3
AC
5703 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$GRj")
5704 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi (misc-null-3) ope GRj)
5705 (trap-semantics (cond (.sym i-f CCi_2)) GRi GRj)
5706 ((fr400 (unit u-trap))
ac7c07ac 5707 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5708 )
5709)
5710
5711(dni tra
5712 "integer trap always"
ac7c07ac 5713 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
9aab5aa3
AC
5714 "tra$pack $GRi,$GRj"
5715 (+ pack ICC_ra (ICCi_2-null) OP_04 GRi (misc-null-3) OPE4_0 GRj)
5716 (trap-semantics (const BI 1) GRi GRj)
5717 ((fr400 (unit u-trap))
ac7c07ac 5718 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5719)
5720
5721(dni tno
5722 "integer trap never"
ac7c07ac 5723 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
9aab5aa3
AC
5724 "tno$pack"
5725 (+ pack ICC_nev (ICCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_0 (GRj-null))
5726 (trap-semantics (const BI 0) GRi GRj)
5727 ((fr400 (unit u-trap))
ac7c07ac 5728 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5729)
5730
5731(trap-r t eq I OP_04 OPE4_0 Ieq NA "integer trap equal")
5732(trap-r t ne I OP_04 OPE4_0 Ine NA "integer trap not equal")
5733(trap-r t le I OP_04 OPE4_0 Ile NA "integer trap less or equal")
5734(trap-r t gt I OP_04 OPE4_0 Igt NA "integer trap greater")
5735(trap-r t lt I OP_04 OPE4_0 Ilt NA "integer trap less")
5736(trap-r t ge I OP_04 OPE4_0 Ige NA "integer trap greater or equal")
5737(trap-r t ls I OP_04 OPE4_0 Ils NA "integer trap less or equal unsigned")
5738(trap-r t hi I OP_04 OPE4_0 Ihi NA "integer trap greater unsigned")
5739(trap-r t c I OP_04 OPE4_0 Ic NA "integer trap carry set")
5740(trap-r t nc I OP_04 OPE4_0 Inc NA "integer trap carry clear")
5741(trap-r t n I OP_04 OPE4_0 In NA "integer trap negative")
5742(trap-r t p I OP_04 OPE4_0 Ip NA "integer trap positive")
5743(trap-r t v I OP_04 OPE4_0 Iv NA "integer trap overflow set")
5744(trap-r t nv I OP_04 OPE4_0 Inv NA "integer trap overflow clear")
5745
5746(dni ftra
5747 "float trap always"
ac7c07ac 5748 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
9aab5aa3
AC
5749 "ftra$pack $GRi,$GRj"
5750 (+ pack FCC_ra (FCCi_2-null) OP_04 GRi (misc-null-3) OPE4_1 GRj)
5751 (trap-semantics (const BI 1) GRi GRj)
5752 ((fr400 (unit u-trap))
ac7c07ac 5753 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5754)
5755
5756(dni ftno
5757 "flost trap never"
ac7c07ac 5758 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
9aab5aa3
AC
5759 "ftno$pack"
5760 (+ pack FCC_nev (FCCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_1 (GRj-null))
5761 (trap-semantics (const BI 0) GRi GRj)
5762 ((fr400 (unit u-trap))
ac7c07ac 5763 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5764)
5765
5766(trap-r ft ne F OP_04 OPE4_1 Fne FR-ACCESS "float trap not equal")
5767(trap-r ft eq F OP_04 OPE4_1 Feq FR-ACCESS "float trap equal")
5768(trap-r ft lg F OP_04 OPE4_1 Flg FR-ACCESS "float trap greater or less")
5769(trap-r ft ue F OP_04 OPE4_1 Fue FR-ACCESS "float trap unordered or equal")
5770(trap-r ft ul F OP_04 OPE4_1 Ful FR-ACCESS "float trap unordered or less")
5771(trap-r ft ge F OP_04 OPE4_1 Fge FR-ACCESS "float trap greater or equal")
5772(trap-r ft lt F OP_04 OPE4_1 Flt FR-ACCESS "float trap less")
5773(trap-r ft uge F OP_04 OPE4_1 Fuge FR-ACCESS "float trap unordered greater or equal")
5774(trap-r ft ug F OP_04 OPE4_1 Fug FR-ACCESS "float trap unordered or greater")
5775(trap-r ft le F OP_04 OPE4_1 Fle FR-ACCESS "float trap less or equal")
5776(trap-r ft gt F OP_04 OPE4_1 Fgt FR-ACCESS "float trap greater")
5777(trap-r ft ule F OP_04 OPE4_1 Fule FR-ACCESS "float trap unordered less or equal")
5778(trap-r ft u F OP_04 OPE4_1 Fu FR-ACCESS "float trap unordered")
5779(trap-r ft o F OP_04 OPE4_1 Fo FR-ACCESS "float trap ordered")
5780
5781(define-pmacro (trap-immed prefix cc i-f op cond attr comment)
5782 (dni (.sym prefix cc)
5783 (comment)
ac7c07ac 5784 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr)
9aab5aa3
AC
5785 (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$s12")
5786 (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi s12)
5787 (trap-semantics (cond (.sym i-f CCi_2)) GRi s12)
5788 ((fr400 (unit u-trap))
ac7c07ac 5789 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5790 )
5791)
5792
5793(dni tira
5794 "integer trap always"
ac7c07ac 5795 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
9aab5aa3
AC
5796 "tira$pack $GRi,$s12"
5797 (+ pack ICC_ra (ICCi_2-null) OP_1C GRi s12)
5798 (trap-semantics (const BI 1) GRi s12)
5799 ((fr400 (unit u-trap))
ac7c07ac 5800 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5801)
5802
5803(dni tino
5804 "integer trap never"
ac7c07ac 5805 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
9aab5aa3
AC
5806 "tino$pack"
5807 (+ pack ICC_nev (ICCi_2-null) OP_1C (GRi-null) (s12-null))
5808 (trap-semantics (const BI 0) GRi s12)
5809 ((fr400 (unit u-trap))
ac7c07ac 5810 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5811)
5812
5813(trap-immed ti eq I OP_1C Ieq NA "integer trap equal")
5814(trap-immed ti ne I OP_1C Ine NA "integer trap not equal")
5815(trap-immed ti le I OP_1C Ile NA "integer trap less or equal")
5816(trap-immed ti gt I OP_1C Igt NA "integer trap greater")
5817(trap-immed ti lt I OP_1C Ilt NA "integer trap less")
5818(trap-immed ti ge I OP_1C Ige NA "integer trap greater or equal")
5819(trap-immed ti ls I OP_1C Ils NA "integer trap less or equal unsigned")
5820(trap-immed ti hi I OP_1C Ihi NA "integer trap greater unsigned")
5821(trap-immed ti c I OP_1C Ic NA "integer trap carry set")
5822(trap-immed ti nc I OP_1C Inc NA "integer trap carry clear")
5823(trap-immed ti n I OP_1C In NA "integer trap negative")
5824(trap-immed ti p I OP_1C Ip NA "integer trap positive")
5825(trap-immed ti v I OP_1C Iv NA "integer trap overflow set")
5826(trap-immed ti nv I OP_1C Inv NA "integer trap overflow clear")
5827
5828(dni ftira
5829 "float trap always"
ac7c07ac 5830 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
9aab5aa3
AC
5831 "ftira$pack $GRi,$s12"
5832 (+ pack FCC_ra (ICCi_2-null) OP_1D GRi s12)
5833 (trap-semantics (const BI 1) GRi s12)
5834 ((fr400 (unit u-trap))
ac7c07ac 5835 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5836)
5837
5838(dni ftino
5839 "float trap never"
ac7c07ac 5840 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
9aab5aa3
AC
5841 "ftino$pack"
5842 (+ pack FCC_nev (FCCi_2-null) OP_1D (GRi-null) (s12-null))
5843 (trap-semantics (const BI 0) GRi s12)
5844 ((fr400 (unit u-trap))
ac7c07ac 5845 (fr500 (unit u-trap)) (fr550 (unit u-trap)))
9aab5aa3
AC
5846)
5847
5848(trap-immed fti ne F OP_1D Fne FR-ACCESS "float trap not equal")
5849(trap-immed fti eq F OP_1D Feq FR-ACCESS "float trap equal")
5850(trap-immed fti lg F OP_1D Flg FR-ACCESS "float trap greater or less")
5851(trap-immed fti ue F OP_1D Fue FR-ACCESS "float trap unordered or equal")
5852(trap-immed fti ul F OP_1D Ful FR-ACCESS "float trap unordered or less")
5853(trap-immed fti ge F OP_1D Fge FR-ACCESS "float trap greater or equal")
5854(trap-immed fti lt F OP_1D Flt FR-ACCESS "float trap less")
5855(trap-immed fti uge F OP_1D Fuge FR-ACCESS "float trap unordered greater or equal")
5856(trap-immed fti ug F OP_1D Fug FR-ACCESS "float trap unordered or greater")
5857(trap-immed fti le F OP_1D Fle FR-ACCESS "float trap less or equal")
5858(trap-immed fti gt F OP_1D Fgt FR-ACCESS "float trap greater")
5859(trap-immed fti ule F OP_1D Fule FR-ACCESS "float trap unordered less or equal")
5860(trap-immed fti u F OP_1D Fu FR-ACCESS "float trap unordered")
5861(trap-immed fti o F OP_1D Fo FR-ACCESS "float trap ordered")
5862
5863(dni break
5864 "break trap"
ac7c07ac 5865 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1))
9aab5aa3
AC
5866 "break$pack"
5867 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_3 (GRj-null))
5868 (sequence ()
5869 ; This is defered to frv_break because for the breakpoint
5870 ; case we want to change as little of the machine state as
5871 ; possible.
5872 ;
5873 ; BPCSR=PC
5874 ; BPSR.BS=PSR.S
5875 ; BPSR.BET=PSR.ET
5876 ; PSR.S=1
5877 ; PSR.ET=0
5878 ; TBR.TT=0xff
5879 ; PC=TBR
5880 ; We still should indicate what is modified by this insn.
5881 (clobber (spr-bpcsr))
5882 (clobber bpsr_bs)
5883 (clobber bpsr_bet)
5884 (clobber psr_s)
5885 (clobber psr_et)
5886 (clobber tbr_tt)
5887 (c-call VOID "frv_break"))
5888 ()
5889)
5890
5891(dni mtrap
5892 "media trap"
ac7c07ac 5893 ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS)
9aab5aa3
AC
5894 "mtrap$pack"
5895 (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_2 (GRj-null))
5896 (c-call VOID "frv_mtrap")
5897 ()
5898)
5899
5900(define-pmacro (condition-code-logic name operation ope comment)
5901 (dni name
5902 (comment)
ac7c07ac 5903 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
9aab5aa3
AC
5904 (.str name "$pack $CRi,$CRj,$CRk")
5905 (+ pack (misc-null-6) CRk OP_0A (misc-null-7) CRi ope (misc-null-8) CRj)
5906 (set CRk (c-call UQI "@cpu@_cr_logic" operation CRi CRj))
5907 ()
5908 )
5909)
5910(define-pmacro (op-andcr) 0)
5911(define-pmacro (op-orcr) 1)
5912(define-pmacro (op-xorcr) 2)
5913(define-pmacro (op-nandcr) 3)
5914(define-pmacro (op-norcr) 4)
5915(define-pmacro (op-andncr) 5)
5916(define-pmacro (op-orncr) 6)
5917(define-pmacro (op-nandncr) 7)
5918(define-pmacro (op-norncr) 8)
5919
5920(define-pmacro (cr-true) 3)
5921(define-pmacro (cr-false) 2)
5922(define-pmacro (cr-undefined) 0)
5923
5924(condition-code-logic andcr (op-andcr) OPE1_08 "and condition code regs")
5925(condition-code-logic orcr (op-orcr) OPE1_09 "or condition code regs")
5926(condition-code-logic xorcr (op-xorcr) OPE1_0A "xor condition code regs")
5927(condition-code-logic nandcr (op-nandcr) OPE1_0C "nand condition code regs")
5928(condition-code-logic norcr (op-norcr) OPE1_0D "nor condition code regs")
5929(condition-code-logic andncr (op-andncr) OPE1_10 "andn condition code regs")
5930(condition-code-logic orncr (op-orncr) OPE1_11 "orn condition code regs")
5931(condition-code-logic nandncr (op-nandncr) OPE1_14 "nandn condition code regs")
5932(condition-code-logic norncr (op-norncr) OPE1_15 "norn condition code regs")
5933
5934(dni notcr
5935 ("not cccr register")
ac7c07ac 5936 ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6))
9aab5aa3
AC
5937 (.str notcr "$pack $CRj,$CRk")
5938 (+ pack (misc-null-6) CRk OP_0A (rs-null) OPE1_0B (misc-null-8) CRj)
5939 (set CRk (xor CRj 1))
5940 ()
5941)
5942
5943(define-pmacro (check-semantics cond cr)
5944 (if cond (set cr (cr-true)) (set cr (cr-false)))
5945)
5946
5947(define-pmacro (check-int-condition-code prefix cc op cond comment)
5948 (dni (.sym prefix cc)
5949 (comment)
ac7c07ac 5950 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
9aab5aa3
AC
5951 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int")
5952 (+ pack (.sym ICC_ cc) CRj_int op (misc-null-5) ICCi_3)
5953 (check-semantics (cond ICCi_3) CRj_int)
5954 ((fr400 (unit u-check))
ac7c07ac 5955 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
5956 )
5957)
5958
5959(dni ckra
5960 "check integer cc always"
ac7c07ac 5961 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
9aab5aa3
AC
5962 "ckra$pack $CRj_int"
5963 (+ pack ICC_ra CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5964 (check-semantics (const BI 1) CRj_int)
5965 ((fr400 (unit u-check))
ac7c07ac 5966 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
5967)
5968
5969(dni ckno
5970 "check integer cc never"
ac7c07ac 5971 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5))
9aab5aa3
AC
5972 "ckno$pack $CRj_int"
5973 (+ pack ICC_nev CRj_int OP_08 (misc-null-5) (ICCi_3-null))
5974 (check-semantics (const BI 0) CRj_int)
5975 ((fr400 (unit u-check))
ac7c07ac 5976 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
5977)
5978
5979(check-int-condition-code ck eq OP_08 Ieq "check integer cc equal")
5980(check-int-condition-code ck ne OP_08 Ine "check integer cc not equal")
5981(check-int-condition-code ck le OP_08 Ile "check integer cc less or equal")
5982(check-int-condition-code ck gt OP_08 Igt "check integer cc greater")
5983(check-int-condition-code ck lt OP_08 Ilt "check integer cc less")
5984(check-int-condition-code ck ge OP_08 Ige "check integer cc greater or equal")
5985(check-int-condition-code ck ls OP_08 Ils "check integer cc less or equal unsigned")
5986(check-int-condition-code ck hi OP_08 Ihi "check integer cc greater unsigned")
5987(check-int-condition-code ck c OP_08 Ic "check integer cc carry set")
5988(check-int-condition-code ck nc OP_08 Inc "check integer cc carry clear")
5989(check-int-condition-code ck n OP_08 In "check integer cc negative")
5990(check-int-condition-code ck p OP_08 Ip "check integer cc positive")
5991(check-int-condition-code ck v OP_08 Iv "check integer cc overflow set")
5992(check-int-condition-code ck nv OP_08 Inv "check integer cc overflow clear")
5993
5994(define-pmacro (check-float-condition-code prefix cc op cond comment)
5995 (dni (.sym prefix cc)
5996 (comment)
ac7c07ac 5997 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
9aab5aa3
AC
5998 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float")
5999 (+ pack (.sym FCC_ cc) CRj_float op (misc-null-5) FCCi_3)
6000 (check-semantics (cond FCCi_3) CRj_float)
6001 ((fr400 (unit u-check))
ac7c07ac 6002 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6003 )
6004)
6005
6006(dni fckra
6007 "check float cc always"
ac7c07ac 6008 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
9aab5aa3
AC
6009 "fckra$pack $CRj_float"
6010 (+ pack FCC_ra CRj_float OP_09 (misc-null-5) FCCi_3)
6011 (check-semantics (const BI 1) CRj_float)
6012 ((fr400 (unit u-check))
ac7c07ac 6013 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6014)
6015
6016(dni fckno
6017 "check float cc never"
ac7c07ac 6018 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS)
9aab5aa3
AC
6019 "fckno$pack $CRj_float"
6020 (+ pack FCC_nev CRj_float OP_09 (misc-null-5) FCCi_3)
6021 (check-semantics (const BI 0) CRj_float)
6022 ((fr400 (unit u-check))
ac7c07ac 6023 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6024)
6025
6026(check-float-condition-code fck ne OP_09 Fne "check float cc not equal")
6027(check-float-condition-code fck eq OP_09 Feq "check float cc equal")
6028(check-float-condition-code fck lg OP_09 Flg "check float cc greater or less")
6029(check-float-condition-code fck ue OP_09 Fue "check float cc unordered or equal")
6030(check-float-condition-code fck ul OP_09 Ful "check float cc unordered or less")
6031(check-float-condition-code fck ge OP_09 Fge "check float cc greater or equal")
6032(check-float-condition-code fck lt OP_09 Flt "check float cc less")
6033(check-float-condition-code fck uge OP_09 Fuge "check float cc unordered greater or equal")
6034(check-float-condition-code fck ug OP_09 Fug "check float cc unordered or greater")
6035(check-float-condition-code fck le OP_09 Fle "check float cc less or equal")
6036(check-float-condition-code fck gt OP_09 Fgt "check float cc greater")
6037(check-float-condition-code fck ule OP_09 Fule "check float cc unordered less or equal")
6038(check-float-condition-code fck u OP_09 Fu "check float cc unordered")
6039(check-float-condition-code fck o OP_09 Fo "check float cc ordered")
6040
6041(define-pmacro (conditional-check-int-condition-code prefix cc op ope test comment)
6042 (dni (.sym prefix cc)
6043 (comment)
ac7c07ac 6044 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
9aab5aa3
AC
6045 (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int,$CCi,$cond")
6046 (+ pack (.sym ICC_ cc) CRj_int op (rs-null) CCi cond ope
6047 (misc-null-9) ICCi_3)
6048 (if (eq CCi (or cond 2))
6049 (check-semantics (test ICCi_3) CRj_int)
6050 (set CRj_int (cr-undefined)))
6051 ((fr400 (unit u-check))
ac7c07ac 6052 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6053 )
6054)
6055
6056(dni cckra
6057 "conditional check integer cc always"
ac7c07ac 6058 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
9aab5aa3
AC
6059 "cckra$pack $CRj_int,$CCi,$cond"
6060 (+ pack ICC_ra 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 1) CRj_int)
6064 (set CRj_int (cr-undefined)))
6065 ((fr400 (unit u-check))
ac7c07ac 6066 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6067)
6068
6069(dni cckno
6070 "conditional check integer cc never"
ac7c07ac 6071 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL)
9aab5aa3
AC
6072 "cckno$pack $CRj_int,$CCi,$cond"
6073 (+ pack ICC_nev CRj_int OP_6A (rs-null) CCi cond OPE4_0
6074 (misc-null-9) (ICCi_3-null))
6075 (if (eq CCi (or cond 2))
6076 (check-semantics (const BI 0) CRj_int)
6077 (set CRj_int (cr-undefined)))
6078 ((fr400 (unit u-check))
ac7c07ac 6079 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6080)
6081
6082(conditional-check-int-condition-code cck eq OP_6A OPE4_0 Ieq "check integer cc equal")
6083(conditional-check-int-condition-code cck ne OP_6A OPE4_0 Ine "check integer cc not equal")
6084(conditional-check-int-condition-code cck le OP_6A OPE4_0 Ile "check integer cc less or equal")
6085(conditional-check-int-condition-code cck gt OP_6A OPE4_0 Igt "check integer cc greater")
6086(conditional-check-int-condition-code cck lt OP_6A OPE4_0 Ilt "check integer cc less")
6087(conditional-check-int-condition-code cck ge OP_6A OPE4_0 Ige "check integer cc greater or equal")
6088(conditional-check-int-condition-code cck ls OP_6A OPE4_0 Ils "check integer cc less or equal unsigned")
6089(conditional-check-int-condition-code cck hi OP_6A OPE4_0 Ihi "check integer cc greater unsigned")
6090(conditional-check-int-condition-code cck c OP_6A OPE4_0 Ic "check integer cc carry set")
6091(conditional-check-int-condition-code cck nc OP_6A OPE4_0 Inc "check integer cc carry clear")
6092(conditional-check-int-condition-code cck n OP_6A OPE4_0 In "check integer cc negative")
6093(conditional-check-int-condition-code cck p OP_6A OPE4_0 Ip "check integer cc positive")
6094(conditional-check-int-condition-code cck v OP_6A OPE4_0 Iv "check integer cc overflow set")
6095(conditional-check-int-condition-code cck nv OP_6A OPE4_0 Inv "check integer cc overflow clear")
6096
6097(define-pmacro (conditional-check-float-condition-code prefix cc op ope test comment)
6098 (dni (.sym prefix cc)
6099 (comment)
ac7c07ac 6100 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
6101 (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float,$CCi,$cond")
6102 (+ pack (.sym FCC_ cc) CRj_float op (rs-null) CCi cond ope
6103 (misc-null-9) FCCi_3)
6104 (if (eq CCi (or cond 2))
6105 (check-semantics (test FCCi_3) CRj_float)
6106 (set CRj_float (cr-undefined)))
6107 ((fr400 (unit u-check))
ac7c07ac 6108 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6109 )
6110)
6111
6112(dni cfckra
6113 "conditional check float cc always"
ac7c07ac 6114 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
6115 "cfckra$pack $CRj_float,$CCi,$cond"
6116 (+ pack FCC_ra 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 1) CRj_float)
6120 (set CRj_float (cr-undefined)))
6121 ((fr400 (unit u-check))
ac7c07ac 6122 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6123)
6124
6125(dni cfckno
6126 "conditional check float cc never"
ac7c07ac 6127 ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS)
9aab5aa3
AC
6128 "cfckno$pack $CRj_float,$CCi,$cond"
6129 (+ pack FCC_nev CRj_float OP_6A (rs-null) CCi cond OPE4_1
6130 (misc-null-9) (FCCi_3-null))
6131 (if (eq CCi (or cond 2))
6132 (check-semantics (const BI 0) CRj_float)
6133 (set CRj_float (cr-undefined)))
6134 ((fr400 (unit u-check))
ac7c07ac 6135 (fr500 (unit u-check)) (fr550 (unit u-check)))
9aab5aa3
AC
6136)
6137
6138(conditional-check-float-condition-code cfck ne OP_6A OPE4_1 Fne "check float cc not equal")
6139(conditional-check-float-condition-code cfck eq OP_6A OPE4_1 Feq "check float cc equal")
6140(conditional-check-float-condition-code cfck lg OP_6A OPE4_1 Flg "check float cc greater or less")
6141(conditional-check-float-condition-code cfck ue OP_6A OPE4_1 Fue "check float cc unordered or equal")
6142(conditional-check-float-condition-code cfck ul OP_6A OPE4_1 Ful "check float cc unordered or less")
6143(conditional-check-float-condition-code cfck ge OP_6A OPE4_1 Fge "check float cc greater or equal")
6144(conditional-check-float-condition-code cfck lt OP_6A OPE4_1 Flt "check float cc less")
6145(conditional-check-float-condition-code cfck uge OP_6A OPE4_1 Fuge "check float cc unordered greater or equal")
6146(conditional-check-float-condition-code cfck ug OP_6A OPE4_1 Fug "check float cc unordered or greater")
6147(conditional-check-float-condition-code cfck le OP_6A OPE4_1 Fle "check float cc less or equal")
6148(conditional-check-float-condition-code cfck gt OP_6A OPE4_1 Fgt "check float cc greater")
6149(conditional-check-float-condition-code cfck ule OP_6A OPE4_1 Fule "check float cc unordered less or equal")
6150(conditional-check-float-condition-code cfck u OP_6A OPE4_1 Fu "check float cc unordered")
6151(conditional-check-float-condition-code cfck o OP_6A OPE4_1 Fo "check float cc ordered")
6152
6153(dni cjmpl
6154 "conditional jump and link"
ac7c07ac 6155 ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5) CONDITIONAL)
9aab5aa3
AC
6156 "cjmpl$pack @($GRi,$GRj),$CCi,$cond"
6157 (+ pack (misc-null-1) (LI-off) OP_6A GRi CCi cond OPE4_2 GRj)
6158 (if (eq CCi (or cond 2))
6159 (jump-and-link-semantics GRi GRj LI))
6160 ((fr400 (unit u-branch))
ac7c07ac 6161 (fr500 (unit u-branch)) (fr550 (unit u-branch)))
9aab5aa3
AC
6162)
6163
6164(dni ccalll
6165 "conditional call and link"
6166 ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5) CONDITIONAL)
6167 "ccalll$pack @($GRi,$GRj),$CCi,$cond"
6168 (+ pack (misc-null-1) (LI-on) OP_6A GRi CCi cond OPE4_2 GRj)
6169 (if (eq CCi (or cond 2))
6170 (jump-and-link-semantics GRi GRj LI))
6171 ((fr400 (unit u-branch))
6172 (fr500 (unit u-branch)))
6173)
6174
6175(define-pmacro (cache-invalidate name cache all op ope profile comment)
6176 (dni name
6177 (comment)
ac7c07ac 6178 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
6179 (.str name "$pack @($GRi,$GRj)")
6180 (+ pack (rd-null) op GRi ope GRj)
6181 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) all)
6182 profile
6183 )
6184)
6185
6186(cache-invalidate ici insn 0 OP_03 OPE1_38
ac7c07ac 6187 ((fr400 (unit u-ici)) (fr500 (unit u-ici)) (fr550 (unit u-ici)))
9aab5aa3
AC
6188 "invalidate insn cache")
6189(cache-invalidate dci data 0 OP_03 OPE1_3C
ac7c07ac 6190 ((fr400 (unit u-dci)) (fr500 (unit u-dci)) (fr550 (unit u-dci)))
9aab5aa3
AC
6191 "invalidate data cache")
6192
6193(define-pmacro (cache-invalidate-entry name cache op ope profile comment)
6194 (dni name
6195 (comment)
ac7c07ac 6196 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
9aab5aa3
AC
6197 (.str name "$pack @($GRi,$GRj),$ae")
6198 (+ pack (misc-null-1) ae op GRi ope GRj)
6199 (if (eq ae 0)
6200 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) -1) ; Invalid ae setting for this insn
6201 (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) ae))
6202 profile
6203 )
6204)
6205
6206(cache-invalidate-entry icei insn OP_03 OPE1_39
ac7c07ac 6207 ((fr400 (unit u-ici)) (fr550 (unit u-ici)))
9aab5aa3
AC
6208 "invalidate insn cache entry")
6209(cache-invalidate-entry dcei data OP_03 OPE1_3A
ac7c07ac 6210 ((fr400 (unit u-dci)) (fr550 (unit u-dci)))
9aab5aa3
AC
6211 "invalidate data cache entry")
6212
6213(dni dcf
6214 "Data cache flush"
ac7c07ac 6215 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
6216 "dcf$pack @($GRi,$GRj)"
6217 (+ pack (rd-null) OP_03 GRi OPE1_3D GRj)
6218 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) 0)
6219 ((fr400 (unit u-dcf))
ac7c07ac 6220 (fr500 (unit u-dcf)) (fr550 (unit u-dcf)))
9aab5aa3
AC
6221)
6222
6223(dni dcef
6224 "Data cache entry flush"
ac7c07ac 6225 ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550))
9aab5aa3
AC
6226 "dcef$pack @($GRi,$GRj),$ae"
6227 (+ pack (misc-null-1) ae OP_03 GRi OPE1_3B GRj)
6228 (if (eq ae 0)
6229 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) -1)
6230 (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) ae))
ac7c07ac 6231 ((fr400 (unit u-dcf)) (fr550 (unit u-dcf)))
9aab5aa3
AC
6232)
6233
6234(define-pmacro (write-TLB name insn op ope comment)
6235 (dni name
6236 (comment)
6237 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6238 (.str insn "$pack $GRk,@($GRi,$GRj)")
6239 (+ pack GRk op GRi ope GRj)
6240 (nop) ; for now
6241 ()
6242 )
6243)
6244
6245(write-TLB witlb witlb OP_03 OPE1_32 "write for insn TLB")
6246(write-TLB wdtlb wdtlb OP_03 OPE1_36 "write for data TLB")
6247
6248(define-pmacro (invalidate-TLB name insn op ope comment)
6249 (dni name
6250 (comment)
6251 ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED)
6252 (.str insn "$pack @($GRi,$GRj)")
6253 (+ pack (rd-null) op GRi ope GRj)
6254 (nop) ; for now
6255 ()
6256 )
6257)
6258
6259(invalidate-TLB itlbi itlbi OP_03 OPE1_33 "invalidate insn TLB")
6260(invalidate-TLB dtlbi dtlbi OP_03 OPE1_37 "invalidate data TLB")
6261
0457efce 6262(define-pmacro (cache-preload name cache pipe attrs op ope profile comment)
9aab5aa3
AC
6263 (dni name
6264 (comment)
0457efce 6265 (.splice (UNIT pipe) (FR500-MAJOR C-2) (FR400-MAJOR C-2) (.unsplice attrs))
9aab5aa3
AC
6266 (.str name "$pack $GRi,$GRj,$lock")
6267 (+ pack (misc-null-1) lock op GRi ope GRj)
6268 (c-call VOID (.str "@cpu@_" cache "_cache_preload") GRi GRj lock)
6269 profile
6270 )
6271)
6272
ac7c07ac
DB
6273(cache-preload icpl insn C ((FR550-MAJOR C-2)) OP_03 OPE1_30
6274 ((fr400 (unit u-icpl)) (fr500 (unit u-icpl)) (fr550 (unit u-icpl)))
9aab5aa3 6275 "preload insn cache")
ac7c07ac
DB
6276(cache-preload dcpl data DCPL ((FR550-MAJOR I-8)) OP_03 OPE1_34
6277 ((fr400 (unit u-dcpl)) (fr500 (unit u-dcpl)) (fr550 (unit u-dcpl)))
9aab5aa3
AC
6278 "preload data cache")
6279
6280(define-pmacro (cache-unlock name cache op ope profile comment)
6281 (dni name
6282 (comment)
ac7c07ac 6283 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
6284 (.str name "$pack $GRi")
6285 (+ pack (rd-null) op GRi ope (GRj-null))
6286 (c-call VOID (.str "@cpu@_" cache "_cache_unlock") GRi)
6287 profile
6288 )
6289)
6290
6291(cache-unlock icul insn OP_03 OPE1_31
ac7c07ac 6292 ((fr400 (unit u-icul)) (fr500 (unit u-icul)) (fr550 (unit u-icul)))
9aab5aa3
AC
6293 "unlock insn cache")
6294(cache-unlock dcul data OP_03 OPE1_35
ac7c07ac 6295 ((fr400 (unit u-dcul)) (fr500 (unit u-dcul)) (fr550 (unit u-dcul)))
9aab5aa3
AC
6296 "unlock data cache")
6297
6298(define-pmacro (barrier name insn op ope profile comment)
6299 (dni name
6300 (comment)
ac7c07ac 6301 ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2))
9aab5aa3
AC
6302 (.str insn "$pack")
6303 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6304 (nop) ; sufficient implementation
6305 profile
6306 )
6307)
6308
6309(barrier bar bar OP_03 OPE1_3E
6310 ((fr400 (unit u-barrier)) (fr500 (unit u-barrier)))
6311 "barrier")
6312(barrier membar membar OP_03 OPE1_3F
6313 ((fr400 (unit u-membar)) (fr500 (unit u-membar)))
6314 "memory barrier")
6315
6316; Coprocessor operations
6317(define-pmacro (cop-op num op)
6318 (dni (.sym cop num)
6319 "Coprocessor operation"
6320 ((UNIT C) (FR500-MAJOR C-2) (MACH frv))
6321 (.str "cop" num "$pack $s6_1,$CPRi,$CPRj,$CPRk")
6322 (+ pack CPRk op CPRi s6_1 CPRj)
6323 (nop) ; sufficient implementation
6324 ()
6325 )
6326)
6327
6328(cop-op 1 OP_7E)
6329(cop-op 2 OP_7F)
6330
6331(define-pmacro (clear-ne-flag-semantics target_index is_float)
6332 (c-call VOID "@cpu@_clear_ne_flags" target_index is_float)
6333)
6334
23600bb3 6335(define-pmacro (clear-ne-flag-r name op ope reg is_float attr profile comment)
9aab5aa3
AC
6336 (dni name
6337 (comment)
ac7c07ac 6338 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
9aab5aa3
AC
6339 (.str name "$pack $" reg "k")
6340 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
23600bb3
DB
6341 (sequence ()
6342 ; hack to get this referenced for profiling
6343 (c-raw-call VOID "frv_ref_SI" (.sym reg k))
6344 (clear-ne-flag-semantics (index-of (.sym reg k)) is_float))
6345 profile
9aab5aa3
AC
6346 )
6347)
6348
23600bb3 6349(clear-ne-flag-r clrgr OP_0A OPE1_00 GR 0 NA
ac7c07ac 6350 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
23600bb3
DB
6351 "Clear GR NE flag")
6352(clear-ne-flag-r clrfr OP_0A OPE1_02 FR 1 FR-ACCESS
ac7c07ac 6353 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
23600bb3 6354 "Clear FR NE flag")
9aab5aa3 6355
23600bb3 6356(define-pmacro (clear-ne-flag-all name op ope is_float attr profile comment)
9aab5aa3
AC
6357 (dni name
6358 (comment)
ac7c07ac 6359 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr)
9aab5aa3
AC
6360 (.str name "$pack")
6361 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6362 (clear-ne-flag-semantics -1 is_float)
23600bb3 6363 profile
9aab5aa3
AC
6364 )
6365)
6366
23600bb3 6367(clear-ne-flag-all clrga OP_0A OPE1_01 0 NA
ac7c07ac 6368 ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr)))
23600bb3
DB
6369 "Clear GR NE flag ALL")
6370(clear-ne-flag-all clrfa OP_0A OPE1_03 1 FR-ACCESS
ac7c07ac 6371 ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr)))
23600bb3 6372 "Clear FR NE flag ALL")
9aab5aa3
AC
6373
6374(define-pmacro (commit-semantics target_index is_float)
6375 (c-call VOID "@cpu@_commit" target_index is_float)
6376)
6377
6378(define-pmacro (commit-r name op ope reg is_float attr comment)
6379 (dni name
6380 (comment)
ac7c07ac 6381 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
9aab5aa3
AC
6382 (.str name "$pack $" reg "k")
6383 (+ pack (.sym reg k) op (rs-null) ope (GRj-null))
6384 (commit-semantics (index-of (.sym reg k)) is_float)
ac7c07ac 6385 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
9aab5aa3
AC
6386 )
6387)
6388
6389(commit-r commitgr OP_0A OPE1_04 GR 0 NA "commit exceptions, specific GR")
6390(commit-r commitfr OP_0A OPE1_06 FR 1 FR-ACCESS "commit exceptions, specific FR")
6391
6392(define-pmacro (commit name op ope is_float attr comment)
6393 (dni name
6394 (comment)
ac7c07ac 6395 ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr)
9aab5aa3
AC
6396 (.str name "$pack")
6397 (+ pack (rd-null) op (rs-null) ope (GRj-null))
6398 (commit-semantics -1 is_float)
ac7c07ac 6399 ((fr500 (unit u-commit)) (fr550 (unit u-commit)))
9aab5aa3
AC
6400 )
6401)
6402
6403(commit commitga OP_0A OPE1_05 0 NA "commit exceptions, any GR")
6404(commit commitfa OP_0A OPE1_07 1 FR-ACCESS "commit exceptions, any FR")
6405
6406(define-pmacro (floating-point-conversion
6407 name op ope conv mode src targ attr comment)
6408 (dni name
6409 (comment)
0457efce 6410 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
9aab5aa3
AC
6411 (.str name "$pack $" src ",$" targ)
6412 (+ pack targ op (rs-null) ope src)
6413 (set targ (conv mode src))
ac7c07ac 6414 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
9aab5aa3
AC
6415 )
6416)
6417
0457efce 6418(floating-point-conversion fitos OP_79 OPE1_00 float SF FRintj FRk
ac7c07ac 6419 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
0457efce
DB
6420 "Convert Integer to Single")
6421(floating-point-conversion fstoi OP_79 OPE1_01 fix SI FRj FRintk
ac7c07ac 6422 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
0457efce
DB
6423 "Convert Single to Integer")
6424(floating-point-conversion fitod OP_7A OPE1_00 float DF FRintj FRdoublek
6425 ((MACH frv))
6426 "Convert Integer to Double")
6427(floating-point-conversion fdtoi OP_7A OPE1_01 fix SI FRdoublej FRintk
6428 ((MACH frv))
6429 "Convert Double to Integer")
9aab5aa3
AC
6430
6431(define-pmacro (floating-point-dual-conversion
6432 name op ope conv mode src src_hw targ targ_hw attr comment)
6433 (dni name
6434 (comment)
8caa9169 6435 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) attr)
9aab5aa3
AC
6436 (.str name "$pack $" src ",$" targ)
6437 (+ pack targ op (rs-null) ope src)
6438 (sequence ()
6439 (set targ (conv mode src))
6440 (set (nextreg targ_hw targ 1)
6441 (conv mode (nextreg src_hw src 1))))
6442 ((fr500 (unit u-float-dual-convert)))
6443 )
6444)
6445
6446(floating-point-dual-conversion fditos OP_79 OPE1_10 float SF FRintj h-fr_int FRk h-fr NA "Dual Convert Integer to Single")
6447(floating-point-dual-conversion fdstoi OP_79 OPE1_11 fix SI FRj h-fr FRintk h-fr_int NA "Dual Convert Single to Integer")
6448
6449(define-pmacro (ne-floating-point-dual-conversion
6450 name op ope conv mode src src_hw targ targ_hw attr comment)
6451 (dni name
6452 (comment)
8caa9169 6453 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) NON-EXCEPTING attr)
9aab5aa3
AC
6454 (.str name "$pack $" src ",$" targ)
6455 (+ pack targ op (rs-null) ope src)
6456 (sequence ()
6457 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6458 (set targ (conv mode src))
6459 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6460 (set (nextreg targ_hw targ 1)
6461 (conv mode (nextreg src_hw src 1))))
6462 ((fr500 (unit u-float-dual-convert)))
6463 )
6464)
6465
6466(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")
6467(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")
6468
6469(define-pmacro (conditional-floating-point-conversion
6470 name op ope conv mode src targ comment)
6471 (dni name
6472 (comment)
ac7c07ac 6473 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6474 (.str name "$pack $" src ",$" targ ",$CCi,$cond")
6475 (+ pack targ op (rs-null) CCi cond ope src)
6476 (if (eq CCi (or cond 2))
6477 (set targ (conv mode src)))
ac7c07ac 6478 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
9aab5aa3
AC
6479 )
6480)
6481
6482(conditional-floating-point-conversion cfitos OP_6B OPE4_0 float SF FRintj FRk "Conditional convert Integer to Single")
6483(conditional-floating-point-conversion cfstoi OP_6B OPE4_1 fix SI FRj FRintk "Conditional convert Single to Integer")
6484
6485(define-pmacro (ne-floating-point-conversion
6486 name op ope conv mode src targ comment)
6487 (dni name
6488 (comment)
ac7c07ac 6489 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6490 (.str name "$pack $" src ",$" targ)
6491 (+ pack targ op (rs-null) ope src)
6492 (sequence ()
6493 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6494 (set targ (conv mode src)))
ac7c07ac 6495 ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert)))
9aab5aa3
AC
6496 )
6497)
6498
6499(ne-floating-point-conversion nfitos OP_79 OPE1_20 float SF FRintj FRk "NE convert Integer to Single")
6500(ne-floating-point-conversion nfstoi OP_79 OPE1_21 fix SI FRj FRintk "NE convert Single to Integer")
6501
6502(register-transfer fmovs OP_79 OPE1_02
1340b9a9 6503 FRj FRk FMALL
ac7c07ac 6504 ((FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6505 ((fr500 (unit u-fr2fr)))
6506 "Move Single Float")
6507(register-transfer fmovd OP_7A OPE1_02
6508 ; TODO -- unit doesn't handle extra register
0457efce
DB
6509 FRdoublej FRdoublek FM01
6510 ((FR500-MAJOR F-1) (MACH frv))
ac7c07ac 6511 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
9aab5aa3
AC
6512 "Move Double Float")
6513
6514(dni fdmovs
6515 "Dual move single float"
8caa9169 6516 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
9aab5aa3
AC
6517 "fdmovs$pack $FRj,$FRk"
6518 (+ pack FRk OP_79 (rs-null) OPE1_12 FRj)
6519 (sequence ()
6520 (set FRk FRj)
6521 (set (nextreg h-fr FRk 1) (nextreg h-fr FRj 1)))
6522 ; TODO -- unit doesn't handle extra register
6523 ((fr500 (unit u-fr2fr)))
6524)
6525
6526(conditional-register-transfer cfmovs OP_6C OPE4_0 FRj FRk FM01
ac7c07ac
DB
6527 ((FR500-MAJOR F-1) (FR550-MAJOR F-2)
6528 (MACH simple,tomcat,fr500,fr550,frv))
6529 ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr)))
9aab5aa3
AC
6530 "Conditional move Single Float")
6531
6532(define-pmacro (floating-point-neg name src targ op ope attr comment)
6533 (dni name
6534 (comment)
0457efce 6535 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
9aab5aa3
AC
6536 (.str name "$pack $" src ",$" targ)
6537 (+ pack src op (rs-null) ope targ)
6538 (set targ (neg src))
ac7c07ac 6539 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
9aab5aa3
AC
6540 )
6541)
6542
ac7c07ac 6543(floating-point-neg fnegs FRj FRk OP_79 OPE1_03 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Floating point negate, single")
0457efce 6544(floating-point-neg fnegd FRdoublej FRdoublek OP_7A OPE1_03 ((MACH frv)) "Floating point negate, double")
9aab5aa3
AC
6545
6546(dni fdnegs
6547 "Floating point dual negate, single"
8caa9169 6548 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
9aab5aa3
AC
6549 "fdnegs$pack $FRj,$FRk"
6550 (+ pack FRk OP_79 (rs-null) OPE1_13 FRj)
6551 (sequence ()
6552 (set FRk (neg FRj))
6553 (set (nextreg h-fr FRk 1) (neg (nextreg h-fr FRj 1))))
6554 ((fr500 (unit u-float-dual-arith)))
6555)
6556
6557(dni cfnegs
6558 "Conditional floating point negate, single"
ac7c07ac 6559 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6560 "cfnegs$pack $FRj,$FRk,$CCi,$cond"
6561 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_1 FRk)
6562 (if (eq CCi (or cond 2))
6563 (set FRk (neg FRj)))
ac7c07ac 6564 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
9aab5aa3
AC
6565)
6566
6567(define-pmacro (float-abs name src targ op ope attr comment)
6568 (dni name
6569 (comment)
0457efce 6570 (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr))
9aab5aa3
AC
6571 (.str name "$pack $" src ",$" targ )
6572 (+ pack targ op (rs-null) ope src)
6573 (set targ (abs src))
ac7c07ac 6574 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
9aab5aa3
AC
6575 )
6576)
6577
ac7c07ac 6578(float-abs fabss FRj FRk OP_79 OPE1_04 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Float absolute value, single")
0457efce 6579(float-abs fabsd FRdoublej FRdoublek OP_7A OPE1_04 ((MACH frv)) "Float absolute value, double")
9aab5aa3
AC
6580
6581(dni fdabss
6582 "Floating point dual absolute value, single"
8caa9169 6583 ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1))
9aab5aa3
AC
6584 "fdabss$pack $FRj,$FRk"
6585 (+ pack FRk OP_79 (rs-null) OPE1_14 FRj)
6586 (sequence ()
6587 (set FRk (abs FRj))
6588 (set (nextreg h-fr FRk 1) (abs (nextreg h-fr FRj 1))))
6589 ((fr500 (unit u-float-dual-arith)))
6590)
6591
6592(dni cfabss
6593 "Conditional floating point absolute value, single"
ac7c07ac 6594 ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6595 "cfabss$pack $FRj,$FRk,$CCi,$cond"
6596 (+ pack FRj OP_6C (rs-null) CCi cond OPE4_2 FRk)
6597 (if (eq CCi (or cond 2))
6598 (set FRk (abs FRj)))
ac7c07ac 6599 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
9aab5aa3
AC
6600)
6601
6602(dni fsqrts
6603 "Square root single"
ac7c07ac 6604 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6605 "fsqrts$pack $FRj,$FRk"
6606 (+ pack FRk OP_79 (rs-null) OPE1_05 FRj)
6607 (set FRk (sqrt SF FRj))
ac7c07ac 6608 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
9aab5aa3
AC
6609)
6610
6611(dni fdsqrts
6612 "Dual square root single"
6613 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4))
6614 "fdsqrts$pack $FRj,$FRk"
6615 (+ pack FRk OP_79 (rs-null) OPE1_15 FRj)
6616 (sequence ()
6617 (set FRk (sqrt SF FRj))
6618 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6619 ((fr500 (unit u-float-dual-sqrt)))
6620)
6621
6622(dni nfdsqrts
6623 "Non excepting Dual square root single"
6624 ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4) NON-EXCEPTING)
6625 "nfdsqrts$pack $FRj,$FRk"
6626 (+ pack FRk OP_79 (rs-null) OPE1_35 FRj)
6627 (sequence ()
6628 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6629 (set FRk (sqrt SF FRj))
6630 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6631 (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1))))
6632 ((fr500 (unit u-float-dual-sqrt)))
6633)
6634
6635(dni fsqrtd
6636 "Square root double"
6637 ((UNIT FM01) (FR500-MAJOR F-4) (MACH frv))
6638 "fsqrtd$pack $FRdoublej,$FRdoublek"
6639 (+ pack FRdoublek OP_7A (rs-null) OPE1_05 FRdoublej)
6640 (set FRdoublek (sqrt DF FRdoublej))
6641 ((fr500 (unit u-float-sqrt)))
6642)
6643
6644(dni cfsqrts
6645 "Conditional square root single"
ac7c07ac 6646 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6647 "cfsqrts$pack $FRj,$FRk,$CCi,$cond"
6648 (+ pack FRk OP_6E (rs-null) CCi cond OPE4_2 FRj)
6649 (if (eq CCi (or cond 2))
6650 (set FRk (sqrt SF FRj)))
ac7c07ac 6651 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
9aab5aa3
AC
6652)
6653
6654(dni nfsqrts
6655 "Non exception square root, single"
ac7c07ac 6656 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6657 "nfsqrts$pack $FRj,$FRk"
6658 (+ pack FRk OP_79 (rs-null) OPE1_25 FRj)
6659 (sequence ()
6660 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6661 (set FRk (sqrt SF FRj)))
ac7c07ac 6662 ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt)))
9aab5aa3
AC
6663)
6664
0457efce 6665(define-pmacro (float-binary-op-s name pipe attr operation op ope comment)
9aab5aa3
AC
6666 (dni name
6667 (comment)
ac7c07ac 6668 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) (.unsplice attr))
9aab5aa3
AC
6669 (.str name "$pack $FRi,$FRj,$FRk")
6670 (+ pack FRk op FRi ope FRj)
6671 (set FRk (operation FRi FRj))
ac7c07ac 6672 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
9aab5aa3
AC
6673 )
6674)
6675
ac7c07ac
DB
6676(float-binary-op-s fadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_06 "add single float")
6677(float-binary-op-s fsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_07 "sub single float")
6678(float-binary-op-s fmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_08 "mul single float")
9aab5aa3
AC
6679
6680(dni fdivs
6681 "div single float"
ac7c07ac 6682 ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6683 "fdivs$pack $FRi,$FRj,$FRk"
6684 (+ pack FRk OP_79 FRi OPE1_09 FRj)
6685 (set FRk (div FRi FRj))
ac7c07ac
DB
6686 ((fr500 (unit u-float-div))
6687 (fr550 (unit u-float-div)))
9aab5aa3
AC
6688)
6689
6690(define-pmacro (float-binary-op-d name operation op ope major comment)
6691 (dni name
6692 (comment)
8caa9169 6693 ((UNIT FMALL) (FR500-MAJOR major) (MACH frv))
9aab5aa3
AC
6694 (.str name "$pack $FRdoublei,$FRdoublej,$FRdoublek")
6695 (+ pack FRdoublek op FRdoublei ope FRdoublej)
6696 (set FRdoublek (operation FRdoublei FRdoublej))
6697 ((fr500 (unit u-float-arith)))
6698 )
6699)
6700
6701(float-binary-op-d faddd add OP_7A OPE1_06 F-2 "add double float")
6702(float-binary-op-d fsubd sub OP_7A OPE1_07 F-2 "sub double float")
6703(float-binary-op-d fmuld mul OP_7A OPE1_08 F-3 "mul double float")
6704(float-binary-op-d fdivd div OP_7A OPE1_09 F-4 "div double float")
6705
d0312406 6706(define-pmacro (conditional-float-binary-op name pipe attr operation op ope profile comment)
9aab5aa3
AC
6707 (dni name
6708 (comment)
ac7c07ac 6709 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
0457efce 6710 (.unsplice attr))
9aab5aa3
AC
6711 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6712 (+ pack FRk op FRi CCi cond ope FRj)
6713 (if (eq CCi (or cond 2))
6714 (set FRk (operation FRi FRj)))
d0312406 6715 profile
9aab5aa3
AC
6716 )
6717)
6718
ac7c07ac
DB
6719(conditional-float-binary-op cfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_6D OPE4_0
6720 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6721 "cond add single")
ac7c07ac
DB
6722(conditional-float-binary-op cfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_6D OPE4_1
6723 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6724 "cond sub single")
ac7c07ac
DB
6725(conditional-float-binary-op cfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_6E OPE4_0
6726 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6727 "cond mul single")
ac7c07ac
DB
6728(conditional-float-binary-op cfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_6E OPE4_1
6729 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
d0312406 6730 "cond div single")
9aab5aa3 6731
d0312406 6732(define-pmacro (ne-float-binary-op name pipe attr operation op ope profile comment)
9aab5aa3
AC
6733 (dni name
6734 (comment)
ac7c07ac 6735 (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv)
0457efce 6736 (.unsplice attr))
9aab5aa3
AC
6737 (.str name "$pack $FRi,$FRj,$FRk")
6738 (+ pack FRk op FRi ope FRj)
6739 (sequence ()
6740 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6741 (set FRk (operation FRi FRj)))
d0312406 6742 profile
9aab5aa3
AC
6743 )
6744)
6745
ac7c07ac
DB
6746(ne-float-binary-op nfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_26
6747 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6748 "ne add single")
ac7c07ac
DB
6749(ne-float-binary-op nfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_27
6750 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6751 "ne sub single")
ac7c07ac
DB
6752(ne-float-binary-op nfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_28
6753 ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith)))
d0312406 6754 "ne mul single")
ac7c07ac
DB
6755(ne-float-binary-op nfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_79 OPE1_29
6756 ((fr500 (unit u-float-div)) (fr550 (unit u-float-div)))
d0312406 6757 "ne div single")
9aab5aa3
AC
6758
6759(define-pmacro (fcc-eq) 8)
6760(define-pmacro (fcc-lt) 4)
6761(define-pmacro (fcc-gt) 2)
6762(define-pmacro (fcc-uo) 1)
6763
6764(define-pmacro (compare-and-set-fcc arg1 arg2 fcc)
6765 (if (gt arg1 arg2)
6766 (set fcc (fcc-gt))
6767 (if (eq arg1 arg2)
6768 (set fcc (fcc-eq))
6769 (if (lt arg1 arg2)
6770 (set fcc (fcc-lt))
6771 (set fcc (fcc-uo)))))
6772)
6773
6774(dni fcmps
6775 "compare single float"
ac7c07ac 6776 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6777 "fcmps$pack $FRi,$FRj,$FCCi_2"
6778 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_0A FRj)
6779 (compare-and-set-fcc FRi FRj FCCi_2)
ac7c07ac 6780 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
9aab5aa3
AC
6781)
6782
6783(dni fcmpd
6784 "compare double float"
8caa9169 6785 ((UNIT FMALL) (FR500-MAJOR F-2) (MACH frv))
9aab5aa3
AC
6786 "fcmpd$pack $FRdoublei,$FRdoublej,$FCCi_2"
6787 (+ pack (cond-null) FCCi_2 OP_7A FRdoublei OPE1_0A FRdoublej)
6788 (compare-and-set-fcc FRdoublei FRdoublej FCCi_2)
6789 ((fr500 (unit u-float-compare)))
6790)
6791
6792(dni cfcmps
6793 "Conditional compare single, float"
ac7c07ac 6794 ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6795 "cfcmps$pack $FRi,$FRj,$FCCi_2,$CCi,$cond"
6796 (+ pack (cond-null) FCCi_2 OP_6D FRi CCi cond OPE4_2 FRj)
6797 (if (eq CCi (or cond 2))
6798 (compare-and-set-fcc FRi FRj FCCi_2))
ac7c07ac 6799 ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare)))
9aab5aa3
AC
6800)
6801
6802(dni fdcmps
6803 "float dual compare single"
ac7c07ac 6804 ((UNIT FMALL) (FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6805 "fdcmps$pack $FRi,$FRj,$FCCi_2"
6806 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_1A FRj)
6807 (sequence ()
6808 (compare-and-set-fcc FRi FRj FCCi_2)
6809 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
6810 (nextreg h-fccr FCCi_2 1)))
ac7c07ac 6811 ((fr500 (unit u-float-dual-compare)) (fr550 (unit u-float-dual-compare)))
9aab5aa3
AC
6812)
6813
6814(define-pmacro (float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6815 (dni name
6816 (comment)
8caa9169 6817 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
9aab5aa3
AC
6818 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6819 (+ pack targ op arg1 ope arg2)
6820 (set targ (add_sub (mul arg1 arg2) targ))
6821 ((fr500 (unit u-float-dual-arith)))
6822 )
6823)
6824
6825(float-mul-with-add fmadds add FRi FRj FRk OP_79 OPE1_0B "mul with add, single")
6826(float-mul-with-add fmsubs sub FRi FRj FRk OP_79 OPE1_0C "mul with sub, single")
6827
6828(float-mul-with-add fmaddd add FRdoublei FRdoublej FRdoublek OP_7A OPE1_0B "mul with add, double")
6829(float-mul-with-add fmsubd sub FRdoublei FRdoublej FRdoublek OP_7A OPE1_0C "mul with sub, double")
6830
6831(dni fdmadds
6832 "Float dual multiply with add"
8caa9169 6833 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
9aab5aa3
AC
6834 "fdmadds$pack $FRi,$FRj,$FRk"
6835 (+ pack FRk OP_79 FRi OPE1_1B FRj)
6836 (sequence ()
6837 (set FRk (add (mul FRi FRj) FRk))
6838 (set (nextreg h-fr FRk 1)
6839 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6840 (nextreg h-fr FRk 1))))
6841 ; TODO dual registers not referenced for profiling
6842 ((fr500 (unit u-float-dual-arith)))
6843)
6844
6845(dni nfdmadds
6846 "Non excepting float dual multiply with add"
8caa9169 6847 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv))
9aab5aa3
AC
6848 "nfdmadds$pack $FRi,$FRj,$FRk"
6849 (+ pack FRk OP_79 FRi OPE1_3B FRj)
6850 (sequence ()
6851 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
6852 (set FRk (add (mul FRi FRj) FRk))
6853 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
6854 (set (nextreg h-fr FRk 1)
6855 (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))
6856 (nextreg h-fr FRk 1))))
6857 ; TODO dual registers not referenced for profiling
6858 ((fr500 (unit u-float-dual-arith)))
6859)
6860
6861(define-pmacro (conditional-float-mul-with-add
6862 name add_sub arg1 arg2 targ op ope comment)
6863 (dni name
6864 (comment)
8caa9169 6865 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) CONDITIONAL)
9aab5aa3
AC
6866 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6867 (+ pack FRk op FRi CCi cond ope FRj)
6868 (if (eq CCi (or cond 2))
6869 (set targ (add_sub (mul arg1 arg2) targ)))
6870 ((fr500 (unit u-float-dual-arith)))
6871 )
6872)
6873
6874(conditional-float-mul-with-add cfmadds add FRi FRj FRk OP_6F OPE4_0 "conditional mul with add, single")
6875(conditional-float-mul-with-add cfmsubs sub FRi FRj FRk OP_6F OPE4_1 "conditional mul with sub, single")
6876
6877(define-pmacro (ne-float-mul-with-add name add_sub arg1 arg2 targ op ope comment)
6878 (dni name
6879 (comment)
8caa9169 6880 ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) NON-EXCEPTING)
9aab5aa3
AC
6881 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6882 (+ pack targ op arg1 ope arg2)
6883 (sequence ()
6884 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6885 (set targ (add_sub (mul arg1 arg2) targ)))
6886 ((fr500 (unit u-float-dual-arith)))
6887 )
6888)
6889
6890(ne-float-mul-with-add nfmadds add FRi FRj FRk OP_79 OPE1_2B "non excepting mul with add, single")
6891(ne-float-mul-with-add nfmsubs sub FRi FRj FRk OP_79 OPE1_2C "non excepting mul with sub, single")
6892
6893(define-pmacro (float-parallel-mul-add-semantics cond add_sub arg1 arg2 targ)
6894 (if cond
6895 (sequence ()
6896 (set targ (mul arg1 arg2))
6897 (set (nextreg h-fr targ 1)
6898 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))))
6899)
6900
6901(define-pmacro (float-parallel-mul-add
6902 name add_sub arg1 arg2 targ op ope comment)
6903 (dni name
6904 (comment)
ac7c07ac 6905 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6906 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6907 (+ pack targ op arg1 ope arg2)
6908 (float-parallel-mul-add-semantics 1 add_sub arg1 arg2 targ)
ac7c07ac 6909 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
6910 )
6911)
6912
6913(float-parallel-mul-add fmas add FRi FRj FRk OP_79 OPE1_0E "parallel mul/add, single")
6914(float-parallel-mul-add fmss sub FRi FRj FRk OP_79 OPE1_0F "parallel mul/sub, single")
6915
6916(define-pmacro (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6917 (sequence ()
6918 (set targ (mul arg1 arg2))
6919 (set (nextreg h-fr targ 1)
6920 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6921 (set (nextreg h-fr targ 2)
6922 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6923 (set (nextreg h-fr targ 3)
6924 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6925)
6926
6927(define-pmacro (float-dual-parallel-mul-add
6928 name add_sub arg1 arg2 targ op ope comment)
6929 (dni name
6930 (comment)
6931 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6932 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6933 (+ pack targ op arg1 ope arg2)
6934 (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6935 ()
6936 )
6937)
6938
6939(float-dual-parallel-mul-add fdmas add FRi FRj FRk OP_79 OPE1_1C "dual parallel mul/add, single")
6940(float-dual-parallel-mul-add fdmss sub FRi FRj FRk OP_79 OPE1_1D "dual parallel mul/sub, single")
6941
6942(define-pmacro (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6943 (sequence ()
6944 (c-call VOID "@cpu@_set_ne_index" (index-of targ))
6945 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1))
6946 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 2))
6947 (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 3))
6948 (set targ (mul arg1 arg2))
6949 (set (nextreg h-fr targ 1)
6950 (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1)))
6951 (set (nextreg h-fr targ 2)
6952 (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2)))
6953 (set (nextreg h-fr targ 3)
6954 (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3))))
6955)
6956
6957(define-pmacro (ne-float-dual-parallel-mul-add
6958 name add_sub arg1 arg2 targ op ope comment)
6959 (dni name
6960 (comment)
6961 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
6962 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
6963 (+ pack targ op arg1 ope arg2)
6964 (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ)
6965 ()
6966 )
6967)
6968
6969(ne-float-dual-parallel-mul-add nfdmas add FRi FRj FRk OP_79 OPE1_3C "non excepting dual parallel mul/add, single")
6970(ne-float-dual-parallel-mul-add nfdmss sub FRi FRj FRk OP_79 OPE1_3D "non excepting dual parallel mul/sub, single")
6971
6972(define-pmacro (conditional-float-parallel-mul-add name add_sub op ope comment)
6973 (dni name
6974 (comment)
ac7c07ac 6975 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) CONDITIONAL (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
6976 (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond")
6977 (+ pack FRk op FRi CCi cond ope FRj)
6978 (float-parallel-mul-add-semantics (eq CCi (or cond 2))
6979 add_sub FRi FRj FRk)
ac7c07ac 6980 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
6981 )
6982)
6983
6984(conditional-float-parallel-mul-add cfmas add OP_6F OPE4_2 "conditional parallel mul/add, single")
6985(conditional-float-parallel-mul-add cfmss sub OP_6F OPE4_3 "conditional parallel mul/sub, single")
6986
6987(define-pmacro (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
6988 (sequence ()
6989 (set targ (ftrunc SF (mul DF (fext DF arg1) (fext DF arg2))))
6990 (set (nextreg h-fr targ 1)
6991 (ftrunc SF (add_sub DF
6992 (fext DF (nextreg h-fr arg1 1))
6993 (fext DF (nextreg h-fr arg2 1))))))
6994)
6995
6996(define-pmacro (float-parallel-mul-add-double
6997 name add_sub arg1 arg2 targ op ope comment)
6998 (dni name
6999 (comment)
7000 ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv))
7001 (.str name "$pack $" arg1 ",$" arg2 ",$" targ)
7002 (+ pack targ op arg1 ope arg2)
7003 (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ)
7004 ()
7005 )
7006)
7007
7008(float-parallel-mul-add-double fmad add FRi FRj FRk OP_7A OPE1_0E "parallel mul/add, double")
7009(float-parallel-mul-add-double fmsd sub FRi FRj FRk OP_7A OPE1_0F "parallel mul/sub, double")
7010
7011(define-pmacro (ne-float-parallel-mul-add name add_sub op ope comment)
7012 (dni name
7013 (comment)
ac7c07ac 7014 ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
7015 (.str name "$pack $FRi,$FRj,$FRk")
7016 (+ pack FRk op FRi ope FRj)
7017 (sequence ()
7018 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7019 (set FRk (mul FRi FRj))
7020 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7021 (set (nextreg h-fr FRk 1)
7022 (add_sub (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
ac7c07ac 7023 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
7024 )
7025)
7026
7027(ne-float-parallel-mul-add nfmas add OP_79 OPE1_2E "ne parallel mul/add,single")
7028(ne-float-parallel-mul-add nfmss sub OP_79 OPE1_2F "ne parallel mul/sub,single")
7029
0457efce 7030(define-pmacro (float-dual-arith name attr oper1 oper2 op ope comment)
9aab5aa3
AC
7031 (dni name
7032 (comment)
0457efce 7033 (.splice (UNIT FM01) (.unsplice attr))
9aab5aa3
AC
7034 (.str name "$pack $FRi,$FRj,$FRk")
7035 (+ pack FRk op FRi ope FRj)
7036 (sequence ()
7037 (set FRk (oper1 FRi FRj))
7038 (set (nextreg h-fr FRk 1)
7039 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
ac7c07ac 7040 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
7041 )
7042)
7043
ac7c07ac
DB
7044(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")
7045(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")
7046(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")
7047(float-dual-arith fddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_19 "dual div,single")
7048(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")
9aab5aa3
AC
7049
7050(dni fdmulcs
7051 "Float dual cross multiply single"
ac7c07ac 7052 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
7053 "fdmulcs$pack $FRi,$FRj,$FRk"
7054 (+ pack FRk OP_79 FRi OPE1_1F FRj)
7055 (sequence ()
7056 (set FRk (mul FRi (nextreg h-fr FRj 1)))
7057 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
ac7c07ac 7058 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
7059)
7060
7061(dni nfdmulcs
7062 "NE float dual cross multiply single"
ac7c07ac 7063 ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
7064 "nfdmulcs$pack $FRi,$FRj,$FRk"
7065 (+ pack FRk OP_79 FRi OPE1_3F FRj)
7066 (sequence ()
7067 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7068 (set FRk (mul FRi (nextreg h-fr FRj 1)))
7069 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7070 (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj)))
ac7c07ac 7071 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
7072)
7073
0457efce 7074(define-pmacro (ne-float-dual-arith name attr oper1 oper2 op ope comment)
9aab5aa3
AC
7075 (dni name
7076 (comment)
0457efce 7077 (.splice (UNIT FM01) (.unsplice attr))
9aab5aa3
AC
7078 (.str name "$pack $FRi,$FRj,$FRk")
7079 (+ pack FRk op FRi ope FRj)
7080 (sequence ()
7081 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7082 (set FRk (oper1 FRi FRj))
7083 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7084 (set (nextreg h-fr FRk 1)
7085 (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1))))
ac7c07ac 7086 ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith)))
9aab5aa3
AC
7087 )
7088)
7089
ac7c07ac
DB
7090(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")
7091(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")
7092(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")
7093(ne-float-dual-arith nfddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_39 "ne dual div,single")
7094(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")
9aab5aa3
AC
7095
7096(dni nfdcmps
7097 "non-excepting dual float compare"
7098 ((UNIT FM01) (FR500-MAJOR F-6) (MACH simple,tomcat,frv))
7099 "nfdcmps$pack $FRi,$FRj,$FCCi_2"
7100 (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_3A FRj)
7101 (sequence ()
7102 (c-call VOID "@cpu@_set_ne_index" (index-of FRk))
7103 (compare-and-set-fcc FRi FRj FCCi_2)
7104 (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1))
7105 (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)
7106 (nextreg h-fccr FCCi_2 1)))
7107 ((fr500 (unit u-float-dual-compare)))
7108)
7109
7110; Media Instructions
7111;
7112(define-pmacro (halfword hilo arg offset)
7113 (reg (.sym h-fr_ hilo) (add (index-of arg) offset)))
7114
7115(dni mhsetlos
7116 "Media set lower signed 12 bits"
ac7c07ac 7117 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
9aab5aa3
AC
7118 "mhsetlos$pack $u12,$FRklo"
7119 (+ pack FRklo OP_78 OPE1_20 u12)
7120 (set FRklo u12)
ac7c07ac 7121 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRklo))))
9aab5aa3
AC
7122)
7123
7124(dni mhsethis
7125 "Media set upper signed 12 bits"
ac7c07ac 7126 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
9aab5aa3
AC
7127 "mhsethis$pack $u12,$FRkhi"
7128 (+ pack FRkhi OP_78 OPE1_22 u12)
7129 (set FRkhi u12)
ac7c07ac 7130 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRkhi))))
9aab5aa3
AC
7131)
7132
7133(dni mhdsets
7134 "Media dual set halfword signed 12 bits"
ac7c07ac 7135 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
9aab5aa3
AC
7136 "mhdsets$pack $u12,$FRintk"
7137 (+ pack FRintk OP_78 OPE1_24 u12)
7138 (sequence ()
7139 ; hack to get FRintk passed to modelling functions
7140 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7141 (set (halfword hi FRintk 0) u12)
7142 (set (halfword lo FRintk 0) u12))
ac7c07ac 7143 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
9aab5aa3
AC
7144)
7145
7146(define-pmacro (set-5-semantics target value)
7147 (sequence ((HI tmp))
7148 (set tmp target)
7149 (set tmp (and tmp #x07ff))
7150 (set tmp (or tmp (sll (and s5 #x1f) 11)))
7151 (set target tmp))
7152)
7153
7154(define-pmacro (media-set-5 name hilo op ope comment)
7155 (dni name
7156 (comment)
ac7c07ac 7157 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
9aab5aa3
AC
7158 (.str name "$pack $s5,$FRk" hilo)
7159 (+ pack (.sym FRk hilo) op (FRi-null) ope (misc-null-11) s5)
7160 (set-5-semantics (.sym FRk hilo) s5)
ac7c07ac 7161 ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk (.sym FRk hilo)))))
9aab5aa3
AC
7162 )
7163)
7164
7165(media-set-5 mhsetloh lo OP_78 OPE1_21 "Media set upper 5 bits lo")
7166(media-set-5 mhsethih hi OP_78 OPE1_23 "Media set upper 5 bits hi")
7167
7168(dni mhdseth
7169 "Media dual set halfword upper 5 bits"
ac7c07ac 7170 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1))
9aab5aa3
AC
7171 "mhdseth$pack $s5,$FRintk"
7172 (+ pack FRintk OP_78 (FRi-null) OPE1_25 (misc-null-11) s5)
7173 (sequence ()
7174 ; hack to get FRintk passed to modelling functions
7175 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7176 (set-5-semantics (halfword hi FRintk 0) s5)
7177 (set-5-semantics (halfword lo FRintk 0) s5))
ac7c07ac 7178 ((fr400 (unit u-media-1)) (fr550 (unit u-media-set)))
9aab5aa3
AC
7179)
7180
7181(define-pmacro (media-logic-r-r name operation op ope comment)
7182 (dni name
7183 (comment)
ac7c07ac 7184 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7185 (.str name "$pack $FRinti,$FRintj,$FRintk")
7186 (+ pack FRintk op FRinti ope FRintj)
7187 (set FRintk (operation FRinti FRintj))
7188 ((fr400 (unit u-media-1))
ac7c07ac 7189 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7190 )
7191)
7192
7193(media-logic-r-r mand and OP_7B OPE1_00 "and reg/reg")
7194(media-logic-r-r mor or OP_7B OPE1_01 "or reg/reg")
7195(media-logic-r-r mxor xor OP_7B OPE1_02 "xor reg/reg")
7196
7197(define-pmacro (conditional-media-logic name operation op ope comment)
7198 (dni name
7199 (comment)
ac7c07ac 7200 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
7201 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7202 (+ pack FRintk op FRinti CCi cond ope FRintj)
7203 (if (eq CCi (or cond 2))
7204 (set FRintk (operation FRinti FRintj)))
7205 ((fr400 (unit u-media-1))
ac7c07ac 7206 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7207 )
7208)
7209
7210(conditional-media-logic cmand and OP_70 OPE4_0 "conditional and reg/reg")
7211(conditional-media-logic cmor or OP_70 OPE4_1 "conditional or reg/reg")
7212(conditional-media-logic cmxor xor OP_70 OPE4_2 "conditional xor reg/reg")
7213
7214(dni mnot
7215 ("mnot")
ac7c07ac 7216 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7217 ("mnot$pack $FRintj,$FRintk")
7218 (+ pack FRintk OP_7B (rs-null) OPE1_03 FRintj)
7219 (set FRintk (inv FRintj))
7220 ((fr400 (unit u-media-1))
ac7c07ac 7221 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7222)
7223
7224(dni cmnot
7225 ("cmnot")
ac7c07ac 7226 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
7227 ("cmnot$pack $FRintj,$FRintk,$CCi,$cond")
7228 (+ pack FRintk OP_70 (rs-null) CCi cond OPE4_3 FRintj)
7229 (if (eq CCi (or cond 2))
7230 (set FRintk (inv FRintj)))
7231 ((fr400 (unit u-media-1))
ac7c07ac 7232 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7233)
7234
7235(define-pmacro (media-rotate-r-r name operation op ope comment)
7236 (dni name
7237 (comment)
ac7c07ac 7238 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
7239 (.str name "$pack $FRinti,$u6,$FRintk")
7240 (+ pack FRintk op FRinti ope u6)
7241 (set FRintk (operation FRinti (and u6 #x1f)))
7242 ((fr400 (unit u-media-3))
ac7c07ac 7243 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7244 )
7245)
7246
7247(media-rotate-r-r mrotli rol OP_7B OPE1_04 "rotate left reg/reg")
7248(media-rotate-r-r mrotri ror OP_7B OPE1_05 "rotate right reg/reg")
7249
7250(define-pmacro (media-cut-r-r name arg op ope comment)
7251 (dni name
7252 (comment)
ac7c07ac 7253 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
9aab5aa3
AC
7254 (.str name "$pack $FRinti,$" arg ",$FRintk")
7255 (+ pack FRintk op FRinti ope arg)
7256 (set FRintk (c-call SI "@cpu@_cut" FRinti (nextreg h-fr_int FRinti 1) arg))
7257 ((fr400 (unit u-media-3))
ac7c07ac 7258 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7259 )
7260)
7261
7262(media-cut-r-r mwcut FRintj OP_7B OPE1_06 "media cut")
7263(media-cut-r-r mwcuti u6 OP_7B OPE1_07 "media cut")
7264
7265(define-pmacro (media-cut-acc name arg op ope comment)
7266 (dni name
7267 (comment)
ac7c07ac 7268 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
7269 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7270 (+ pack FRintk op ACC40Si ope arg)
7271 (set FRintk (c-call SI "@cpu@_media_cut" ACC40Si arg))
7272 ((fr400 (unit u-media-4))
ac7c07ac 7273 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
9aab5aa3
AC
7274 )
7275)
7276
7277(media-cut-acc mcut FRintj OP_7B OPE1_2C "media accumulator cut reg")
7278(media-cut-acc mcuti s6 OP_7B OPE1_2E "media accumulator cut immed")
7279
7280(define-pmacro (media-cut-acc-ss name arg op ope comment)
7281 (dni name
7282 (comment)
ac7c07ac 7283 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
7284 (.str name "$pack $ACC40Si,$" arg ",$FRintk")
7285 (+ pack FRintk op ACC40Si ope arg)
7286 (set FRintk (c-call SI "@cpu@_media_cut_ss" ACC40Si arg))
7287 ((fr400 (unit u-media-4))
ac7c07ac 7288 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
9aab5aa3
AC
7289 )
7290)
7291
7292(media-cut-acc-ss mcutss FRintj OP_7B OPE1_2D "media accumulator cut reg with saturation")
7293(media-cut-acc-ss mcutssi s6 OP_7B OPE1_2F "media accumulator cut immed with saturation")
7294
7295; Dual Media Instructions
7296;
7297(define-pmacro (register-unaligned register alignment)
7298 (and (index-of register) (sub alignment 1))
7299)
7300
7301(dni mdcutssi
7302 "Media dual cut with signed saturation"
ac7c07ac 7303 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
7304 "mdcutssi$pack $ACC40Si,$s6,$FRintkeven"
7305 (+ pack FRintkeven OP_78 ACC40Si OPE1_0E s6)
9aab5aa3
AC
7306 (if (register-unaligned ACC40Si 2)
7307 (c-call VOID "@cpu@_media_acc_not_aligned")
36c3ae24 7308 (if (register-unaligned FRintkeven 2)
9aab5aa3
AC
7309 (c-call VOID "@cpu@_media_register_not_aligned")
7310 (sequence ()
36c3ae24
NC
7311 (set FRintkeven (c-call SI "@cpu@_media_cut_ss" ACC40Si s6))
7312 (set (nextreg h-fr_int FRintkeven 1)
9aab5aa3
AC
7313 (c-call SI "@cpu@_media_cut_ss"
7314 (nextreg h-acc40S ACC40Si 1) s6)))))
36c3ae24 7315 ((fr400 (unit u-media-4-acc-dual
ac7c07ac 7316 (out FRintk FRintkeven))) (fr550 (unit u-media-3-acc-dual)))
9aab5aa3
AC
7317)
7318
7319; The (add (xxxx) (mul arg 0)) is a hack to get a reference to arg generated
7320; so it will be passed to the unit modelers. YUCK!!!!!
7321(define-pmacro (extract-hilo reg1 off1 reg2 off2 arg1hi arg1lo arg2hi arg2lo)
7322 (sequence ()
7323 (set arg1hi (add (halfword hi reg1 off1) (mul reg1 0)))
7324 (set arg1lo (add (halfword lo reg1 off1) (mul reg1 0)))
7325 (set arg2hi (add (halfword hi reg2 off2) (mul reg2 0)))
7326 (set arg2lo (add (halfword lo reg2 off2) (mul reg2 0))))
7327)
7328
7329(dni maveh
7330 "Media dual average"
ac7c07ac 7331 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7332 "maveh$pack $FRinti,$FRintj,$FRintk"
7333 (+ pack FRintk OP_7B FRinti OPE1_08 FRintj)
7334 (set FRintk (c-call SI "@cpu@_media_average" FRinti FRintj))
7335 ((fr400 (unit u-media-1))
ac7c07ac 7336 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7337)
7338
7339(define-pmacro (media-dual-shift name operation op ope profile comment)
7340 (dni name
7341 (comment)
ac7c07ac 7342 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
7343 (.str name "$pack $FRinti,$u6,$FRintk")
7344 (+ pack FRintk op FRinti ope u6)
7345 (sequence ()
7346 ; hack to get these referenced for profiling
7347 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7348 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7349 (set (halfword hi FRintk 0)
7350 (operation (halfword hi FRinti 0) (and u6 #xf)))
7351 (set (halfword lo FRintk 0)
7352 (operation (halfword lo FRinti 0) (and u6 #xf))))
7353 profile
7354 )
7355)
7356
7357(media-dual-shift msllhi sll OP_7B OPE1_09
ac7c07ac 7358 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7359 "Media dual shift left logical")
7360(media-dual-shift msrlhi srl OP_7B OPE1_0A
ac7c07ac 7361 ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7362 "Media dual shift right logical")
7363(media-dual-shift msrahi sra OP_7B OPE1_0B
ac7c07ac 7364 ((fr400 (unit u-media-6)) (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7365 "Media dual shift right arithmetic")
7366
7367(define-pmacro (media-dual-word-rotate-r-r name operation op ope comment)
7368 (dni name
7369 (comment)
ac7c07ac 7370 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
7371 (.str name "$pack $FRintieven,$s6,$FRintkeven")
7372 (+ pack FRintkeven op FRintieven ope s6)
7373 (if (orif (register-unaligned FRintieven 2)
7374 (register-unaligned FRintkeven 2))
9aab5aa3
AC
7375 (c-call VOID "@cpu@_media_register_not_aligned")
7376 (sequence ()
36c3ae24
NC
7377 (set FRintkeven (operation FRintieven (and s6 #x1f)))
7378 (set (nextreg h-fr_int FRintkeven 1)
7379 (operation (nextreg h-fr_int FRintieven 1)
75798298 7380 (and s6 #x1f)))))
36c3ae24
NC
7381 ((fr400 (unit u-media-3-quad
7382 (in FRinti FRintieven)
ac7c07ac 7383 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
9aab5aa3
AC
7384 )
7385)
7386
7387(media-dual-word-rotate-r-r mdrotli rol OP_78 OPE1_0B "rotate left reg/reg")
7388
7389(dni mcplhi
ac7c07ac
DB
7390 "Media bit concatenate, halfword"
7391 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
9aab5aa3
AC
7392 "mcplhi$pack $FRinti,$u6,$FRintk"
7393 (+ pack FRintk OP_78 FRinti OPE1_0C u6)
7394 (sequence ((HI arg1) (HI arg2) (HI shift))
7395 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
7396 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7397 (set shift (and u6 #xf))
7398 (set arg1 (sll (halfword hi FRinti 0) shift))
7399 (if (ne shift 0)
7400 (sequence ()
7401 (set arg2 (halfword hi FRinti 1))
7402 (set arg2 (srl HI (sll HI arg2 (sub 15 shift))
7403 (sub 15 shift)))
7404 (set arg1 (or HI arg1 arg2))))
7405 (set (halfword hi FRintk 0) arg1))
ac7c07ac 7406 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
9aab5aa3
AC
7407)
7408
7409(dni mcpli
ac7c07ac
DB
7410 "Media bit concatenate, word"
7411 ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
9aab5aa3
AC
7412 "mcpli$pack $FRinti,$u6,$FRintk"
7413 (+ pack FRintk OP_78 FRinti OPE1_0D u6)
7414 (sequence ((SI tmp) (SI shift))
7415 (set shift (and u6 #x1f))
7416 (set tmp (sll FRinti shift))
7417 (if (ne shift 0)
7418 (sequence ((SI tmp1))
7419 (set tmp1 (srl (sll (nextreg h-fr_int FRinti 1)
7420 (sub 31 shift))
7421 (sub 31 shift)))
7422 (set tmp (or tmp tmp1))))
7423 (set FRintk tmp))
ac7c07ac 7424 ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual)))
9aab5aa3
AC
7425)
7426
7427(define-pmacro (saturate arg max min result)
7428 (if (gt arg max)
7429 (set result max)
7430 (if (lt arg min)
7431 (set result min)
7432 (set result arg)))
7433)
7434
7435(dni msaths
7436 "Media dual saturation signed"
ac7c07ac 7437 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7438 "msaths$pack $FRinti,$FRintj,$FRintk"
7439 (+ pack FRintk OP_7B FRinti OPE1_0C FRintj)
7440 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
7441 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7442 (saturate argihi argjhi (inv argjhi) (halfword hi FRintk 0))
7443 (saturate argilo argjlo (inv argjlo) (halfword lo FRintk 0)))
7444 ((fr400 (unit u-media-1))
ac7c07ac 7445 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7446)
7447
7448(dni mqsaths
7449 "Media quad saturation signed"
ac7c07ac 7450 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
36c3ae24
NC
7451 "mqsaths$pack $FRintieven,$FRintjeven,$FRintkeven"
7452 (+ pack FRintkeven OP_78 FRintieven OPE1_0F FRintjeven)
7453 (if (orif (register-unaligned FRintieven 2)
7454 (orif (register-unaligned FRintjeven 2)
7455 (register-unaligned FRintkeven 2)))
9aab5aa3
AC
7456 (c-call VOID "@cpu@_media_register_not_aligned")
7457 (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo))
36c3ae24
NC
7458 ; hack to get FRintkeven referenced as a target for profiling
7459 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7460 (extract-hilo FRintieven 0 FRintjeven 0 argihi argilo argjhi argjlo)
7461 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 0))
7462 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 0))
7463 (extract-hilo FRintieven 1 FRintjeven 1 argihi argilo argjhi argjlo)
7464 (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 1))
7465 (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 1))))
7466 ((fr400 (unit u-media-1-quad
7467 (in FRinti FRintieven)
7468 (in FRintj FRintjeven)
ac7c07ac 7469 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
9aab5aa3
AC
7470)
7471
7472(define-pmacro (saturate-unsigned arg max result)
7473 (if (gt arg max)
7474 (set result max)
7475 (set result arg))
7476)
7477
7478(dni msathu
7479 "Media dual saturation unsigned"
ac7c07ac 7480 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7481 "msathu$pack $FRinti,$FRintj,$FRintk"
7482 (+ pack FRintk OP_7B FRinti OPE1_0D FRintj)
7483 (sequence ((UHI argihi) (UHI argilo) (UHI argjhi) (UHI argjlo))
7484 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7485 (saturate-unsigned argihi argjhi (halfword hi FRintk 0))
7486 (saturate-unsigned argilo argjlo (halfword lo FRintk 0)))
7487 ((fr400 (unit u-media-1))
ac7c07ac 7488 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7489)
7490
7491(define-pmacro (media-dual-compare name mode op ope comment)
7492 (dni name
7493 (comment)
ac7c07ac 7494 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7495 (.str name "$pack $FRinti,$FRintj,$FCCk")
7496 (+ pack (cond-null) FCCk op FRinti ope FRintj)
7497 (if (register-unaligned FCCk 2)
7498 (c-call VOID "@cpu@_media_cr_not_aligned")
7499 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7500 (extract-hilo FRinti 0 FRintj 0
7501 argihi argilo argjhi argjlo)
7502 (compare-and-set-fcc argihi argjhi FCCk)
7503 (compare-and-set-fcc argilo argjlo (nextreg h-fccr FCCk 1))))
7504 ; TODO - doesn't handle second FCC
7505 ((fr400 (unit u-media-7))
ac7c07ac 7506 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7507 )
7508)
7509
7510(media-dual-compare mcmpsh HI OP_7B OPE1_0E "Media dual compare signed")
7511(media-dual-compare mcmpuh UHI OP_7B OPE1_0F "Media dual compare unsigned")
7512
7513; Bits for the MSR.SIE field
7514(define-pmacro (msr-sie-nil) 0)
7515(define-pmacro (msr-sie-fri-hi) 8)
7516(define-pmacro (msr-sie-fri-lo) 4)
7517(define-pmacro (msr-sie-fri-1-hi) 2)
7518(define-pmacro (msr-sie-fri-1-lo) 1)
7519(define-pmacro (msr-sie-acci) 8)
7520(define-pmacro (msr-sie-acci-1) 4)
7521(define-pmacro (msr-sie-acci-2) 2)
7522(define-pmacro (msr-sie-acci-3) 1)
7523
7524(define-pmacro (saturate-v arg max min sie result)
7525 (if (gt DI arg max)
7526 (sequence ()
7527 (set result max)
7528 (c-call VOID "@cpu@_media_overflow" sie))
7529 (if (lt DI arg min)
7530 (sequence ()
7531 (set result min)
7532 (c-call VOID "@cpu@_media_overflow" sie))
7533 (set result arg)))
7534)
7535
7536(dni mabshs
7537 "Media dual absolute value, halfword"
ac7c07ac 7538 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7539 "mabshs$pack $FRintj,$FRintk"
7540 (+ pack FRintk OP_78 (FRi-null) OPE1_0A FRintj)
7541 (sequence ((HI arghi) (HI arglo))
7542 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
7543 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
7544 (set arghi (halfword hi FRintj 0))
7545 (set arglo (halfword lo FRintj 0))
7546 (saturate-v (abs arghi) 32767 -32768 (msr-sie-fri-hi)
7547 (halfword hi FRintk 0))
7548 (saturate-v (abs arglo) 32767 -32768 (msr-sie-fri-lo)
7549 (halfword lo FRintk 0)))
ac7c07ac 7550 ((fr400 (unit u-media-1)) (fr550 (unit u-media)))
9aab5aa3
AC
7551)
7552
7553(define-pmacro (media-arith-sat-semantics
7554 operation arg1 arg2 res mode max min sie)
7555 (sequence ((DI tmp))
7556 (set tmp (operation arg1 arg2))
7557 (saturate-v tmp max min sie res))
7558)
7559
7560(define-pmacro (media-dual-arith-sat-semantics operation mode max min)
7561 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7562 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
7563 (media-arith-sat-semantics operation argihi argjhi
7564 (halfword hi FRintk 0) mode max min
7565 (msr-sie-fri-hi))
7566 (media-arith-sat-semantics operation argilo argjlo
7567 (halfword lo FRintk 0) mode max min
7568 (msr-sie-fri-lo)))
7569)
7570
7571(define-pmacro (media-dual-arith-sat name operation mode max min op ope comment)
7572 (dni name
7573 (comment)
ac7c07ac 7574 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1))
9aab5aa3
AC
7575 (.str name "$pack $FRinti,$FRintj,$FRintk")
7576 (+ pack FRintk op FRinti ope FRintj)
7577 (media-dual-arith-sat-semantics operation mode max min)
7578 ((fr400 (unit u-media-1))
ac7c07ac 7579 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7580 )
7581)
7582
7583(media-dual-arith-sat maddhss add HI 32767 -32768 OP_7B OPE1_10 "Media dual add signed with saturation")
7584(media-dual-arith-sat maddhus add UHI 65535 0 OP_7B OPE1_11 "Media dual add unsigned with saturation")
7585
7586(media-dual-arith-sat msubhss sub HI 32767 -32768 OP_7B OPE1_12 "Media dual sub signed with saturation")
7587(media-dual-arith-sat msubhus sub UHI 65535 0 OP_7B OPE1_13 "Media dual sub unsigned with saturation")
7588
7589(define-pmacro (conditional-media-dual-arith-sat
7590 name operation mode max min op ope comment)
7591 (dni name
7592 (comment)
ac7c07ac 7593 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
7594 (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond")
7595 (+ pack FRintk op FRinti CCi cond ope FRintj)
7596 (if (eq CCi (or cond 2))
7597 (media-dual-arith-sat-semantics operation mode max min))
7598 ((fr400 (unit u-media-1))
ac7c07ac 7599 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
7600 )
7601)
7602
7603(conditional-media-dual-arith-sat cmaddhss add HI 32767 -32768 OP_71 OPE4_0 "Conditional Media dual add signed with saturation")
7604(conditional-media-dual-arith-sat cmaddhus add UHI 65535 0 OP_71 OPE4_1 "Conditional Media dual add unsigned with saturation")
7605
7606(conditional-media-dual-arith-sat cmsubhss sub HI 32767 -32768 OP_71 OPE4_2 "Conditional Media dual sub signed with saturation")
7607(conditional-media-dual-arith-sat cmsubhus sub UHI 65535 0 OP_71 OPE4_3 "Conditional Media dual sub unsigned with saturation")
7608
7609(define-pmacro (media-quad-arith-sat-semantics cond operation mode max min)
36c3ae24
NC
7610 (if (orif (register-unaligned FRintieven 2)
7611 (orif (register-unaligned FRintjeven 2)
7612 (register-unaligned FRintkeven 2)))
9aab5aa3
AC
7613 (c-call VOID "@cpu@_media_register_not_aligned")
7614 (if cond
7615 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
36c3ae24
NC
7616 ; hack to get FRintkeven referenced as a target for profiling
7617 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
7618 (extract-hilo FRintieven 0 FRintjeven 0
9aab5aa3
AC
7619 argihi argilo argjhi argjlo)
7620 (media-arith-sat-semantics operation argihi argjhi
36c3ae24 7621 (halfword hi FRintkeven 0) mode
9aab5aa3
AC
7622 max min (msr-sie-fri-hi))
7623 (media-arith-sat-semantics operation argilo argjlo
36c3ae24 7624 (halfword lo FRintkeven 0) mode
9aab5aa3 7625 max min (msr-sie-fri-lo))
36c3ae24 7626 (extract-hilo FRintieven 1 FRintjeven 1
9aab5aa3
AC
7627 argihi argilo argjhi argjlo)
7628 (media-arith-sat-semantics operation argihi argjhi
36c3ae24 7629 (halfword hi FRintkeven 1) mode
9aab5aa3
AC
7630 max min (msr-sie-fri-1-hi))
7631 (media-arith-sat-semantics operation argilo argjlo
36c3ae24 7632 (halfword lo FRintkeven 1) mode
9aab5aa3
AC
7633 max min (msr-sie-fri-1-lo)))))
7634)
7635
7636(define-pmacro (media-quad-arith-sat name operation mode max min op ope comment)
7637 (dni name
7638 (comment)
ac7c07ac 7639 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2))
36c3ae24
NC
7640 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven")
7641 (+ pack FRintkeven op FRintieven ope FRintjeven)
9aab5aa3 7642 (media-quad-arith-sat-semantics 1 operation mode max min)
36c3ae24
NC
7643 ((fr400 (unit u-media-1-quad
7644 (in FRinti FRintieven)
7645 (in FRintj FRintjeven)
741a7751 7646 (out FRintk FRintkeven)))
36c3ae24
NC
7647 (fr500 (unit u-media-quad-arith
7648 (in FRinti FRintieven)
7649 (in FRintj FRintjeven)
ac7c07ac 7650 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
9aab5aa3
AC
7651 )
7652)
7653
7654(media-quad-arith-sat mqaddhss add HI 32767 -32768 OP_7B OPE1_18 "Media quad add signed with saturation")
7655(media-quad-arith-sat mqaddhus add UHI 65535 0 OP_7B OPE1_19 "Media quad add unsigned with saturation")
7656
7657(media-quad-arith-sat mqsubhss sub HI 32767 -32768 OP_7B OPE1_1A "Media quad sub signed with saturation")
7658(media-quad-arith-sat mqsubhus sub UHI 65535 0 OP_7B OPE1_1B "Media quad sub unsigned with saturation")
7659
7660(define-pmacro (conditional-media-quad-arith-sat
7661 name operation mode max min op ope comment)
7662 (dni name
7663 (comment)
ac7c07ac 7664 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2) CONDITIONAL)
36c3ae24
NC
7665 (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven,$CCi,$cond")
7666 (+ pack FRintkeven op FRintieven CCi cond ope FRintjeven)
9aab5aa3
AC
7667 (media-quad-arith-sat-semantics (eq CCi (or cond 2))
7668 operation mode max min)
36c3ae24
NC
7669 ((fr400 (unit u-media-1-quad
7670 (in FRinti FRintieven)
7671 (in FRintj FRintjeven)
741a7751 7672 (out FRintk FRintkeven)))
36c3ae24
NC
7673 (fr500 (unit u-media-quad-arith
7674 (in FRinti FRintieven)
7675 (in FRintj FRintjeven)
ac7c07ac 7676 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
9aab5aa3
AC
7677 )
7678)
7679
7680(conditional-media-quad-arith-sat cmqaddhss add HI 32767 -32768 OP_73 OPE4_0 "Conditional Media quad add signed with saturation")
7681(conditional-media-quad-arith-sat cmqaddhus add UHI 65535 0 OP_73 OPE4_1 "Conditional Media quad add unsigned with saturation")
7682
7683(conditional-media-quad-arith-sat cmqsubhss sub HI 32767 -32768 OP_73 OPE4_2 "Conditional Media quad sub signed with saturation")
7684(conditional-media-quad-arith-sat cmqsubhus sub UHI 65535 0 OP_73 OPE4_3 "Conditional Media quad sub unsigned with saturation")
7685
7686(define-pmacro (media-acc-arith-sat name operation mode max min op ope comment)
7687 (dni name
7688 (comment)
ac7c07ac 7689 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
9aab5aa3
AC
7690 (.str name "$pack $ACC40Si,$ACC40Sk")
7691 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
ac7c07ac
DB
7692 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7693 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7694 (if (register-unaligned ACC40Si 2)
7695 (c-call VOID "@cpu@_media_acc_not_aligned")
7696 (media-arith-sat-semantics operation ACC40Si
7697 (nextreg h-acc40S ACC40Si 1)
7698 ACC40Sk mode max min (msr-sie-acci)))))
7699 ((fr400 (unit u-media-2-acc)) (fr550 (unit u-media-4-acc)))
9aab5aa3
AC
7700 )
7701)
7702
7703(media-acc-arith-sat maddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7704 OP_78 OPE1_04 "Media accumulator addition")
7705(media-acc-arith-sat msubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7706 OP_78 OPE1_05 "Media accumulator subtraction")
7707
7708(define-pmacro (media-dual-acc-arith-sat name operation mode max min op ope
7709 comment)
7710 (dni name
7711 (comment)
ac7c07ac 7712 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
9aab5aa3
AC
7713 (.str name "$pack $ACC40Si,$ACC40Sk")
7714 (+ pack ACC40Sk op ACC40Si ope (ACCj-null))
ac7c07ac
DB
7715 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7716 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7717 (if (register-unaligned ACC40Si 4)
7718 (c-call VOID "@cpu@_media_acc_not_aligned")
7719 (if (register-unaligned ACC40Sk 2)
7720 (c-call VOID "@cpu@_media_acc_not_aligned")
7721 (sequence ()
7722 (media-arith-sat-semantics operation ACC40Si
7723 (nextreg h-acc40S ACC40Si 1)
7724 ACC40Sk mode max min
7725 (msr-sie-acci))
7726 (media-arith-sat-semantics operation
7727 (nextreg h-acc40S ACC40Si 2)
7728 (nextreg h-acc40S ACC40Si 3)
7729 (nextreg h-acc40S ACC40Sk 1)
7730 mode max min
7731 (msr-sie-acci-1)))))))
7732 ((fr400 (unit u-media-2-acc-dual)) (fr550 (unit u-media-4-acc-dual)))
9aab5aa3
AC
7733 )
7734)
7735
7736(media-dual-acc-arith-sat mdaddaccs add DI #x7fffffffff (inv DI #x7fffffffff)
7737 OP_78 OPE1_06 "Media accumulator addition")
7738(media-dual-acc-arith-sat mdsubaccs sub DI #x7fffffffff (inv DI #x7fffffffff)
7739 OP_78 OPE1_07 "Media accumulator subtraction")
7740
7741(dni masaccs
7742 "Media add and subtract signed accumulator with saturation"
ac7c07ac 7743 ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
9aab5aa3
AC
7744 "masaccs$pack $ACC40Si,$ACC40Sk"
7745 (+ pack ACC40Sk OP_78 ACC40Si OPE1_08 (ACCj-null))
ac7c07ac
DB
7746 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7747 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7748 (if (register-unaligned ACC40Si 2)
7749 (c-call VOID "@cpu@_media_acc_not_aligned")
7750 (if (register-unaligned ACC40Sk 2)
7751 (c-call VOID "@cpu@_media_acc_not_aligned")
7752 (sequence ()
7753 (media-arith-sat-semantics add ACC40Si
7754 (nextreg h-acc40S ACC40Si 1)
7755 ACC40Sk DI
7756 #x7fffffffff
7757 (inv DI #x7fffffffff)
7758 (msr-sie-acci))
7759 (media-arith-sat-semantics sub ACC40Si
7760 (nextreg h-acc40S ACC40Si 1)
7761 (nextreg h-acc40S ACC40Sk 1)
7762 DI
7763 #x7fffffffff
7764 (inv DI #x7fffffffff)
7765 (msr-sie-acci-1)))))))
7766 ((fr400 (unit u-media-2-add-sub)) (fr550 (unit u-media-4-add-sub)))
9aab5aa3
AC
7767 )
7768
7769(dni mdasaccs
7770 "Media add and subtract signed accumulator with saturation"
ac7c07ac 7771 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
9aab5aa3
AC
7772 "mdasaccs$pack $ACC40Si,$ACC40Sk"
7773 (+ pack ACC40Sk OP_78 ACC40Si OPE1_09 (ACCj-null))
ac7c07ac
DB
7774 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si))
7775 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7776 (if (register-unaligned ACC40Si 4)
7777 (c-call VOID "@cpu@_media_acc_not_aligned")
7778 (if (register-unaligned ACC40Sk 4)
7779 (c-call VOID "@cpu@_media_acc_not_aligned")
7780 (sequence ()
7781 (media-arith-sat-semantics add ACC40Si
7782 (nextreg h-acc40S ACC40Si 1)
7783 ACC40Sk DI
7784 #x7fffffffff
7785 (inv DI #x7fffffffff)
7786 (msr-sie-acci))
7787 (media-arith-sat-semantics sub ACC40Si
7788 (nextreg h-acc40S ACC40Si 1)
7789 (nextreg h-acc40S ACC40Sk 1)
7790 DI
7791 #x7fffffffff
7792 (inv DI #x7fffffffff)
7793 (msr-sie-acci-1))
7794 (media-arith-sat-semantics add
7795 (nextreg h-acc40S ACC40Si 2)
7796 (nextreg h-acc40S ACC40Si 3)
7797 (nextreg h-acc40S ACC40Sk 2)
7798 DI
7799 #x7fffffffff
7800 (inv DI #x7fffffffff)
7801 (msr-sie-acci-2))
7802 (media-arith-sat-semantics sub
7803 (nextreg h-acc40S ACC40Si 2)
7804 (nextreg h-acc40S ACC40Si 3)
7805 (nextreg h-acc40S ACC40Sk 3)
7806 DI
7807 #x7fffffffff
7808 (inv DI #x7fffffffff)
7809 (msr-sie-acci-3)))))))
7810 ((fr400 (unit u-media-2-add-sub-dual)) (fr550 (unit u-media-4-add-sub-dual)))
9aab5aa3
AC
7811 )
7812
7813(define-pmacro (media-multiply-semantics conv arg1 arg2 res)
7814 (set res (mul DI (conv DI arg1) (conv DI arg2)))
7815)
7816
7817(define-pmacro (media-dual-multiply-semantics cond mode conv rhs1 rhs2)
ac7c07ac
DB
7818 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7819 (if (register-unaligned ACC40Sk 2)
7820 (c-call VOID "@cpu@_media_acc_not_aligned")
7821 (if cond
7822 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7823 (extract-hilo FRinti 0 FRintj 0
7824 argihi argilo argjhi argjlo)
7825 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7826 (media-multiply-semantics conv argilo rhs2
7827 (nextreg h-acc40S ACC40Sk 1))))))
9aab5aa3
AC
7828)
7829
7830(define-pmacro (media-dual-multiply name mode conv rhs1 rhs2 op ope comment)
7831 (dni name
7832 (comment)
ac7c07ac 7833 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) PRESERVE-OVF)
9aab5aa3
AC
7834 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
7835 (+ pack ACC40Sk op FRinti ope FRintj)
7836 (media-dual-multiply-semantics 1 mode conv rhs1 rhs2)
7837 ((fr400 (unit u-media-2))
ac7c07ac 7838 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
7839 )
7840)
7841
7842(media-dual-multiply mmulhs HI ext argjhi argjlo OP_7B OPE1_14 "Media dual multiply signed")
7843(media-dual-multiply mmulhu UHI zext argjhi argjlo OP_7B OPE1_15 "Media dual multiply unsigned")
7844
7845(media-dual-multiply mmulxhs HI ext argjlo argjhi OP_7B OPE1_28 "Media dual cross multiply signed")
7846(media-dual-multiply mmulxhu UHI zext argjlo argjhi OP_7B OPE1_29 "Media dual cross multiply unsigned")
7847
7848(define-pmacro (conditional-media-dual-multiply
7849 name mode conv rhs1 rhs2 op ope comment)
7850 (dni name
7851 (comment)
ac7c07ac 7852 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)
9aab5aa3
AC
7853 PRESERVE-OVF CONDITIONAL)
7854 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
7855 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
7856 (media-dual-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
7857 ((fr400 (unit u-media-2))
ac7c07ac 7858 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
7859 )
7860)
7861
7862(conditional-media-dual-multiply cmmulhs HI ext argjhi argjlo OP_72 OPE4_0 "Conditional Media dual multiply signed")
7863(conditional-media-dual-multiply cmmulhu UHI zext argjhi argjlo OP_72 OPE4_1 "Conditional Media dual multiply unsigned")
7864
7865(define-pmacro (media-quad-multiply-semantics cond mode conv rhs1 rhs2)
ac7c07ac
DB
7866 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
7867 (if (register-unaligned ACC40Sk 4)
7868 (c-call VOID "@cpu@_media_acc_not_aligned")
7869 (if (orif (register-unaligned FRintieven 2)
7870 (register-unaligned FRintjeven 2))
7871 (c-call VOID "@cpu@_media_register_not_aligned")
7872 (if cond
7873 (sequence ((mode argihi) (mode argilo)
7874 (mode argjhi) (mode argjlo))
7875 (extract-hilo FRintieven 0 FRintjeven 0
7876 argihi argilo argjhi argjlo)
7877 (media-multiply-semantics conv argihi rhs1 ACC40Sk)
7878 (media-multiply-semantics conv argilo rhs2
7879 (nextreg h-acc40S ACC40Sk 1))
7880 (extract-hilo FRintieven 1 FRintjeven 1
7881 argihi argilo argjhi argjlo)
7882 (media-multiply-semantics conv argihi rhs1
7883 (nextreg h-acc40S ACC40Sk 2))
7884 (media-multiply-semantics conv argilo rhs2
7885 (nextreg h-acc40S ACC40Sk 3)))))))
9aab5aa3
AC
7886)
7887
7888(define-pmacro (media-quad-multiply name mode conv rhs1 rhs2 op ope comment)
7889 (dni name
7890 (comment)
ac7c07ac 7891 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) PRESERVE-OVF)
36c3ae24
NC
7892 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
7893 (+ pack ACC40Sk op FRintieven ope FRintjeven)
9aab5aa3 7894 (media-quad-multiply-semantics 1 mode conv rhs1 rhs2)
36c3ae24
NC
7895 ((fr400 (unit u-media-2-quad
7896 (in FRinti FRintieven)
7897 (in FRintj FRintjeven)))
7898 (fr500 (unit u-media-quad-mul
7899 (in FRinti FRintieven)
ac7c07ac 7900 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
7901 )
7902)
7903
7904(media-quad-multiply mqmulhs HI ext argjhi argjlo OP_7B OPE1_1C "Media quad multiply signed")
7905(media-quad-multiply mqmulhu UHI zext argjhi argjlo OP_7B OPE1_1D "Media quad multiply unsigned")
7906
7907(media-quad-multiply mqmulxhs HI ext argjlo argjhi OP_7B OPE1_2A "Media quad cross multiply signed")
7908(media-quad-multiply mqmulxhu UHI zext argjlo argjhi OP_7B OPE1_2B "Media quad cross multiply unsigned")
7909
7910(define-pmacro (conditional-media-quad-multiply
7911 name mode conv rhs1 rhs2 op ope comment)
7912 (dni name
7913 (comment)
ac7c07ac 7914 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)
9aab5aa3 7915 PRESERVE-OVF CONDITIONAL)
36c3ae24
NC
7916 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk,$CCi,$cond")
7917 (+ pack ACC40Sk op FRintieven CCi cond ope FRintjeven)
9aab5aa3 7918 (media-quad-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2)
36c3ae24
NC
7919 ((fr400 (unit u-media-2-quad
7920 (in FRinti FRintieven)
7921 (in FRintj FRintjeven)))
7922 (fr500 (unit u-media-quad-mul
7923 (in FRinti FRintieven)
ac7c07ac 7924 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
7925 )
7926)
7927
7928(conditional-media-quad-multiply cmqmulhs HI ext argjhi argjlo OP_74 OPE4_0 "Conditional Media quad multiply signed")
7929(conditional-media-quad-multiply cmqmulhu UHI zext argjhi argjlo OP_74 OPE4_1 "Conditional Media quad multiply unsigned")
7930
7931(define-pmacro (media-multiply-acc-semantics
7932 conv arg1 addop arg2 res max min sie)
7933 (sequence ((DI tmp))
7934 (set tmp (addop res (mul DI (conv DI arg1) (conv DI arg2))))
7935 (saturate-v tmp max min sie res))
7936)
7937
7938(define-pmacro (media-dual-multiply-acc-semantics
7939 cond mode conv addop rhw res max min)
ac7c07ac
DB
7940 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
7941 (if (register-unaligned res 2)
7942 (c-call VOID "@cpu@_media_acc_not_aligned")
7943 (if cond
7944 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
7945 (extract-hilo FRinti 0 FRintj 0
7946 argihi argilo argjhi argjlo)
7947 (media-multiply-acc-semantics conv argihi addop argjhi
7948 res
7949 max min (msr-sie-acci))
7950 (media-multiply-acc-semantics conv argilo addop argjlo
7951 (nextreg rhw res 1)
7952 max min (msr-sie-acci-1))))))
9aab5aa3
AC
7953)
7954
7955(define-pmacro (media-dual-multiply-acc
7956 name mode conv addop rhw res max min op ope comment)
7957 (dni name
7958 (comment)
ac7c07ac 7959 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
9aab5aa3
AC
7960 (.str name "$pack $FRinti,$FRintj,$" res)
7961 (+ pack res op FRinti ope FRintj)
7962 (media-dual-multiply-acc-semantics 1 mode conv addop rhw res max min)
7963 ((fr400 (unit u-media-2))
ac7c07ac 7964 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
7965 )
7966)
7967
7968(media-dual-multiply-acc mmachs HI ext add h-acc40S ACC40Sk
7969 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7970 OP_7B OPE1_16
7971 "Media dual multiply and accumulate signed")
7972
7973(media-dual-multiply-acc mmachu UHI zext add h-acc40U ACC40Uk
7974 (const DI #xffffffffff) (const DI 0)
7975 OP_7B OPE1_17
7976 "Media dual multiply and accumulate unsigned")
7977
7978(media-dual-multiply-acc mmrdhs HI ext sub h-acc40S ACC40Sk
7979 (const DI #x7fffffffff) (const DI #xffffff8000000000)
7980 OP_7B OPE1_30
7981 "Media dual multiply and reduce signed")
7982
7983(media-dual-multiply-acc mmrdhu UHI zext sub h-acc40U ACC40Uk
7984 (const DI #xffffffffff) (const DI 0)
7985 OP_7B OPE1_31
7986 "Media dual multiply and reduce unsigned")
7987
7988(define-pmacro (conditional-media-dual-multiply-acc
7989 name mode conv addop rhw res max min op ope comment)
7990 (dni name
7991 (comment)
ac7c07ac 7992 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
7993 (.str name "$pack $FRinti,$FRintj,$" res ",$CCi,$cond")
7994 (+ pack res op FRinti CCi cond ope FRintj)
7995 (media-dual-multiply-acc-semantics (eq CCi (or cond 2))
7996 mode conv addop rhw res max min)
7997 ((fr400 (unit u-media-2))
ac7c07ac 7998 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
7999 )
8000)
8001
8002(conditional-media-dual-multiply-acc cmmachs HI ext add h-acc40S ACC40Sk
8003 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8004 OP_72 OPE4_2
8005 "Conditional Media dual multiply and accumulate signed")
8006
8007(conditional-media-dual-multiply-acc cmmachu UHI zext add h-acc40U ACC40Uk
8008 (const DI #xffffffffff) (const DI 0)
8009 OP_72 OPE4_3
8010 "Conditional Media dual multiply and accumulate unsigned")
8011
8012(define-pmacro (media-quad-multiply-acc-semantics
8013 cond mode conv addop rhw res max min)
ac7c07ac
DB
8014 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8015 (if (register-unaligned res 4)
8016 (c-call VOID "@cpu@_media_acc_not_aligned")
8017 (if (orif (register-unaligned FRintieven 2)
8018 (register-unaligned FRintjeven 2))
8019 (c-call VOID "@cpu@_media_register_not_aligned")
8020 (if cond
8021 (sequence ((mode argihi) (mode argilo)
8022 (mode argjhi) (mode argjlo))
8023 (extract-hilo FRintieven 0 FRintjeven 0
8024 argihi argilo argjhi argjlo)
8025 (media-multiply-acc-semantics conv argihi addop argjhi
8026 res
8027 max min (msr-sie-acci))
8028 (media-multiply-acc-semantics conv argilo addop argjlo
8029 (nextreg rhw res 1)
8030 max min (msr-sie-acci-1))
8031 (extract-hilo FRintieven 1 FRintjeven 1
8032 argihi argilo argjhi argjlo)
8033 (media-multiply-acc-semantics conv argihi addop argjhi
8034 (nextreg rhw res 2)
8035 max min (msr-sie-acci-2))
8036 (media-multiply-acc-semantics conv argilo addop argjlo
8037 (nextreg rhw res 3)
8038 max min
8039 (msr-sie-acci-3)))))))
9aab5aa3
AC
8040)
8041
8042(define-pmacro (media-quad-multiply-acc
8043 name mode conv addop rhw res max min op ope comment)
8044 (dni name
8045 (comment)
ac7c07ac 8046 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8047 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8048 (+ pack res op FRintieven ope FRintjeven)
9aab5aa3 8049 (media-quad-multiply-acc-semantics 1 mode conv addop rhw res max min)
36c3ae24
NC
8050 ((fr400 (unit u-media-2-quad
8051 (in FRinti FRintieven)
8052 (in FRintj FRintjeven)))
8053 (fr500 (unit u-media-quad-mul
8054 (in FRinti FRintieven)
ac7c07ac 8055 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8056 )
8057)
8058
8059(media-quad-multiply-acc mqmachs HI ext add h-acc40S ACC40Sk
8060 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8061 OP_7B OPE1_1E
8062 "Media quad multiply and accumulate signed")
8063
8064(media-quad-multiply-acc mqmachu UHI zext add h-acc40U ACC40Uk
8065 (const DI #xffffffffff) (const DI 0)
8066 OP_7B OPE1_1F
8067 "Media quad multiply and accumulate unsigned")
8068
8069(define-pmacro (conditional-media-quad-multiply-acc
8070 name mode conv addop rhw res max min op ope comment)
8071 (dni name
8072 (comment)
ac7c07ac 8073 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) CONDITIONAL)
36c3ae24
NC
8074 (.str name "$pack $FRintieven,$FRintjeven,$" res ",$CCi,$cond")
8075 (+ pack res op FRintieven CCi cond ope FRintjeven)
9aab5aa3
AC
8076 (media-quad-multiply-acc-semantics (eq CCi (or cond 2))
8077 mode conv addop rhw res max min)
36c3ae24
NC
8078 ((fr400 (unit u-media-2-quad
8079 (in FRinti FRintieven)
8080 (in FRintj FRintjeven)))
8081 (fr500 (unit u-media-quad-mul
8082 (in FRinti FRintieven)
ac7c07ac 8083 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8084 )
8085)
8086
8087(conditional-media-quad-multiply-acc cmqmachs HI ext add h-acc40S ACC40Sk
8088 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8089 OP_74 OPE4_2
8090 "Conditional Media quad multiply and accumulate signed")
8091
8092(conditional-media-quad-multiply-acc cmqmachu UHI zext add h-acc40U ACC40Uk
8093 (const DI #xffffffffff) (const DI 0)
8094 OP_74 OPE4_3
8095 "Conditional media quad multiply and accumulate unsigned")
8096
8097(define-pmacro (media-quad-multiply-cross-acc-semantics
8098 cond mode conv addop rhw res max min)
ac7c07ac
DB
8099 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8100 (if (register-unaligned res 4)
8101 (c-call VOID "@cpu@_media_acc_not_aligned")
8102 (if (orif (register-unaligned FRintieven 2)
8103 (register-unaligned FRintjeven 2))
8104 (c-call VOID "@cpu@_media_register_not_aligned")
8105 (if cond
8106 (sequence ((mode argihi) (mode argilo)
8107 (mode argjhi) (mode argjlo))
8108 (extract-hilo FRintieven 0 FRintjeven 0
8109 argihi argilo argjhi argjlo)
8110 (media-multiply-acc-semantics conv argihi addop argjhi
8111 (nextreg rhw res 2)
8112 max min (msr-sie-acci-2))
8113 (media-multiply-acc-semantics conv argilo addop argjlo
8114 (nextreg rhw res 3)
8115 max min (msr-sie-acci-3))
8116 (extract-hilo FRintieven 1 FRintjeven 1
8117 argihi argilo argjhi argjlo)
8118 (media-multiply-acc-semantics conv argihi addop argjhi
8119 res
8120 max min (msr-sie-acci))
8121 (media-multiply-acc-semantics conv argilo addop argjlo
8122 (nextreg rhw res 1)
8123 max min
8124 (msr-sie-acci-1)))))))
9aab5aa3
AC
8125)
8126
8127(define-pmacro (media-quad-multiply-cross-acc
8128 name mode conv addop rhw res max min op ope comment)
8129 (dni name
8130 (comment)
ac7c07ac 8131 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8132 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8133 (+ pack res op FRintieven ope FRintjeven)
9aab5aa3
AC
8134 (media-quad-multiply-cross-acc-semantics 1 mode conv addop rhw res
8135 max min)
36c3ae24
NC
8136 ((fr400 (unit u-media-2-quad
8137 (in FRinti FRintieven)
ac7c07ac 8138 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8139 )
8140)
8141
8142(media-quad-multiply-cross-acc mqxmachs HI ext add h-acc40S ACC40Sk
8143 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8144 OP_78 OPE1_00
8145 "Media quad multiply and cross accumulate signed")
8146
8147(define-pmacro (media-quad-cross-multiply-cross-acc-semantics
8148 cond mode conv addop rhw res max min)
ac7c07ac
DB
8149 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8150 (if (register-unaligned res 4)
8151 (c-call VOID "@cpu@_media_acc_not_aligned")
8152 (if (orif (register-unaligned FRintieven 2)
8153 (register-unaligned FRintjeven 2))
8154 (c-call VOID "@cpu@_media_register_not_aligned")
8155 (if cond
8156 (sequence ((mode argihi) (mode argilo)
8157 (mode argjhi) (mode argjlo))
8158 (extract-hilo FRintieven 0 FRintjeven 0
8159 argihi argilo argjhi argjlo)
8160 (media-multiply-acc-semantics conv argihi addop argjlo
8161 (nextreg rhw res 2)
8162 max min (msr-sie-acci-2))
8163 (media-multiply-acc-semantics conv argilo addop argjhi
8164 (nextreg rhw res 3)
8165 max min (msr-sie-acci-3))
8166 (extract-hilo FRintieven 1 FRintjeven 1
8167 argihi argilo argjhi argjlo)
8168 (media-multiply-acc-semantics conv argihi addop argjlo
8169 res
8170 max min (msr-sie-acci))
8171 (media-multiply-acc-semantics conv argilo addop argjhi
8172 (nextreg rhw res 1)
8173 max min
8174 (msr-sie-acci-1)))))))
9aab5aa3
AC
8175)
8176
8177(define-pmacro (media-quad-cross-multiply-cross-acc
8178 name mode conv addop rhw res max min op ope comment)
8179 (dni name
8180 (comment)
ac7c07ac 8181 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8182 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8183 (+ pack res op FRintieven ope FRintjeven)
9aab5aa3
AC
8184 (media-quad-cross-multiply-cross-acc-semantics 1 mode conv addop rhw res
8185 max min)
36c3ae24
NC
8186 ((fr400 (unit u-media-2-quad
8187 (in FRinti FRintieven)
ac7c07ac 8188 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8189 )
8190)
8191
8192(media-quad-cross-multiply-cross-acc mqxmacxhs HI ext add h-acc40S ACC40Sk
8193 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8194 OP_78 OPE1_01
8195 "Media quad cross multiply and cross accumulate signed")
8196
8197(define-pmacro (media-quad-cross-multiply-acc-semantics
8198 cond mode conv addop rhw res max min)
ac7c07ac
DB
8199 (if (c-call SI "@cpu@_check_acc_range" (index-of res))
8200 (if (register-unaligned res 4)
8201 (c-call VOID "@cpu@_media_acc_not_aligned")
8202 (if (orif (register-unaligned FRintieven 2)
8203 (register-unaligned FRintjeven 2))
8204 (c-call VOID "@cpu@_media_register_not_aligned")
8205 (if cond
8206 (sequence ((mode argihi) (mode argilo)
8207 (mode argjhi) (mode argjlo))
8208 (extract-hilo FRintieven 0 FRintjeven 0
8209 argihi argilo argjhi argjlo)
8210 (media-multiply-acc-semantics conv argihi addop argjlo
8211 res
8212 max min (msr-sie-acci))
8213 (media-multiply-acc-semantics conv argilo addop argjhi
8214 (nextreg rhw res 1)
8215 max min (msr-sie-acci-1))
8216 (extract-hilo FRintieven 1 FRintjeven 1
8217 argihi argilo argjhi argjlo)
8218 (media-multiply-acc-semantics conv argihi addop argjlo
8219 (nextreg rhw res 2)
8220 max min (msr-sie-acci-2))
8221 (media-multiply-acc-semantics conv argilo addop argjhi
8222 (nextreg rhw res 3)
8223 max min
8224 (msr-sie-acci-3)))))))
9aab5aa3
AC
8225)
8226
8227(define-pmacro (media-quad-cross-multiply-acc
8228 name mode conv addop rhw res max min op ope comment)
8229 (dni name
8230 (comment)
ac7c07ac 8231 ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8232 (.str name "$pack $FRintieven,$FRintjeven,$" res)
8233 (+ pack res op FRintieven ope FRintjeven)
9aab5aa3
AC
8234 (media-quad-cross-multiply-acc-semantics 1 mode conv addop rhw res
8235 max min)
36c3ae24
NC
8236 ((fr400 (unit u-media-2-quad
8237 (in FRinti FRintieven)
ac7c07ac 8238 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8239 )
8240)
8241
8242(media-quad-cross-multiply-acc mqmacxhs HI ext add h-acc40S ACC40Sk
8243 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8244 OP_78 OPE1_02
8245 "Media quad cross multiply and accumulate signed")
8246
8247(define-pmacro (media-complex-semantics
8248 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8249 (sequence ((DI tmp1) (DI tmp2))
8250 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8251 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8252 (set tmp1 (sub tmp1 tmp2))
8253 (saturate-v tmp1 max min sie res))
8254)
8255
8256(define-pmacro (media-complex-semantics-i
8257 conv lhs1 rhs1 lhs2 rhs2 res max min sie)
8258 (sequence ((DI tmp1) (DI tmp2))
8259 (media-multiply-semantics conv lhs1 rhs1 tmp1)
8260 (media-multiply-semantics conv lhs2 rhs2 tmp2)
8261 (set tmp1 (add tmp1 tmp2))
8262 (saturate-v tmp1 max min sie res))
8263)
8264
8265(define-pmacro (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
ac7c07ac
DB
8266 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8267 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8268 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8269 (media-complex-semantics conv argihi rhs1 argilo rhs2 ACC40Sk
8270 max min (msr-sie-acci))))
9aab5aa3
AC
8271)
8272
8273(define-pmacro (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
ac7c07ac
DB
8274 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8275 (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo))
8276 (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo)
8277 (media-complex-semantics-i conv argihi rhs1 argilo rhs2 ACC40Sk
8278 max min (msr-sie-acci))))
9aab5aa3
AC
8279)
8280
8281(define-pmacro (media-dual-complex
8282 name mode conv rhs1 rhs2 max min op ope comment)
8283 (dni name
8284 (comment)
ac7c07ac 8285 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
9aab5aa3
AC
8286 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8287 (+ pack ACC40Sk op FRinti ope FRintj)
8288 (media-dual-complex-semantics mode conv rhs1 rhs2 max min)
8289 ((fr400 (unit u-media-2))
ac7c07ac 8290 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
8291 )
8292)
8293
8294(define-pmacro (media-dual-complex-i
8295 name mode conv rhs1 rhs2 max min op ope comment)
8296 (dni name
8297 (comment)
ac7c07ac 8298 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1))
9aab5aa3
AC
8299 (.str name "$pack $FRinti,$FRintj,$ACC40Sk")
8300 (+ pack ACC40Sk op FRinti ope FRintj)
8301 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)
8302 ((fr400 (unit u-media-2))
ac7c07ac 8303 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
8304 )
8305)
8306
8307(media-dual-complex mcpxrs HI ext argjhi argjlo
8308 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8309 OP_7B OPE1_20
8310 "Media dual complex real signed with saturation")
8311
8312(media-dual-complex mcpxru UHI zext argjhi argjlo
8313 (const DI #xffffffffff) (const DI 0)
8314 OP_7B OPE1_21
8315 "Media dual complex real unsigned with saturation")
8316
8317(media-dual-complex-i mcpxis HI ext argjlo argjhi
8318 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8319 OP_7B OPE1_22
8320 "Media dual complex imaginary signed with saturation")
8321
8322(media-dual-complex-i mcpxiu UHI zext argjlo argjhi
8323 (const DI #xffffffffff) (const DI 0)
8324 OP_7B OPE1_23
8325 "Media dual complex imaginary unsigned with saturation")
8326
8327(define-pmacro (conditional-media-dual-complex
8328 name mode conv rhs1 rhs2 max min op ope comment)
8329 (dni name
8330 (comment)
ac7c07ac 8331 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
8332 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8333 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8334 (if (eq CCi (or cond 2))
8335 (media-dual-complex-semantics mode conv rhs1 rhs2 max min))
8336 ((fr400 (unit u-media-2))
ac7c07ac 8337 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
8338 )
8339)
8340
8341(define-pmacro (conditional-media-dual-complex-i
8342 name mode conv rhs1 rhs2 max min op ope comment)
8343 (dni name
8344 (comment)
ac7c07ac 8345 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
8346 (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond")
8347 (+ pack ACC40Sk op FRinti CCi cond ope FRintj)
8348 (if (eq CCi (or cond 2))
8349 (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min))
8350 ((fr400 (unit u-media-2))
ac7c07ac 8351 (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4)))
9aab5aa3
AC
8352 )
8353)
8354
8355(conditional-media-dual-complex cmcpxrs HI ext argjhi argjlo
8356 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8357 OP_75 OPE4_0
8358 "Conditional Media dual complex real signed with saturation")
8359
8360(conditional-media-dual-complex cmcpxru UHI zext argjhi argjlo
8361 (const DI #xffffffffff) (const DI 0)
8362 OP_75 OPE4_1
8363 "Conditional Media dual complex real unsigned with saturation")
8364
8365(conditional-media-dual-complex-i cmcpxis HI ext argjlo argjhi
8366 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8367 OP_75 OPE4_2
8368 "Conditional Media dual complex imaginary signed with saturation")
8369
8370(conditional-media-dual-complex-i cmcpxiu UHI zext argjlo argjhi
8371 (const DI #xffffffffff) (const DI 0)
8372 OP_75 OPE4_3
8373 "Conditional Media dual complex imaginary unsigned with saturation")
8374
8375(define-pmacro (media-quad-complex
8376 name mode conv rhs1 rhs2 max min op ope comment)
8377 (dni name
8378 (comment)
ac7c07ac 8379 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8380 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8381 (+ pack ACC40Sk op FRintieven ope FRintjeven)
ac7c07ac
DB
8382 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8383 (if (register-unaligned ACC40Sk 2)
8384 (c-call VOID "@cpu@_media_acc_not_aligned")
8385 (if (orif (register-unaligned FRintieven 2)
8386 (register-unaligned FRintjeven 2))
8387 (c-call VOID "@cpu@_media_register_not_aligned")
8388 (sequence ((mode argihi) (mode argilo)
8389 (mode argjhi) (mode argjlo))
8390 (extract-hilo FRintieven 0 FRintjeven 0
8391 argihi argilo argjhi argjlo)
8392 (media-complex-semantics conv argihi rhs1 argilo rhs2
8393 ACC40Sk
8394 max min (msr-sie-acci))
8395 (extract-hilo FRintieven 1 FRintjeven 1
8396 argihi argilo argjhi argjlo)
8397 (media-complex-semantics conv argihi rhs1 argilo rhs2
8398 (nextreg h-acc40S ACC40Sk 1)
8399 max min (msr-sie-acci-1))))))
36c3ae24
NC
8400 ((fr400 (unit u-media-2-quad
8401 (in FRinti FRintieven)
8402 (in FRintj FRintjeven)))
8403 (fr500 (unit u-media-quad-complex
8404 (in FRinti FRintieven)
ac7c07ac 8405 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8406 )
8407)
8408
8409(define-pmacro (media-quad-complex-i
8410 name mode conv rhs1 rhs2 max min op ope comment)
8411 (dni name
8412 (comment)
ac7c07ac 8413 ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2))
36c3ae24
NC
8414 (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk")
8415 (+ pack ACC40Sk op FRintieven ope FRintjeven)
ac7c07ac
DB
8416 (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk))
8417 (if (register-unaligned ACC40Sk 2)
8418 (c-call VOID "@cpu@_media_acc_not_aligned")
8419 (if (orif (register-unaligned FRintieven 2)
8420 (register-unaligned FRintjeven 2))
8421 (c-call VOID "@cpu@_media_register_not_aligned")
8422 (sequence ((mode argihi) (mode argilo)
8423 (mode argjhi) (mode argjlo))
8424 (extract-hilo FRintieven 0 FRintjeven 0
8425 argihi argilo argjhi argjlo)
8426 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8427 ACC40Sk
8428 max min (msr-sie-acci))
8429 (extract-hilo FRintieven 1 FRintjeven 1
8430 argihi argilo argjhi argjlo)
8431 (media-complex-semantics-i conv argihi rhs1 argilo rhs2
8432 (nextreg h-acc40S ACC40Sk 1)
8433 max min (msr-sie-acci-1))))))
36c3ae24
NC
8434 ((fr400 (unit u-media-2-quad
8435 (in FRinti FRintieven)
8436 (in FRintj FRintjeven)))
8437 (fr500 (unit u-media-quad-complex
8438 (in FRinti FRintieven)
ac7c07ac 8439 (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad)))
9aab5aa3
AC
8440 )
8441)
8442
8443(media-quad-complex mqcpxrs HI ext argjhi argjlo
8444 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8445 OP_7B OPE1_24
8446 "Media quad complex real signed with saturation")
8447
8448(media-quad-complex mqcpxru UHI zext argjhi argjlo
8449 (const DI #xffffffffff) (const DI 0)
8450 OP_7B OPE1_25
8451 "Media quad complex real unsigned with saturation")
8452
8453(media-quad-complex-i mqcpxis HI ext argjlo argjhi
8454 (const DI #x7fffffffff) (const DI #xffffff8000000000)
8455 OP_7B OPE1_26
8456 "Media quad complex imaginary signed with saturation")
8457
8458(media-quad-complex-i mqcpxiu UHI zext argjlo argjhi
8459 (const DI #xffffffffff) (const DI 0)
8460 OP_7B OPE1_27
8461 "Media quad complex imaginary unsigned with saturation")
8462
8463(define-pmacro (media-pack src1 src2 targ offset)
8464 (sequence ()
8465 (set (halfword hi targ offset) (halfword lo src1 offset))
8466 (set (halfword lo targ offset) (halfword lo src2 offset)))
8467)
8468
8469(define-pmacro (media-expand-halfword-to-word-semantics cond)
8470 (if cond
8471 (sequence ((UHI tmp))
8472 (if (and u6 1)
8473 (set tmp (halfword lo FRinti 0))
8474 (set tmp (halfword hi FRinti 0)))
8475 (set (halfword hi FRintk 0) tmp)
8476 (set (halfword lo FRintk 0) tmp)))
8477)
8478
8479(dni mexpdhw
8480 "Media expand halfword to word"
ac7c07ac 8481 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8482 "mexpdhw$pack $FRinti,$u6,$FRintk"
8483 (+ pack FRintk OP_7B FRinti OPE1_32 u6)
8484 (media-expand-halfword-to-word-semantics 1)
8485 ((fr400 (unit u-media-3))
ac7c07ac 8486 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
8487)
8488
8489(dni cmexpdhw
8490 "Conditional media expand halfword to word"
ac7c07ac 8491 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1) CONDITIONAL)
9aab5aa3
AC
8492 "cmexpdhw$pack $FRinti,$u6,$FRintk,$CCi,$cond"
8493 (+ pack FRintk OP_76 FRinti CCi cond OPE4_2 u6)
8494 (media-expand-halfword-to-word-semantics (eq CCi (or cond 2)))
8495 ((fr400 (unit u-media-3))
ac7c07ac 8496 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
8497)
8498
8499(define-pmacro (media-expand-halfword-to-double-semantics cond)
36c3ae24 8500 (if (register-unaligned FRintkeven 2)
9aab5aa3
AC
8501 (c-call VOID "@cpu@_media_register_not_aligned")
8502 (if cond
8503 (sequence ((UHI tmp))
36c3ae24
NC
8504 ; a hack to get FRintkeven referenced for profiling
8505 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
9aab5aa3
AC
8506 (if (and u6 1)
8507 (set tmp (halfword lo FRinti 0))
8508 (set tmp (halfword hi FRinti 0)))
36c3ae24
NC
8509 (set (halfword hi FRintkeven 0) tmp)
8510 (set (halfword lo FRintkeven 0) tmp)
8511 (set (halfword hi FRintkeven 1) tmp)
8512 (set (halfword lo FRintkeven 1) tmp))))
9aab5aa3
AC
8513)
8514
8515(dni mexpdhd
8516 "Media expand halfword to double"
ac7c07ac 8517 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
8518 "mexpdhd$pack $FRinti,$u6,$FRintkeven"
8519 (+ pack FRintkeven OP_7B FRinti OPE1_33 u6)
9aab5aa3 8520 (media-expand-halfword-to-double-semantics 1)
36c3ae24
NC
8521 ((fr400 (unit u-media-dual-expand
8522 (out FRintk FRintkeven)))
8523 (fr500 (unit u-media-dual-expand
ac7c07ac 8524 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
9aab5aa3
AC
8525)
8526
8527(dni cmexpdhd
8528 "Conditional media expand halfword to double"
ac7c07ac 8529 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
36c3ae24
NC
8530 "cmexpdhd$pack $FRinti,$u6,$FRintkeven,$CCi,$cond"
8531 (+ pack FRintkeven OP_76 FRinti CCi cond OPE4_3 u6)
9aab5aa3 8532 (media-expand-halfword-to-double-semantics (eq CCi (or cond 2)))
36c3ae24
NC
8533 ((fr400 (unit u-media-dual-expand
8534 (out FRintk FRintkeven)))
8535 (fr500 (unit u-media-dual-expand
ac7c07ac 8536 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
9aab5aa3
AC
8537)
8538
8539(dni mpackh
8540 "Media halfword pack"
ac7c07ac 8541 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8542 "mpackh$pack $FRinti,$FRintj,$FRintk"
8543 (+ pack FRintk OP_7B FRinti OPE1_34 FRintj)
8544 (media-pack FRinti FRintj FRintk 0)
8545 ((fr400 (unit u-media-3))
ac7c07ac 8546 (fr500 (unit u-media)) (fr550 (unit u-media)))
9aab5aa3
AC
8547)
8548
8549(dni mdpackh
8550 "Media dual pack"
ac7c07ac 8551 ((UNIT FM01) (FR500-MAJOR M-5) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
8552 "mdpackh$pack $FRintieven,$FRintjeven,$FRintkeven"
8553 (+ pack FRintkeven OP_7B FRintieven OPE1_36 FRintjeven)
8554 (if (orif (register-unaligned FRintieven 2)
8555 (orif (register-unaligned FRintjeven 2)
8556 (register-unaligned FRintkeven 2)))
9aab5aa3
AC
8557 (c-call VOID "@cpu@_media_register_not_aligned")
8558 (sequence ()
8559 ; hack to get these referenced for profiling
36c3ae24
NC
8560 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
8561 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
8562 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8563 (media-pack FRintieven FRintjeven FRintkeven 0)
8564 (media-pack FRintieven FRintjeven FRintkeven 1)))
8565 ((fr400 (unit u-media-3-quad
8566 (in FRinti FRintieven)
8567 (in FRintj FRintjeven)
8568 (out FRintk FRintkeven)))
8569 (fr500 (unit u-media-quad-arith
8570 (in FRinti FRintieven)
8571 (in FRintj FRintjeven)
ac7c07ac 8572 (out FRintk FRintkeven))) (fr550 (unit u-media-quad)))
9aab5aa3
AC
8573)
8574
8575(define-pmacro (media-unpack src soff targ toff)
8576 (sequence ()
8577 (set (halfword hi targ toff) (halfword hi src soff))
8578 (set (halfword lo targ toff) (halfword hi src soff))
8579 (set (halfword hi targ (add toff 1)) (halfword lo src soff))
8580 (set (halfword lo targ (add toff 1)) (halfword lo src soff)))
8581)
8582
8583(dni munpackh
8584 "Media halfword unpack"
ac7c07ac 8585 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
8586 "munpackh$pack $FRinti,$FRintkeven"
8587 (+ pack FRintkeven OP_7B FRinti OPE1_35 (FRj-null))
8588 (if (register-unaligned FRintkeven 2)
9aab5aa3
AC
8589 (c-call VOID "@cpu@_media_register_not_aligned")
8590 (sequence ()
8591 ; hack to get these referenced for profiling
8592 (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
36c3ae24
NC
8593 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8594 (media-unpack FRinti 0 FRintkeven 0)))
8595 ((fr400 (unit u-media-dual-expand
8596 (out FRintk FRintkeven)))
8597 (fr500 (unit u-media-dual-expand
ac7c07ac 8598 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
9aab5aa3
AC
8599)
8600
8601(dni mdunpackh
8602 "Media dual unpack"
8603 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
36c3ae24
NC
8604 "mdunpackh$pack $FRintieven,$FRintk"
8605 (+ pack FRintk OP_7B FRintieven OPE1_37 (FRj-null))
8606 (if (orif (register-unaligned FRintieven 2) (register-unaligned FRintk 4))
9aab5aa3
AC
8607 (c-call VOID "@cpu@_media_register_not_aligned")
8608 (sequence ()
8609 ; hack to get these referenced for profiling
36c3ae24 8610 (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven))
9aab5aa3 8611 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
36c3ae24
NC
8612 (media-unpack FRintieven 0 FRintk 0)
8613 (media-unpack FRintieven 1 FRintk 2)))
8614 ((fr500 (unit u-media-dual-unpack
8615 (in FRinti FRintieven))))
9aab5aa3
AC
8616)
8617
8618(define-pmacro (ubyte num arg offset)
8619 (reg (.sym h-fr_ num) (add (index-of arg) offset)))
8620
8621(define-pmacro (mbtoh-semantics cond)
36c3ae24 8622 (if (register-unaligned FRintkeven 2)
9aab5aa3
AC
8623 (c-call VOID "@cpu@_media_register_not_aligned")
8624 (if cond
8625 (sequence ()
36c3ae24
NC
8626 (set (halfword hi FRintkeven 0) (ubyte 3 FRintj 0))
8627 (set (halfword lo FRintkeven 0) (ubyte 2 FRintj 0))
8628 (set (halfword hi FRintkeven 1) (ubyte 1 FRintj 0))
8629 (set (halfword lo FRintkeven 1) (ubyte 0 FRintj 0)))))
9aab5aa3
AC
8630)
8631
8632(dni mbtoh
8633 "Media convert byte to halfword"
ac7c07ac 8634 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
8635 "mbtoh$pack $FRintj,$FRintkeven"
8636 (+ pack FRintkeven OP_7B (FRi-null) OPE1_38 FRintj)
9aab5aa3
AC
8637 (sequence ()
8638 ; hack to get these referenced for profiling
8639 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
36c3ae24 8640 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
9aab5aa3 8641 (mbtoh-semantics 1))
36c3ae24 8642 ((fr400 (unit u-media-dual-expand
6d9ab561 8643 (out FRintk FRintkeven)))
36c3ae24 8644 (fr500 (unit u-media-dual-btoh
ac7c07ac 8645 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand)))
9aab5aa3
AC
8646)
8647
8648(dni cmbtoh
8649 "Conditional media convert byte to halfword"
ac7c07ac 8650 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
36c3ae24
NC
8651 "cmbtoh$pack $FRintj,$FRintkeven,$CCi,$cond"
8652 (+ pack FRintkeven OP_77 (FRi-null) CCi cond OPE4_0 FRintj)
6d9ab561
NC
8653 (sequence ()
8654 ; hack to get these referenced for profiling
8655 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8656 (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven))
8657 (mbtoh-semantics (eq CCi (or cond 2))))
36c3ae24
NC
8658 ((fr400 (unit u-media-dual-expand
8659 (out FRintk FRintkeven)))
8660 (fr500 (unit u-media-dual-btoh
ac7c07ac 8661 (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand (in FRinti FRintj))))
9aab5aa3
AC
8662)
8663
8664(define-pmacro (mhtob-semantics cond)
36c3ae24 8665 (if (register-unaligned FRintjeven 2)
9aab5aa3
AC
8666 (c-call VOID "@cpu@_media_register_not_aligned")
8667 (if cond
8668 (sequence ()
36c3ae24
NC
8669 (set (ubyte 3 FRintk 0) (halfword hi FRintjeven 0))
8670 (set (ubyte 2 FRintk 0) (halfword lo FRintjeven 0))
8671 (set (ubyte 1 FRintk 0) (halfword hi FRintjeven 1))
8672 (set (ubyte 0 FRintk 0) (halfword lo FRintjeven 1)))))
9aab5aa3
AC
8673)
8674
8675(dni mhtob
8676 "Media convert halfword to byte"
ac7c07ac 8677 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
36c3ae24
NC
8678 "mhtob$pack $FRintjeven,$FRintk"
8679 (+ pack FRintk OP_7B (FRi-null) OPE1_39 FRintjeven)
9aab5aa3
AC
8680 (sequence ()
8681 ; hack to get these referenced for profiling
36c3ae24 8682 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
9aab5aa3
AC
8683 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8684 (mhtob-semantics 1))
36c3ae24
NC
8685 ((fr400 (unit u-media-dual-htob
8686 (in FRintj FRintjeven)))
8687 (fr500 (unit u-media-dual-htob
ac7c07ac 8688 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
9aab5aa3
AC
8689)
8690
8691(dni cmhtob
8692 "Conditional media convert halfword to byte"
ac7c07ac 8693 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL)
36c3ae24
NC
8694 "cmhtob$pack $FRintjeven,$FRintk,$CCi,$cond"
8695 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_1 FRintjeven)
9aab5aa3
AC
8696 (sequence ()
8697 ; hack to get these referenced for profiling
36c3ae24 8698 (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven))
9aab5aa3
AC
8699 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8700 (mhtob-semantics (eq CCi (or cond 2))))
36c3ae24
NC
8701 ((fr400 (unit u-media-dual-htob
8702 (in FRintj FRintjeven)))
8703 (fr500 (unit u-media-dual-htob
ac7c07ac 8704 (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven))))
9aab5aa3
AC
8705)
8706
8707(define-pmacro (mbtohe-semantics cond)
8708 (if (register-unaligned FRintk 4)
8709 (c-call VOID "@cpu@_media_register_not_aligned")
8710 (if cond
8711 (sequence ()
8712 (set (halfword hi FRintk 0) (ubyte 3 FRintj 0))
8713 (set (halfword lo FRintk 0) (ubyte 3 FRintj 0))
8714 (set (halfword hi FRintk 1) (ubyte 2 FRintj 0))
8715 (set (halfword lo FRintk 1) (ubyte 2 FRintj 0))
8716 (set (halfword hi FRintk 2) (ubyte 1 FRintj 0))
8717 (set (halfword lo FRintk 2) (ubyte 1 FRintj 0))
8718 (set (halfword hi FRintk 3) (ubyte 0 FRintj 0))
8719 (set (halfword lo FRintk 3) (ubyte 0 FRintj 0)))))
8720)
8721
8722(dni mbtohe
8723 "Media convert byte to halfword extended"
8724 ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv))
8725 "mbtohe$pack $FRintj,$FRintk"
8726 (+ pack FRintk OP_7B (FRi-null) OPE1_3A 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 1))
8732 ((fr500 (unit u-media-dual-btohe)))
8733)
8734
8735(dni cmbtohe
8736 "Conditional media convert byte to halfword extended"
8737 ((UNIT FM01) (FR500-MAJOR M-7) CONDITIONAL (MACH simple,tomcat,frv))
8738 "cmbtohe$pack $FRintj,$FRintk,$CCi,$cond"
8739 (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_2 FRintj)
8740 (sequence ()
8741 ; hack to get these referenced for profiling
8742 (set FRintj (c-raw-call SI "frv_ref_SI" FRintj))
8743 (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
8744 (mbtohe-semantics (eq CCi (or cond 2))))
8745 ((fr500 (unit u-media-dual-btohe)))
8746)
8747
8caa9169
DB
8748; Media NOP
8749; A special case of mclracc
8750(dni mnop "Media nop"
ac7c07ac 8751 ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-1) (FR400-MAJOR M-1))
8caa9169
DB
8752 "mnop$pack"
8753 (+ pack (f-ACC40Sk 63) OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8754 (nop)
8755 ()
8756)
8757
8758; mclracc with #A==0
8759(dni mclracc-0
8760 "Media clear accumulator(s)"
ac7c07ac 8761 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
8caa9169
DB
8762 "mclracc$pack $ACC40Sk,$A0"
8763 (+ pack ACC40Sk OP_7B (f-A 0) (misc-null-10) OPE1_3B (FRj-null))
8764 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 0)
8765 ((fr400 (unit u-media-4))
ac7c07ac 8766 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
8caa9169
DB
8767)
8768
8769; mclracc with #A==1
8770(dni mclracc-1
9aab5aa3 8771 "Media clear accumulator(s)"
ac7c07ac 8772 ((UNIT MCLRACC-1) (FR500-MAJOR M-6) (FR550-MAJOR M-3) (FR400-MAJOR M-2))
8caa9169
DB
8773 "mclracc$pack $ACC40Sk,$A1"
8774 (+ pack ACC40Sk OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null))
8775 (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 1)
9aab5aa3 8776 ((fr400 (unit u-media-4))
ac7c07ac 8777 (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc)))
9aab5aa3
AC
8778)
8779
8780(dni mrdacc
8781 "Media read accumulator"
ac7c07ac 8782 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8783 "mrdacc$pack $ACC40Si,$FRintk"
8784 (+ pack FRintk OP_7B ACC40Si OPE1_3C (FRj-null))
8785 (set FRintk ACC40Si)
8786 ((fr400 (unit u-media-4))
ac7c07ac 8787 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc)))
9aab5aa3
AC
8788)
8789
8790(dni mrdaccg
8791 "Media read accumulator guard"
ac7c07ac 8792 ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8793 "mrdaccg$pack $ACCGi,$FRintk"
8794 (+ pack FRintk OP_7B ACCGi OPE1_3E (FRj-null))
8795 (set FRintk ACCGi)
8796 ((fr400 (unit u-media-4-accg))
ac7c07ac 8797 (fr500 (unit u-media)) (fr550 (unit u-media-3-acc (in ACC40Si ACCGi))))
9aab5aa3
AC
8798)
8799
8800(dni mwtacc
8801 "Media write accumulator"
ac7c07ac 8802 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8803 "mwtacc$pack $FRinti,$ACC40Sk"
8804 (+ pack ACC40Sk OP_7B FRinti OPE1_3D (FRj-null))
8805 (set ACC40Sk (or (and ACC40Sk (const DI #xffffffff00000000))
8806 FRinti))
8807 ((fr400 (unit u-media-4))
ac7c07ac 8808 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc)))
9aab5aa3
AC
8809)
8810
8811(dni mwtaccg
8812 "Media write accumulator guard"
ac7c07ac 8813 ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1))
9aab5aa3
AC
8814 "mwtaccg$pack $FRinti,$ACCGk"
8815 (+ pack ACCGk OP_7B FRinti OPE1_3F (FRj-null))
d0312406
DB
8816 (sequence ()
8817 ; hack to get these referenced for profiling
8818 (c-raw-call VOID "frv_ref_SI" ACCGk)
8819 (set ACCGk FRinti))
9aab5aa3 8820 ((fr400 (unit u-media-4-accg))
ac7c07ac 8821 (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc (in ACC40Sk ACCGk))))
9aab5aa3
AC
8822)
8823
8824(define-pmacro (media-cop num op)
8825 (dni (.sym mcop num)
8826 "Media custom instruction"
8827 ((UNIT FM01) (FR500-MAJOR M-1) (MACH frv))
8828 (.str "mcop" num "$pack $FRi,$FRj,$FRk")
8829 (+ pack FRk op FRi OPE1_00 FRj)
8830 (c-call VOID "@cpu@_media_cop" num)
8831 ()
8832 )
8833)
8834
8835(media-cop 1 OP_7C)
8836(media-cop 2 OP_7D)
8837
8838; nop
8839; A nop is defined to be a "ori gr0,0,gr0"
8840; This needn't be a macro-insn, but making it one greatly simplifies decode.c
8841; On the other hand spending a little time in the decoder is often worth it.
8842;
8843(dnmi nop "nop"
8caa9169 8844 ((UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
8845 "nop$pack"
8846 (emit ori pack (GRi 0) (s12 0) (GRk 0))
8847)
8848
8849; Floating point NOP
8850(dni fnop
8851 "Floating point nop"
ac7c07ac 8852 ((UNIT FMALL) (FR500-MAJOR F-8) (FR550-MAJOR F-1) (MACH simple,tomcat,fr500,fr550,frv))
9aab5aa3
AC
8853 "fnop$pack"
8854 (+ pack (rd-null) OP_79 (FRi-null) OPE1_0D (FRj-null))
8855 (nop)
8856 ()
8857)
8858
9aab5aa3
AC
8859; A return instruction
8860(dnmi ret "return"
8861 (NO-DIS (UNIT B01) (FR500-MAJOR B-3) (FR400-MAJOR B-3))
8862 "ret$pack"
8863 (emit bralr pack (hint_taken 2))
8864)
8865
8866(dnmi cmp "compare"
8caa9169 8867 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
8868 "cmp$pack $GRi,$GRj,$ICCi_1"
8869 (emit subcc pack GRi GRj (GRk 0) ICCi_1)
8870)
8871
8872(dnmi cmpi "compare immediate"
8caa9169 8873 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
8874 "cmpi$pack $GRi,$s10,$ICCi_1"
8875 (emit subicc pack GRi s10 (GRk 0) ICCi_1)
8876)
8877
8878(dnmi ccmp "conditional compare"
8caa9169 8879 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
8880 "ccmp$pack $GRi,$GRj,$CCi,$cond"
8881 (emit csubcc pack GRi GRj (GRk 0) CCi cond)
8882)
8883
8884(dnmi mov "move"
8caa9169 8885 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1))
9aab5aa3
AC
8886 "mov$pack $GRi,$GRk"
8887 (emit ori pack GRi (s12 0) GRk)
8888)
8889
8890(dnmi cmov "conditional move"
8caa9169 8891 (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL)
9aab5aa3
AC
8892 "cmov$pack $GRi,$GRk,$CCi,$cond"
8893 (emit cor pack GRi (GRj 0) GRk CCi cond)
8894)
This page took 0.407938 seconds and 4 git commands to generate.