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