1 110010,26.OFFSET:POOL32X:32::BC
6 NIA = CIA + (EXTEND26 (OFFSET) << 2) + 4;
9 111010,26.OFFSET:POOL32X:32::BALC
15 NIA = CIA + (EXTEND26 (OFFSET) << 2) + 4;
18 110110,5.RS!0,21.OFFSET:POOL32X:32::BEQZC
19 "beqzc r<RS>, <OFFSET>"
24 NIA = CIA + (EXTEND21 (OFFSET) << 2) + 4;
29 110110,00000,5.RT,16.OFFSET:POOL32X:32::JIC
34 NIA = GPR[RT] + (EXTEND16(OFFSET) << 2);
37 111110,5.RS!0,21.OFFSET:POOL32X:32::BNEZC
38 "bnezc r<RS>, <OFFSET>"
43 NIA = CIA + (EXTEND21 (OFFSET) << 2) + 4;
48 111110,00000,5.RT,16.OFFSET:POOL32X:32::JIALC
49 "jialc r<RT>, <OFFSET>"
54 NIA = GPR[RT] + EXTEND16(OFFSET);
57 010110,5.RS,5.RT,16.OFFSET:POOL32X:32::B1xxC
58 "blezc r<RT>, <OFFSET>": RS==0&&RT!=0
59 "bgezc r<RT>, <OFFSET>":RS!=0&&RS==RT
60 "bgec r<RS>, r<RT>, <OFFSET>"
64 if (RS == 0 && RT != 0)
67 if ((signed_word)GPR[RT] <= 0)
68 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
72 else if (RS != 0 && RS == RT)
75 if ((signed_word)GPR[RT] >= 0)
76 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
83 if ((signed_word) GPR[RS] >= (signed_word) GPR[RT])
84 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
90 010111,5.RS,5.RT,16.OFFSET:POOL32X:32::B2xxC
91 "bgtzc r<RT>, <OFFSET>":RS==0&&RT!=0
92 "bltzc r<RT>, <OFFSET>":RS!=0&&RS==RT
93 "bltc r<RS>, r<RT>, <OFFSET>"
97 if (RS == 0 && RT != 0)
100 if ((signed_word)GPR[RT] > 0)
101 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
105 else if (RS != 0 && RS == RT)
108 if ((signed_word)GPR[RT] < 0)
109 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
116 if ((signed_word) GPR[RS] < (signed_word) GPR[RT])
117 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
123 000110,5.RS,5.RT!0,16.OFFSET:POOL32X:32::B3xxC
124 "blezalc r<RT>, <OFFSET>":RS==0
125 "bgezalc r<RT>, <OFFSET>":RS!=0&&RS==RT
126 "bgeuc r<RS>, r<RT>, <OFFSET>"
130 if (RS == 0 && RT != 0)
134 if ((signed_word)GPR[RT] <= 0)
135 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
139 else if (RS != 0 && RS == RT)
143 if ((signed_word)GPR[RT] >= 0)
144 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
151 if (GPR[RS] >= GPR[RT])
152 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
158 000111,5.RS,5.RT!0,16.OFFSET:POOL32X:32::B4xxC
159 "bgtzalc r<RT>, <OFFSET>":RS==0
160 "bltzalc r<RT>, <OFFSET>":RS!=0&&RS==RT
161 "bltuc r<RS>, r<RT>, <OFFSET>"
165 if (RS == 0 && RT != 0)
169 if ((signed_word)GPR[RT] > 0)
170 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
174 else if (RS != 0 && RS == RT)
178 if ((signed_word)GPR[RT] < 0)
179 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
186 if (GPR[RS] < GPR[RT])
187 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
193 001000,5.RS,5.RT,16.OFFSET:POOL32X:32::BxxxC
194 "bovc r<RS>, r<RT>, <OFFSET>":RS>=RT
195 "beqzalc r<RT>, <OFFSET>":RS==0&&RT>RS
196 "beqc r<RS>, r<RT>, <OFFSET>"
203 ALU32_BEGIN (GPR[RS] & 0x0ffffffff);
204 ALU32_ADD (GPR[RT] & 0x0ffffffff);
206 if (ALU32_HAD_OVERFLOW)
207 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
216 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
223 if (GPR[RS] == GPR[RT])
224 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
230 011000,5.RS,5.RT,16.OFFSET:POOL32X:32::BNxxxC
231 "bnvc r<RS>, r<RT>, <OFFSET>":RS>=RT
232 "bnezalc r<RT>, <OFFSET>":RS==0&&RT>RS
233 "bnec r<RS>, r<RT>, <OFFSET>"
240 ALU32_BEGIN (GPR[RS] & 0x0ffffffff);
241 ALU32_ADD (GPR[RT] & 0x0ffffffff);
243 if (!ALU32_HAD_OVERFLOW)
244 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
248 else if (RS == 0 && RT > RS)
253 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
260 if (GPR[RT] != GPR[RS])
261 NIA = CIA + (EXTEND16 (OFFSET) << 2) + 4;
267 :%s::::R6COND:int r6cond
320 010001,1010,1.FMT,5.FT,5.FS,5.FD,0,5.R6COND:POOL32X:32,f::CMP.cond.fmt
321 "cmp.%s<R6COND>.%s<FMT> f<FD>, f<FS>, f<FT>"
327 TRACE_ALU_INPUT2 (ValueFPR (FS, FMT), ValueFPR (FT, FMT));
329 result = R6Compare (ValueFPR (FS, FMT), ValueFPR (FT, FMT), FMT, R6COND);
330 StoreFPR (FD, FMT, result);
331 TRACE_ALU_RESULT (result);
334 010001,01001,5.FT,16.OFFSET:POOL32X:32,f::BC1EQZ
335 "bc1eqz f<FT>, <OFFSET>"
339 address_word offset = EXTEND16 (OFFSET) << 2;
341 TRACE_ALU_INPUT1 (FGR[FT]);
342 if ((FGR[FT] & 0x01) == 0)
343 DELAY_SLOT (NIA + offset);
346 010001,01101,5.FT,16.OFFSET:POOL32X:32,f::BC1NEZ
347 "bc1nez f<FT>, <OFFSET>"
351 address_word offset = EXTEND16 (OFFSET) << 2;
353 TRACE_ALU_INPUT1 (FGR[FT]);
354 if ((FGR[FT] & 0x01) != 0)
355 DELAY_SLOT (NIA + offset);
357 010001,1000,1.FMT,5.FT,5.FS,5.FD,011000:POOLX:32,f::MADDF.fmt
358 "maddf.%s<FMT> f<FD>, f<FS>, f<FT>"
364 check_u64 (SD_, instruction_0);
365 check_fmt_p (SD_, fmt, instruction_0);
366 TRACE_ALU_INPUT3 (FGR[FD], FGR[FS], FGR[FT]);
367 StoreFPR (FD, fmt, FusedMultiplyAdd (ValueFPR (FS, fmt),
369 ValueFPR (FD, fmt), fmt));
370 TRACE_ALU_RESULT (FGR[FD]);
373 010001,1000,1.FMT,5.FT,5.FS,5.FD,011001:POOLX:32,f::MSUBF.fmt
374 "msubf.%s<FMT> f<FD>, f<FS>, f<FT>"
380 check_u64 (SD_, instruction_0);
381 check_fmt_p (SD_, fmt, instruction_0);
382 TRACE_ALU_INPUT3 (FGR[FD], FGR[FS], FGR[FT]);
383 StoreFPR (FD, fmt, FusedMultiplySub (ValueFPR (FS, fmt),
385 ValueFPR (FD, fmt), fmt));
386 TRACE_ALU_RESULT (FGR[FD]);
389 000000,5.RS,5.RT,5.RD,000,2.IMM,000101:SPECIAL:32::LSA
390 "lsa r<RD>, r<RS>, r<RT>, <IMM + 1>"
394 uint32_t t = GPR[RS] << (IMM + 1);
395 GPR[RD] = EXTEND32(GPR[RT] + t);
396 TRACE_ALU_RESULT (GPR[RD]);
399 000000,5.RS,5.RT,5.RD,000,2.IMM,010101:SPECIAL:64::DLSA
400 "dlsa r<RD>, r<RS>, r<RT>, <IMM + 1>"
403 uint64_t t = GPR[RS] << (IMM + 1);
404 GPR[RD] = GPR[RT] + t;
405 TRACE_ALU_RESULT (GPR[RD]);
408 001111,5.RS!0,5.RT,16.IMMEDIATE:POOL32X:32::AUI
409 "aui r<RS>, r<RT>, <IMMEDIATE>"
413 TRACE_ALU_INPUT2 (GPR[RS], IMMEDIATE);
414 GPR[RT] = EXTEND32 (GPR[RS] + (EXTEND16 (IMMEDIATE) << 16));
415 TRACE_ALU_RESULT (GPR[RT]);
418 011101,5.RS!0,5.RT,16.IMMEDIATE:POOL32X:64::DAUI
419 "daui r<RS>, r<RT>, <IMMEDIATE>"
422 TRACE_ALU_INPUT2 (GPR[RS], IMMEDIATE);
423 GPR[RT] = GPR[RS] + (EXTEND16 (IMMEDIATE) << 16);
424 TRACE_ALU_RESULT (GPR[RT]);
427 000001,5.RS,00110,16.IMMEDIATE:POOL32X:64::DAHI
428 "dahi r<RS>, <IMMEDIATE>"
431 TRACE_ALU_INPUT2 (GPR[RS], IMMEDIATE);
432 GPR[RS] = GPR[RS] + (EXTEND16 (IMMEDIATE) << 32);
433 TRACE_ALU_RESULT (GPR[RS]);
436 000001,5.RS,11110,16.IMMEDIATE:POOL32X:64::DATI
437 "dati r<RS>, <IMMEDIATE>"
440 TRACE_ALU_INPUT2 (GPR[RS], IMMEDIATE);
441 GPR[RS] = GPR[RS] + (EXTEND16 (IMMEDIATE) << 48);
442 TRACE_ALU_RESULT (GPR[RS]);
445 011111,5.RS,5.RT,5.RD,010,2.IMMEDIATE,100000:POOL32X:32::ALIGN
446 "align r<RD>, r<RS>, r<RT>, <IMMEDIATE>"
450 uint32_t rs = GPR[RS];
451 uint32_t rt = GPR[RT];
452 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
453 GPR[RD] = EXTEND32 (rs >> 8 * (4 - IMMEDIATE) | rt << 8 * IMMEDIATE);
454 TRACE_ALU_RESULT (GPR[RD]);
457 011111,5.RS,5.RT,5.RD,01,3.IMMEDIATE,100100:POOL32X:64::DALIGN
458 "dalign r<RD>, r<RS>, r<RT>, <IMMEDIATE>"
461 uint64_t rs = GPR[RS];
462 uint64_t rt = GPR[RT];
463 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
464 GPR[RD] = rs >> 8 * (8 - IMMEDIATE) | rt << 8 * IMMEDIATE;
465 TRACE_ALU_RESULT (GPR[RD]);
468 011111,00000,5.RT,5.RD,00000,100000:POOL32X:32::BITSWAP
469 "bitswap r<RD>, r<RT>"
473 /* Taken from: http://graphics.stanford.edu/~seander/bithacks.html */
474 uint32_t v = GPR[RT];
476 TRACE_ALU_INPUT1 (v);
477 v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);
478 v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2);
479 v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4);
480 GPR[RD] = EXTEND32 (v);
481 TRACE_ALU_RESULT(GPR[RD]);
484 011111,00000,5.RT,5.RD,00000,100100:POOL32X:64::DBITSWAP
485 "dbitswap r<RD>, r<RT>"
488 /* Taken from: http://graphics.stanford.edu/~seander/bithacks.html */
489 uint64_t v = GPR[RT];
491 TRACE_ALU_INPUT1 (v);
492 v = ((v >> 1) & 0x5555555555555555) | ((v & 0x5555555555555555) << 1);
493 v = ((v >> 2) & 0x3333333333333333) | ((v & 0x3333333333333333) << 2);
494 v = ((v >> 4) & 0x0F0F0F0F0F0F0F0F) | ((v & 0x0F0F0F0F0F0F0F0F) << 4);
499 111011,5.RS,00,19.IMMEDIATE:POOL32X:32::ADDIUPC
500 "addiupc r<RS>, <IMMEDIATE>"
504 TRACE_ALU_INPUT1 (IMMEDIATE);
505 GPR[RS] = loadstore_ea (SD_, CIA, EXTEND19 (IMMEDIATE) << 2);
506 TRACE_ALU_RESULT (GPR[RS]);
509 111011,5.RS,11110,16.IMMEDIATE:POOL32X:32::AUIPC
510 "auipc r<RS>, <IMMEDIATE>"
514 TRACE_ALU_INPUT1 (IMMEDIATE);
515 GPR[RS] = loadstore_ea (SD_, CIA, EXTEND32 (IMMEDIATE << 16));
516 TRACE_ALU_RESULT (GPR[RS]);
519 111011,5.RS,11111,16.IMMEDIATE:POOL32X:32::ALUIPC
520 "aluipc r<RS>, <IMMEDIATE>"
524 TRACE_ALU_INPUT1 (IMMEDIATE);
525 GPR[RS] = ~0x0FFFF & loadstore_ea (SD_, CIA, EXTEND32 (IMMEDIATE << 16));
526 TRACE_ALU_RESULT (GPR[RS]);
529 111011,5.RS,01,19.IMMEDIATE:POOL32X:32::LWPC
530 "lwpc r<RS>, <IMMEDIATE>"
534 uint32_t offset = EXTEND19 (IMMEDIATE) << 2;
535 TRACE_ALU_INPUT1 (IMMEDIATE);
536 GPR[RS] = EXTEND32 (do_load (SD_, AccessLength_WORD, CIA, offset));
537 TRACE_ALU_RESULT (GPR[RS]);
540 111011,5.RS,10,19.IMMEDIATE:POOL32X:64::LWUPC
541 "lwupc r<RS>, <IMMEDIATE>"
544 uint32_t offset = EXTEND19 (IMMEDIATE) << 2;
545 TRACE_ALU_INPUT1 (CIA + offset);
546 GPR[RS] = do_load (SD_, AccessLength_WORD, CIA, offset);
547 TRACE_ALU_RESULT (GPR[RS]);
550 111011,5.RS,110,18.IMMEDIATE:POOL32X:64::LDPC
551 "ldpc r<RS>, <IMMEDIATE>"
554 uint32_t offset = EXTEND18 (IMMEDIATE) << 3;
555 TRACE_ALU_INPUT1 (IMMEDIATE);
556 GPR[RS] = do_load (SD_, AccessLength_DOUBLEWORD, CIA, offset);
557 TRACE_ALU_RESULT (GPR[RS]);
559 010001,1000,1.FMT,00000,5.FS,5.FD,011010::32,64,f::RINT.fmt
560 "rint.%s<FMT> f<FD>, f<FS>"
567 check_u64 (SD_, instruction_0);
568 check_fmt_p (SD_, fmt, instruction_0);
569 TRACE_ALU_INPUT1 (FGR[FS]);
570 RoundToIntegralExact (ValueFPR (FS, fmt), &result, fmt);
571 StoreFPR (FD, fmt, result);
572 TRACE_ALU_RESULT (FGR[FD]);
575 010001,1000,1.FMT,00000,5.FS,5.FD,011011::32,64,f::CLASS.fmt
576 "class.%s<FMT> f<FD>, f<FS>"
582 check_u64 (SD_, instruction_0);
583 check_fmt_p (SD_, fmt, instruction_0);
584 StoreFPR (FD, fmt, Classify (ValueFPR (FS, fmt), fmt));
587 010001,1000,1.FMT,5.FT,5.FS,5.FD,011100::32,64,f::MIN.fmt
588 "min.%s<FMT> f<FD>, f<FS>, f<FT>"
594 check_u64 (SD_, instruction_0);
595 check_fmt_p (SD_, fmt, instruction_0);
596 TRACE_ALU_INPUT2 (FGR[FS], FGR[FT]);
597 StoreFPR (FD, fmt, Min (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
598 TRACE_ALU_RESULT (FGR[FD]);
601 010001,1000,1.FMT,5.FT,5.FS,5.FD,011110::32,64,f::MAX.fmt
602 "max.%s<FMT> f<FD>, f<FS>, f<FT>"
608 check_u64 (SD_, instruction_0);
609 check_fmt_p (SD_, fmt, instruction_0);
610 TRACE_ALU_INPUT2 (FGR[FS], FGR[FT]);
611 StoreFPR (FD, fmt, Max (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
612 TRACE_ALU_RESULT (FGR[FD]);
615 010001,1000,1.FMT,5.FT,5.FS,5.FD,011101::32,64,f::MINA.fmt
616 "mina.%s<FMT> f<FD>, f<FS>, f<FT>"
622 check_u64 (SD_, instruction_0);
623 check_fmt_p (SD_, fmt, instruction_0);
624 TRACE_ALU_INPUT2 (FGR[FS], FGR[FT]);
625 StoreFPR (FD, fmt, MinA (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
626 TRACE_ALU_RESULT (FGR[FD]);
629 010001,1000,1.FMT,5.FT,5.FS,5.FD,011111::32,64,f::MAXA.fmt
630 "maxa.%s<FMT> f<FD>, f<FS>, f<FT>"
636 check_u64 (SD_, instruction_0);
637 check_fmt_p (SD_, fmt, instruction_0);
638 TRACE_ALU_INPUT2 (FGR[FS], FGR[FT]);
639 StoreFPR (FD, fmt, MaxA (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
640 TRACE_ALU_RESULT (FGR[FD]);
642 000000,5.RS,5.RT,5.RD,00010,011000:POOL32X:32::MUL
643 "mul r<RD>, r<RS>, r<RT>"
648 if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT]))
650 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
651 prod = ((int64_t)(int32_t) GPR[RS])
652 * ((int64_t)(int32_t) GPR[RT]);
653 GPR[RD] = EXTEND32 (VL4_8 (prod));
654 TRACE_ALU_RESULT (GPR[RD]);
657 000000,5.RS,5.RT,5.RD,00011,011000:POOL32X:32::MUH
658 "muh r<RD>, r<RS>, r<RT>"
663 if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT]))
665 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
666 prod = ((int64_t)(int32_t) GPR[RS])
667 * ((int64_t)(int32_t) GPR[RT]);
668 GPR[RD] = EXTEND32 (VH4_8 (prod));
669 TRACE_ALU_RESULT (GPR[RD]);
672 000000,5.RS,5.RT,5.RD,00010,011001:POOL32X:32::MULU
673 "mulu r<RD>, r<RS>, r<RT>"
678 if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT]))
680 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
681 prod = ((uint64_t)(uint32_t) GPR[RS])
682 * ((uint64_t)(uint32_t) GPR[RT]);
683 GPR[RD] = EXTEND32 (VL4_8 (prod));
684 TRACE_ALU_RESULT (GPR[RD]);
687 000000,5.RS,5.RT,5.RD,00011,011001:POOL32X:32::MUHU
688 "muhu r<RD>, r<RS>, r<RT>"
693 if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT]))
695 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
696 prod = ((uint64_t)(uint32_t) GPR[RS])
697 * ((uint64_t)(uint32_t) GPR[RT]);
698 GPR[RD] = EXTEND32 (VH4_8 (prod));
699 TRACE_ALU_RESULT (GPR[RD]);
702 000000,5.RS,5.RT,5.RD,00010,011010:POOL32X:32::DIV
703 "div r<RD>, r<RS>, r<RT>"
709 TRACE_ALU_INPUT2 (n,d);
711 GPR[RD] = EXTEND32 (0x80000000);
712 else if (n == SIGNED32 (0x80000000) && d == -1)
713 GPR[RD] = EXTEND32 (0x80000000);
715 GPR[RD] = EXTEND32 (n / d);
717 TRACE_ALU_RESULT (GPR[RD]);
720 000000,5.RS,5.RT,5.RD,00011,011010:POOL32X:32::MOD
721 "mod r<RD>, r<RS>, r<RT>"
727 TRACE_ALU_INPUT2 (n,d);
728 if (d == 0 || (n == SIGNED32 (0x80000000) && d == -1))
729 GPR[RD] = EXTEND32 (0);
731 GPR[RD] = EXTEND32 (n % d);
733 TRACE_ALU_RESULT (GPR[RD]);
736 000000,5.RS,5.RT,5.RD,00010,011011:POOL32X:32::DIVU
737 "divu r<RD>, r<RS>, r<RT>"
741 uint32_t n = GPR[RS];
742 uint32_t d = GPR[RT];
743 TRACE_ALU_INPUT2 (n,d);
745 GPR[RD] = EXTEND32 (0x80000000);
747 GPR[RD] = EXTEND32 (n / d);
749 TRACE_ALU_RESULT (GPR[RD]);
752 000000,5.RS,5.RT,5.RD,00011,011011:POOL32X:32::MODU
753 "modu r<RD>, r<RS>, r<RT>"
757 uint32_t n = GPR[RS];
758 uint32_t d = GPR[RT];
759 TRACE_ALU_INPUT2 (n,d);
761 GPR[RD] = EXTEND32 (0);
763 GPR[RD] = EXTEND32 (n % d);
765 TRACE_ALU_RESULT (GPR[RD]);
768 000000,5.RS,5.RT,5.RD,00010,011100:POOL32X:64::DMUL
769 "dmul r<RD>, r<RS>, r<RT>"
778 uint64_t op1 = GPR[RS];
779 uint64_t op2 = GPR[RT];
781 check_u64 (SD_, instruction_0);
782 TRACE_ALU_INPUT2 (op1, op2);
783 /* make signed multiply unsigned */
785 if ((int64_t) op1 < 0)
790 if ((int64_t) op2 < 0)
795 /* multiply out the sub products */
796 m00 = ((uint64_t) VL4_8 (op1) * (uint64_t) VL4_8 (op2));
797 m10 = ((uint64_t) VH4_8 (op1) * (uint64_t) VL4_8 (op2));
798 m01 = ((uint64_t) VL4_8 (op1) * (uint64_t) VH4_8 (op2));
799 /* add the products */
800 mid = ((uint64_t) VH4_8 (m00)
801 + (uint64_t) VL4_8 (m10)
802 + (uint64_t) VL4_8 (m01));
803 lo = U8_4 (mid, m00);
809 TRACE_ALU_RESULT (GPR[RD]);
812 000000,5.RS,5.RT,5.RD,00011,011100:POOL32X:64::DMUH
813 "dmuh r<RD>, r<RS>, r<RT>"
824 uint64_t op1 = GPR[RS];
825 uint64_t op2 = GPR[RT];
827 check_u64 (SD_, instruction_0);
828 TRACE_ALU_INPUT2 (op1, op2);
829 /* make signed multiply unsigned */
831 if ((int64_t) op1 < 0)
836 if ((int64_t) op2 < 0)
841 /* multiply out the 4 sub products */
842 m00 = ((uint64_t) VL4_8 (op1) * (uint64_t) VL4_8 (op2));
843 m10 = ((uint64_t) VH4_8 (op1) * (uint64_t) VL4_8 (op2));
844 m01 = ((uint64_t) VL4_8 (op1) * (uint64_t) VH4_8 (op2));
845 m11 = ((uint64_t) VH4_8 (op1) * (uint64_t) VH4_8 (op2));
846 /* add the products */
847 mid = ((uint64_t) VH4_8 (m00)
848 + (uint64_t) VL4_8 (m10)
849 + (uint64_t) VL4_8 (m01));
850 lo = U8_4 (mid, m00);
852 + (uint64_t) VH4_8 (mid)
853 + (uint64_t) VH4_8 (m01)
854 + (uint64_t) VH4_8 (m10));
866 TRACE_ALU_RESULT (GPR[RD]);
869 000000,5.RS,5.RT,5.RD,00010,011101:POOL32X:64::DMULU
870 "dmulu r<RD>, r<RS>, r<RT>"
878 uint64_t op1 = GPR[RS];
879 uint64_t op2 = GPR[RT];
881 check_u64 (SD_, instruction_0);
882 TRACE_ALU_INPUT2 (op1, op2);
883 /* multiply out the sub products */
884 m00 = ((uint64_t) VL4_8 (op1) * (uint64_t) VL4_8 (op2));
885 m10 = ((uint64_t) VH4_8 (op1) * (uint64_t) VL4_8 (op2));
886 m01 = ((uint64_t) VL4_8 (op1) * (uint64_t) VH4_8 (op2));
887 /* add the products */
888 mid = ((uint64_t) VH4_8 (m00)
889 + (uint64_t) VL4_8 (m10)
890 + (uint64_t) VL4_8 (m01));
891 lo = U8_4 (mid, m00);
894 TRACE_ALU_RESULT (GPR[RD]);
897 000000,5.RS,5.RT,5.RD,00011,011101:POOL32X:64::DMUHU
898 "dmuhu r<RD>, r<RS>, r<RT>"
908 uint64_t op1 = GPR[RS];
909 uint64_t op2 = GPR[RT];
911 check_u64 (SD_, instruction_0);
912 TRACE_ALU_INPUT2 (op1, op2);
913 /* multiply out the 4 sub products */
914 m00 = ((uint64_t) VL4_8 (op1) * (uint64_t) VL4_8 (op2));
915 m10 = ((uint64_t) VH4_8 (op1) * (uint64_t) VL4_8 (op2));
916 m01 = ((uint64_t) VL4_8 (op1) * (uint64_t) VH4_8 (op2));
917 m11 = ((uint64_t) VH4_8 (op1) * (uint64_t) VH4_8 (op2));
918 /* add the products */
919 mid = ((uint64_t) VH4_8 (m00)
920 + (uint64_t) VL4_8 (m10)
921 + (uint64_t) VL4_8 (m01));
922 lo = U8_4 (mid, m00);
924 + (uint64_t) VH4_8 (mid)
925 + (uint64_t) VH4_8 (m01)
926 + (uint64_t) VH4_8 (m10));
929 TRACE_ALU_RESULT (GPR[RD]);
932 000000,5.RS,5.RT,5.RD,00010,011110:POOL32X:64::DDIV
933 "ddiv r<RD>, r<RS>, r<RT>"
939 check_u64 (SD_, instruction_0);
940 TRACE_ALU_INPUT2 (n, d);
942 GPR[RD] = SIGNED64 (0x8000000000000000);
943 else if (d == -1 && n == SIGNED64 (0x8000000000000000))
944 GPR[RD] = SIGNED64 (0x8000000000000000);
948 TRACE_ALU_RESULT (GPR[RD]);
951 000000,5.RS,5.RT,5.RD,00011,011110:POOL32X:64::DMOD
952 "dmod r<RD>, r<RS>, r<RT>"
958 check_u64 (SD_, instruction_0);
959 TRACE_ALU_INPUT2 (n, d);
960 if (d == 0 || (d == -1 && n == SIGNED64 (0x8000000000000000)))
961 GPR[RD] = SIGNED64 (0);
965 TRACE_ALU_RESULT (GPR[RD]);
968 000000,5.RS,5.RT,5.RD,00010,011111:POOL32X:64::DDIVU
969 "ddivu r<RD>, r<RS>, r<RT>"
972 uint64_t n = GPR[RS];
973 uint64_t d = GPR[RT];
975 check_u64 (SD_, instruction_0);
976 TRACE_ALU_INPUT2 (n, d);
978 GPR[RD] = UNSIGNED64 (0x8000000000000000);
982 TRACE_ALU_RESULT (GPR[RD]);
985 000000,5.RS,5.RT,5.RD,00011,011111:POOL32X:64::DMODU
986 "dmodu r<RD>, r<RS>, r<RT>"
989 uint64_t n = GPR[RS];
990 uint64_t d = GPR[RT];
992 check_u64 (SD_, instruction_0);
993 TRACE_ALU_INPUT2 (n, d);
995 GPR[RD] = UNSIGNED64 (0);
999 TRACE_ALU_RESULT (GPR[RD]);
1002 011111,5.BASE,5.RT,9.OFFSET,0,110110:SPECIAL3:32::LL
1003 "ll r<RT>, <OFFSET>(r<BASE>)"
1007 do_ll (SD_, RT, EXTEND9 (OFFSET), BASE);
1010 011111,5.BASE,5.RT,5.RD,0000,1,110110:SPECIAL3:32::LLWP
1011 "llwp r<RT>, r<RD>, (r<BASE>)"
1022 offset = BigEndianCPU ? 0 : 4;
1028 offset = BigEndianCPU ? 4 : 0;
1031 do_ll (SD_, first, offset, BASE);
1032 do_ll (SD_, second, offset ^ 4, BASE);
1036 011111,5.BASE,5.RT,9.OFFSET,0,100110:SPECIAL3:32::SC
1037 "sc r<RT>, <OFFSET>(r<BASE>)"
1041 do_sc (SD_, RT, EXTEND9 (OFFSET), BASE, instruction_0, 1);
1044 011111,5.BASE,5.RT,9.OFFSET,0,110111:SPECIAL3:64::LLD
1045 "lld r<RT>, <OFFSET>(r<BASE>)"
1048 check_u64 (SD_, instruction_0);
1049 do_lld (SD_, RT, EXTEND9 (OFFSET), BASE);
1053 011111,5.BASE,5.RT,5.RD,0000,1,100110:SPECIAL3:32::SCWP
1054 "scwp r<RT>, r<RD>, (r<BASE>)"
1058 int offset = BigEndianCPU ? 0 : 4;
1060 do_sc (SD_, RD, offset, BASE, instruction_0, 0);
1061 do_sc (SD_, RT, offset ^ 4, BASE, instruction_0, 1);
1064 011111,5.BASE,5.RT,5.RD,0000,1,110111:SPECIAL3:64::LLDP
1065 "lldp r<RT>, r<RD>, (r<BASE>)"
1071 check_u64 (SD_, instruction_0);
1077 offset = BigEndianCPU ? 0 : 8;
1083 offset = BigEndianCPU ? 8 : 0;
1086 do_lld (SD_, first, offset, BASE);
1087 do_lld (SD_, second, offset ^ 8, BASE);
1090 011111,5.BASE,5.RT,9.OFFSET,0,100111:SPECIAL3:64::SCD
1091 "scd r<RT>, <OFFSET>(r<BASE>)"
1094 check_u64 (SD_, instruction_0);
1095 do_scd (SD_, RT, EXTEND9 (OFFSET), BASE, 1);
1098 011111,5.BASE,5.RT,5.RD,0000,1,100111:SPECIAL3:64::SCDP
1099 "scdp r<RT>, r<RD>, (r<BASE>)"
1102 int offset = BigEndianCPU ? 0 : 8;
1103 check_u64 (SD_, instruction_0);
1105 do_scd (SD_, RD, offset, BASE, 0);
1106 do_scd (SD_, RT, offset ^ 8, BASE, 1);
1109 011111,5.BASE,5.HINT,9.OFFSET,0,110101:SPECIAL3:32::PREF
1110 "pref <HINT>, <OFFSET>(r<BASE>)"
1114 do_pref (SD_, HINT, EXTEND9 (OFFSET), BASE);
1117 011111,5.BASE,5.HINT,9.OFFSET,0,100101:SPECIAL3:32::CACHE
1118 "cache <HINT>, <OFFSET>(r<BASE>)"
1122 do_cache (SD_, HINT, BASE, EXTEND9 (OFFSET), instruction_0);
1126 000000,5.RS,00000,5.RD,00001,010000:POOL32X:32::CLZ
1131 do_clz (SD_, RD, RS);
1134 000000,5.RS,00000,5.RD,00001,010001:POOL32X:32::CLO
1139 do_clo (SD_, RD, RS);
1142 000000,5.RS,00000,5.RD,00001,010010:POOL32X:64::DCLZ
1146 check_u64 (SD_, instruction_0);
1147 do_dclz (SD_, RD, RS);
1150 000000,5.RS,00000,5.RD,00001,010011:POOL32X:64::DCLO
1154 check_u64 (SD_, instruction_0);
1155 do_dclo (SD_, RD, RS);
1157 010001,1000,1.FMT,5.FT,5.FS,5.FD,010000:POOL32X:32,f::SEL.fmt
1158 "sel.%s<FMT> f<FD>, f<FS>, f<FT>"
1163 check_fmt_p (SD_, FMT, instruction_0);
1164 TRACE_ALU_INPUT3 (FGR[FD], ValueFPR(FS, FMT), ValueFPR(FT, FMT));
1165 if ((FGR[FD] & 0x01) != 0)
1166 StoreFPR (FD, FMT, ValueFPR (FT, FMT));
1168 StoreFPR (FD, FMT, ValueFPR (FS, FMT));
1169 TRACE_ALU_RESULT (ValueFPR(FD, FMT));
1172 010001,1000,1.FMT,5.FT,5.FS,5.FD,010100:POOL32X:32,f::SELEQZ.fmt
1173 "seleqz.%s<FMT> f<FD>, f<FS>, f<FT>"
1178 check_fmt_p (SD_, FMT, instruction_0);
1179 TRACE_ALU_INPUT2 (ValueFPR(FS, FMT), FGR[FT]);
1180 if ((FGR[FT] & 0x01) == 0)
1181 StoreFPR (FD, FMT, ValueFPR (FS, FMT));
1183 StoreFPR (FD, FMT, 0);
1184 TRACE_ALU_RESULT (ValueFPR(FD, FMT));
1187 010001,1000,1.FMT,5.FT,5.FS,5.FD,010111:POOL32X:32,f::SELNEZ.fmt
1188 "selnez.%s<FMT> f<FD>, f<FS>, f<FT>"
1193 check_fmt_p (SD_, FMT, instruction_0);
1194 TRACE_ALU_INPUT2 (ValueFPR(FS, FMT), FGR[FT]);
1195 if ((FGR[FT] & 0x01) == 0)
1196 StoreFPR (FD, FMT, 0);
1198 StoreFPR (FD, FMT, ValueFPR (FS, FMT));
1199 TRACE_ALU_RESULT (ValueFPR(FD, FMT));
1202 000000,5.RS,5.RT,5.RD,00000,110101:POOL32X:32::SELEQZ
1203 "seleqz r<RD>, r<RS>, r<RT>"
1207 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
1212 TRACE_ALU_RESULT (GPR[RD]);
1215 000000,5.RS,5.RT,5.RD,00000,110111:POOL32X:32::SELNEZ
1216 "selnez r<RD>, r<RS>, r<RT>"
1220 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
1225 TRACE_ALU_RESULT (GPR[RD]);