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