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