3 // Given an extended register number, translate it into an index into the
4 // register array. This is necessary as the upper 8 extended registers are
5 // actually synonyms for the d0-d3/a0-a3 registers.
9 :function:::int:translate_rreg:int rreg
12 /* The higher register numbers actually correspond to the
13 basic machine's address and data registers. */
14 if (rreg > 7 && rreg < 12)
15 return REG_A0 + rreg - 8;
16 else if (rreg > 11 && rreg < 16)
17 return REG_D0 + rreg - 12;
22 :function:::int:translate_xreg:int xreg
37 sim_engine_abort (SD, CPU, cia, "%s:%d: bad switch\n", __FILE__, __LINE__);
41 // 1111 0000 0010 00An; mov USP,An
42 8.0xf0+4.0x2,00,2.AN0:D0m:::mov
48 State.regs[REG_A0 + AN0] = State.regs[REG_USP];
52 // 1111 0000 0010 01An; mov SSP,An
53 8.0xf0+4.0x2,01,2.AN0:D0n:::mov
59 State.regs[REG_A0 + AN0] = State.regs[REG_SSP];
63 // 1111 0000 0010 10An; mov MSP,An
64 8.0xf0+4.0x2,10,2.AN0:D0o:::mov
70 State.regs[REG_A0 + AN0] = State.regs[REG_MSP];
74 // 1111 0000 0010 11An; mov PC,An
75 8.0xf0+4.0x2,11,2.AN0:D0p:::mov
81 State.regs[REG_A0 + AN0] = PC;
85 // 1111 0000 0011 Am00; mov Am,USP
86 8.0xf0+4.0x3,2.AM1,00:D0q:::mov
92 State.regs[REG_USP] = State.regs[REG_A0 + AM1];
95 // 1111 0000 0011 Am01; mov Am,SSP
96 8.0xf0+4.0x3,2.AM1,01:D0r:::mov
102 State.regs[REG_SSP] = State.regs[REG_A0 + AM1];
105 // 1111 0000 0011 Am10; mov Am,MSP
106 8.0xf0+4.0x3,2.AM1,10:D0s:::mov
112 State.regs[REG_MSP] = State.regs[REG_A0 + AM1];
116 // 1111 0000 1110 imm4; syscall
117 8.0xf0+4.0xe,IMM4:D0t:::syscall
122 uint32_t sp, next_pc;
125 sp = State.regs[REG_SP];
126 next_pc = State.regs[REG_PC] + 2;
127 store_word (sp - 4, next_pc);
128 store_word (sp - 8, PSW);
129 State.regs[REG_PC] = 0x40000000 + IMM4 * 8;
134 // 1111 0010 1110 11Dn; mov EPSW,Dn
135 8.0xf2+4.0xe,11,2.DN0:D0u:::mov
141 State.regs[REG_D0 + DN0] = PSW;
145 // 1111 0010 1111 Dm01; mov Dm,EPSW
146 8.0xf2+4.0xf,2.DM1,01:D0v:::mov
152 PSW = State.regs[REG_D0 + DM1];
155 // 1111 0101 00Am Rn; mov Am,Rn
156 8.0xf5+00,2.AM1,4.RN0:D0w:::mov
161 int destreg = translate_rreg (SD_, RN0);
164 State.regs[destreg] = State.regs[REG_A0 + AM1];
167 // 1111 0101 01Dm Rn; mov Dm,Rn
168 8.0xf5+01,2.DM1,4.RN0:D0x:::mov
173 int destreg = translate_rreg (SD_, RN0);
176 State.regs[destreg] = State.regs[REG_D0 + DM1];
179 // 1111 0101 10Rm An; mov Rm,An
180 8.0xf5+10,4.RM1,2.AN0:D0y:::mov
185 int destreg = translate_rreg (SD_, RM1);
188 State.regs[REG_A0 + AN0] = State.regs[destreg];
191 // 1111 0101 11Rm Dn; mov Rm,Dn
192 8.0xf5+11,4.RM1,2.DN0:D0z:::mov
197 int destreg = translate_rreg (SD_, RM1);
200 State.regs[REG_D0 + DN0] = State.regs[destreg];
204 // 1111 1000 1100 1110 regs....; movm (USP),regs
205 8.0xf8+8.0xce+8.REGS:D1a:::movm
210 uint32_t usp = State.regs[REG_USP];
219 State.regs[REG_LAR] = load_word (usp);
221 State.regs[REG_LIR] = load_word (usp);
223 State.regs[REG_MDR] = load_word (usp);
225 State.regs[REG_A0 + 1] = load_word (usp);
227 State.regs[REG_A0] = load_word (usp);
229 State.regs[REG_D0 + 1] = load_word (usp);
231 State.regs[REG_D0] = load_word (usp);
237 State.regs[REG_A0 + 3] = load_word (usp);
243 State.regs[REG_A0 + 2] = load_word (usp);
249 State.regs[REG_D0 + 3] = load_word (usp);
255 State.regs[REG_D0 + 2] = load_word (usp);
259 if (STATE_ARCHITECTURE (SD)->mach == bfd_mach_am33
260 || STATE_ARCHITECTURE (SD)->mach == bfd_mach_am33_2
265 /* Need to restore MDQR, MCRH, MCRL, and MCVF */
267 State.regs[REG_E0 + 1] = load_word (usp);
269 State.regs[REG_E0 + 0] = load_word (usp);
275 State.regs[REG_E0 + 7] = load_word (usp);
277 State.regs[REG_E0 + 6] = load_word (usp);
279 State.regs[REG_E0 + 5] = load_word (usp);
281 State.regs[REG_E0 + 4] = load_word (usp);
287 State.regs[REG_E0 + 3] = load_word (usp);
289 State.regs[REG_E0 + 2] = load_word (usp);
294 /* And make sure to update the stack pointer. */
295 State.regs[REG_USP] = usp;
298 // 1111 1000 1100 1111 regs....; movm (USP),regs
299 8.0xf8+8.0xcf+8.REGS:D1b:::movm
304 uint32_t usp = State.regs[REG_USP];
310 if (STATE_ARCHITECTURE (SD)->mach == bfd_mach_am33
311 || STATE_ARCHITECTURE (SD)->mach == bfd_mach_am33_2
317 store_word (usp, State.regs[REG_E0 + 2]);
319 store_word (usp, State.regs[REG_E0 + 3]);
325 store_word (usp, State.regs[REG_E0 + 4]);
327 store_word (usp, State.regs[REG_E0 + 5]);
329 store_word (usp, State.regs[REG_E0 + 6]);
331 store_word (usp, State.regs[REG_E0 + 7]);
337 store_word (usp, State.regs[REG_E0 + 0]);
339 store_word (usp, State.regs[REG_E0 + 1]);
341 /* Need to save MDQR, MCRH, MCRL, and MCVF */
348 store_word (usp, State.regs[REG_D0 + 2]);
354 store_word (usp, State.regs[REG_D0 + 3]);
360 store_word (usp, State.regs[REG_A0 + 2]);
366 store_word (usp, State.regs[REG_A0 + 3]);
372 store_word (usp, State.regs[REG_D0]);
374 store_word (usp, State.regs[REG_D0 + 1]);
376 store_word (usp, State.regs[REG_A0]);
378 store_word (usp, State.regs[REG_A0 + 1]);
380 store_word (usp, State.regs[REG_MDR]);
382 store_word (usp, State.regs[REG_LIR]);
384 store_word (usp, State.regs[REG_LAR]);
388 /* And make sure to update the stack pointer. */
389 State.regs[REG_USP] = usp;
392 // 1111 1100 1111 1100 imm32...; and imm32,EPSW
393 8.0xfc+8.0xfc+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:4a:::and
399 PSW &= FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
402 // 1111 1100 1111 1101 imm32...; or imm32,EPSW
403 8.0xfc+8.0xfd+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::or
409 PSW |= FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
412 // 1111 1001 0000 1000 Rm Rn; mov Rm,Rn (Rm != Rn)
413 8.0xf9+8.0x08+4.RM2,4.RN0!RM2:D1g:::mov
422 srcreg = translate_rreg (SD_, RM2);
423 dstreg = translate_rreg (SD_, RN0);
424 State.regs[dstreg] = State.regs[srcreg];
427 // 1111 1001 0001 1000 Rn Rn; ext Rn
428 8.0xf9+8.0x18+4.RN0,4.RN2=RN0:D1:::ext
436 srcreg = translate_rreg (SD_, RN0);
437 if (State.regs[srcreg] & 0x80000000)
438 State.regs[REG_MDR] = -1;
440 State.regs[REG_MDR] = 0;
443 // 1111 1001 0010 1000 Rm Rn; extb Rm,Rn
444 8.0xf9+8.0x28+4.RM2,4.RN0!RM2:D1:::extb
452 srcreg = translate_rreg (SD_, RM2);
453 dstreg = translate_rreg (SD_, RN0);
454 State.regs[dstreg] = EXTEND8 (State.regs[srcreg]);
457 // 1111 1001 0011 1000 Rm Rn; extbu Rm,Rn
458 8.0xf9+8.0x38+4.RM2,4.RN0!RM2:D1:::extbu
466 srcreg = translate_rreg (SD_, RM2);
467 dstreg = translate_rreg (SD_, RN0);
468 State.regs[dstreg] = State.regs[srcreg] & 0xff;
471 // 1111 1001 0100 1000 Rm Rn; exth Rm,Rn
472 8.0xf9+8.0x48+4.RM2,4.RN0!RM2:D1:::exth
480 srcreg = translate_rreg (SD_, RM2);
481 dstreg = translate_rreg (SD_, RN0);
482 State.regs[dstreg] = EXTEND16 (State.regs[srcreg]);
485 // 1111 1001 0101 1000 Rm Rn; exthu Rm,Rn
486 8.0xf9+8.0x58+4.RM2,4.RN0!RM2:D1:::exthu
494 srcreg = translate_rreg (SD_, RM2);
495 dstreg = translate_rreg (SD_, RN0);
496 State.regs[dstreg] = State.regs[srcreg] & 0xffff;
499 // 1111 1001 0110 1000 Rn Rn; clr Rn
500 8.0xf9+8.0x68+4.RM2,4.RN0=RM2:D1:::clr
508 dstreg = translate_rreg (SD_, RN0);
509 State.regs[dstreg] = 0;
511 PSW &= ~(PSW_V | PSW_C | PSW_N);
514 // 1111 1001 0111 1000 Rm Rn; add Rm,Rn
515 8.0xf9+8.0x78+4.RM2,4.RN0:D1b:::add
523 srcreg = translate_rreg (SD_, RM2);
524 dstreg = translate_rreg (SD_, RN0);
525 genericAdd (State.regs[srcreg], dstreg);
528 // 1111 1001 1000 1000 Rm Rn; addc Rm,Rn
529 8.0xf9+8.0x88+4.RM2,4.RN0:D1b:::addc
536 uint32_t reg1, reg2, sum;
539 srcreg = translate_rreg (SD_, RM2);
540 dstreg = translate_rreg (SD_, RN0);
542 reg1 = State.regs[srcreg];
543 reg2 = State.regs[dstreg];
544 sum = reg1 + reg2 + ((PSW & PSW_C) != 0);
545 State.regs[dstreg] = sum;
547 z = ((PSW & PSW_Z) != 0) && (sum == 0);
548 n = (sum & 0x80000000);
549 c = (sum < reg1) || (sum < reg2);
550 v = ((reg2 & 0x80000000) == (reg1 & 0x80000000)
551 && (reg2 & 0x80000000) != (sum & 0x80000000));
553 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
554 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
555 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
558 // 1111 1001 1001 1000 Rm Rn; sub Rm,Rn
559 8.0xf9+8.0x98+4.RM2,4.RN0:D1b:::sub
567 srcreg = translate_rreg (SD_, RM2);
568 dstreg = translate_rreg (SD_, RN0);
569 genericSub (State.regs[srcreg], dstreg);
572 // 1111 1001 1010 1000 Rm Rn; subc Rm,Rn
573 8.0xf9+8.0xa8+4.RM2,4.RN0:D1b:::subc
580 uint32_t reg1, reg2, difference;
583 srcreg = translate_rreg (SD_, RM2);
584 dstreg = translate_rreg (SD_, RN0);
586 reg1 = State.regs[srcreg];
587 reg2 = State.regs[dstreg];
588 difference = reg2 - reg1 - ((PSW & PSW_C) != 0);
589 State.regs[dstreg] = difference;
591 z = ((PSW & PSW_Z) != 0) && (difference == 0);
592 n = (difference & 0x80000000);
594 v = ((reg2 & 0x80000000) == (reg1 & 0x80000000)
595 && (reg2 & 0x80000000) != (difference & 0x80000000));
597 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
598 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
599 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
602 // 1111 1001 1011 1000 Rn Rn; inc Rn
603 8.0xf9+8.0xb8+4.RN0,4.RN2=RN0:D1:::inc
611 dstreg = translate_rreg (SD_, RN0);
612 genericAdd (1, dstreg);
615 // 1111 1001 1101 1000 Rn Rn; inc Rn
616 8.0xf9+8.0xc8+4.RN0,4.RN2=RN0:D1:::inc4
624 dstreg = translate_rreg (SD_, RN0);
625 genericAdd (4, dstreg);
628 // 1111 1001 1101 1000 Rm Rn; cmp Rm,Rn
629 8.0xf9+8.0xd8+4.RM2,4.RN0:D1:::cmp
634 int srcreg1, srcreg2;
637 srcreg1 = translate_rreg (SD_, RN0);
638 srcreg2 = translate_rreg (SD_, RM2);
639 genericCmp (State.regs[srcreg2], State.regs[srcreg1]);
642 // 1111 1001 1110 1000 XRm Rn; mov XRm,Rn
643 8.0xf9+8.0xe8+4.XRM2,4.RN0:D1l:::mov
651 dstreg = translate_rreg (SD_, RN0);
652 srcreg = translate_xreg (SD_, XRM2);
654 State.regs[dstreg] = State.regs[srcreg];
657 // 1111 1001 1111 1000 Rm XRn; mov Rm,XRn
658 8.0xf9+8.0xf8+4.RM2,4.XRN0:D1m:::mov
666 srcreg = translate_rreg (SD_, RM2);
667 dstreg = translate_xreg (SD_, XRN0);
669 State.regs[dstreg] = State.regs[srcreg];
672 // 1111 1001 0000 1001 Rm Rn; and Rm,Rn
673 8.0xf9+8.0x09+4.RM2,4.RN0:D1a:::and
683 srcreg = translate_rreg (SD_, RM2);
684 dstreg = translate_rreg (SD_, RN0);
686 State.regs[dstreg] &= State.regs[srcreg];
687 z = (State.regs[dstreg] == 0);
688 n = (State.regs[dstreg] & 0x80000000) != 0;
689 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
690 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
693 // 1111 1001 0001 1001 Rm Rn; or Rm,Rn
694 8.0xf9+8.0x19+4.RM2,4.RN0:D1a:::or
703 srcreg = translate_rreg (SD_, RM2);
704 dstreg = translate_rreg (SD_, RN0);
706 State.regs[dstreg] |= State.regs[srcreg];
707 z = (State.regs[dstreg] == 0);
708 n = (State.regs[dstreg] & 0x80000000) != 0;
709 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
710 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
713 // 1111 1001 0010 1001 Rm Rn; xor Rm,Rn
714 8.0xf9+8.0x29+4.RM2,4.RN0:D1a:::xor
723 srcreg = translate_rreg (SD_, RM2);
724 dstreg = translate_rreg (SD_, RN0);
726 State.regs[dstreg] ^= State.regs[srcreg];
727 z = (State.regs[dstreg] == 0);
728 n = (State.regs[dstreg] & 0x80000000) != 0;
729 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
730 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
733 // 1111 1001 0011 1001 Rn Rn; not Rn
734 8.0xf9+8.0x39+4.RM2,4.RN0=RM2:D1:::not
743 dstreg = translate_rreg (SD_, RN0);
745 State.regs[dstreg] = ~State.regs[dstreg];
746 z = (State.regs[dstreg] == 0);
747 n = (State.regs[dstreg] & 0x80000000) != 0;
748 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
749 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
752 // 1111 1001 0100 1001 Rm Rn; asr Rm,Rn
753 8.0xf9+8.0x49+4.RM2,4.RN0:D1a:::asr
763 srcreg = translate_rreg (SD_, RM2);
764 dstreg = translate_rreg (SD_, RN0);
766 temp = State.regs[dstreg];
768 temp >>= State.regs[srcreg];
769 State.regs[dstreg] = temp;
770 z = (State.regs[dstreg] == 0);
771 n = (State.regs[dstreg] & 0x80000000) != 0;
772 PSW &= ~(PSW_Z | PSW_N | PSW_C);
773 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
776 // 1111 1001 0101 1001 Rm Rn; lsr Rm,Rn
777 8.0xf9+8.0x59+4.RM2,4.RN0:D1a:::lsr
787 srcreg = translate_rreg (SD_, RM2);
788 dstreg = translate_rreg (SD_, RN0);
790 c = State.regs[dstreg] & 1;
791 State.regs[dstreg] >>= State.regs[srcreg];
792 z = (State.regs[dstreg] == 0);
793 n = (State.regs[dstreg] & 0x80000000) != 0;
794 PSW &= ~(PSW_Z | PSW_N | PSW_C);
795 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
798 // 1111 1001 0110 1001 Rm Rn; asl Rm,Rn
799 8.0xf9+8.0x69+4.RM2,4.RN0:D1a:::asl
808 srcreg = translate_rreg (SD_, RM2);
809 dstreg = translate_rreg (SD_, RN0);
811 State.regs[dstreg] <<= State.regs[srcreg];
812 z = (State.regs[dstreg] == 0);
813 n = (State.regs[dstreg] & 0x80000000) != 0;
814 PSW &= ~(PSW_Z | PSW_N);
815 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
818 // 1111 1001 0111 1001 Rn Rn; asl2 Rn
819 8.0xf9+8.0x79+4.RM2,4.RN0=RM2:D1:::asl2
828 dstreg = translate_rreg (SD_, RN0);
830 State.regs[dstreg] <<= 2;
831 z = (State.regs[dstreg] == 0);
832 n = (State.regs[dstreg] & 0x80000000) != 0;
833 PSW &= ~(PSW_Z | PSW_N);
834 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
837 // 1111 1001 1000 1001 Rn Rn; ror Rn
838 8.0xf9+8.0x89+4.RM2,4.RN0=RM2:D1:::ror
848 dstreg = translate_rreg (SD_, RN0);
850 value = State.regs[dstreg];
854 value |= ((PSW & PSW_C) != 0) ? 0x80000000 : 0;
855 State.regs[dstreg] = value;
857 n = (value & 0x80000000) != 0;
858 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
859 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
862 // 1111 1001 1001 1001 Rn Rn; rol Rn
863 8.0xf9+8.0x99+4.RM2,4.RN0=RM2:D1:::rol
873 dstreg = translate_rreg (SD_, RN0);
875 value = State.regs[dstreg];
876 c = (value & 0x80000000) ? 1 : 0;
879 value |= ((PSW & PSW_C) != 0);
880 State.regs[dstreg] = value;
882 n = (value & 0x80000000) != 0;
883 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
884 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
887 // 1111 1001 1010 1001 Rm Rn; mul Rm,Rn
888 8.0xf9+8.0xa9+4.RM2,4.RN0:D1b:::mul
898 srcreg = translate_rreg (SD_, RM2);
899 dstreg = translate_rreg (SD_, RN0);
901 temp = ((int64_t)(int32_t)State.regs[dstreg]
902 * (int64_t)(int32_t)State.regs[srcreg]);
903 State.regs[dstreg] = temp & 0xffffffff;
904 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
905 z = (State.regs[dstreg] == 0);
906 n = (State.regs[dstreg] & 0x80000000) != 0;
907 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
908 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
911 // 1111 1001 1011 1001 Rm Rn; mulu Rm,Rn
912 8.0xf9+8.0xb9+4.RM2,4.RN0:D1b:::mulu
922 srcreg = translate_rreg (SD_, RM2);
923 dstreg = translate_rreg (SD_, RN0);
925 temp = ((uint64_t)State.regs[dstreg]
926 * (uint64_t)State.regs[srcreg]);
927 State.regs[dstreg] = temp & 0xffffffff;
928 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
929 z = (State.regs[dstreg] == 0);
930 n = (State.regs[dstreg] & 0x80000000) != 0;
931 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
932 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
935 // 1111 1001 1100 1001 Rm Rn; div Rm,Rn
936 8.0xf9+8.0xc9+4.RM2,4.RN0:D1b:::div
946 srcreg = translate_rreg (SD_, RM2);
947 dstreg = translate_rreg (SD_, RN0);
949 temp = State.regs[REG_MDR];
951 temp |= State.regs[dstreg];
952 State.regs[REG_MDR] = temp % (int32_t)State.regs[srcreg];
953 temp /= (int32_t)State.regs[srcreg];
954 State.regs[dstreg] = temp & 0xffffffff;
955 z = (State.regs[dstreg] == 0);
956 n = (State.regs[dstreg] & 0x80000000) != 0;
957 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
958 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
961 // 1111 1001 1101 1001 Rm Rn; divu Rm,Rn
962 8.0xf9+8.0xd9+4.RM2,4.RN0:D1b:::divu
972 srcreg = translate_rreg (SD_, RM2);
973 dstreg = translate_rreg (SD_, RN0);
975 temp = State.regs[REG_MDR];
977 temp |= State.regs[dstreg];
978 State.regs[REG_MDR] = temp % State.regs[srcreg];
979 temp /= State.regs[srcreg];
980 State.regs[dstreg] = temp & 0xffffffff;
981 z = (State.regs[dstreg] == 0);
982 n = (State.regs[dstreg] & 0x80000000) != 0;
983 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
984 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
988 // 1111 1001 0000 1010 Rm Rn; mov (Rm),Rn
989 8.0xf9+8.0x0a+4.RN2,4.RM0:D1h:::mov
997 srcreg = translate_rreg (SD_, RM0);
998 dstreg = translate_rreg (SD_, RN2);
999 State.regs[dstreg] = load_word (State.regs[srcreg]);
1002 // 1111 1001 0001 1010 Rm Rn; mov Rm,(Rn)
1003 8.0xf9+8.0x1a+4.RM2,4.RN0:D1i:::mov
1011 srcreg = translate_rreg (SD_, RM2);
1012 dstreg = translate_rreg (SD_, RN0);
1013 store_word (State.regs[dstreg], State.regs[srcreg]);
1016 // 1111 1001 0010 1010 Rm Rn; movbu (Rm),Rn
1017 8.0xf9+8.0x2a+4.RN2,4.RM0:D1g:::movbu
1025 srcreg = translate_rreg (SD_, RM0);
1026 dstreg = translate_rreg (SD_, RN2);
1027 State.regs[dstreg] = load_byte (State.regs[srcreg]);
1030 // 1111 1001 0011 1010 Rm Rn; movbu Rm,(Rn)
1031 8.0xf9+8.0x3a+4.RM2,4.RN0:D1i:::movbu
1039 srcreg = translate_rreg (SD_, RM2);
1040 dstreg = translate_rreg (SD_, RN0);
1041 store_byte (State.regs[dstreg], State.regs[srcreg]);
1044 // 1111 1001 0100 1010 Rm Rn; movhu (Rm),Rn
1045 8.0xf9+8.0x4a+4.RN2,4.RM0:D1g:::movhu
1053 srcreg = translate_rreg (SD_, RM0);
1054 dstreg = translate_rreg (SD_, RN2);
1055 State.regs[dstreg] = load_half (State.regs[srcreg]);
1058 // 1111 1001 0101 1010 Rm Rn; movhu Rm,(Rn)
1059 8.0xf9+8.0x5a+4.RM2,4.RN0:D1i:::movhu
1067 srcreg = translate_rreg (SD_, RM2);
1068 dstreg = translate_rreg (SD_, RN0);
1069 store_half (State.regs[dstreg], State.regs[srcreg]);
1072 // 1111 1001 0110 1010 Rm Rn; mov (Rm+),Rn
1073 8.0xf9+8.0x6a+4.RN2,4.RM0!RN2:D1y:::mov
1081 srcreg = translate_rreg (SD_, RM0);
1082 dstreg = translate_rreg (SD_, RN2);
1083 State.regs[dstreg] = load_word (State.regs[srcreg]);
1084 State.regs[srcreg] += 4;
1087 // 1111 1001 0111 1010 Rm Rn; mov Rm,(Rn+)
1088 8.0xf9+8.0x7a+4.RM2,4.RN0:D1z:::mov
1096 srcreg = translate_rreg (SD_, RM2);
1097 dstreg = translate_rreg (SD_, RN0);
1098 store_word (State.regs[dstreg], State.regs[srcreg]);
1099 State.regs[dstreg] += 4;
1102 // 1111 1001 1000 1010 Rn 0000; mov (sp),Rn
1103 8.0xf9+8.0x8a+4.RN2,4.0000:D1j:::mov
1111 dstreg = translate_rreg (SD_, RN2);
1112 State.regs[dstreg] = load_word (State.regs[REG_SP]);
1115 // 1111 1001 1001 1010 Rm 0000; mov Rm, (sp)
1116 8.0xf9+8.0x9a+4.RM2,4.0000:D1k:::mov
1124 srcreg = translate_rreg (SD_, RM2);
1125 store_word (State.regs[REG_SP], State.regs[srcreg]);
1128 // 1111 1001 1010 1010 Rn 0000; mobvu (sp),Rn
1129 8.0xf9+8.0xaa+4.RN2,4.0000:D1j:::movbu
1137 dstreg = translate_rreg (SD_, RN2);
1138 State.regs[dstreg] = load_byte (State.regs[REG_SP]);
1141 // 1111 1001 1011 1010 Rm 0000; movbu Rm, (sp)
1142 8.0xf9+8.0xba+4.RM2,4.0000:D1k:::movbu
1150 srcreg = translate_rreg (SD_, RM2);
1151 store_byte (State.regs[REG_SP], State.regs[srcreg]);
1154 // 1111 1001 1000 1100 Rn 0000; movhu (sp),Rn
1155 8.0xf9+8.0xca+4.RN2,4.0000:D1j:::movhu
1163 dstreg = translate_rreg (SD_, RN2);
1164 State.regs[dstreg] = load_half (State.regs[REG_SP]);
1167 // 1111 1001 1001 1101 Rm 0000; movhu Rm, (sp)
1168 8.0xf9+8.0xda+4.RM2,4.0000:D1k:::movhu
1176 srcreg = translate_rreg (SD_, RM2);
1177 store_half (State.regs[REG_SP], State.regs[srcreg]);
1180 // 1111 1001 1110 1010 Rm Rn; movhu (Rm+),Rn
1181 8.0xf9+8.0xea+4.RN2,4.RM0!RN2:D1y:::movhu
1189 srcreg = translate_rreg (SD_, RM0);
1190 dstreg = translate_rreg (SD_, RN2);
1191 State.regs[dstreg] = load_half (State.regs[srcreg]);
1192 State.regs[srcreg] += 2;
1195 // 1111 1001 1111 1010 Rm Rn; movhu Rm,(Rn+)
1196 8.0xf9+8.0xfa+4.RM2,4.RN0:D1z:::movhu
1204 srcreg = translate_rreg (SD_, RM2);
1205 dstreg = translate_rreg (SD_, RN0);
1206 store_half (State.regs[dstreg], State.regs[srcreg]);
1207 State.regs[dstreg] += 2;
1211 // 1111 1001 0000 1011 Rm Rn; mac Rm,Rn
1212 8.0xf9+8.0x0b+4.RM2,4.RN0:D1:::mac
1217 int srcreg1, srcreg2;
1222 srcreg1 = translate_rreg (SD_, RM2);
1223 srcreg2 = translate_rreg (SD_, RN0);
1225 temp = ((int64_t)(int32_t)State.regs[srcreg2]
1226 * (int64_t)(int32_t)State.regs[srcreg1]);
1227 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
1228 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
1229 State.regs[REG_MCRL] = sum;
1232 sum = State.regs[REG_MCRH] + temp + c;
1233 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
1234 && (temp & 0x80000000) != (sum & 0x80000000));
1235 State.regs[REG_MCRH] = sum;
1237 State.regs[REG_MCVF] = 1;
1240 // 1111 1001 0001 1011 Rm Rn; macu Rm,Rn
1241 8.0xf9+8.0x1b+4.RM2,4.RN0:D1:::macu
1246 int srcreg1, srcreg2;
1251 srcreg1 = translate_rreg (SD_, RM2);
1252 srcreg2 = translate_rreg (SD_, RN0);
1254 temp = ((uint64_t)State.regs[srcreg2]
1255 * (uint64_t)State.regs[srcreg1]);
1256 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
1257 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
1258 State.regs[REG_MCRL] = sum;
1261 sum = State.regs[REG_MCRH] + temp + c;
1262 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
1263 && (temp & 0x80000000) != (sum & 0x80000000));
1264 State.regs[REG_MCRH] = sum;
1266 State.regs[REG_MCVF] = 1;
1269 // 1111 1001 0010 1011 Rm Rn; macb Rm,Rn
1270 8.0xf9+8.0x2b+4.RM2,4.RN0:D1:::macb
1275 int srcreg1, srcreg2;
1280 srcreg1 = translate_rreg (SD_, RM2);
1281 srcreg2 = translate_rreg (SD_, RN0);
1283 temp = ((int32_t)(int8_t)(State.regs[srcreg2] & 0xff)
1284 * (int32_t)(int8_t)(State.regs[srcreg1] & 0xff));
1285 sum = State.regs[REG_MCRL] + temp;
1286 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
1287 && (temp & 0x80000000) != (sum & 0x80000000));
1288 State.regs[REG_MCRL] = sum;
1290 State.regs[REG_MCVF] = 1;
1293 // 1111 1001 0011 1011 Rm Rn; macbu Rm,Rn
1294 8.0xf9+8.0x3b+4.RM2,4.RN0:D1:::macbu
1299 int srcreg1, srcreg2;
1304 srcreg1 = translate_rreg (SD_, RM2);
1305 srcreg2 = translate_rreg (SD_, RN0);
1307 temp = ((uint32_t)(State.regs[srcreg2] & 0xff)
1308 * (uint32_t)(State.regs[srcreg1] & 0xff));
1309 sum = State.regs[REG_MCRL] + temp;
1310 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
1311 && (temp & 0x80000000) != (sum & 0x80000000));
1312 State.regs[REG_MCRL] = sum;
1314 State.regs[REG_MCVF] = 1;
1317 // 1111 1001 0100 1011 Rm Rn; mach Rm,Rn
1318 8.0xf9+8.0x4b+4.RM2,4.RN0:D1:::mach
1323 int srcreg1, srcreg2;
1328 srcreg1 = translate_rreg (SD_, RM2);
1329 srcreg2 = translate_rreg (SD_, RN0);
1331 temp = ((uint64_t)(int16_t)(State.regs[srcreg2] & 0xffff)
1332 * (uint64_t)(int16_t)(State.regs[srcreg1] & 0xffff));
1333 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
1334 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
1335 State.regs[REG_MCRL] = sum;
1338 sum = State.regs[REG_MCRH] + temp + c;
1339 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
1340 && (temp & 0x80000000) != (sum & 0x80000000));
1341 State.regs[REG_MCRH] = sum;
1343 State.regs[REG_MCVF] = 1;
1346 // 1111 1001 0101 1011 Rm Rn; machu Rm,Rn
1347 8.0xf9+8.0x5b+4.RM2,4.RN0:D1:::machu
1352 int srcreg1, srcreg2;
1357 srcreg1 = translate_rreg (SD_, RM2);
1358 srcreg2 = translate_rreg (SD_, RN0);
1360 temp = ((uint64_t)(State.regs[srcreg2] & 0xffff)
1361 * (uint64_t)(State.regs[srcreg1] & 0xffff));
1362 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
1363 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
1364 State.regs[REG_MCRL] = sum;
1367 sum = State.regs[REG_MCRH] + temp + c;
1368 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
1369 && (temp & 0x80000000) != (sum & 0x80000000));
1370 State.regs[REG_MCRH] = sum;
1372 State.regs[REG_MCVF] = 1;
1375 // 1111 1001 0110 1011 Rm Rn; dmach Rm,Rn
1376 8.0xf9+8.0x6b+4.RM2,4.RN0:D1:::dmach
1381 int srcreg1, srcreg2;
1382 int32_t temp, temp2, sum;
1386 srcreg1 = translate_rreg (SD_, RM2);
1387 srcreg2 = translate_rreg (SD_, RN0);
1389 temp = ((int32_t)(int16_t)(State.regs[srcreg2] & 0xffff)
1390 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
1391 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
1392 * (int32_t)(int16_t)((State.regs[srcreg2] >> 16) & 0xffff));
1393 sum = temp + temp2 + State.regs[REG_MCRL];
1394 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
1395 && (temp & 0x80000000) != (sum & 0x80000000));
1396 State.regs[REG_MCRL] = sum;
1398 State.regs[REG_MCVF] = 1;
1401 // 1111 1001 0111 1011 Rm Rn; dmachu Rm,Rn
1402 8.0xf9+8.0x7b+4.RM2,4.RN0:D1:::dmachu
1407 int srcreg1, srcreg2;
1408 uint32_t temp, temp2, sum;
1412 srcreg1 = translate_rreg (SD_, RM2);
1413 srcreg2 = translate_rreg (SD_, RN0);
1415 temp = ((uint32_t)(State.regs[srcreg2] & 0xffff)
1416 * (uint32_t)(State.regs[srcreg1] & 0xffff));
1417 temp2 = ((uint32_t)((State.regs[srcreg1] >> 16) & 0xffff)
1418 * (uint32_t)((State.regs[srcreg2] >> 16) & 0xffff));
1419 sum = temp + temp2 + State.regs[REG_MCRL];
1420 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
1421 && (temp & 0x80000000) != (sum & 0x80000000));
1422 State.regs[REG_MCRL] = sum;
1424 State.regs[REG_MCVF] = 1;
1427 // 1111 1001 1000 1011 Rm Rn; dmulh Rm,Rn
1428 8.0xf9+8.0x8b+4.RM2,4.RN0:D1:::dmulh
1437 srcreg = translate_rreg (SD_, RM2);
1438 dstreg = translate_rreg (SD_, RN0);
1440 temp = ((int32_t)(int16_t)(State.regs[dstreg] & 0xffff)
1441 * (int32_t)(int16_t)(State.regs[srcreg] & 0xffff));
1442 State.regs[REG_MDRQ] = temp;
1443 temp = ((int32_t)(int16_t)((State.regs[dstreg] >> 16) & 0xffff)
1444 * (int32_t)(int16_t)((State.regs[srcreg] >>16) & 0xffff));
1445 State.regs[dstreg] = temp;
1448 // 1111 1001 1001 1011 Rm Rn; dmulhu Rm,Rn
1449 8.0xf9+8.0x9b+4.RM2,4.RN0:D1:::dumachu
1458 srcreg = translate_rreg (SD_, RM2);
1459 dstreg = translate_rreg (SD_, RN0);
1461 temp = ((uint32_t)(State.regs[dstreg] & 0xffff)
1462 * (uint32_t)(State.regs[srcreg] & 0xffff));
1463 State.regs[REG_MDRQ] = temp;
1464 temp = ((uint32_t)((State.regs[dstreg] >> 16) & 0xffff)
1465 * (uint32_t)((State.regs[srcreg] >>16) & 0xffff));
1466 State.regs[dstreg] = temp;
1469 // 1111 1001 1010 1011 Rm Rn; sat16 Rm,Rn
1470 8.0xf9+8.0xab+4.RM2,4.RN0:D1:::sat16
1479 srcreg = translate_rreg (SD_, RM2);
1480 dstreg = translate_rreg (SD_, RN0);
1482 value = State.regs[srcreg];
1484 if (value >= 0x7fff)
1485 State.regs[dstreg] = 0x7fff;
1486 else if (value <= 0xffff8000)
1487 State.regs[dstreg] = 0xffff8000;
1489 State.regs[dstreg] = value;
1491 n = (State.regs[dstreg] & 0x8000) != 0;
1492 z = (State.regs[dstreg] == 0);
1493 PSW &= ~(PSW_Z | PSW_N);
1494 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1497 // 1111 1001 1011 1011 Rm Rn; mcste Rm,Rn
1498 8.0xf9+8.0xbb+4.RM2,4.RN0:D1:::mcste
1506 srcreg = translate_rreg (SD_, RM2);
1507 dstreg = translate_rreg (SD_, RN0);
1509 PSW &= ~(PSW_V | PSW_C);
1510 PSW |= (State.regs[REG_MCVF] ? PSW_V : 0);
1512 /* 32bit saturation. */
1513 if (State.regs[srcreg] == 0x20)
1517 tmp = State.regs[REG_MCRH];
1519 tmp += State.regs[REG_MCRL];
1521 if (tmp > 0x7fffffff)
1522 State.regs[dstreg] = 0x7fffffff;
1523 else if (tmp < 0xffffffff80000000LL)
1524 State.regs[dstreg] = 0x80000000;
1526 State.regs[dstreg] = tmp;
1528 /* 16bit saturation */
1529 else if (State.regs[srcreg] == 0x10)
1533 tmp = State.regs[REG_MCRH];
1535 tmp += State.regs[REG_MCRL];
1538 State.regs[dstreg] = 0x7fff;
1539 else if (tmp < 0xffffffffffff8000LL)
1540 State.regs[dstreg] = 0x8000;
1542 State.regs[dstreg] = tmp;
1544 /* 8 bit saturation */
1545 else if (State.regs[srcreg] == 0x8)
1549 tmp = State.regs[REG_MCRH];
1551 tmp += State.regs[REG_MCRL];
1554 State.regs[dstreg] = 0x7f;
1555 else if (tmp < 0xffffffffffffff80LL)
1556 State.regs[dstreg] = 0x80;
1558 State.regs[dstreg] = tmp;
1560 /* 9 bit saturation */
1561 else if (State.regs[srcreg] == 0x9)
1565 tmp = State.regs[REG_MCRH];
1567 tmp += State.regs[REG_MCRL];
1570 State.regs[dstreg] = 0x80;
1571 else if (tmp < 0xffffffffffffff81LL)
1572 State.regs[dstreg] = 0x81;
1574 State.regs[dstreg] = tmp;
1576 /* 9 bit saturation */
1577 else if (State.regs[srcreg] == 0x30)
1581 tmp = State.regs[REG_MCRH];
1583 tmp += State.regs[REG_MCRL];
1585 if (tmp > 0x7fffffffffffLL)
1586 tmp = 0x7fffffffffffLL;
1587 else if (tmp < 0xffff800000000000LL)
1588 tmp = 0xffff800000000000LL;
1591 State.regs[dstreg] = tmp;
1595 // 1111 1001 1100 1011 Rm Rn; swap Rm,Rn
1596 8.0xf9+8.0xcb+4.RM2,4.RN0:D1:::swap
1604 srcreg = translate_rreg (SD_, RM2);
1605 dstreg = translate_rreg (SD_, RN0);
1607 State.regs[dstreg] = (((State.regs[srcreg] & 0xff) << 24)
1608 | (((State.regs[srcreg] >> 8) & 0xff) << 16)
1609 | (((State.regs[srcreg] >> 16) & 0xff) << 8)
1610 | ((State.regs[srcreg] >> 24) & 0xff));
1613 // 1111 1101 1101 1011 Rm Rn; swaph Rm,Rn
1614 8.0xf9+8.0xdb+4.RM2,4.RN0:D1:::swaph
1622 srcreg = translate_rreg (SD_, RM2);
1623 dstreg = translate_rreg (SD_, RN0);
1625 State.regs[dstreg] = (((State.regs[srcreg] & 0xff) << 8)
1626 | ((State.regs[srcreg] >> 8) & 0xff)
1627 | (((State.regs[srcreg] >> 16) & 0xff) << 24)
1628 | (((State.regs[srcreg] >> 24) & 0xff) << 16));
1631 // 1111 1001 1110 1011 Rm Rn; swhw Rm,Rn
1632 8.0xf9+8.0xeb+4.RM2,4.RN0:D1:::swhw
1640 srcreg = translate_rreg (SD_, RM2);
1641 dstreg = translate_rreg (SD_, RN0);
1643 State.regs[dstreg] = (((State.regs[srcreg] & 0xffff) << 16)
1644 | ((State.regs[srcreg] >> 16) & 0xffff));
1647 // 1111 1001 1111 1011 Rm Rn; bsch Rm,Rn
1648 8.0xf9+8.0xfb+4.RM2,4.RN0:D1:::bsch
1658 srcreg = translate_rreg (SD_, RM2);
1659 dstreg = translate_rreg (SD_, RN0);
1661 temp = State.regs[srcreg];
1662 start = (State.regs[dstreg] & 0x1f) - 1;
1667 for (i = start; i >= 0; i--)
1669 if (temp & (1 << i))
1672 State.regs[dstreg] = i;
1680 State.regs[dstreg] = 0;
1683 PSW |= (c ? PSW_C : 0);
1687 // 1111 1011 0000 1000 Rn Rn IMM8; mov IMM8,Rn
1688 8.0xfb+8.0x08+4.RM2,4.RN0=RM2+8.IMM8:D2j:::mov
1696 dstreg = translate_rreg (SD_, RN0);
1697 State.regs[dstreg] = EXTEND8 (IMM8);
1700 // 1111 1011 0001 1000 Rn Rn IMM8; movu IMM8,Rn
1701 8.0xfb+8.0x18+4.RM2,4.RN0=RM2+8.IMM8:D2:::movu
1709 dstreg = translate_rreg (SD_, RN0);
1710 State.regs[dstreg] = IMM8 & 0xff;
1713 // 1111 1011 0111 1000 Rn Rn IMM8; add IMM8,Rn
1714 8.0xfb+8.0x78+4.RM2,4.RN0=RM2+8.IMM8:D2d:::add
1722 dstreg = translate_rreg (SD_, RN0);
1723 genericAdd (EXTEND8 (IMM8), dstreg);
1726 // 1111 1011 1000 1000 Rn Rn IMM8; addc IMM8,Rn
1727 8.0xfb+8.0x88+4.RM2,4.RN0=RM2+8.IMM8:D2d:::addc
1737 dstreg = translate_rreg (SD_, RN0);
1739 imm = EXTEND8 (IMM8);
1740 reg2 = State.regs[dstreg];
1741 sum = imm + reg2 + ((PSW & PSW_C) != 0);
1742 State.regs[dstreg] = sum;
1744 z = ((PSW & PSW_Z) != 0) && (sum == 0);
1745 n = (sum & 0x80000000);
1746 c = (sum < imm) || (sum < reg2);
1747 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
1748 && (reg2 & 0x80000000) != (sum & 0x80000000));
1750 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1751 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
1752 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
1755 // 1111 1011 1001 1000 Rn Rn IMM8; sub IMM8,Rn
1756 8.0xfb+8.0x98+4.RM2,4.RN0=RM2+8.IMM8:D2d:::sub
1764 dstreg = translate_rreg (SD_, RN0);
1766 genericSub (EXTEND8 (IMM8), dstreg);
1769 // 1111 1011 1010 1000 Rn Rn IMM8; subc IMM8,Rn
1770 8.0xfb+8.0xa8+4.RM2,4.RN0=RM2+8.IMM8:D2d:::subc
1777 uint32_t reg2, difference;
1780 dstreg = translate_rreg (SD_, RN0);
1782 imm = EXTEND8 (IMM8);
1783 reg2 = State.regs[dstreg];
1784 difference = reg2 - imm - ((PSW & PSW_C) != 0);
1785 State.regs[dstreg] = difference;
1787 z = ((PSW & PSW_Z) != 0) && (difference == 0);
1788 n = (difference & 0x80000000);
1790 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
1791 && (reg2 & 0x80000000) != (difference & 0x80000000));
1793 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1794 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
1795 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
1798 // 1111 1011 1101 1000 Rn Rn IMM8; cmp IMM8,Rn
1799 8.0xfb+8.0xd8+4.RM2,4.RN0=RM2+8.IMM8:D2b:::cmp
1807 srcreg = translate_rreg (SD_, RN0);
1808 genericCmp (EXTEND8 (IMM8), State.regs[srcreg]);
1811 // 1111 1011 1111 1000 XRn XRn IMM8; mov IMM8,XRn
1812 8.0xfb+8.0xf8+4.XRM2,4.XRN0=XRM2+8.IMM8:D2k:::mov
1820 dstreg = translate_xreg (SD_, XRN0);
1822 State.regs[dstreg] = IMM8;
1825 // 1111 1011 0000 1001 Rn Rn IMM8; and IMM8,Rn
1826 8.0xfb+8.0x09+4.RM2,4.RN0=RM2+8.IMM8:D2d:::and
1835 dstreg = translate_rreg (SD_, RN0);
1837 State.regs[dstreg] &= (IMM8 & 0xff);
1838 z = (State.regs[dstreg] == 0);
1839 n = (State.regs[dstreg] & 0x80000000) != 0;
1840 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1841 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1844 // 1111 1011 0001 1001 Rn Rn IMM8; or IMM8,Rn
1845 8.0xfb+8.0x19+4.RM2,4.RN0=RM2+8.IMM8:D2d:::or
1854 dstreg = translate_rreg (SD_, RN0);
1856 State.regs[dstreg] |= (IMM8 & 0xff);
1857 z = (State.regs[dstreg] == 0);
1858 n = (State.regs[dstreg] & 0x80000000) != 0;
1859 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1860 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1863 // 1111 1011 0010 1001 Rn Rn IMM8; xor IMM8,Rn
1864 8.0xfb+8.0x29+4.RM2,4.RN0=RM2+8.IMM8:D2d:::xor
1873 dstreg = translate_rreg (SD_, RN0);
1875 State.regs[dstreg] ^= (IMM8 & 0xff);
1876 z = (State.regs[dstreg] == 0);
1877 n = (State.regs[dstreg] & 0x80000000) != 0;
1878 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1879 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1882 // 1111 1011 0100 1001 Rn Rn IMM8; asr IMM8,Rn
1883 8.0xfb+8.0x49+4.RM2,4.RN0=RM2+8.IMM8:D2a:::asr
1893 dstreg = translate_rreg (SD_, RN0);
1895 temp = State.regs[dstreg];
1897 temp >>= (IMM8 & 0xff);
1898 State.regs[dstreg] = temp;
1899 z = (State.regs[dstreg] == 0);
1900 n = (State.regs[dstreg] & 0x80000000) != 0;
1901 PSW &= ~(PSW_Z | PSW_N | PSW_C);
1902 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
1905 // 1111 1011 0101 1001 Rn Rn IMM8; lsr IMM8,Rn
1906 8.0xfb+8.0x59+4.RM2,4.RN0=RM2+8.IMM8:D2a:::lsr
1915 dstreg = translate_rreg (SD_, RN0);
1917 c = State.regs[dstreg] & 1;
1918 State.regs[dstreg] >>= (IMM8 & 0xff);
1919 z = (State.regs[dstreg] == 0);
1920 n = (State.regs[dstreg] & 0x80000000) != 0;
1921 PSW &= ~(PSW_Z | PSW_N | PSW_C);
1922 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
1925 // 1111 1011 0110 1001 Rn Rn IMM8; asl IMM8,Rn
1926 8.0xfb+8.0x69+4.RM2,4.RN0=RM2+8.IMM8:D2a:::asl
1935 dstreg = translate_rreg (SD_, RN0);
1937 State.regs[dstreg] <<= (IMM8 & 0xff);
1938 z = (State.regs[dstreg] == 0);
1939 n = (State.regs[dstreg] & 0x80000000) != 0;
1940 PSW &= ~(PSW_Z | PSW_N);
1941 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1944 // 1111 1011 1010 1001 Rn Rn IMM8; mul IMM8,Rn
1945 8.0xfb+8.0xa9+4.RM2,4.RN0=RM2+8.IMM8:D2a:::mul
1955 dstreg = translate_rreg (SD_, RN0);
1957 temp = ((int64_t)(int32_t)State.regs[dstreg]
1958 * (int64_t)(int32_t)EXTEND8 (IMM8));
1959 State.regs[dstreg] = temp & 0xffffffff;
1960 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
1961 z = (State.regs[dstreg] == 0);
1962 n = (State.regs[dstreg] & 0x80000000) != 0;
1963 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1964 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1967 // 1111 1011 1011 1001 Rn Rn IMM8; mulu IMM8,Rn
1968 8.0xfb+8.0xb9+4.RM2,4.RN0=RM2+8.IMM8:D2a:::mulu
1978 dstreg = translate_rreg (SD_, RN0);
1980 temp = ((uint64_t)State.regs[dstreg]
1981 * (uint64_t)(IMM8 & 0xff));
1982 State.regs[dstreg] = temp & 0xffffffff;
1983 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
1984 z = (State.regs[dstreg] == 0);
1985 n = (State.regs[dstreg] & 0x80000000) != 0;
1986 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1987 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1990 // 1111 1011 1110 1001 Rn Rn IMM8; btst imm8,Rn
1991 8.0xfb+8.0xe9+4.RN2,4.RM0=RN2+8.IMM8:D2l:::btst
1999 srcreg = translate_rreg (SD_, RM0);
2000 genericBtst(IMM8, State.regs[srcreg]);
2003 // 1111 1011 0000 1010 Rn Rm IMM8; mov (d8,Rm),Rn
2004 8.0xfb+8.0x0a+4.RN2,4.RM0+8.IMM8:D2l:::mov
2012 srcreg = translate_rreg (SD_, RM0);
2013 dstreg = translate_rreg (SD_, RN2);
2014 State.regs[dstreg] = load_word (State.regs[srcreg] + EXTEND8 (IMM8));
2017 // 1111 1011 0001 1010 Rn Rm IMM8; mov Rm,(d8,Rn)
2018 8.0xfb+8.0x1a+4.RM2,4.RN0+8.IMM8:D2m:::mov
2026 srcreg = translate_rreg (SD_, RM2);
2027 dstreg = translate_rreg (SD_, RN0);
2028 store_word (State.regs[dstreg] + EXTEND8 (IMM8), State.regs[srcreg]);
2031 // 1111 1011 0010 1010 Rn Rm IMM8; movbu (d8,Rm),Rn
2032 8.0xfb+8.0x2a+4.RN2,4.RM0+8.IMM8:D2l:::movbu
2040 srcreg = translate_rreg (SD_, RM0);
2041 dstreg = translate_rreg (SD_, RN2);
2042 State.regs[dstreg] = load_byte (State.regs[srcreg] + EXTEND8 (IMM8));
2045 // 1111 1011 0011 1010 Rn Rm IMM8; movbu Rm,(d8,Rn)
2046 8.0xfb+8.0x3a+4.RM2,4.RN0+8.IMM8:D2m:::movbu
2054 srcreg = translate_rreg (SD_, RM2);
2055 dstreg = translate_rreg (SD_, RN0);
2056 store_byte (State.regs[dstreg] + EXTEND8 (IMM8), State.regs[srcreg]);
2059 // 1111 1011 0100 1010 Rn Rm IMM8; movhu (d8,Rm),Rn
2060 8.0xfb+8.0x4a+4.RN2,4.RM0+8.IMM8:D2l:::movhu
2068 srcreg = translate_rreg (SD_, RM0);
2069 dstreg = translate_rreg (SD_, RN2);
2070 State.regs[dstreg] = load_half (State.regs[srcreg] + EXTEND8 (IMM8));
2073 // 1111 1011 0101 1010 Rn Rm IMM8; movhu Rm,(d8,Rn)
2074 8.0xfb+8.0x5a+4.RM2,4.RN0+8.IMM8:D2m:::movhu
2082 srcreg = translate_rreg (SD_, RM2);
2083 dstreg = translate_rreg (SD_, RN0);
2084 store_half (State.regs[dstreg] + EXTEND8 (IMM8), State.regs[srcreg]);
2087 // 1111 1011 0110 1010 Rn Rm IMM8; mov (d8,Rm+),Rn
2088 8.0xfb+8.0x6a+4.RN2,4.RM0!RN2+8.IMM8:D2y:::mov
2096 srcreg = translate_rreg (SD_, RM0);
2097 dstreg = translate_rreg (SD_, RN2);
2098 State.regs[dstreg] = load_word (State.regs[srcreg]);
2099 State.regs[srcreg] += EXTEND8 (IMM8);
2102 // 1111 1011 0111 1010 Rn Rm IMM8; mov Rm,(d8,Rn+)
2103 8.0xfb+8.0x7a+4.RM2,4.RN0+8.IMM8:D2z:::mov
2111 srcreg = translate_rreg (SD_, RM2);
2112 dstreg = translate_rreg (SD_, RN0);
2113 store_word (State.regs[dstreg], State.regs[srcreg]);
2114 State.regs[dstreg] += EXTEND8 (IMM8);
2118 // 1111 1011 1000 1010 Rn 0000 IMM8; mov (d8,sp),Rn
2119 8.0xfb+8.0x8a+4.RN2,4.0x0+8.IMM8:D2n:::mov
2127 dstreg = translate_rreg (SD_, RN2);
2128 State.regs[dstreg] = load_word (State.regs[REG_SP] + IMM8);
2131 // 1111 1011 1001 1010 Rm 0000 IMM8; mov Rm,(d8,sp)
2132 8.0xfb+8.0x9a+4.RM2,4.0x0+8.IMM8:D2o:::mov
2140 srcreg = translate_rreg (SD_, RM2);
2141 store_word (State.regs[REG_SP] + IMM8, State.regs[srcreg]);
2144 // 1111 1011 1010 1010 Rn Rm IMM8; movbu (d8,sp),Rn
2145 8.0xfb+8.0xaa+4.RN2,4.0x0+8.IMM8:D2n:::movbu
2153 dstreg = translate_rreg (SD_, RN2);
2154 State.regs[dstreg] = load_byte (State.regs[REG_SP] + IMM8);
2157 // 1111 1011 1011 1010 Rn Rm IMM8; movbu Rm,(d8,sp)
2158 8.0xfb+8.0xba+4.RM2,4.0x0+8.IMM8:D2o:::movbu
2166 srcreg = translate_rreg (SD_, RM2);
2167 store_byte (State.regs[REG_SP] + IMM8, State.regs[srcreg]);
2170 // 1111 1011 1100 1010 Rn Rm IMM8; movhu (d8,sp),Rn
2171 8.0xfb+8.0xca+4.RN2,4.0x0+8.IMM8:D2n:::movhu
2179 dstreg = translate_rreg (SD_, RN2);
2180 State.regs[dstreg] = load_half (State.regs[REG_SP] + IMM8);
2183 // 1111 1011 1101 1010 Rn Rm IMM8; movhu Rm,(d8,sp)
2184 8.0xfb+8.0xda+4.RM2,4.0x0+8.IMM8:D2o:::movhu
2192 srcreg = translate_rreg (SD_, RM2);
2193 store_half (State.regs[REG_SP] + IMM8, State.regs[srcreg]);
2196 // 1111 1011 1110 1010 Rn Rm IMM8; movhu (d8,Rm+),Rn
2197 8.0xfb+8.0xea+4.RN2,4.RM0!RN2+8.IMM8:D2y:::movhu
2205 srcreg = translate_rreg (SD_, RM0);
2206 dstreg = translate_rreg (SD_, RN2);
2207 State.regs[dstreg] = load_half (State.regs[srcreg]);
2208 State.regs[srcreg] += EXTEND8 (IMM8);
2211 // 1111 1011 1111 1010 Rn Rm IMM8; movhu Rm,(d8,Rn+)
2212 8.0xfb+8.0xfa+4.RM2,4.RN0+8.IMM8:D2z:::movhu
2220 srcreg = translate_rreg (SD_, RM2);
2221 dstreg = translate_rreg (SD_, RN0);
2222 store_half (State.regs[dstreg], State.regs[srcreg]);
2223 State.regs[dstreg] += EXTEND8 (IMM8);
2227 // 1111 1011 0000 1011 Rn Rn IMM8; mac imm8,Rn
2228 8.0xfb+8.0x0b+4.RN2,4.RN0=RN2+8.IMM8:D2:::mac
2238 srcreg = translate_rreg (SD_, RN2);
2240 temp = ((int64_t)(int32_t)EXTEND8 (IMM8)
2241 * (int64_t)(int32_t)State.regs[srcreg]);
2242 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2243 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2244 State.regs[REG_MCRL] = sum;
2247 sum = State.regs[REG_MCRH] + temp + c;
2248 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2249 && (temp & 0x80000000) != (sum & 0x80000000));
2250 State.regs[REG_MCRH] = sum;
2252 State.regs[REG_MCVF] = 1;
2255 // 1111 1011 0001 1011 Rn Rn IMM8; macu imm8,Rn
2256 8.0xfb+8.0x1b+4.RN2,4.RN0=RN2+8.IMM8:D2:::macu
2266 srcreg = translate_rreg (SD_, RN2);
2268 temp = ((uint64_t) (IMM8)
2269 * (uint64_t)State.regs[srcreg]);
2270 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2271 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2272 State.regs[REG_MCRL] = sum;
2275 sum = State.regs[REG_MCRH] + temp + c;
2276 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2277 && (temp & 0x80000000) != (sum & 0x80000000));
2278 State.regs[REG_MCRH] = sum;
2280 State.regs[REG_MCVF] = 1;
2283 // 1111 1011 0010 1011 Rn Rn IMM8; macb imm8,Rn
2284 8.0xfb+8.0x2b+4.RN2,4.RN0=RN2+8.IMM8:D2:::macb
2294 srcreg = translate_rreg (SD_, RN2);
2296 temp = ((int64_t)(int8_t)EXTEND8 (IMM8)
2297 * (int64_t)(int8_t)State.regs[srcreg] & 0xff);
2298 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2299 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2300 State.regs[REG_MCRL] = sum;
2303 sum = State.regs[REG_MCRH] + temp + c;
2304 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2305 && (temp & 0x80000000) != (sum & 0x80000000));
2306 State.regs[REG_MCRH] = sum;
2308 State.regs[REG_MCVF] = 1;
2311 // 1111 1011 0011 1011 Rn Rn IMM8; macbu imm8,Rn
2312 8.0xfb+8.0x3b+4.RN2,4.RN0=RN2+8.IMM8:D2:::macbu
2322 srcreg = translate_rreg (SD_, RN2);
2324 temp = ((uint64_t) (IMM8)
2325 * (uint64_t)State.regs[srcreg] & 0xff);
2326 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2327 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2328 State.regs[REG_MCRL] = sum;
2331 sum = State.regs[REG_MCRH] + temp + c;
2332 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2333 && (temp & 0x80000000) != (sum & 0x80000000));
2334 State.regs[REG_MCRH] = sum;
2336 State.regs[REG_MCVF] = 1;
2339 // 1111 1011 0100 1011 Rn Rn IMM8; mach imm8,Rn
2340 8.0xfb+8.0x4b+4.RN2,4.RN0=RN2+8.IMM8:D2:::mach
2350 srcreg = translate_rreg (SD_, RN2);
2352 temp = ((int64_t)(int16_t)EXTEND8 (IMM8)
2353 * (int64_t)(int16_t)State.regs[srcreg] & 0xffff);
2354 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2355 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2356 State.regs[REG_MCRL] = sum;
2359 sum = State.regs[REG_MCRH] + temp + c;
2360 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2361 && (temp & 0x80000000) != (sum & 0x80000000));
2362 State.regs[REG_MCRH] = sum;
2364 State.regs[REG_MCVF] = 1;
2367 // 1111 1011 0101 1011 Rn Rn IMM8; machu imm8,Rn
2368 8.0xfb+8.0x5b+4.RN2,4.RN0=RN2+8.IMM8:D2:::machu
2378 srcreg = translate_rreg (SD_, RN2);
2380 temp = ((uint64_t) (IMM8)
2381 * (uint64_t)State.regs[srcreg] & 0xffff);
2382 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
2383 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
2384 State.regs[REG_MCRL] = sum;
2387 sum = State.regs[REG_MCRH] + temp + c;
2388 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
2389 && (temp & 0x80000000) != (sum & 0x80000000));
2390 State.regs[REG_MCRH] = sum;
2392 State.regs[REG_MCVF] = 1;
2395 // 1111 1011 1011 1011 Rn Rn IMM8; mcste imm8,Rn
2396 8.0xfb+8.0xbb+4.RN2,4.RN0=RN2+8.IMM8:D2:::mcste
2404 dstreg = translate_rreg (SD_, RN0);
2406 PSW &= ~(PSW_V | PSW_C);
2407 PSW |= (State.regs[REG_MCVF] ? PSW_V : 0);
2409 /* 32bit saturation. */
2414 tmp = State.regs[REG_MCRH];
2416 tmp += State.regs[REG_MCRL];
2418 if (tmp > 0x7fffffff)
2419 State.regs[dstreg] = 0x7fffffff;
2420 else if (tmp < 0xffffffff80000000LL)
2421 State.regs[dstreg] = 0x80000000;
2423 State.regs[dstreg] = tmp;
2425 /* 16bit saturation */
2426 else if (IMM8 == 0x10)
2430 tmp = State.regs[REG_MCRH];
2432 tmp += State.regs[REG_MCRL];
2435 State.regs[dstreg] = 0x7fff;
2436 else if (tmp < 0xffffffffffff8000LL)
2437 State.regs[dstreg] = 0x8000;
2439 State.regs[dstreg] = tmp;
2441 /* 8 bit saturation */
2442 else if (IMM8 == 0x8)
2446 tmp = State.regs[REG_MCRH];
2448 tmp += State.regs[REG_MCRL];
2451 State.regs[dstreg] = 0x7f;
2452 else if (tmp < 0xffffffffffffff80LL)
2453 State.regs[dstreg] = 0x80;
2455 State.regs[dstreg] = tmp;
2457 /* 9 bit saturation */
2458 else if (IMM8 == 0x9)
2462 tmp = State.regs[REG_MCRH];
2464 tmp += State.regs[REG_MCRL];
2467 State.regs[dstreg] = 0x80;
2468 else if (tmp < 0xffffffffffffff81LL)
2469 State.regs[dstreg] = 0x81;
2471 State.regs[dstreg] = tmp;
2473 /* 9 bit saturation */
2474 else if (IMM8 == 0x30)
2478 tmp = State.regs[REG_MCRH];
2480 tmp += State.regs[REG_MCRL];
2482 if (tmp > 0x7fffffffffffLL)
2483 tmp = 0x7fffffffffffLL;
2484 else if (tmp < 0xffff800000000000LL)
2485 tmp = 0xffff800000000000LL;
2488 State.regs[dstreg] = tmp;
2492 // 1111 1011 0111 1100 Rm Rn Rd; add Rm,Rn,Rd
2493 8.0xfb+8.0x7c+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::add
2499 uint32_t sum, source1, source2;
2500 int srcreg1, srcreg2, dstreg;
2503 srcreg1 = translate_rreg (SD_, RM2);
2504 srcreg2 = translate_rreg (SD_, RN0);
2505 dstreg = translate_rreg (SD_, RD0);
2507 source1 = State.regs[srcreg1];
2508 source2 = State.regs[srcreg2];
2509 sum = source1 + source2;
2510 State.regs[dstreg] = sum;
2513 n = (sum & 0x80000000);
2514 c = (sum < source1) || (sum < source2);
2515 v = ((source1 & 0x80000000) == (source2 & 0x80000000)
2516 && (source1 & 0x80000000) != (sum & 0x80000000));
2518 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2519 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
2520 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
2523 // 1111 1011 1000 1100 Rm Rn Rd; addc Rm,Rn,Rd
2524 8.0xfb+8.0x8c+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::addc
2530 uint32_t sum, source1, source2;
2531 int srcreg1, srcreg2, dstreg;
2534 srcreg1 = translate_rreg (SD_, RM2);
2535 srcreg2 = translate_rreg (SD_, RN0);
2536 dstreg = translate_rreg (SD_, RD0);
2538 source1 = State.regs[srcreg1];
2539 source2 = State.regs[srcreg2];
2540 sum = source1 + source2 + ((PSW & PSW_C) != 0);
2541 State.regs[dstreg] = sum;
2543 z = ((PSW & PSW_Z) != 0) && (sum == 0);
2544 n = (sum & 0x80000000);
2545 c = (sum < source1) || (sum < source2);
2546 v = ((source1 & 0x80000000) == (source2 & 0x80000000)
2547 && (source1 & 0x80000000) != (sum & 0x80000000));
2549 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2550 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
2551 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
2554 // 1111 1011 1001 1100 Rm Rn Rd; sub Rm,Rn,Rd
2555 8.0xfb+8.0x9c+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::sub
2561 uint32_t difference, source1, source2;
2562 int srcreg1, srcreg2, dstreg;
2565 srcreg1 = translate_rreg (SD_, RM2);
2566 srcreg2 = translate_rreg (SD_, RN0);
2567 dstreg = translate_rreg (SD_, RD0);
2569 source1 = State.regs[srcreg1];
2570 source2 = State.regs[srcreg2];
2571 difference = source2 - source1;
2572 State.regs[dstreg] = difference;
2574 z = (difference == 0);
2575 n = (difference & 0x80000000);
2576 c = (source1 > source2);
2577 v = ((source1 & 0x80000000) == (source2 & 0x80000000)
2578 && (source1 & 0x80000000) != (difference & 0x80000000));
2580 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2581 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
2582 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
2585 // 1111 1011 1010 1100 Rm Rn Rd; subc Rm,Rn,Rd
2586 8.0xfb+8.0xac+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::subc
2592 uint32_t difference, source1, source2;
2593 int srcreg1, srcreg2, dstreg;
2596 srcreg1 = translate_rreg (SD_, RM2);
2597 srcreg2 = translate_rreg (SD_, RN0);
2598 dstreg = translate_rreg (SD_, RD0);
2600 source1 = State.regs[srcreg1];
2601 source2 = State.regs[srcreg2];
2602 difference = source2 - source1 - ((PSW & PSW_C) != 0);
2603 State.regs[dstreg] = difference;
2605 z = ((PSW & PSW_Z) != 0) && (difference == 0);
2606 n = (difference & 0x80000000);
2607 c = (source1 > source2);
2608 v = ((source1 & 0x80000000) == (source2 & 0x80000000)
2609 && (source1 & 0x80000000) != (difference & 0x80000000));
2611 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2612 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
2613 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
2616 // 1111 1011 0000 1101 Rm Rn Rd; and Rm,Rn,Rd
2617 8.0xfb+8.0x0d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::and
2623 int srcreg1, srcreg2, dstreg;
2626 srcreg1 = translate_rreg (SD_, RM2);
2627 srcreg2 = translate_rreg (SD_, RN0);
2628 dstreg = translate_rreg (SD_, RD0);
2630 State.regs[dstreg] = State.regs[srcreg1] & State.regs[srcreg2];
2632 z = (State.regs[dstreg] == 0);
2633 n = (State.regs[dstreg] & 0x80000000);
2635 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2636 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2639 // 1111 1011 0001 1101 Rm Rn Rd; or Rm,Rn,Rd
2640 8.0xfb+8.0x1d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::or
2646 int srcreg1, srcreg2, dstreg;
2649 srcreg1 = translate_rreg (SD_, RM2);
2650 srcreg2 = translate_rreg (SD_, RN0);
2651 dstreg = translate_rreg (SD_, RD0);
2653 State.regs[dstreg] = State.regs[srcreg1] | State.regs[srcreg2];
2655 z = (State.regs[dstreg] == 0);
2656 n = (State.regs[dstreg] & 0x80000000);
2658 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2659 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2662 // 1111 1011 0010 1101 Rm Rn Rd; xor Rm,Rn,Rd
2663 8.0xfb+8.0x2d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::xor
2669 int srcreg1, srcreg2, dstreg;
2672 srcreg1 = translate_rreg (SD_, RM2);
2673 srcreg2 = translate_rreg (SD_, RN0);
2674 dstreg = translate_rreg (SD_, RD0);
2676 State.regs[dstreg] = State.regs[srcreg1] ^ State.regs[srcreg2];
2678 z = (State.regs[dstreg] == 0);
2679 n = (State.regs[dstreg] & 0x80000000);
2681 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2682 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2685 // 1111 1011 0100 1101 Rm Rn Rd; asr Rm,Rn,Rd
2686 8.0xfb+8.0x4d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::asr
2693 int srcreg1, srcreg2, dstreg;
2696 srcreg1 = translate_rreg (SD_, RM2);
2697 srcreg2 = translate_rreg (SD_, RN0);
2698 dstreg = translate_rreg (SD_, RD0);
2700 temp = State.regs[srcreg2];
2702 temp >>= State.regs[srcreg1];
2703 State.regs[dstreg] = temp;
2705 z = (State.regs[dstreg] == 0);
2706 n = (State.regs[dstreg] & 0x80000000);
2708 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2709 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2712 // 1111 1011 0101 1101 Rm Rn Rd; lsr Rm,Rn,Rd
2713 8.0xfb+8.0x5d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::lsr
2719 int srcreg1, srcreg2, dstreg;
2722 srcreg1 = translate_rreg (SD_, RM2);
2723 srcreg2 = translate_rreg (SD_, RN0);
2724 dstreg = translate_rreg (SD_, RD0);
2726 c = State.regs[srcreg2] & 1;
2727 State.regs[dstreg] = State.regs[srcreg2] >> State.regs[srcreg1];
2729 z = (State.regs[dstreg] == 0);
2730 n = (State.regs[dstreg] & 0x80000000);
2732 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2733 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2736 // 1111 1011 0110 1101 Rm Rn Rd; asl Rm,Rn,Rd
2737 8.0xfb+8.0x6d+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::asl
2743 int srcreg1, srcreg2, dstreg;
2746 srcreg1 = translate_rreg (SD_, RM2);
2747 srcreg2 = translate_rreg (SD_, RN0);
2748 dstreg = translate_rreg (SD_, RD0);
2750 State.regs[dstreg] = State.regs[srcreg2] << State.regs[srcreg1];
2752 z = (State.regs[dstreg] == 0);
2753 n = (State.regs[dstreg] & 0x80000000);
2755 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2756 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2759 // 1111 1011 1010 1101 Rm Rn Rd1 Rd2; mul Rm,Rn,Rd1,Rd2
2760 8.0xfb+8.0xad+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::mul
2765 int srcreg1, srcreg2, dstreg1, dstreg2;
2770 srcreg1 = translate_rreg (SD_, RM2);
2771 srcreg2 = translate_rreg (SD_, RN0);
2772 dstreg1 = translate_rreg (SD_, RD0);
2773 dstreg2 = translate_rreg (SD_, RD2);
2775 temp = ((int64_t)(int32_t)State.regs[srcreg1]
2776 * (int64_t)(int32_t)State.regs[srcreg2]);
2777 State.regs[dstreg2] = temp & 0xffffffff;
2778 State.regs[dstreg1] = (temp & 0xffffffff00000000LL) >> 32;
2780 z = (State.regs[dstreg1] == 0) && (State.regs[dstreg2] == 0);
2781 n = (State.regs[dstreg1] & 0x80000000);
2783 PSW &= ~(PSW_Z | PSW_N);
2784 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2787 // 1111 1011 1011 1101 Rm Rn Rd1 Rd2; mulu Rm,Rn,Rd1,Rd2
2788 8.0xfb+8.0xbd+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::mulu
2793 int srcreg1, srcreg2, dstreg1, dstreg2;
2798 srcreg1 = translate_rreg (SD_, RM2);
2799 srcreg2 = translate_rreg (SD_, RN0);
2800 dstreg1 = translate_rreg (SD_, RD0);
2801 dstreg2 = translate_rreg (SD_, RD2);
2803 temp = ((uint64_t)State.regs[srcreg1]
2804 * (uint64_t)State.regs[srcreg2]);
2805 State.regs[dstreg2] = temp & 0xffffffff;
2806 State.regs[dstreg1] = (temp & 0xffffffff00000000LL) >> 32;
2808 z = (State.regs[dstreg1] == 0) && (State.regs[dstreg2] == 0);
2809 n = (State.regs[dstreg1] & 0x80000000);
2811 PSW &= ~(PSW_Z | PSW_N);
2812 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0));
2815 // 1111 1011 0000 1110 Rn 0000 abs8 ; mov (abs8),Rn
2816 8.0xfb+8.0x0e+4.RN2,4.0x0+8.IMM8:D2p:::mov
2824 dstreg = translate_rreg (SD_, RN2);
2825 State.regs[dstreg] = load_word (IMM8);
2828 // 1111 1011 0001 1110 Rm 0000 abs8 ; mov Rn,(abs8)
2829 8.0xfb+8.0x1e+4.RM2,4.0x0+8.IMM8:D2q:::mov
2837 srcreg = translate_rreg (SD_, RM2);
2838 store_word (IMM8, State.regs[srcreg]);
2841 // 1111 1011 0010 1110 Rn 0000 abs8 ; movbu (abs8),Rn
2842 8.0xfb+8.0x2e+4.RN2,4.0x0+8.IMM8:D2p:::movbu
2850 dstreg = translate_rreg (SD_, RN2);
2851 State.regs[dstreg] = load_byte (IMM8);
2854 // 1111 1011 0011 1110 Rm 0000 abs8 ; movbu Rn,(abs8)
2855 8.0xfb+8.0x3e+4.RM2,4.0x0+8.IMM8:D2q:::movbu
2863 srcreg = translate_rreg (SD_, RM2);
2864 store_byte (IMM8, State.regs[srcreg]);
2867 // 1111 1011 0100 1110 Rn 0000 abs8 ; movhu (abs8),Rn
2868 8.0xfb+8.0x4e+4.RN2,4.0x0+8.IMM8:D2p:::movhu
2876 dstreg = translate_rreg (SD_, RN2);
2877 State.regs[dstreg] = load_half (IMM8);
2880 // 1111 1011 0101 1110 Rm 0000 abs8 ; movhu Rn,(abs8)
2881 8.0xfb+8.0x5e+4.RM2,4.0x0+8.IMM8:D2q:::movhu
2889 srcreg = translate_rreg (SD_, RM2);
2890 store_half (IMM8, State.regs[srcreg]);
2893 // 1111 1011 1000 1110 Ri Rm Rn; mov (Ri,Rm),Rn
2894 8.0xfb+8.0x8e+4.RI0,4.RM0+4.RN0,4.0x0:D2r:::mov
2899 int srcreg1, srcreg2, dstreg;
2902 srcreg1 = translate_rreg (SD_, RM0);
2903 srcreg2 = translate_rreg (SD_, RI0);
2904 dstreg = translate_rreg (SD_, RN0);
2905 State.regs[dstreg] = load_word (State.regs[srcreg1] + State.regs[srcreg2]);
2908 // 1111 1011 1001 1110 Ri Rm Rn; mov Rn,(Ri,Rm)
2909 8.0xfb+8.0x9e+4.RI0,4.RN0+4.RM0,4.0x0:D2s:::mov
2914 int srcreg, dstreg1, dstreg2;
2917 srcreg = translate_rreg (SD_, RM0);
2918 dstreg1 = translate_rreg (SD_, RI0);
2919 dstreg2 = translate_rreg (SD_, RN0);
2920 store_word (State.regs[dstreg1] + State.regs[dstreg2], State.regs[srcreg]);
2923 // 1111 1011 1010 1110 Ri Rm Rn; movbu (Ri,Rm),Rn
2924 8.0xfb+8.0xae+4.RI0,4.RM0+4.RN0,4.0x0:D2r:::movbu
2929 int srcreg1, srcreg2, dstreg;
2932 srcreg1 = translate_rreg (SD_, RM0);
2933 srcreg2 = translate_rreg (SD_, RI0);
2934 dstreg = translate_rreg (SD_, RN0);
2935 State.regs[dstreg] = load_byte (State.regs[srcreg1] + State.regs[srcreg2]);
2938 // 1111 1011 1011 1110 Ri Rm Rn; movbu Rn,(Ri,Rm)
2939 8.0xfb+8.0xbe+4.RI0,4.RN0+4.RM0,4.0x0:D2s:::movbu
2944 int srcreg, dstreg1, dstreg2;
2947 srcreg = translate_rreg (SD_, RM0);
2948 dstreg1 = translate_rreg (SD_, RI0);
2949 dstreg2 = translate_rreg (SD_, RN0);
2950 store_byte (State.regs[dstreg1] + State.regs[dstreg2], State.regs[srcreg]);
2953 // 1111 1011 1100 1110 Ri Rm Rn; movhu (Ri,Rm),Rn
2954 8.0xfb+8.0xce+4.RI0,4.RM0+4.RN0,4.0x0:D2r:::movhu
2959 int srcreg1, srcreg2, dstreg;
2962 srcreg1 = translate_rreg (SD_, RM0);
2963 srcreg2 = translate_rreg (SD_, RI0);
2964 dstreg = translate_rreg (SD_, RN0);
2965 State.regs[dstreg] = load_half (State.regs[srcreg1] + State.regs[srcreg2]);
2968 // 1111 1011 1101 1110 Ri Rm Rn; movhu Rn,(Ri,Rm)
2969 8.0xfb+8.0xde+4.RI0,4.RN0+4.RM0,4.0x0:D2s:::movhu
2974 int srcreg, dstreg1, dstreg2;
2977 srcreg = translate_rreg (SD_, RM0);
2978 dstreg1 = translate_rreg (SD_, RI0);
2979 dstreg2 = translate_rreg (SD_, RN0);
2980 store_half (State.regs[dstreg1] + State.regs[dstreg2], State.regs[srcreg]);
2983 // 1111 1011 0000 1111 Rm Rn Rd1 Rd2; mac Rm,Rn,Rd1,Rd2
2984 8.0xfb+8.0x0f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::mac
2989 int srcreg1, srcreg2, dstreg1, dstreg2;
2995 srcreg1 = translate_rreg (SD_, RM2);
2996 srcreg2 = translate_rreg (SD_, RN0);
2997 dstreg1 = translate_rreg (SD_, RD0);
2998 dstreg2 = translate_rreg (SD_, RD2);
3000 temp = ((int64_t)(int32_t)State.regs[srcreg1]
3001 * (int64_t)(int32_t)State.regs[srcreg2]);
3003 sum = State.regs[dstreg2] + (temp & 0xffffffff);
3004 c = (sum < State.regs[dstreg2]) || (sum < (temp & 0xffffffff));
3005 State.regs[dstreg2] = sum;
3008 sum = State.regs[dstreg1] + temp + c;
3009 v = ((State.regs[dstreg1] & 0x80000000) == (temp & 0x80000000)
3010 && (temp & 0x80000000) != (sum & 0x80000000));
3011 State.regs[dstreg1] = sum;
3014 State.regs[REG_MCVF] = 1;
3016 PSW |= (( v ? PSW_V : 0));
3020 // 1111 1011 0001 1111 Rm Rn Rd1 Rd2; macu Rm,Rn,Rd1,Rd2
3021 8.0xfb+8.0x1f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::macu
3026 int srcreg1, srcreg2, dstreg1, dstreg2;
3032 srcreg1 = translate_rreg (SD_, RM2);
3033 srcreg2 = translate_rreg (SD_, RN0);
3034 dstreg1 = translate_rreg (SD_, RD0);
3035 dstreg2 = translate_rreg (SD_, RD2);
3037 temp = ((uint64_t)State.regs[srcreg1]
3038 * (uint64_t)State.regs[srcreg2]);
3040 sum = State.regs[dstreg2] + (temp & 0xffffffff);
3041 c = (sum < State.regs[dstreg2]) || (sum < (temp & 0xffffffff));
3042 State.regs[dstreg2] = sum;
3045 sum = State.regs[dstreg1] + temp + c;
3046 v = ((State.regs[dstreg1] & 0x80000000) == (temp & 0x80000000)
3047 && (temp & 0x80000000) != (sum & 0x80000000));
3048 State.regs[dstreg1] = sum;
3051 State.regs[REG_MCVF] = 1;
3053 PSW |= (( v ? PSW_V : 0));
3057 // 1111 1011 0010 1111 Rm Rn Rd1; macb Rm,Rn,Rd1
3058 8.0xfb+8.0x2f+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::macb
3063 int srcreg1, srcreg2, dstreg;
3068 srcreg1 = translate_rreg (SD_, RM2);
3069 srcreg2 = translate_rreg (SD_, RN0);
3070 dstreg = translate_rreg (SD_, RD0);
3072 temp = ((int32_t)(State.regs[srcreg2] & 0xff)
3073 * (int32_t)(State.regs[srcreg1] & 0xff));
3074 sum = State.regs[dstreg] + temp;
3075 v = ((State.regs[dstreg] & 0x80000000) == (temp & 0x80000000)
3076 && (temp & 0x80000000) != (sum & 0x80000000));
3077 State.regs[dstreg] = sum;
3080 State.regs[REG_MCVF] = 1;
3082 PSW |= ((v ? PSW_V : 0));
3086 // 1111 1011 0011 1111 Rm Rn Rd1; macbu Rm,Rn,Rd1
3087 8.0xfb+8.0x3f+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::macbu
3092 int srcreg1, srcreg2, dstreg;
3097 srcreg1 = translate_rreg (SD_, RM2);
3098 srcreg2 = translate_rreg (SD_, RN0);
3099 dstreg = translate_rreg (SD_, RD0);
3101 temp = ((uint32_t)(State.regs[srcreg2] & 0xff)
3102 * (uint32_t)(State.regs[srcreg1] & 0xff));
3103 sum = State.regs[dstreg] + temp;
3104 v = ((State.regs[dstreg] & 0x80000000) == (temp & 0x80000000)
3105 && (temp & 0x80000000) != (sum & 0x80000000));
3106 State.regs[dstreg] = sum;
3109 State.regs[REG_MCVF] = 1;
3111 PSW |= ((v ? PSW_V : 0));
3115 // 1111 1011 0100 1111 Rm Rn Rd1; mach Rm,Rn,Rd1,Rd2
3116 8.0xfb+8.0x4f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::mach
3121 int srcreg1, srcreg2, dstreg1, dstreg2;
3126 srcreg1 = translate_rreg (SD_, RM2);
3127 srcreg2 = translate_rreg (SD_, RN0);
3128 dstreg1 = translate_rreg (SD_, RD0);
3129 dstreg2 = translate_rreg (SD_, RD0);
3131 temp = ((int32_t)(State.regs[srcreg2] & 0xffff)
3132 * (int32_t)(State.regs[srcreg1] & 0xffff));
3133 State.regs[dstreg2] += (temp & 0xffffffff);
3134 sum = State.regs[dstreg1] + ((temp >> 32) & 0xffffffff);
3135 v = ((State.regs[dstreg1] & 0x80000000) == (temp & 0x80000000)
3136 && (temp & 0x80000000) != (sum & 0x80000000));
3137 State.regs[dstreg1] = sum;
3140 State.regs[REG_MCVF] = 1;
3142 PSW |= ((v ? PSW_V : 0));
3146 // 1111 1011 0101 1111 Rm Rn Rd1; machu Rm,Rn,Rd1,Rd2
3147 8.0xfb+8.0x5f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::machu
3152 int srcreg1, srcreg2, dstreg1, dstreg2;
3157 srcreg1 = translate_rreg (SD_, RM2);
3158 srcreg2 = translate_rreg (SD_, RN0);
3159 dstreg1 = translate_rreg (SD_, RD0);
3160 dstreg2 = translate_rreg (SD_, RD0);
3162 temp = ((uint32_t)(State.regs[srcreg2] & 0xffff)
3163 * (uint32_t)(State.regs[srcreg1] & 0xffff));
3164 State.regs[dstreg2] += (temp & 0xffffffff);
3165 sum = State.regs[dstreg1] + ((temp >> 32) & 0xffffffff);
3166 v = ((State.regs[dstreg1] & 0x80000000) == (temp & 0x80000000)
3167 && (temp & 0x80000000) != (sum & 0x80000000));
3168 State.regs[dstreg1] = sum;
3171 State.regs[REG_MCVF] = 1;
3173 PSW |= ((v ? PSW_V : 0));
3177 // 1111 1011 0110 1111 Rm Rn Rd1; dmach Rm,Rn,Rd1
3178 8.0xfb+8.0x6f+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::dmach
3183 int srcreg1, srcreg2, dstreg;
3184 int32_t temp, temp2, sum;
3188 srcreg1 = translate_rreg (SD_, RM2);
3189 srcreg2 = translate_rreg (SD_, RN0);
3190 dstreg = translate_rreg (SD_, RD0);
3192 temp = ((int32_t)(State.regs[srcreg2] & 0xffff)
3193 * (int32_t)(State.regs[srcreg1] & 0xffff));
3194 temp2 = ((int32_t)((State.regs[srcreg1] >> 16) & 0xffff)
3195 * (int32_t)((State.regs[srcreg2] >> 16) & 0xffff));
3196 sum = temp + temp2 + State.regs[dstreg];
3197 v = ((State.regs[dstreg] & 0x80000000) == (temp & 0x80000000)
3198 && (temp & 0x80000000) != (sum & 0x80000000));
3199 State.regs[dstreg] = sum;
3202 State.regs[REG_MCVF] = 1;
3204 PSW |= ((v ? PSW_V : 0));
3208 // 1111 1011 0111 1111 Rm Rn Rd1; dmachu Rm,Rn,Rd1
3209 8.0xfb+8.0x7f+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::dmachu
3214 int srcreg1, srcreg2, dstreg;
3215 int32_t temp, temp2, sum;
3219 srcreg1 = translate_rreg (SD_, RM2);
3220 srcreg2 = translate_rreg (SD_, RN0);
3221 dstreg = translate_rreg (SD_, RD0);
3223 temp = ((uint32_t)(State.regs[srcreg2] & 0xffff)
3224 * (uint32_t)(State.regs[srcreg1] & 0xffff));
3225 temp2 = ((uint32_t)((State.regs[srcreg1] >> 16) & 0xffff)
3226 * (uint32_t)((State.regs[srcreg2] >> 16) & 0xffff));
3227 sum = temp + temp2 + State.regs[dstreg];
3228 v = ((State.regs[dstreg] & 0x80000000) == (temp & 0x80000000)
3229 && (temp & 0x80000000) != (sum & 0x80000000));
3230 State.regs[dstreg] = sum;
3233 State.regs[REG_MCVF] = 1;
3235 PSW |= ((v ? PSW_V : 0));
3239 // 1111 1011 1000 1111 Rm Rn Rd1 Rd2; dmulh Rm,Rn,Rd1,Rd2
3240 8.0xfb+8.0x8f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::dmulh
3245 int srcreg1, srcreg2, dstreg1, dstreg2;
3249 srcreg1 = translate_rreg (SD_, RM2);
3250 srcreg2 = translate_rreg (SD_, RN0);
3251 dstreg1 = translate_rreg (SD_, RD0);
3252 dstreg2 = translate_rreg (SD_, RD2);
3254 temp = ((int32_t)(State.regs[srcreg1] & 0xffff)
3255 * (int32_t)(State.regs[srcreg2] & 0xffff));
3256 State.regs[dstreg2] = temp;
3257 temp = ((int32_t)((State.regs[srcreg1] >> 16) & 0xffff)
3258 * (int32_t)((State.regs[srcreg2] >> 16) & 0xffff));
3259 State.regs[dstreg1] = temp;
3262 // 1111 1011 1001 1111 Rm Rn Rd1 Rd2; dmulhu Rm,Rn,Rd1,Rd2
3263 8.0xfb+8.0x9f+4.RM2,4.RN0+4.RD0,4.RD2!RD0:D2c:::dmulhu
3268 int srcreg1, srcreg2, dstreg1, dstreg2;
3272 srcreg1 = translate_rreg (SD_, RM2);
3273 srcreg2 = translate_rreg (SD_, RN0);
3274 dstreg1 = translate_rreg (SD_, RD0);
3275 dstreg2 = translate_rreg (SD_, RD2);
3277 temp = ((uint32_t)(State.regs[srcreg1] & 0xffff)
3278 * (uint32_t)(State.regs[srcreg2] & 0xffff));
3279 State.regs[dstreg2] = temp;
3280 temp = ((uint32_t)((State.regs[srcreg1] >> 16) & 0xffff)
3281 * (uint32_t)((State.regs[srcreg2] >> 16) & 0xffff));
3282 State.regs[dstreg1] = temp;
3285 // 1111 1011 1010 1111 Rm Rn; sat24 Rm,Rn
3286 8.0xfb+8.0xaf+4.RM2,4.RN0+8.0x0:D2:::sat24
3295 srcreg = translate_rreg (SD_, RM2);
3296 dstreg = translate_rreg (SD_, RN0);
3298 value = State.regs[srcreg];
3300 if (value >= 0x7fffff)
3301 State.regs[dstreg] = 0x7fffff;
3302 else if (value <= 0xff800000)
3303 State.regs[dstreg] = 0xff800000;
3305 State.regs[dstreg] = value;
3307 n = (State.regs[dstreg] & 0x800000) != 0;
3308 z = (State.regs[dstreg] == 0);
3309 PSW &= ~(PSW_Z | PSW_N);
3310 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3313 // 1111 1011 1111 1111 Rm Rn Rd1; bsch Rm,Rn,Rd1
3314 8.0xfb+8.0xff+4.RM2,4.RN0+4.RD0,4.0x0:D2c:::bsch
3320 int srcreg1, srcreg2, dstreg;
3324 srcreg1 = translate_rreg (SD_, RM2);
3325 srcreg2 = translate_rreg (SD_, RN0);
3326 dstreg = translate_rreg (SD_, RD0);
3328 temp = State.regs[srcreg1];
3329 start = (State.regs[srcreg2] & 0x1f) - 1;
3334 for (i = start; i >= 0; i--)
3336 if (temp & (1 << i))
3339 State.regs[dstreg] = i;
3347 State.regs[dstreg] = 0;
3350 PSW |= (c ? PSW_C : 0);
3353 // 1111 1101 0000 1000 Rn Rn IMM32; mov imm24,Rn
3354 8.0xfd+8.0x08+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4t:::mov
3362 dstreg = translate_rreg (SD_, RN0);
3363 State.regs[dstreg] = EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3366 // 1111 1101 0001 1000 Rn Rn IMM32; movu imm24,Rn
3367 8.0xfd+8.0x18+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4k:::movu
3375 dstreg = translate_rreg (SD_, RN0);
3376 State.regs[dstreg] = FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffffff;
3379 // 1111 1101 0111 1000 Rn Rn IMM32; add imm24,Rn
3380 8.0xfd+8.0x78+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4c:::add
3388 dstreg = translate_rreg (SD_, RN0);
3389 genericAdd (EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)), dstreg);
3392 // 1111 1101 1000 1000 Rn Rn IMM32; addc imm24,Rn
3393 8.0xfd+8.0x88+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::addc
3398 int dstreg, z, n, c, v;
3399 uint32_t sum, imm, reg2;
3402 dstreg = translate_rreg (SD_, RN0);
3404 imm = EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3405 reg2 = State.regs[dstreg];
3406 sum = imm + reg2 + ((PSW & PSW_C) != 0);
3407 State.regs[dstreg] = sum;
3409 z = ((PSW & PSW_Z) != 0) && (sum == 0);
3410 n = (sum & 0x80000000);
3411 c = (sum < imm) || (sum < reg2);
3412 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
3413 && (reg2 & 0x80000000) != (sum & 0x80000000));
3415 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3416 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
3417 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
3420 // 1111 1101 1001 1000 Rn Rn IMM32; sub imm24,Rn
3421 8.0xfd+8.0x98+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::sub
3429 dstreg = translate_rreg (SD_, RN0);
3430 genericSub (EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)), dstreg);
3433 // 1111 1101 1010 1000 Rn Rn IMM32; subc imm24,Rn
3434 8.0xfd+8.0xa8+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::subc
3439 int dstreg, z, n, c, v;
3440 uint32_t difference, imm, reg2;
3443 dstreg = translate_rreg (SD_, RN0);
3445 imm = EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3446 reg2 = State.regs[dstreg];
3447 difference = reg2 - imm - ((PSW & PSW_C) != 0);
3448 State.regs[dstreg] = difference;
3450 z = ((PSW & PSW_Z) != 0) && (difference == 0);
3451 n = (difference & 0x80000000);
3453 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
3454 && (reg2 & 0x80000000) != (difference & 0x80000000));
3456 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3457 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
3458 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
3461 // 1111 1101 1101 1000 Rn Rn IMM32; cmp imm24,Rn
3462 8.0xfd+8.0xd8+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::cmp
3470 srcreg = translate_rreg (SD_, RN0);
3471 genericCmp (EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)), State.regs[srcreg]);
3474 // 1111 1101 1111 1000 XRn XRn IMM32; mov imm24,XRn
3475 8.0xfd+8.0xf8+4.XRM2,4.XRN0=XRM2+8.IMM24A+8.IMM24B+8.IMM24C:D4o:::mov
3483 dstreg = translate_xreg (SD_, XRN0);
3485 State.regs[dstreg] = FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffffff;
3488 // 1111 1101 0000 1001 Rn Rn IMM24; and imm24,Rn
3489 8.0xfd+8.0x09+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::and
3498 dstreg = translate_rreg (SD_, RN0);
3500 State.regs[dstreg] &= (FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffffff);
3501 z = (State.regs[dstreg] == 0);
3502 n = (State.regs[dstreg] & 0x80000000) != 0;
3503 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3504 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3507 // 1111 1101 0001 1001 Rn Rn IMM24; or imm24,Rn
3508 8.0xfd+8.0x19+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::or
3517 dstreg = translate_rreg (SD_, RN0);
3519 State.regs[dstreg] |= (FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffffff);
3520 z = (State.regs[dstreg] == 0);
3521 n = (State.regs[dstreg] & 0x80000000) != 0;
3522 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3523 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3526 // 1111 1101 0010 1001 Rn Rn IMM24; xor imm24,Rn
3527 8.0xfd+8.0x29+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::xor
3536 dstreg = translate_rreg (SD_, RN0);
3538 State.regs[dstreg] ^= (FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffffff);
3539 z = (State.regs[dstreg] == 0);
3540 n = (State.regs[dstreg] & 0x80000000) != 0;
3541 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3542 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3545 // 1111 1101 0100 1001 Rn Rn IMM24; asr imm24,Rn
3546 8.0xfd+8.0x49+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::asr
3556 dstreg = translate_rreg (SD_, RN0);
3558 temp = State.regs[dstreg];
3560 temp >>= (FETCH24 (IMM24A, IMM24B, IMM24C));
3561 State.regs[dstreg] = temp;
3562 z = (State.regs[dstreg] == 0);
3563 n = (State.regs[dstreg] & 0x80000000) != 0;
3564 PSW &= ~(PSW_Z | PSW_N | PSW_C);
3565 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
3569 // 1111 1101 0101 1001 Rn Rn IMM24; lsr imm24,Rn
3570 8.0xfd+8.0x59+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::lsr
3579 dstreg = translate_rreg (SD_, RN0);
3581 c = State.regs[dstreg] & 1;
3582 State.regs[dstreg] >>= (FETCH24 (IMM24A, IMM24B, IMM24C));
3583 z = (State.regs[dstreg] == 0);
3584 n = (State.regs[dstreg] & 0x80000000) != 0;
3585 PSW &= ~(PSW_Z | PSW_N | PSW_C);
3586 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
3589 // 1111 1101 0110 1001 Rn Rn IMM24; asl imm24,Rn
3590 8.0xfd+8.0x69+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::asl
3599 dstreg = translate_rreg (SD_, RN0);
3601 State.regs[dstreg] <<= (FETCH24 (IMM24A, IMM24B, IMM24C));
3602 z = (State.regs[dstreg] == 0);
3603 n = (State.regs[dstreg] & 0x80000000) != 0;
3604 PSW &= ~(PSW_Z | PSW_N);
3605 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3608 // 1111 1101 1010 1001 Rn Rn IMM24; mul imm24,Rn
3609 8.0xfd+8.0xa9+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::mul
3619 dstreg = translate_rreg (SD_, RN0);
3621 temp = ((int64_t)(int32_t)State.regs[dstreg]
3622 * (int64_t)(int32_t)EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)));
3623 State.regs[dstreg] = temp & 0xffffffff;
3624 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
3625 z = (State.regs[dstreg] == 0);
3626 n = (State.regs[dstreg] & 0x80000000) != 0;
3627 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3628 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3631 // 1111 1101 1011 1001 Rn Rn IMM24; mulu imm24,Rn
3632 8.0xfd+8.0xb9+4.RM2,4.RN0=RM2+8.IMM24A+8.IMM24B+8.IMM24C:D4b:::mulu
3642 dstreg = translate_rreg (SD_, RN0);
3644 temp = ((uint64_t)State.regs[dstreg]
3645 * (uint64_t)EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)));
3646 State.regs[dstreg] = temp & 0xffffffff;
3647 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
3648 z = (State.regs[dstreg] == 0);
3649 n = (State.regs[dstreg] & 0x80000000) != 0;
3650 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3651 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3654 // 1111 1101 1110 1001 Rn Rn IMM24; btst imm24,,Rn
3655 8.0xfd+8.0xe9+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4p:::btst
3663 srcreg = translate_rreg (SD_, RN0);
3664 genericBtst (FETCH24 (IMM24A, IMM24B, IMM24C), State.regs[srcreg]);
3667 // 1111 1101 0000 1010 Rn Rm IMM24; mov (d24,Rm),Rn
3668 8.0xfd+8.0x0a+4.RN2,4.RM0+8.IMM24A+8.IMM24B+8.IMM24C:D4p:::mov
3676 srcreg = translate_rreg (SD_, RM0);
3677 dstreg = translate_rreg (SD_, RN2);
3678 State.regs[dstreg] = load_word (State.regs[srcreg]
3679 + EXTEND24 (FETCH24 (IMM24A,
3683 // 1111 1101 0001 1010 Rm Rn IMM24; mov Rm,(d24,Rn)
3684 8.0xfd+8.0x1a+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4q:::mov
3692 srcreg = translate_rreg (SD_, RM2);
3693 dstreg = translate_rreg (SD_, RN0);
3694 store_word (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
3695 State.regs[srcreg]);
3698 // 1111 1101 0010 1010 Rn Rm IMM24; movbu (d24,Rm),Rn
3699 8.0xfd+8.0x2a+4.RN2,4.RM0+8.IMM24A+8.IMM24B+8.IMM24C:D4p:::movbu
3707 srcreg = translate_rreg (SD_, RM0);
3708 dstreg = translate_rreg (SD_, RN2);
3709 State.regs[dstreg] = load_byte (State.regs[srcreg]
3710 + EXTEND24 (FETCH24 (IMM24A,
3714 // 1111 1101 0011 1010 Rm Rn IMM24; movbu Rm,(d24,Rn)
3715 8.0xfd+8.0x3a+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4q:::movbu
3723 srcreg = translate_rreg (SD_, RM2);
3724 dstreg = translate_rreg (SD_, RN0);
3725 store_byte (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
3726 State.regs[srcreg]);
3729 // 1111 1101 0100 1010 Rn Rm IMM24; movhu (d24,Rm),Rn
3730 8.0xfd+8.0x4a+4.RN2,4.RM0+8.IMM24A+8.IMM24B+8.IMM24C:D4p:::movhu
3738 srcreg = translate_rreg (SD_, RM0);
3739 dstreg = translate_rreg (SD_, RN2);
3740 State.regs[dstreg] = load_half (State.regs[srcreg]
3741 + EXTEND24 (FETCH24 (IMM24A,
3745 // 1111 1101 0101 1010 Rm Rn IMM24; movhu Rm,(d24,Rn)
3746 8.0xfd+8.0x5a+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4q:::movhu
3754 srcreg = translate_rreg (SD_, RM2);
3755 dstreg = translate_rreg (SD_, RN0);
3756 store_half (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
3757 State.regs[srcreg]);
3760 // 1111 1101 0110 1010 Rn Rm IMM24; mov (d24,Rm+),Rn
3761 8.0xfd+8.0x6a+4.RN2,4.RM0!RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4y:::mov
3769 srcreg = translate_rreg (SD_, RM0);
3770 dstreg = translate_rreg (SD_, RN2);
3771 State.regs[dstreg] = load_word (State.regs[srcreg]);
3772 State.regs[srcreg] += EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3775 // 1111 1101 0111 1010 Rm Rn IMM24; mov Rm,(d24,Rn+)
3776 8.0xfd+8.0x7a+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::mov
3784 srcreg = translate_rreg (SD_, RM2);
3785 dstreg = translate_rreg (SD_, RN0);
3786 store_word (State.regs[dstreg], State.regs[srcreg]);
3787 State.regs[dstreg] += EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3791 // 1111 1101 1000 1010 Rn 0000 IMM24; mov (d24,sp),Rn
3792 8.0xfd+8.0x8a+4.RN2,4.0x0+IMM24A+8.IMM24B+8.IMM24C:D4r:::mov
3800 dstreg = translate_rreg (SD_, RN2);
3801 State.regs[dstreg] = load_word (State.regs[REG_SP]
3802 + FETCH24 (IMM24A, IMM24B, IMM24C));
3805 // 1111 1101 1001 1010 Rm 0000 IMM24; mov Rm,(d24,sp)
3806 8.0xfd+8.0x9a+4.RM2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4s:::mov
3814 srcreg = translate_rreg (SD_, RM2);
3815 store_word (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
3816 State.regs[srcreg]);
3819 // 1111 1101 1010 1010 Rn 0000 IMM24; movbu (d24,sp),Rn
3820 8.0xfd+8.0xaa+4.RN2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4r:::movbu
3828 dstreg = translate_rreg (SD_, RN2);
3829 State.regs[dstreg] = load_byte (State.regs[REG_SP]
3830 + FETCH24 (IMM24A, IMM24B, IMM24C));
3833 // 1111 1101 1011 1010 Rm 0000 IMM24; movbu Rm,(d24,sp)
3834 8.0xfd+8.0xba+4.RM2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4s:::movbu
3842 srcreg = translate_rreg (SD_, RM2);
3843 store_byte (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
3844 State.regs[srcreg]);
3847 // 1111 1101 1100 1010 Rn 0000 IMM24; movhu (d24,sp),Rn
3848 8.0xfd+8.0xca+4.RN2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4r:::movhu
3856 dstreg = translate_rreg (SD_, RN2);
3857 State.regs[dstreg] = load_half (State.regs[REG_SP]
3858 + FETCH24 (IMM24A, IMM24B, IMM24C));
3861 // 1111 1101 1101 1010 Rm Rn IMM24; movhu Rm,(d24,sp)
3862 8.0xfd+8.0xda+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4s:::movhu
3870 srcreg = translate_rreg (SD_, RM2);
3871 store_half (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
3872 State.regs[srcreg]);
3875 // 1111 1101 1110 1010 Rn Rm IMM24; movhu (d24,Rm+),Rn
3876 8.0xfd+8.0xea+4.RN2,4.RM0!RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4y:::movhu
3884 srcreg = translate_rreg (SD_, RM0);
3885 dstreg = translate_rreg (SD_, RN2);
3886 State.regs[dstreg] = load_half (State.regs[srcreg]);
3887 State.regs[dstreg] += EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3890 // 1111 1101 1111 1010 Rm Rn IMM24; movhu Rm,(d24,Rn+)
3891 8.0xfd+8.0xfa+4.RM2,4.RN0+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::movhu
3899 srcreg = translate_rreg (SD_, RM2);
3900 dstreg = translate_rreg (SD_, RN0);
3901 store_half (State.regs[dstreg], State.regs[srcreg]);
3902 State.regs[srcreg] += EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C));
3905 // 1111 1101 0000 1011 Rn IMM24; mac imm24,Rn
3906 8.0xfd+8.0x0b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::mac
3916 srcreg = translate_rreg (SD_, RN2);
3918 temp = ((int64_t)EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C))
3919 * (int64_t)State.regs[srcreg]);
3920 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
3921 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
3922 State.regs[REG_MCRL] = sum;
3925 sum = State.regs[REG_MCRH] + temp + c;
3926 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
3927 && (temp & 0x80000000) != (sum & 0x80000000));
3928 State.regs[REG_MCRH] = sum;
3930 State.regs[REG_MCVF] = 1;
3933 // 1111 1101 0001 1011 Rn IMM24; macu imm24,Rn
3934 8.0xfd+8.0x1b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::macu
3944 srcreg = translate_rreg (SD_, RN2);
3946 temp = ((uint64_t) (FETCH24 (IMM24A, IMM24B, IMM24C))
3947 * (uint64_t)State.regs[srcreg]);
3948 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
3949 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
3950 State.regs[REG_MCRL] = sum;
3953 sum = State.regs[REG_MCRH] + temp + c;
3954 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
3955 && (temp & 0x80000000) != (sum & 0x80000000));
3956 State.regs[REG_MCRH] = sum;
3958 State.regs[REG_MCVF] = 1;
3961 // 1111 1101 0010 1011 Rn IMM24; macb imm24,Rn
3962 8.0xfd+8.0x2b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::macb
3972 srcreg = translate_rreg (SD_, RN2);
3974 temp = ((int64_t)EXTEND8 (FETCH24 (IMM24A, IMM24B, IMM24C))
3975 * (int64_t)State.regs[srcreg] & 0xff);
3976 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
3977 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
3978 State.regs[REG_MCRL] = sum;
3981 sum = State.regs[REG_MCRH] + temp + c;
3982 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
3983 && (temp & 0x80000000) != (sum & 0x80000000));
3984 State.regs[REG_MCRH] = sum;
3986 State.regs[REG_MCVF] = 1;
3989 // 1111 1101 0011 1011 Rn IMM24; macbu imm24,Rn
3990 8.0xfd+8.0x3b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::macbu
4000 srcreg = translate_rreg (SD_, RN2);
4002 temp = ((uint64_t) (FETCH24 (IMM24A, IMM24B, IMM24C))
4003 * (uint64_t)State.regs[srcreg] & 0xff);
4004 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
4005 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
4006 State.regs[REG_MCRL] = sum;
4009 sum = State.regs[REG_MCRH] + temp + c;
4010 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
4011 && (temp & 0x80000000) != (sum & 0x80000000));
4012 State.regs[REG_MCRH] = sum;
4014 State.regs[REG_MCVF] = 1;
4017 // 1111 1101 0100 1011 Rn IMM24; mach imm24,Rn
4018 8.0xfd+8.0x4b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::mach
4028 srcreg = translate_rreg (SD_, RN2);
4030 temp = ((int64_t)EXTEND16 (FETCH24 (IMM24A, IMM24B, IMM24C))
4031 * (int64_t)State.regs[srcreg] & 0xffff);
4032 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
4033 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
4034 State.regs[REG_MCRL] = sum;
4037 sum = State.regs[REG_MCRH] + temp + c;
4038 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
4039 && (temp & 0x80000000) != (sum & 0x80000000));
4040 State.regs[REG_MCRH] = sum;
4042 State.regs[REG_MCVF] = 1;
4045 // 1111 1101 0101 1011 Rn IMM24; machu imm24,Rn
4046 8.0xfd+8.0x5b+4.RN2,4.RN0=RN2+8.IMM24A+8.IMM24B+8.IMM24C:D4z:::machu
4056 srcreg = translate_rreg (SD_, RN2);
4058 temp = ((uint64_t) (FETCH24 (IMM24A, IMM24B, IMM24C) & 0xffff)
4059 * (uint64_t)State.regs[srcreg] & 0xffff);
4060 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
4061 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
4062 State.regs[REG_MCRL] = sum;
4065 sum = State.regs[REG_MCRH] + temp + c;
4066 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
4067 && (temp & 0x80000000) != (sum & 0x80000000));
4068 State.regs[REG_MCRH] = sum;
4070 State.regs[REG_MCVF] = 1;
4073 // 1111 1101 0000 1110 Rn 0000 ABS24; mov (abs24),Rn
4074 8.0xfd+8.0x0e+4.RN2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4u:::mov
4082 dstreg = translate_rreg (SD_, RN2);
4083 State.regs[dstreg] = load_word (FETCH24 (IMM24A, IMM24B, IMM24C));
4086 // 1111 1101 0001 1110 Rm 0000 ABS24; mov Rm,(abs24)
4087 8.0xfd+8.0x1e+4.RM2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4v:::mov
4095 srcreg = translate_rreg (SD_, RM2);
4096 store_word (FETCH24 (IMM24A, IMM24B, IMM24C), State.regs[srcreg]);
4100 // 1111 1101 0010 1110 Rn 0000 ABS24; movbu (abs24),Rn
4101 8.0xfd+8.0x2e+4.RN2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4t:::movbu
4109 dstreg = translate_rreg (SD_, RN2);
4110 State.regs[dstreg] = load_byte (FETCH24 (IMM24A, IMM24B, IMM24C));
4113 // 1111 1101 0011 1110 Rm 0000 ABS24; movbu Rm,(abs24)
4114 8.0xfd+8.0x3e+4.RM2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4u:::movbu
4122 srcreg = translate_rreg (SD_, RM2);
4123 store_byte (FETCH24 (IMM24A, IMM24B, IMM24C), State.regs[srcreg]);
4127 // 1111 1101 0100 1110 Rn 0000 ABS24; movhu (abs24),Rn
4128 8.0xfd+8.0x4e+4.RN2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4t:::movhu
4136 dstreg = translate_rreg (SD_, RN2);
4137 State.regs[dstreg] = load_half (FETCH24 (IMM24A, IMM24B, IMM24C));
4140 // 1111 1101 0101 1110 Rm 0000 ABS24; movhu Rm,(abs24)
4141 8.0xfd+8.0x5e+4.RM2,4.0x0+8.IMM24A+8.IMM24B+8.IMM24C:D4u:::movhu
4149 srcreg = translate_rreg (SD_, RM2);
4150 store_half (FETCH24 (IMM24A, IMM24B, IMM24C), State.regs[srcreg]);
4154 // 1111 1110 0000 1000 Rn Rn IMM32; mov imm32,Rn
4155 8.0xfe+8.0x08+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::mov
4163 dstreg = translate_rreg (SD_, RN0);
4164 State.regs[dstreg] = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
4167 // 1111 1110 0001 1000 Rn Rn IMM32; movu imm32,Rn
4168 8.0xfe+8.0x18+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::movu
4176 dstreg = translate_rreg (SD_, RN0);
4177 State.regs[dstreg] = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
4180 // 1111 1110 0111 1000 Rn Rn IMM32; add imm32,Rn
4181 8.0xfe+8.0x78+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::add
4189 dstreg = translate_rreg (SD_, RN0);
4190 genericAdd (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), dstreg);
4193 // 1111 1110 1000 1000 Rn Rn IMM32; addc imm32,Rn
4194 8.0xfe+8.0x88+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::addc
4200 uint32_t imm, reg2, sum;
4204 dstreg = translate_rreg (SD_, RN0);
4206 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4207 reg2 = State.regs[dstreg];
4208 sum = imm + reg2 + ((PSW & PSW_C) != 0);
4209 State.regs[dstreg] = sum;
4211 z = ((PSW & PSW_Z) != 0) && (sum == 0);
4212 n = (sum & 0x80000000);
4213 c = (sum < imm) || (sum < reg2);
4214 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
4215 && (reg2 & 0x80000000) != (sum & 0x80000000));
4217 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4218 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
4219 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
4222 // 1111 1110 1001 1000 Rn Rn IMM32; sub imm32,Rn
4223 8.0xfe+8.0x98+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::sub
4231 dstreg = translate_rreg (SD_, RN0);
4232 genericSub (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), dstreg);
4235 // 1111 1110 1010 1000 Rn Rn IMM32; subc imm32,Rn
4236 8.0xfe+8.0xa8+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::subc
4242 uint32_t imm, reg2, difference;
4246 dstreg = translate_rreg (SD_, RN0);
4248 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4249 reg2 = State.regs[dstreg];
4250 difference = reg2 - imm - ((PSW & PSW_C) != 0);
4251 State.regs[dstreg] = difference;
4253 z = ((PSW & PSW_Z) != 0) && (difference == 0);
4254 n = (difference & 0x80000000);
4256 v = ((reg2 & 0x80000000) == (imm & 0x80000000)
4257 && (reg2 & 0x80000000) != (difference & 0x80000000));
4259 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4260 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
4261 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
4264 // 1111 1110 0111 1000 Rn Rn IMM32; cmp imm32,Rn
4265 8.0xfe+8.0xd8+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::cmp
4273 srcreg = translate_rreg (SD_, RN0);
4274 genericCmp (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), State.regs[srcreg]);
4277 // 1111 1110 1111 1000 XRn XRn IMM32; mov imm32,XRn
4278 8.0xfe+8.0xf8+4.XRM2,4.XRN0=XRM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5b:::mov
4286 dstreg = translate_xreg (SD_, XRN0);
4288 State.regs[dstreg] = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
4291 // 1111 1110 0000 1001 Rn Rn IMM32; and imm32,Rn
4292 8.0xfe+8.0x09+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::and
4301 dstreg = translate_rreg (SD_, RN0);
4303 State.regs[dstreg] &= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4304 z = (State.regs[dstreg] == 0);
4305 n = (State.regs[dstreg] & 0x80000000) != 0;
4306 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4307 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4310 // 1111 1110 0001 1001 Rn Rn IMM32; or imm32,Rn
4311 8.0xfe+8.0x19+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::or
4320 dstreg = translate_rreg (SD_, RN0);
4322 State.regs[dstreg] |= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4323 z = (State.regs[dstreg] == 0);
4324 n = (State.regs[dstreg] & 0x80000000) != 0;
4325 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4326 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4329 // 1111 1110 0010 1001 Rn Rn IMM32; xor imm32,Rn
4330 8.0xfe+8.0x29+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::xor
4339 dstreg = translate_rreg (SD_, RN0);
4341 State.regs[dstreg] ^= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4342 z = (State.regs[dstreg] == 0);
4343 n = (State.regs[dstreg] & 0x80000000) != 0;
4344 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4345 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4348 // 1111 1110 0100 1001 Rn Rn IMM32; asr imm32,Rn
4349 8.0xfe+8.0x49+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::asr
4359 dstreg = translate_rreg (SD_, RN0);
4361 temp = State.regs[dstreg];
4363 temp >>= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4364 State.regs[dstreg] = temp;
4365 z = (State.regs[dstreg] == 0);
4366 n = (State.regs[dstreg] & 0x80000000) != 0;
4367 PSW &= ~(PSW_Z | PSW_N | PSW_C);
4368 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
4371 // 1111 1110 0101 1001 Rn Rn IMM32; lsr imm32,Rn
4372 8.0xfe+8.0x59+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::lsr
4381 dstreg = translate_rreg (SD_, RN0);
4383 c = State.regs[dstreg] & 1;
4384 State.regs[dstreg] >>= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4385 z = (State.regs[dstreg] == 0);
4386 n = (State.regs[dstreg] & 0x80000000) != 0;
4387 PSW &= ~(PSW_Z | PSW_N | PSW_C);
4388 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
4391 // 1111 1110 0110 1001 Rn Rn IMM32; asl imm32,Rn
4392 8.0xfe+8.0x69+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::asl
4401 dstreg = translate_rreg (SD_, RN0);
4403 State.regs[dstreg] <<= (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4404 z = (State.regs[dstreg] == 0);
4405 n = (State.regs[dstreg] & 0x80000000) != 0;
4406 PSW &= ~(PSW_Z | PSW_N);
4407 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4410 // 1111 1110 1010 1001 Rn Rn IMM32; mul imm32,Rn
4411 8.0xfe+8.0xa9+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::mul
4421 dstreg = translate_rreg (SD_, RN0);
4423 temp = ((int64_t)(int32_t)State.regs[dstreg]
4424 * (int64_t)(int32_t)(FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D)));
4425 State.regs[dstreg] = temp & 0xffffffff;
4426 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
4427 z = (State.regs[dstreg] == 0);
4428 n = (State.regs[dstreg] & 0x80000000) != 0;
4429 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4430 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4433 // 1111 1110 1011 1001 Rn Rn IMM32; mulu imm32,Rn
4434 8.0xfe+8.0xb9+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::mulu
4444 dstreg = translate_rreg (SD_, RN0);
4446 temp = ((uint64_t)State.regs[dstreg]
4447 * (uint64_t) (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D)));
4448 State.regs[dstreg] = temp & 0xffffffff;
4449 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
4450 z = (State.regs[dstreg] == 0);
4451 n = (State.regs[dstreg] & 0x80000000) != 0;
4452 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
4453 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
4456 // 1111 1110 1110 1001 Rn Rn IMM32; btst imm32,Rn
4457 8.0xfe+8.0xe9+4.RM2,4.RN0=RM2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5a:::btst
4465 srcreg = translate_rreg (SD_, RN0);
4466 genericBtst (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), State.regs[srcreg]);
4469 // 1111 1110 0000 1010 Rn Rm IMM32; mov (d32,Rm),Rn
4470 8.0xfe+8.0x0a+4.RN2,4.RM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5f:::mov
4478 srcreg = translate_rreg (SD_, RM0);
4479 dstreg = translate_rreg (SD_, RN2);
4480 State.regs[dstreg] = load_word (State.regs[srcreg]
4481 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4484 // 1111 1110 0001 1010 Rm Rn IMM32; mov Rm,(d32,Rn)
4485 8.0xfe+8.0x1a+4.RM2,4.RN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5g:::mov
4493 srcreg = translate_rreg (SD_, RM2);
4494 dstreg = translate_rreg (SD_, RN0);
4495 store_word (State.regs[dstreg] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4496 State.regs[srcreg]);
4499 // 1111 1110 0010 1010 Rn Rm IMM32; movbu (d32,Rm),Rn
4500 8.0xfe+8.0x2a+4.RN2,4.RM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::movbu
4508 srcreg = translate_rreg (SD_, RM0);
4509 dstreg = translate_rreg (SD_, RN2);
4510 State.regs[dstreg] = load_byte (State.regs[srcreg]
4511 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4514 // 1111 1110 0011 1010 Rm Rn IMM32; movbu Rm,(d32,Rn)
4515 8.0xfe+8.0x3a+4.RM2,4.RN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5b:::movbu
4523 srcreg = translate_rreg (SD_, RM2);
4524 dstreg = translate_rreg (SD_, RN0);
4525 store_byte (State.regs[dstreg] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4526 State.regs[srcreg]);
4529 // 1111 1110 0100 1010 Rn Rm IMM32; movhu (d32,Rm),Rn
4530 8.0xfe+8.0x4a+4.RN2,4.RM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::movhu
4538 srcreg = translate_rreg (SD_, RM0);
4539 dstreg = translate_rreg (SD_, RN2);
4540 State.regs[dstreg] = load_half (State.regs[srcreg]
4541 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4544 // 1111 1110 0101 1010 Rm Rn IMM32; movhu Rm,(d32,Rn)
4545 8.0xfe+8.0x5a+4.RM2,4.RN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5b:::movhu
4553 srcreg = translate_rreg (SD_, RM2);
4554 dstreg = translate_rreg (SD_, RN0);
4555 store_half (State.regs[dstreg] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4556 State.regs[srcreg]);
4559 // 1111 1110 0110 1010 Rn Rm IMM32; mov (d32,Rm+),Rn
4560 8.0xfe+8.0x6a+4.RN2,4.RM0!RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5y:::mov
4568 srcreg = translate_rreg (SD_, RM0);
4569 dstreg = translate_rreg (SD_, RN2);
4570 State.regs[dstreg] = load_word (State.regs[srcreg]);
4571 State.regs[srcreg] += FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4574 // 1111 1110 0111 1010 Rm Rn IMM32; mov Rm,(d32,Rn+)
4575 8.0xfe+8.0x7a+4.RM2,4.RN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5z:::mov
4583 srcreg = translate_rreg (SD_, RM2);
4584 dstreg = translate_rreg (SD_, RN0);
4585 store_word (State.regs[dstreg], State.regs[srcreg]);
4586 State.regs[dstreg] += FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4590 // 1111 1110 1000 1010 Rn 0000 IMM32; mov (d32,sp),Rn
4591 8.0xfe+8.0x8a+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5c:::mov
4599 dstreg = translate_rreg (SD_, RN2);
4600 State.regs[dstreg] = load_word (State.regs[REG_SP]
4601 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4604 // 1111 1110 1001 1010 Rm 0000 IMM32; mov Rm,(d32,sp)
4605 8.0xfe+8.0x9a+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5d:::mov
4613 srcreg = translate_rreg (SD_, RM2);
4614 store_word (State.regs[REG_SP] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4615 State.regs[srcreg]);
4618 // 1111 1110 1010 1010 Rn 0000 IMM32; movbu (d32,sp),Rn
4619 8.0xfe+8.0xaa+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5c:::movbu
4627 dstreg = translate_rreg (SD_, RN2);
4628 State.regs[dstreg] = load_byte (State.regs[REG_SP]
4629 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4632 // 1111 1110 1011 1010 Rm 0000 IMM32; movbu Rm,(d32,sp)
4633 8.0xfe+8.0xba+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5d:::movbu
4641 srcreg = translate_rreg (SD_, RM2);
4642 store_byte (State.regs[REG_SP] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4643 State.regs[srcreg]);
4646 // 1111 1110 1100 1010 Rn 0000 IMM32; movhu (d32,sp),Rn
4647 8.0xfe+8.0xca+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5c:::movhu
4655 dstreg = translate_rreg (SD_, RN2);
4656 State.regs[dstreg] = load_half (State.regs[REG_SP]
4657 + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4660 // 1111 1110 1101 1010 Rm 0000 IMM32; movhu Rm,(d32,sp)
4661 8.0xfe+8.0xda+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5d:::movhu
4669 srcreg = translate_rreg (SD_, RM2);
4670 store_half (State.regs[REG_SP] + FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D),
4671 State.regs[srcreg]);
4675 // 1111 1110 1110 1010 Rn Rm IMM32; movhu (d32,Rm+),Rn
4676 8.0xfe+8.0xea+4.RN2,4.RM0!RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5y:::movhu
4684 srcreg = translate_rreg (SD_, RM0);
4685 dstreg = translate_rreg (SD_, RN2);
4686 State.regs[dstreg] = load_half (State.regs[srcreg]);
4687 State.regs[srcreg] += FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4690 // 1111 1110 1111 1010 Rm Rn IMM32; movhu Rm,(d32,Rn+)
4691 8.0xfe+8.0xfa+4.RM2,4.RN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5f:::movhu
4699 srcreg = translate_rreg (SD_, RM2);
4700 dstreg = translate_rreg (SD_, RN0);
4701 store_half (State.regs[dstreg], State.regs[srcreg]);
4702 State.regs[dstreg] += FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4706 // 1111 1110 0000 1011 Rn Rn IMM32; mac imm32,Rn
4707 8.0xfe+8.0x0b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::mac
4717 srcreg = translate_rreg (SD_, RN0);
4718 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4720 temp = ((int64_t)(int32_t)State.regs[srcreg]
4721 * (int64_t)(int32_t)imm);
4722 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
4723 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
4724 State.regs[REG_MCRL] = sum;
4727 sum = State.regs[REG_MCRH] + temp + c;
4728 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
4729 && (temp & 0x80000000) != (sum & 0x80000000));
4730 State.regs[REG_MCRH] = sum;
4732 State.regs[REG_MCVF] = 1;
4735 // 1111 1110 0001 1011 Rn Rn IMM32; macu imm32,Rn
4736 8.0xfe+8.0x1b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::macu
4746 srcreg = translate_rreg (SD_, RN0);
4747 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4749 temp = ((uint64_t)State.regs[srcreg]
4751 sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
4752 c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
4753 State.regs[REG_MCRL] = sum;
4756 sum = State.regs[REG_MCRH] + temp + c;
4757 v = ((State.regs[REG_MCRH] & 0x80000000) == (temp & 0x80000000)
4758 && (temp & 0x80000000) != (sum & 0x80000000));
4759 State.regs[REG_MCRH] = sum;
4761 State.regs[REG_MCVF] = 1;
4764 // 1111 1110 0010 1011 Rn Rn IMM32; macb imm32,Rn
4765 8.0xfe+8.0x2b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::macb
4775 srcreg = translate_rreg (SD_, RN0);
4776 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4778 temp = ((int32_t)(int8_t)(State.regs[srcreg] & 0xff)
4779 * (int32_t)(int8_t)(imm & 0xff));
4780 sum = State.regs[REG_MCRL] + temp;
4781 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4782 && (temp & 0x80000000) != (sum & 0x80000000));
4783 State.regs[REG_MCRL] = sum;
4785 State.regs[REG_MCVF] = 1;
4788 // 1111 1110 0011 1011 Rn Rn IMM32; macbu imm32,Rn
4789 8.0xfe+8.0x3b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::macbu
4799 srcreg = translate_rreg (SD_, RN0);
4800 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4802 temp = ((uint32_t)(State.regs[srcreg] & 0xff)
4803 * (uint32_t)(imm & 0xff));
4804 sum = State.regs[REG_MCRL] + temp;
4805 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4806 && (temp & 0x80000000) != (sum & 0x80000000));
4807 State.regs[REG_MCRL] = sum;
4809 State.regs[REG_MCVF] = 1;
4812 // 1111 1110 0100 1011 Rn Rn IMM32; mach imm32,Rn
4813 8.0xfe+8.0x4b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::mach
4823 srcreg = translate_rreg (SD_, RN0);
4824 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4826 temp = ((int32_t)(int16_t)(State.regs[srcreg] & 0xffff)
4827 * (int32_t)(int16_t)(imm & 0xffff));
4828 sum = State.regs[REG_MCRL] + temp;
4829 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4830 && (temp & 0x80000000) != (sum & 0x80000000));
4831 State.regs[REG_MCRL] = sum;
4833 State.regs[REG_MCVF] = 1;
4836 // 1111 1110 0101 1011 Rn Rn IMM32; machu imm32,Rn
4837 8.0xfe+8.0x5b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::machu
4847 srcreg = translate_rreg (SD_, RN0);
4848 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4850 temp = ((uint32_t)(State.regs[srcreg] & 0xffff)
4851 * (uint32_t)(imm & 0xffff));
4852 sum = State.regs[REG_MCRL] + temp;
4853 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4854 && (temp & 0x80000000) != (sum & 0x80000000));
4855 State.regs[REG_MCRL] = sum;
4857 State.regs[REG_MCVF] = 1;
4860 // 1111 1110 0110 1011 Rn Rn IMM32; dmach imm32,Rn
4861 8.0xfe+8.0x6b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::dmach
4867 int32_t temp, temp2, sum;
4871 srcreg = translate_rreg (SD_, RN0);
4872 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4874 temp = ((int32_t)(int16_t)(State.regs[srcreg] & 0xffff)
4875 * (int32_t)(int16_t)(imm & 0xffff));
4876 temp2 = ((int32_t)(int16_t)((State.regs[srcreg] >> 16) & 0xffff)
4877 * (int32_t)(int16_t)((imm >> 16) & 0xffff));
4878 sum = temp + temp2 + State.regs[REG_MCRL];
4879 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4880 && (temp & 0x80000000) != (sum & 0x80000000));
4881 State.regs[REG_MCRL] = sum;
4883 State.regs[REG_MCVF] = 1;
4886 // 1111 1110 0111 1011 Rn Rn IMM32; dmachu imm32,Rn
4887 8.0xfe+8.0x7b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::dmachu
4893 int32_t temp, temp2, sum;
4897 srcreg = translate_rreg (SD_, RN0);
4898 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4900 temp = ((uint32_t)(State.regs[srcreg] & 0xffff)
4901 * (uint32_t)(imm & 0xffff));
4902 temp2 = ((uint32_t)((State.regs[srcreg] >> 16) & 0xffff)
4903 * (uint32_t)((imm >> 16) & 0xffff));
4904 sum = temp + temp2 + State.regs[REG_MCRL];
4905 v = ((State.regs[REG_MCRL] & 0x80000000) == (temp & 0x80000000)
4906 && (temp & 0x80000000) != (sum & 0x80000000));
4907 State.regs[REG_MCRL] = sum;
4909 State.regs[REG_MCVF] = 1;
4912 // 1111 1110 1000 1011 Rn Rn IMM32; dmulh imm32,Rn
4913 8.0xfe+8.0x8b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::dmulh
4922 dstreg = translate_rreg (SD_, RN0);
4923 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4925 temp = ((int32_t)(int16_t)(State.regs[dstreg] & 0xffff)
4926 * (int32_t)(int16_t)(imm & 0xffff));
4927 State.regs[REG_MDRQ] = temp;
4928 temp = ((int32_t)(int16_t)((State.regs[dstreg] >> 16) & 0xffff)
4929 * (int32_t)(int16_t)((imm>>16) & 0xffff));
4930 State.regs[dstreg] = temp;
4933 // 1111 1110 1001 1011 Rn Rn IMM32; dmulhu imm32,Rn
4934 8.0xfe+8.0x9b+4.RN2,4.RN0=RN2+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5:::dmulhu
4943 dstreg = translate_rreg (SD_, RN0);
4944 imm = FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D);
4946 temp = ((uint32_t)(State.regs[dstreg] & 0xffff)
4947 * (uint32_t)(imm & 0xffff));
4948 State.regs[REG_MDRQ] = temp;
4949 temp = ((uint32_t)((State.regs[dstreg] >> 16) & 0xffff)
4950 * (uint32_t)((imm >>16) & 0xffff));
4951 State.regs[dstreg] = temp;
4954 // 1111 1110 0000 1110 Rn 0000 IMM32; mov (abs32),Rn
4955 8.0xfe+8.0x0e+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5h:::mov
4963 dstreg = translate_rreg (SD_, RN2);
4964 State.regs[dstreg] = load_word (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4967 // 1111 1110 0001 1110 Rm 0000 IMM32; mov Rn,(abs32)
4968 8.0xfe+8.0x1e+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5e:::mov
4976 srcreg = translate_rreg (SD_, RM2);
4977 store_word (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), State.regs[srcreg]);
4980 // 1111 1110 0020 1110 Rn 0000 IMM32; movbu (abs32),Rn
4981 8.0xfe+8.0x2e+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5i:::movbu
4989 dstreg = translate_rreg (SD_, RN2);
4990 State.regs[dstreg] = load_byte (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
4993 // 1111 1110 0011 1110 Rm 0000 IMM32; movbu Rn,(abs32)
4994 8.0xfe+8.0x3e+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5e:::movbu
5002 srcreg = translate_rreg (SD_, RM2);
5003 store_byte (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), State.regs[srcreg]);
5006 // 1111 1110 0100 1110 Rn 0000 IMM32; movhu (abs32),Rn
5007 8.0xfe+8.0x4e+4.RN2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5j:::movhu
5015 dstreg = translate_rreg (SD_, RN2);
5016 State.regs[dstreg] = load_half (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D));
5019 // 1111 1110 0101 1110 Rm 0000 IMM32; movhu Rn,(abs32)
5020 8.0xfe+8.0x5e+4.RM2,4.0x0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D5e:::movhu
5028 srcreg = translate_rreg (SD_, RM2);
5029 store_half (FETCH32 (IMM32A, IMM32B, IMM32C, IMM32D), State.regs[srcreg]);
5032 // 1111 0111 0000 0000 Rm1 Rn1 Rm2 Rn2; add_add Rm1, Rn1, Rm2, Rn2
5033 8.0xf7+8.0x00+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_add
5038 int srcreg1, srcreg2, dstreg1, dstreg2;
5042 srcreg1 = translate_rreg (SD_, RM1);
5043 srcreg2 = translate_rreg (SD_, RM2);
5044 dstreg1 = translate_rreg (SD_, RN1);
5045 dstreg2 = translate_rreg (SD_, RN2);
5047 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5048 State.regs[dstreg2] += State.regs[srcreg2];
5049 State.regs[dstreg1] = result1;
5052 // 1111 0111 0001 0000 Rm1 Rn1 imm4 Rn2; add_add Rm1, Rn1, imm4, Rn2
5053 8.0xf7+8.0x10+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_add
5058 int srcreg1, dstreg1, dstreg2;
5062 srcreg1 = translate_rreg (SD_, RM1);
5063 dstreg1 = translate_rreg (SD_, RN1);
5064 dstreg2 = translate_rreg (SD_, RN2);
5066 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5067 State.regs[dstreg2] += EXTEND4 (IMM4);
5068 State.regs[dstreg1] = result1;
5071 // 1111 0111 0010 0000 Rm1 Rn1 Rm2 Rn2; add_sub Rm1, Rn1, Rm2, Rn2
5072 8.0xf7+8.0x20+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_sub
5077 int srcreg1, srcreg2, dstreg1, dstreg2;
5081 srcreg1 = translate_rreg (SD_, RM1);
5082 srcreg2 = translate_rreg (SD_, RM2);
5083 dstreg1 = translate_rreg (SD_, RN1);
5084 dstreg2 = translate_rreg (SD_, RN2);
5086 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5087 State.regs[dstreg2] -= State.regs[srcreg2];
5088 State.regs[dstreg1] = result1;
5091 // 1111 0111 0011 0000 Rm1 Rn1 imm4 Rn2; add_sub Rm1, Rn1, imm4, Rn2
5092 8.0xf7+8.0x30+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_sub
5097 int srcreg1, dstreg1, dstreg2;
5101 srcreg1 = translate_rreg (SD_, RM1);
5102 dstreg1 = translate_rreg (SD_, RN1);
5103 dstreg2 = translate_rreg (SD_, RN2);
5105 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5106 State.regs[dstreg2] -= EXTEND4 (IMM4);
5107 State.regs[dstreg1] = result1;
5110 // 1111 0111 0100 0000 Rm1 Rn1 Rm2 Rn2; add_cmp Rm1, Rn1, Rm2, Rn2
5111 8.0xf7+8.0x40+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_cmp
5116 int srcreg1, srcreg2, dstreg1, dstreg2;
5119 srcreg1 = translate_rreg (SD_, RM1);
5120 srcreg2 = translate_rreg (SD_, RM2);
5121 dstreg1 = translate_rreg (SD_, RN1);
5122 dstreg2 = translate_rreg (SD_, RN2);
5124 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
5125 State.regs[dstreg1] += State.regs[srcreg1];
5128 // 1111 0111 0101 0000 Rm1 Rn1 imm4 Rn2; add_cmp Rm1, Rn1, imm4, Rn2
5129 8.0xf7+8.0x50+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_cmp
5134 int srcreg1, dstreg1, dstreg2;
5137 srcreg1 = translate_rreg (SD_, RM1);
5138 dstreg1 = translate_rreg (SD_, RN1);
5139 dstreg2 = translate_rreg (SD_, RN2);
5141 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
5142 State.regs[dstreg1] += State.regs[srcreg1];
5145 // 1111 0111 0110 0000 Rm1 Rn1 Rm2 Rn2; add_mov Rm1, Rn1, Rm2, Rn2
5146 8.0xf7+8.0x60+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_mov
5151 int srcreg1, srcreg2, dstreg1, dstreg2;
5155 srcreg1 = translate_rreg (SD_, RM1);
5156 srcreg2 = translate_rreg (SD_, RM2);
5157 dstreg1 = translate_rreg (SD_, RN1);
5158 dstreg2 = translate_rreg (SD_, RN2);
5160 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5161 State.regs[dstreg2] = State.regs[srcreg2];
5162 State.regs[dstreg1] = result1;
5165 // 1111 0111 0111 0000 Rm1 Rn1 imm4 Rn2; add_mov Rm1, Rn1, imm4, Rn2
5166 8.0xf7+8.0x70+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_mov
5171 int srcreg1, dstreg1, dstreg2;
5175 srcreg1 = translate_rreg (SD_, RM1);
5176 dstreg1 = translate_rreg (SD_, RN1);
5177 dstreg2 = translate_rreg (SD_, RN2);
5179 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5180 State.regs[dstreg2] = EXTEND4 (IMM4);
5181 State.regs[dstreg1] = result1;
5184 // 1111 0111 1000 0000 Rm1 Rn1 Rm2 Rn2; add_asr Rm1, Rn1, Rm2, Rn2
5185 8.0xf7+8.0x80+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_asr
5190 int srcreg1, srcreg2, dstreg1, dstreg2;
5195 srcreg1 = translate_rreg (SD_, RM1);
5196 srcreg2 = translate_rreg (SD_, RM2);
5197 dstreg1 = translate_rreg (SD_, RN1);
5198 dstreg2 = translate_rreg (SD_, RN2);
5200 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5201 temp = State.regs[dstreg2];
5202 temp >>= State.regs[srcreg2];
5203 State.regs[dstreg2] = temp;
5204 State.regs[dstreg1] = result1;
5207 // 1111 0111 1001 0000 Rm1 Rn1 imm4 Rn2; add_asr Rm1, Rn1, imm4, Rn2
5208 8.0xf7+8.0x90+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_asr
5213 int srcreg1, dstreg1, dstreg2;
5218 srcreg1 = translate_rreg (SD_, RM1);
5219 dstreg1 = translate_rreg (SD_, RN1);
5220 dstreg2 = translate_rreg (SD_, RN2);
5222 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5223 temp = State.regs[dstreg2];
5225 State.regs[dstreg2] = temp;
5226 State.regs[dstreg1] = result1;
5229 // 1111 0111 1010 0000 Rm1 Rn1 Rm2 Rn2; add_lsr Rm1, Rn1, Rm2, Rn2
5230 8.0xf7+8.0xa0+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_lsr
5235 int srcreg1, srcreg2, dstreg1, dstreg2;
5239 srcreg1 = translate_rreg (SD_, RM1);
5240 srcreg2 = translate_rreg (SD_, RM2);
5241 dstreg1 = translate_rreg (SD_, RN1);
5242 dstreg2 = translate_rreg (SD_, RN2);
5244 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5245 State.regs[dstreg2] >>= State.regs[srcreg2];
5246 State.regs[dstreg1] = result1;
5249 // 1111 0111 1011 0000 Rm1 Rn1 imm4 Rn2; add_lsr Rm1, Rn1, imm4, Rn2
5250 8.0xf7+8.0xb0+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_lsr
5255 int srcreg1, dstreg1, dstreg2;
5259 srcreg1 = translate_rreg (SD_, RM1);
5260 dstreg1 = translate_rreg (SD_, RN1);
5261 dstreg2 = translate_rreg (SD_, RN2);
5263 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5264 State.regs[dstreg2] >>= IMM4;
5265 State.regs[dstreg1] = result1;
5269 // 1111 0111 1100 0000 Rm1 Rn1 Rm2 Rn2; add_asl Rm1, Rn1, Rm2, Rn2
5270 8.0xf7+8.0xc0+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::add_asl
5275 int srcreg1, srcreg2, dstreg1, dstreg2;
5279 srcreg1 = translate_rreg (SD_, RM1);
5280 srcreg2 = translate_rreg (SD_, RM2);
5281 dstreg1 = translate_rreg (SD_, RN1);
5282 dstreg2 = translate_rreg (SD_, RN2);
5284 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5285 State.regs[dstreg2] <<= State.regs[srcreg2];
5286 State.regs[dstreg1] = result1;
5289 // 1111 0111 1101 0000 Rm1 Rn1 imm4 Rn2; add_asl Rm1, Rn1, imm4, Rn2
5290 8.0xf7+8.0xd0+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::add_asl
5295 int srcreg1, dstreg1, dstreg2;
5299 srcreg1 = translate_rreg (SD_, RM1);
5300 dstreg1 = translate_rreg (SD_, RN1);
5301 dstreg2 = translate_rreg (SD_, RN2);
5303 result1 = State.regs[dstreg1] + State.regs[srcreg1];
5304 State.regs[dstreg2] <<= IMM4;
5305 State.regs[dstreg1] = result1;
5308 // 1111 0111 0000 0001 Rm1 Rn1 Rm2 Rn2; cmp_add Rm1, Rn1, Rm2, Rn2
5309 8.0xf7+8.0x01+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_add
5314 int srcreg1, srcreg2, dstreg1, dstreg2;
5317 srcreg1 = translate_rreg (SD_, RM1);
5318 srcreg2 = translate_rreg (SD_, RM2);
5319 dstreg1 = translate_rreg (SD_, RN1);
5320 dstreg2 = translate_rreg (SD_, RN2);
5322 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5323 State.regs[dstreg2] += State.regs[srcreg2];
5326 // 1111 0111 0001 0001 Rm1 Rn1 imm4 Rn2; cmp_add Rm1, Rn1, imm4, Rn2
5327 8.0xf7+8.0x11+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_add
5332 int srcreg1, dstreg1, dstreg2;
5335 srcreg1 = translate_rreg (SD_, RM1);
5336 dstreg1 = translate_rreg (SD_, RN1);
5337 dstreg2 = translate_rreg (SD_, RN2);
5339 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5340 State.regs[dstreg2] += EXTEND4 (IMM4);
5343 // 1111 0111 0010 0001 Rm1 Rn1 Rm2 Rn2; cmp_sub Rm1, Rn1, Rm2, Rn2
5344 8.0xf7+8.0x21+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_sub
5349 int srcreg1, srcreg2, dstreg1, dstreg2;
5352 srcreg1 = translate_rreg (SD_, RM1);
5353 srcreg2 = translate_rreg (SD_, RM2);
5354 dstreg1 = translate_rreg (SD_, RN1);
5355 dstreg2 = translate_rreg (SD_, RN2);
5357 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5358 State.regs[dstreg2] -= State.regs[srcreg2];
5361 // 1111 0111 0011 0001 Rm1 Rn1 imm4 Rn2; cmp_sub Rm1, Rn1, imm4, Rn2
5362 8.0xf7+8.0x31+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_sub
5367 int srcreg1, dstreg1, dstreg2;
5370 srcreg1 = translate_rreg (SD_, RM1);
5371 dstreg1 = translate_rreg (SD_, RN1);
5372 dstreg2 = translate_rreg (SD_, RN2);
5374 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5375 State.regs[dstreg2] -= EXTEND4 (IMM4);
5378 // 1111 0111 0110 0001 Rm1 Rn1 Rm2 Rn2; cmp_mov Rm1, Rn1, Rm2, Rn2
5379 8.0xf7+8.0x61+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_mov
5384 int srcreg1, srcreg2, dstreg1, dstreg2;
5387 srcreg1 = translate_rreg (SD_, RM1);
5388 srcreg2 = translate_rreg (SD_, RM2);
5389 dstreg1 = translate_rreg (SD_, RN1);
5390 dstreg2 = translate_rreg (SD_, RN2);
5392 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5393 State.regs[dstreg2] = State.regs[srcreg2];
5396 // 1111 0111 0111 0001 Rm1 Rn1 imm4 Rn2; cmp_mov Rm1, Rn1, imm4, Rn2
5397 8.0xf7+8.0x71+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_mov
5402 int srcreg1, dstreg1, dstreg2;
5405 srcreg1 = translate_rreg (SD_, RM1);
5406 dstreg1 = translate_rreg (SD_, RN1);
5407 dstreg2 = translate_rreg (SD_, RN2);
5409 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5410 State.regs[dstreg2] = EXTEND4 (IMM4);
5413 // 1111 0111 1000 0001 Rm1 Rn1 Rm2 Rn2; cmp_asr Rm1, Rn1, Rm2, Rn2
5414 8.0xf7+8.0x81+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_asr
5419 int srcreg1, srcreg2, dstreg1, dstreg2;
5423 srcreg1 = translate_rreg (SD_, RM1);
5424 srcreg2 = translate_rreg (SD_, RM2);
5425 dstreg1 = translate_rreg (SD_, RN1);
5426 dstreg2 = translate_rreg (SD_, RN2);
5428 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5429 temp = State.regs[dstreg2];
5430 temp >>= State.regs[srcreg2];
5431 State.regs[dstreg2] = temp;
5434 // 1111 0111 1001 0001 Rm1 Rn1 imm4 Rn2; cmp_asr Rm1, Rn1, imm4, Rn2
5435 8.0xf7+8.0x91+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_asr
5440 int srcreg1, dstreg1, dstreg2;
5444 srcreg1 = translate_rreg (SD_, RM1);
5445 dstreg1 = translate_rreg (SD_, RN1);
5446 dstreg2 = translate_rreg (SD_, RN2);
5448 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5449 temp = State.regs[dstreg2];
5451 State.regs[dstreg2] = temp;
5454 // 1111 0111 1010 0001 Rm1 Rn1 Rm2 Rn2; cmp_lsr Rm1, Rn1, Rm2, Rn2
5455 8.0xf7+8.0xa1+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_lsr
5460 int srcreg1, srcreg2, dstreg1, dstreg2;
5463 srcreg1 = translate_rreg (SD_, RM1);
5464 srcreg2 = translate_rreg (SD_, RM2);
5465 dstreg1 = translate_rreg (SD_, RN1);
5466 dstreg2 = translate_rreg (SD_, RN2);
5468 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5469 State.regs[dstreg2] >>= State.regs[srcreg2];
5472 // 1111 0111 1011 0001 Rm1 Rn1 imm4 Rn2; cmp_lsr Rm1, Rn1, imm4, Rn2
5473 8.0xf7+8.0xb1+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_lsr
5478 int srcreg1, dstreg1, dstreg2;
5481 srcreg1 = translate_rreg (SD_, RM1);
5482 dstreg1 = translate_rreg (SD_, RN1);
5483 dstreg2 = translate_rreg (SD_, RN2);
5485 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5486 State.regs[dstreg2] >>= IMM4;
5490 // 1111 0111 1100 0001 Rm1 Rn1 Rm2 Rn2; cmp_asl Rm1, Rn1, Rm2, Rn2
5491 8.0xf7+8.0xc1+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::cmp_asl
5496 int srcreg1, srcreg2, dstreg1, dstreg2;
5499 srcreg1 = translate_rreg (SD_, RM1);
5500 srcreg2 = translate_rreg (SD_, RM2);
5501 dstreg1 = translate_rreg (SD_, RN1);
5502 dstreg2 = translate_rreg (SD_, RN2);
5504 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5505 State.regs[dstreg2] <<= State.regs[srcreg2];
5508 // 1111 0111 1101 0001 Rm1 Rn1 imm4 Rn2; cmp_asl Rm1, Rn1, imm4, Rn2
5509 8.0xf7+8.0xd1+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::cmp_asl
5514 int srcreg1, dstreg1, dstreg2;
5517 srcreg1 = translate_rreg (SD_, RM1);
5518 dstreg1 = translate_rreg (SD_, RN1);
5519 dstreg2 = translate_rreg (SD_, RN2);
5521 genericCmp (State.regs[srcreg1], State.regs[dstreg1]);
5522 State.regs[dstreg2] <<= IMM4;
5525 // 1111 0111 0000 0010 Rm1 Rn1 Rm2 Rn2; sub_add Rm1, Rn1, Rm2, Rn2
5526 8.0xf7+8.0x02+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_add
5531 int srcreg1, srcreg2, dstreg1, dstreg2;
5535 srcreg1 = translate_rreg (SD_, RM1);
5536 srcreg2 = translate_rreg (SD_, RM2);
5537 dstreg1 = translate_rreg (SD_, RN1);
5538 dstreg2 = translate_rreg (SD_, RN2);
5540 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5541 State.regs[dstreg2] += State.regs[srcreg2];
5542 State.regs[dstreg1] = result1;
5545 // 1111 0111 0001 0010 Rm1 Rn1 imm4 Rn2; sub_add Rm1, Rn1, imm4, Rn2
5546 8.0xf7+8.0x12+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_add
5551 int srcreg1, dstreg1, dstreg2;
5555 srcreg1 = translate_rreg (SD_, RM1);
5556 dstreg1 = translate_rreg (SD_, RN1);
5557 dstreg2 = translate_rreg (SD_, RN2);
5559 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5560 State.regs[dstreg2] += EXTEND4 (IMM4);
5561 State.regs[dstreg1] = result1;
5564 // 1111 0111 0010 0010 Rm1 Rn1 Rm2 Rn2; sub_sub Rm1, Rn1, Rm2, Rn2
5565 8.0xf7+8.0x22+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_sub
5570 int srcreg1, srcreg2, dstreg1, dstreg2;
5574 srcreg1 = translate_rreg (SD_, RM1);
5575 srcreg2 = translate_rreg (SD_, RM2);
5576 dstreg1 = translate_rreg (SD_, RN1);
5577 dstreg2 = translate_rreg (SD_, RN2);
5579 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5580 State.regs[dstreg2] -= State.regs[srcreg2];
5581 State.regs[dstreg1] = result1;
5584 // 1111 0111 0011 0010 Rm1 Rn1 imm4 Rn2; sub_sub Rm1, Rn1, imm4, Rn2
5585 8.0xf7+8.0x32+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_sub
5590 int srcreg1, dstreg1, dstreg2;
5594 srcreg1 = translate_rreg (SD_, RM1);
5595 dstreg1 = translate_rreg (SD_, RN1);
5596 dstreg2 = translate_rreg (SD_, RN2);
5598 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5599 State.regs[dstreg2] -= EXTEND4 (IMM4);
5600 State.regs[dstreg1] = result1;
5603 // 1111 0111 0100 0010 Rm1 Rn1 Rm2 Rn2; sub_cmp Rm1, Rn1, Rm2, Rn2
5604 8.0xf7+8.0x42+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_cmp
5609 int srcreg1, srcreg2, dstreg1, dstreg2;
5612 srcreg1 = translate_rreg (SD_, RM1);
5613 srcreg2 = translate_rreg (SD_, RM2);
5614 dstreg1 = translate_rreg (SD_, RN1);
5615 dstreg2 = translate_rreg (SD_, RN2);
5617 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
5618 State.regs[dstreg1] -= State.regs[srcreg1];
5621 // 1111 0111 0101 0010 Rm1 Rn1 imm4 Rn2; sub_cmp Rm1, Rn1, imm4, Rn2
5622 8.0xf7+8.0x52+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_cmp
5627 int srcreg1, dstreg1, dstreg2;
5630 srcreg1 = translate_rreg (SD_, RM1);
5631 dstreg1 = translate_rreg (SD_, RN1);
5632 dstreg2 = translate_rreg (SD_, RN2);
5634 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
5635 State.regs[dstreg1] -= State.regs[srcreg1];
5638 // 1111 0111 0110 0010 Rm1 Rn1 Rm2 Rn2; sub_mov Rm1, Rn1, Rm2, Rn2
5639 8.0xf7+8.0x62+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_mov
5644 int srcreg1, srcreg2, dstreg1, dstreg2;
5648 srcreg1 = translate_rreg (SD_, RM1);
5649 srcreg2 = translate_rreg (SD_, RM2);
5650 dstreg1 = translate_rreg (SD_, RN1);
5651 dstreg2 = translate_rreg (SD_, RN2);
5653 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5654 State.regs[dstreg2] = State.regs[srcreg2];
5655 State.regs[dstreg1] = result1;
5658 // 1111 0111 0111 0010 Rm1 Rn1 imm4 Rn2; sub_mov Rm1, Rn1, imm4, Rn2
5659 8.0xf7+8.0x72+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_mov
5664 int srcreg1, dstreg1, dstreg2;
5668 srcreg1 = translate_rreg (SD_, RM1);
5669 dstreg1 = translate_rreg (SD_, RN1);
5670 dstreg2 = translate_rreg (SD_, RN2);
5672 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5673 State.regs[dstreg2] = EXTEND4 (IMM4);
5674 State.regs[dstreg1] = result1;
5677 // 1111 0111 1000 0010 Rm1 Rn1 Rm2 Rn2; sub_asr Rm1, Rn1, Rm2, Rn2
5678 8.0xf7+8.0x82+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_asr
5683 int srcreg1, srcreg2, dstreg1, dstreg2;
5688 srcreg1 = translate_rreg (SD_, RM1);
5689 srcreg2 = translate_rreg (SD_, RM2);
5690 dstreg1 = translate_rreg (SD_, RN1);
5691 dstreg2 = translate_rreg (SD_, RN2);
5693 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5694 temp = State.regs[dstreg2];
5695 temp >>= State.regs[srcreg2];
5696 State.regs[dstreg2] = temp;
5697 State.regs[dstreg1] = result1;
5700 // 1111 0111 1001 0010 Rm1 Rn1 imm4 Rn2; sub_asr Rm1, Rn1, imm4, Rn2
5701 8.0xf7+8.0x92+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_asr
5706 int srcreg1, dstreg1, dstreg2;
5711 srcreg1 = translate_rreg (SD_, RM1);
5712 dstreg1 = translate_rreg (SD_, RN1);
5713 dstreg2 = translate_rreg (SD_, RN2);
5715 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5716 temp = State.regs[dstreg2];
5718 State.regs[dstreg2] = temp;
5719 State.regs[dstreg1] = result1;
5722 // 1111 0111 1010 0010 Rm1 Rn1 Rm2 Rn2; sub_lsr Rm1, Rn1, Rm2, Rn2
5723 8.0xf7+8.0xa2+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_lsr
5728 int srcreg1, srcreg2, dstreg1, dstreg2;
5732 srcreg1 = translate_rreg (SD_, RM1);
5733 srcreg2 = translate_rreg (SD_, RM2);
5734 dstreg1 = translate_rreg (SD_, RN1);
5735 dstreg2 = translate_rreg (SD_, RN2);
5737 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5738 State.regs[dstreg2] >>= State.regs[srcreg2];
5739 State.regs[dstreg1] = result1;
5742 // 1111 0111 1011 0010 Rm1 Rn1 imm4 Rn2; sub_lsr Rm1, Rn1, imm4, Rn2
5743 8.0xf7+8.0xb2+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_lsr
5748 int srcreg1, dstreg1, dstreg2;
5752 srcreg1 = translate_rreg (SD_, RM1);
5753 dstreg1 = translate_rreg (SD_, RN1);
5754 dstreg2 = translate_rreg (SD_, RN2);
5756 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5757 State.regs[dstreg2] >>= IMM4;
5758 State.regs[dstreg1] = result1;
5762 // 1111 0111 1100 0010 Rm1 Rn1 Rm2 Rn2; sub_asl Rm1, Rn1, Rm2, Rn2
5763 8.0xf7+8.0xc2+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sub_asl
5768 int srcreg1, srcreg2, dstreg1, dstreg2;
5772 srcreg1 = translate_rreg (SD_, RM1);
5773 srcreg2 = translate_rreg (SD_, RM2);
5774 dstreg1 = translate_rreg (SD_, RN1);
5775 dstreg2 = translate_rreg (SD_, RN2);
5777 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5778 State.regs[dstreg2] <<= State.regs[srcreg2];
5779 State.regs[dstreg1] = result1;
5782 // 1111 0111 1101 0010 Rm1 Rn1 imm4 Rn2; sub_asl Rm1, Rn1, imm4, Rn2
5783 8.0xf7+8.0xd2+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sub_asl
5788 int srcreg1, dstreg1, dstreg2;
5792 srcreg1 = translate_rreg (SD_, RM1);
5793 dstreg1 = translate_rreg (SD_, RN1);
5794 dstreg2 = translate_rreg (SD_, RN2);
5796 result1 = State.regs[dstreg1] - State.regs[srcreg1];
5797 State.regs[dstreg2] <<= IMM4;
5798 State.regs[dstreg1] = result1;
5801 // 1111 0111 0000 0011 Rm1 Rn1 Rm2 Rn2; mov_add Rm1, Rn1, Rm2, Rn2
5802 8.0xf7+8.0x03+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_add
5807 int srcreg1, srcreg2, dstreg1, dstreg2;
5811 srcreg1 = translate_rreg (SD_, RM1);
5812 srcreg2 = translate_rreg (SD_, RM2);
5813 dstreg1 = translate_rreg (SD_, RN1);
5814 dstreg2 = translate_rreg (SD_, RN2);
5816 result1 = State.regs[srcreg1];
5817 State.regs[dstreg2] += State.regs[srcreg2];
5818 State.regs[dstreg1] = result1;
5821 // 1111 0111 0001 0011 Rm1 Rn1 imm4 Rn2; mov_add Rm1, Rn1, imm4, Rn2
5822 8.0xf7+8.0x13+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_add
5827 int srcreg1, dstreg1, dstreg2;
5831 srcreg1 = translate_rreg (SD_, RM1);
5832 dstreg1 = translate_rreg (SD_, RN1);
5833 dstreg2 = translate_rreg (SD_, RN2);
5835 result1 = State.regs[srcreg1];
5836 State.regs[dstreg2] += EXTEND4 (IMM4);
5837 State.regs[dstreg1] = result1;
5840 // 1111 0111 0010 0011 Rm1 Rn1 Rm2 Rn2; mov_sub Rm1, Rn1, Rm2, Rn2
5841 8.0xf7+8.0x23+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_sub
5846 int srcreg1, srcreg2, dstreg1, dstreg2;
5850 srcreg1 = translate_rreg (SD_, RM1);
5851 srcreg2 = translate_rreg (SD_, RM2);
5852 dstreg1 = translate_rreg (SD_, RN1);
5853 dstreg2 = translate_rreg (SD_, RN2);
5855 result1 = State.regs[srcreg1];
5856 State.regs[dstreg2] -= State.regs[srcreg2];
5857 State.regs[dstreg1] = result1;
5860 // 1111 0111 0011 0011 Rm1 Rn1 imm4 Rn2; mov_sub Rm1, Rn1, imm4, Rn2
5861 8.0xf7+8.0x33+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_sub
5866 int srcreg1, dstreg1, dstreg2;
5870 srcreg1 = translate_rreg (SD_, RM1);
5871 dstreg1 = translate_rreg (SD_, RN1);
5872 dstreg2 = translate_rreg (SD_, RN2);
5874 result1 = State.regs[srcreg1];
5875 State.regs[dstreg2] -= EXTEND4 (IMM4);
5876 State.regs[dstreg1] = result1;
5879 // 1111 0111 0100 0011 Rm1 Rn1 Rm2 Rn2; mov_cmp Rm1, Rn1, Rm2, Rn2
5880 8.0xf7+8.0x43+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_cmp
5885 int srcreg1, srcreg2, dstreg1, dstreg2;
5888 srcreg1 = translate_rreg (SD_, RM1);
5889 srcreg2 = translate_rreg (SD_, RM2);
5890 dstreg1 = translate_rreg (SD_, RN1);
5891 dstreg2 = translate_rreg (SD_, RN2);
5893 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
5894 State.regs[dstreg1] = State.regs[srcreg1];
5897 // 1111 0111 0101 0011 Rm1 Rn1 imm4 Rn2; mov_cmp Rm1, Rn1, imm4, Rn2
5898 8.0xf7+8.0x53+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_cmp
5903 int srcreg1, dstreg1, dstreg2;
5906 srcreg1 = translate_rreg (SD_, RM1);
5907 dstreg1 = translate_rreg (SD_, RN1);
5908 dstreg2 = translate_rreg (SD_, RN2);
5910 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
5911 State.regs[dstreg1] = State.regs[srcreg1];
5914 // 1111 0111 0110 0011 Rm1 Rn1 Rm2 Rn2; mov_mov Rm1, Rn1, Rm2, Rn2
5915 8.0xf7+8.0x63+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_mov
5920 int srcreg1, srcreg2, dstreg1, dstreg2;
5924 srcreg1 = translate_rreg (SD_, RM1);
5925 srcreg2 = translate_rreg (SD_, RM2);
5926 dstreg1 = translate_rreg (SD_, RN1);
5927 dstreg2 = translate_rreg (SD_, RN2);
5929 result1 = State.regs[srcreg1];
5930 State.regs[dstreg2] = State.regs[srcreg2];
5931 State.regs[dstreg1] = result1;
5934 // 1111 0111 0111 0011 Rm1 Rn1 imm4 Rn2; mov_mov Rm1, Rn1, imm4, Rn2
5935 8.0xf7+8.0x73+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_mov
5940 int srcreg1, dstreg1, dstreg2;
5944 srcreg1 = translate_rreg (SD_, RM1);
5945 dstreg1 = translate_rreg (SD_, RN1);
5946 dstreg2 = translate_rreg (SD_, RN2);
5948 result1 = State.regs[srcreg1];
5949 State.regs[dstreg2] = EXTEND4 (IMM4);
5950 State.regs[dstreg1] = result1;
5953 // 1111 0111 1000 0011 Rm1 Rn1 Rm2 Rn2; mov_asr Rm1, Rn1, Rm2, Rn2
5954 8.0xf7+8.0x83+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_asr
5959 int srcreg1, srcreg2, dstreg1, dstreg2;
5964 srcreg1 = translate_rreg (SD_, RM1);
5965 srcreg2 = translate_rreg (SD_, RM2);
5966 dstreg1 = translate_rreg (SD_, RN1);
5967 dstreg2 = translate_rreg (SD_, RN2);
5969 result1 = State.regs[srcreg1];
5970 temp = State.regs[dstreg2];
5971 temp >>= State.regs[srcreg2];
5972 State.regs[dstreg2] = temp;
5973 State.regs[dstreg1] = result1;
5976 // 1111 0111 1001 0011 Rm1 Rn1 imm4 Rn2; mov_asr Rm1, Rn1, imm4, Rn2
5977 8.0xf7+8.0x93+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_asr
5982 int srcreg1, dstreg1, dstreg2;
5987 srcreg1 = translate_rreg (SD_, RM1);
5988 dstreg1 = translate_rreg (SD_, RN1);
5989 dstreg2 = translate_rreg (SD_, RN2);
5991 result1 = State.regs[srcreg1];
5992 temp = State.regs[dstreg2];
5994 State.regs[dstreg2] = temp;
5995 State.regs[dstreg1] = result1;
5998 // 1111 0111 1010 0011 Rm1 Rn1 Rm2 Rn2; mov_lsr Rm1, Rn1, Rm2, Rn2
5999 8.0xf7+8.0xa3+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_lsr
6004 int srcreg1, srcreg2, dstreg1, dstreg2;
6008 srcreg1 = translate_rreg (SD_, RM1);
6009 srcreg2 = translate_rreg (SD_, RM2);
6010 dstreg1 = translate_rreg (SD_, RN1);
6011 dstreg2 = translate_rreg (SD_, RN2);
6013 result1 = State.regs[srcreg1];
6014 State.regs[dstreg2] >>= State.regs[srcreg2];
6015 State.regs[dstreg1] = result1;
6018 // 1111 0111 1011 0011 Rm1 Rn1 imm4 Rn2; mov_lsr Rm1, Rn1, imm4, Rn2
6019 8.0xf7+8.0xb3+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_lsr
6024 int srcreg1, dstreg1, dstreg2;
6028 srcreg1 = translate_rreg (SD_, RM1);
6029 dstreg1 = translate_rreg (SD_, RN1);
6030 dstreg2 = translate_rreg (SD_, RN2);
6032 result1 = State.regs[srcreg1];
6033 State.regs[dstreg2] >>= IMM4;
6034 State.regs[dstreg1] = result1;
6038 // 1111 0111 1100 0011 Rm1 Rn1 Rm2 Rn2; mov_asl Rm1, Rn1, Rm2, Rn2
6039 8.0xf7+8.0xc3+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::mov_asl
6044 int srcreg1, srcreg2, dstreg1, dstreg2;
6048 srcreg1 = translate_rreg (SD_, RM1);
6049 srcreg2 = translate_rreg (SD_, RM2);
6050 dstreg1 = translate_rreg (SD_, RN1);
6051 dstreg2 = translate_rreg (SD_, RN2);
6053 result1 = State.regs[srcreg1];
6054 State.regs[dstreg2] <<= State.regs[srcreg2];
6055 State.regs[dstreg1] = result1;
6058 // 1111 0111 1101 0011 Rm1 Rn1 imm4 Rn2; mov_asl Rm1, Rn1, imm4, Rn2
6059 8.0xf7+8.0xd3+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::mov_asl
6064 int srcreg1, dstreg1, dstreg2;
6068 srcreg1 = translate_rreg (SD_, RM1);
6069 dstreg1 = translate_rreg (SD_, RN1);
6070 dstreg2 = translate_rreg (SD_, RN2);
6072 result1 = State.regs[srcreg1];
6073 State.regs[dstreg2] <<= IMM4;
6074 State.regs[dstreg1] = result1;
6077 // 1111 0111 0000 0100 imm4 Rn1 Rm2 Rn2; add_add imm4, Rn1, Rm2, Rn2
6078 8.0xf7+8.0x04+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_add
6083 int srcreg2, dstreg1, dstreg2;
6087 srcreg2 = translate_rreg (SD_, RM2);
6088 dstreg1 = translate_rreg (SD_, RN1);
6089 dstreg2 = translate_rreg (SD_, RN2);
6091 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6092 State.regs[dstreg2] += State.regs[srcreg2];
6093 State.regs[dstreg1] = result1;
6096 // 1111 0111 0001 0100 imm4 Rn1 imm4 Rn2; add_add imm4, Rn1, imm4, Rn2
6097 8.0xf7+8.0x14+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_add
6102 int dstreg1, dstreg2;
6106 dstreg1 = translate_rreg (SD_, RN1);
6107 dstreg2 = translate_rreg (SD_, RN2);
6109 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6110 State.regs[dstreg2] += EXTEND4 (IMM4);
6111 State.regs[dstreg1] = result1;
6114 // 1111 0111 0010 0100 imm4 Rn1 Rm2 Rn2; add_sub imm4, Rn1, Rm2, Rn2
6115 8.0xf7+8.0x24+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_sub
6120 int srcreg2, dstreg1, dstreg2;
6124 srcreg2 = translate_rreg (SD_, RM2);
6125 dstreg1 = translate_rreg (SD_, RN1);
6126 dstreg2 = translate_rreg (SD_, RN2);
6128 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6129 State.regs[dstreg2] -= State.regs[srcreg2];
6130 State.regs[dstreg1] = result1;
6133 // 1111 0111 0011 0100 imm4 Rn1 imm4 Rn2; add_sub imm4, Rn1, imm4, Rn2
6134 8.0xf7+8.0x34+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_sub
6139 int dstreg1, dstreg2;
6143 dstreg1 = translate_rreg (SD_, RN1);
6144 dstreg2 = translate_rreg (SD_, RN2);
6146 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6147 State.regs[dstreg2] -= EXTEND4 (IMM4);
6148 State.regs[dstreg1] = result1;
6151 // 1111 0111 0100 0100 imm4 Rn1 Rm2 Rn2; add_cmp imm4, Rn1, Rm2, Rn2
6152 8.0xf7+8.0x44+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_cmp
6157 int srcreg2, dstreg1, dstreg2;
6160 srcreg2 = translate_rreg (SD_, RM2);
6161 dstreg1 = translate_rreg (SD_, RN1);
6162 dstreg2 = translate_rreg (SD_, RN2);
6164 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
6165 State.regs[dstreg1] += EXTEND4 (IMM4A);
6168 // 1111 0111 0101 0100 imm4 Rn1 imm4 Rn2; add_cmp imm4, Rn1, imm4, Rn2
6169 8.0xf7+8.0x54+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_cmp
6174 int dstreg1, dstreg2;
6177 dstreg1 = translate_rreg (SD_, RN1);
6178 dstreg2 = translate_rreg (SD_, RN2);
6180 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
6181 State.regs[dstreg1] += EXTEND4 (IMM4A);
6184 // 1111 0111 0110 0100 imm4 Rn1 Rm2 Rn2; add_mov imm4, Rn1, Rm2, Rn2
6185 8.0xf7+8.0x64+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_mov
6190 int srcreg2, dstreg1, dstreg2;
6194 srcreg2 = translate_rreg (SD_, RM2);
6195 dstreg1 = translate_rreg (SD_, RN1);
6196 dstreg2 = translate_rreg (SD_, RN2);
6198 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6199 State.regs[dstreg2] = State.regs[srcreg2];
6200 State.regs[dstreg1] = result1;
6203 // 1111 0111 0111 0100 imm4 Rn1 imm4 Rn2; add_mov imm4, Rn1, imm4, Rn2
6204 8.0xf7+8.0x74+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_mov
6209 int dstreg1, dstreg2;
6213 dstreg1 = translate_rreg (SD_, RN1);
6214 dstreg2 = translate_rreg (SD_, RN2);
6216 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6217 State.regs[dstreg2] = EXTEND4 (IMM4);
6218 State.regs[dstreg1] = result1;
6221 // 1111 0111 1000 0100 imm4 Rn1 Rm2 Rn2; add_asr imm4, Rn1, Rm2, Rn2
6222 8.0xf7+8.0x84+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_asr
6227 int srcreg2, dstreg1, dstreg2;
6232 srcreg2 = translate_rreg (SD_, RM2);
6233 dstreg1 = translate_rreg (SD_, RN1);
6234 dstreg2 = translate_rreg (SD_, RN2);
6236 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6237 temp = State.regs[dstreg2];
6238 temp >>= State.regs[srcreg2];
6239 State.regs[dstreg2] = temp;
6240 State.regs[dstreg1] = result1;
6243 // 1111 0111 1001 0100 imm4 Rn1 imm4 Rn2; add_asr imm4, Rn1, imm4, Rn2
6244 8.0xf7+8.0x94+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_asr
6249 int dstreg1, dstreg2;
6254 dstreg1 = translate_rreg (SD_, RN1);
6255 dstreg2 = translate_rreg (SD_, RN2);
6257 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6258 temp = State.regs[dstreg2];
6260 State.regs[dstreg2] = temp;
6261 State.regs[dstreg1] = result1;
6264 // 1111 0111 1010 0100 imm4 Rn1 Rm2 Rn2; add_lsr imm4, Rn1, Rm2, Rn2
6265 8.0xf7+8.0xa4+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_lsr
6270 int srcreg2, dstreg1, dstreg2;
6274 srcreg2 = translate_rreg (SD_, RM2);
6275 dstreg1 = translate_rreg (SD_, RN1);
6276 dstreg2 = translate_rreg (SD_, RN2);
6278 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6279 State.regs[dstreg2] >>= State.regs[srcreg2];
6280 State.regs[dstreg1] = result1;
6283 // 1111 0111 1011 0100 imm4 Rn1 imm4 Rn2; add_lsr imm4, Rn1, imm4, Rn2
6284 8.0xf7+8.0xb4+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_lsr
6289 int dstreg1, dstreg2;
6293 dstreg1 = translate_rreg (SD_, RN1);
6294 dstreg2 = translate_rreg (SD_, RN2);
6296 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6297 State.regs[dstreg2] >>= IMM4;
6298 State.regs[dstreg1] = result1;
6302 // 1111 0111 1100 0100 imm4 Rn1 Rm2 Rn2; add_asl imm4, Rn1, Rm2, Rn2
6303 8.0xf7+8.0xc4+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::add_asl
6308 int srcreg2, dstreg1, dstreg2;
6312 srcreg2 = translate_rreg (SD_, RM2);
6313 dstreg1 = translate_rreg (SD_, RN1);
6314 dstreg2 = translate_rreg (SD_, RN2);
6316 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6317 State.regs[dstreg2] <<= State.regs[srcreg2];
6318 State.regs[dstreg1] = result1;
6321 // 1111 0111 1101 0100 imm4 Rn1 imm4 Rn2; add_asl imm4, Rn1, imm4, Rn2
6322 8.0xf7+8.0xd4+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::add_asl
6327 int dstreg1, dstreg2;
6331 dstreg1 = translate_rreg (SD_, RN1);
6332 dstreg2 = translate_rreg (SD_, RN2);
6334 result1 = State.regs[dstreg1] + EXTEND4 (IMM4A);
6335 State.regs[dstreg2] <<= IMM4;
6336 State.regs[dstreg1] = result1;
6339 // 1111 0111 0000 0101 imm4 Rn1 Rm2 Rn2; cmp_add imm4, Rn1, Rm2, Rn2
6340 8.0xf7+8.0x05+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_add
6345 int srcreg2, dstreg1, dstreg2;
6348 srcreg2 = translate_rreg (SD_, RM2);
6349 dstreg1 = translate_rreg (SD_, RN1);
6350 dstreg2 = translate_rreg (SD_, RN2);
6352 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6353 State.regs[dstreg2] += State.regs[srcreg2];
6356 // 1111 0111 0001 0101 imm4 Rn1 imm4 Rn2; cmp_add imm4, Rn1, imm4, Rn2
6357 8.0xf7+8.0x15+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_add
6362 int dstreg1, dstreg2;
6365 dstreg1 = translate_rreg (SD_, RN1);
6366 dstreg2 = translate_rreg (SD_, RN2);
6368 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6369 State.regs[dstreg2] += EXTEND4 (IMM4);
6372 // 1111 0111 0010 0101 imm4 Rn1 Rm2 Rn2; cmp_sub imm4, Rn1, Rm2, Rn2
6373 8.0xf7+8.0x25+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_sub
6378 int srcreg2, dstreg1, dstreg2;
6381 srcreg2 = translate_rreg (SD_, RM2);
6382 dstreg1 = translate_rreg (SD_, RN1);
6383 dstreg2 = translate_rreg (SD_, RN2);
6385 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6386 State.regs[dstreg2] -= State.regs[srcreg2];
6389 // 1111 0111 0011 0101 imm4 Rn1 imm4 Rn2; cmp_sub imm4, Rn1, imm4, Rn2
6390 8.0xf7+8.0x35+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_sub
6395 int dstreg1, dstreg2;
6398 dstreg1 = translate_rreg (SD_, RN1);
6399 dstreg2 = translate_rreg (SD_, RN2);
6401 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6402 State.regs[dstreg2] -= EXTEND4 (IMM4);
6405 // 1111 0111 0110 0101 imm4 Rn1 Rm2 Rn2; cmp_mov imm4, Rn1, Rm2, Rn2
6406 8.0xf7+8.0x65+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_mov
6411 int srcreg2, dstreg1, dstreg2;
6414 srcreg2 = translate_rreg (SD_, RM2);
6415 dstreg1 = translate_rreg (SD_, RN1);
6416 dstreg2 = translate_rreg (SD_, RN2);
6418 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6419 State.regs[dstreg2] = State.regs[srcreg2];
6422 // 1111 0111 0111 0101 imm4 Rn1 imm4 Rn2; cmp_mov imm4, Rn1, imm4, Rn2
6423 8.0xf7+8.0x75+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_mov
6428 int dstreg1, dstreg2;
6431 dstreg1 = translate_rreg (SD_, RN1);
6432 dstreg2 = translate_rreg (SD_, RN2);
6434 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6435 State.regs[dstreg2] = EXTEND4 (IMM4);
6438 // 1111 0111 1000 0101 imm4 Rn1 Rm2 Rn2; cmp_asr imm4, Rn1, Rm2, Rn2
6439 8.0xf7+8.0x85+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_asr
6444 int srcreg2, dstreg1, dstreg2;
6448 srcreg2 = translate_rreg (SD_, RM2);
6449 dstreg1 = translate_rreg (SD_, RN1);
6450 dstreg2 = translate_rreg (SD_, RN2);
6452 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6453 temp = State.regs[dstreg2];
6454 temp >>= State.regs[srcreg2];
6455 State.regs[dstreg2] = temp;
6458 // 1111 0111 1001 0101 imm4 Rn1 imm4 Rn2; cmp_asr imm4, Rn1, imm4, Rn2
6459 8.0xf7+8.0x95+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_asr
6464 int dstreg1, dstreg2;
6468 dstreg1 = translate_rreg (SD_, RN1);
6469 dstreg2 = translate_rreg (SD_, RN2);
6471 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6472 temp = State.regs[dstreg2];
6474 State.regs[dstreg2] = temp;
6477 // 1111 0111 1010 0101 imm4 Rn1 Rm2 Rn2; cmp_lsr imm4, Rn1, Rm2, Rn2
6478 8.0xf7+8.0xa5+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_lsr
6483 int srcreg2, dstreg1, dstreg2;
6486 srcreg2 = translate_rreg (SD_, RM2);
6487 dstreg1 = translate_rreg (SD_, RN1);
6488 dstreg2 = translate_rreg (SD_, RN2);
6490 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6491 State.regs[dstreg2] >>= State.regs[srcreg2];
6494 // 1111 0111 1011 0101 imm4 Rn1 imm4 Rn2; cmp_lsr imm4, Rn1, imm4, Rn2
6495 8.0xf7+8.0xb5+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_lsr
6500 int dstreg1, dstreg2;
6503 dstreg1 = translate_rreg (SD_, RN1);
6504 dstreg2 = translate_rreg (SD_, RN2);
6506 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6507 State.regs[dstreg2] >>= IMM4;
6511 // 1111 0111 1100 0101 imm4 Rn1 Rm2 Rn2; cmp_asl imm4, Rn1, Rm2, Rn2
6512 8.0xf7+8.0xc5+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::cmp_asl
6517 int srcreg2, dstreg1, dstreg2;
6520 srcreg2 = translate_rreg (SD_, RM2);
6521 dstreg1 = translate_rreg (SD_, RN1);
6522 dstreg2 = translate_rreg (SD_, RN2);
6524 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6525 State.regs[dstreg2] <<= State.regs[srcreg2];
6528 // 1111 0111 1101 0101 imm4 Rn1 imm4 Rn2; cmp_asl imm4, Rn1, imm4, Rn2
6529 8.0xf7+8.0xd5+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::cmp_asl
6534 int dstreg1, dstreg2;
6537 dstreg1 = translate_rreg (SD_, RN1);
6538 dstreg2 = translate_rreg (SD_, RN2);
6540 genericCmp (EXTEND4 (IMM4A), State.regs[dstreg1]);
6541 State.regs[dstreg2] <<= IMM4;
6544 // 1111 0111 0000 0110 imm4 Rn1 Rm2 Rn2; sub_add imm4, Rn1, Rm2, Rn2
6545 8.0xf7+8.0x06+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_add
6550 int srcreg2, dstreg1, dstreg2;
6554 srcreg2 = translate_rreg (SD_, RM2);
6555 dstreg1 = translate_rreg (SD_, RN1);
6556 dstreg2 = translate_rreg (SD_, RN2);
6558 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6559 State.regs[dstreg2] += State.regs[srcreg2];
6560 State.regs[dstreg1] = result1;
6563 // 1111 0111 0001 0110 imm4 Rn1 imm4 Rn2; sub_add imm4, Rn1, imm4, Rn2
6564 8.0xf7+8.0x16+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_add
6569 int dstreg1, dstreg2;
6573 dstreg1 = translate_rreg (SD_, RN1);
6574 dstreg2 = translate_rreg (SD_, RN2);
6576 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6577 State.regs[dstreg2] += EXTEND4 (IMM4);
6578 State.regs[dstreg1] = result1;
6581 // 1111 0111 0010 0110 imm4 Rn1 Rm2 Rn2; sub_sub imm4, Rn1, Rm2, Rn2
6582 8.0xf7+8.0x26+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_sub
6587 int srcreg2, dstreg1, dstreg2;
6591 srcreg2 = translate_rreg (SD_, RM2);
6592 dstreg1 = translate_rreg (SD_, RN1);
6593 dstreg2 = translate_rreg (SD_, RN2);
6595 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6596 State.regs[dstreg2] -= State.regs[srcreg2];
6597 State.regs[dstreg1] = result1;
6600 // 1111 0111 0011 0110 imm4 Rn1 imm4 Rn2; sub_sub imm4, Rn1, imm4, Rn2
6601 8.0xf7+8.0x36+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_sub
6606 int dstreg1, dstreg2;
6610 dstreg1 = translate_rreg (SD_, RN1);
6611 dstreg2 = translate_rreg (SD_, RN2);
6613 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6614 State.regs[dstreg2] -= EXTEND4 (IMM4);
6615 State.regs[dstreg1] = result1;
6618 // 1111 0111 0100 0110 imm4 Rn1 Rm2 Rn2; sub_cmp imm4, Rn1, Rm2, Rn2
6619 8.0xf7+8.0x46+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_cmp
6624 int srcreg2, dstreg1, dstreg2;
6627 srcreg2 = translate_rreg (SD_, RM2);
6628 dstreg1 = translate_rreg (SD_, RN1);
6629 dstreg2 = translate_rreg (SD_, RN2);
6631 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
6632 State.regs[dstreg1] -= EXTEND4 (IMM4A);
6635 // 1111 0111 0101 0110 imm4 Rn1 imm4 Rn2; sub_cmp imm4, Rn1, imm4, Rn2
6636 8.0xf7+8.0x56+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_cmp
6641 int dstreg1, dstreg2;
6644 dstreg1 = translate_rreg (SD_, RN1);
6645 dstreg2 = translate_rreg (SD_, RN2);
6647 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
6648 State.regs[dstreg1] -= EXTEND4 (IMM4A);
6651 // 1111 0111 0110 0110 imm4 Rn1 Rm2 Rn2; sub_mov imm4, Rn1, Rm2, Rn2
6652 8.0xf7+8.0x66+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_mov
6657 int srcreg2, dstreg1, dstreg2;
6661 srcreg2 = translate_rreg (SD_, RM2);
6662 dstreg1 = translate_rreg (SD_, RN1);
6663 dstreg2 = translate_rreg (SD_, RN2);
6665 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6666 State.regs[dstreg2] = State.regs[srcreg2];
6667 State.regs[dstreg1] = result1;
6670 // 1111 0111 0111 0110 imm4 Rn1 imm4 Rn2; sub_mov imm4, Rn1, imm4, Rn2
6671 8.0xf7+8.0x76+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_mov
6676 int dstreg1, dstreg2;
6680 dstreg1 = translate_rreg (SD_, RN1);
6681 dstreg2 = translate_rreg (SD_, RN2);
6683 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6684 State.regs[dstreg2] = EXTEND4 (IMM4);
6685 State.regs[dstreg1] = result1;
6688 // 1111 0111 1000 0110 imm4 Rn1 Rm2 Rn2; sub_asr imm4, Rn1, Rm2, Rn2
6689 8.0xf7+8.0x86+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_asr
6694 int srcreg2, dstreg1, dstreg2;
6699 srcreg2 = translate_rreg (SD_, RM2);
6700 dstreg1 = translate_rreg (SD_, RN1);
6701 dstreg2 = translate_rreg (SD_, RN2);
6703 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6704 temp = State.regs[dstreg2];
6705 temp >>= State.regs[srcreg2];
6706 State.regs[dstreg2] = temp;
6707 State.regs[dstreg1] = result1;
6710 // 1111 0111 1001 0110 imm4 Rn1 imm4 Rn2; sub_asr imm4, Rn1, imm4, Rn2
6711 8.0xf7+8.0x96+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_asr
6716 int dstreg1, dstreg2;
6721 dstreg1 = translate_rreg (SD_, RN1);
6722 dstreg2 = translate_rreg (SD_, RN2);
6724 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6725 temp = State.regs[dstreg2];
6727 State.regs[dstreg2] = temp;
6728 State.regs[dstreg1] = result1;
6731 // 1111 0111 1010 0110 imm4 Rn1 Rm2 Rn2; sub_lsr imm4, Rn1, Rm2, Rn2
6732 8.0xf7+8.0xa6+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_lsr
6737 int srcreg2, dstreg1, dstreg2;
6741 srcreg2 = translate_rreg (SD_, RM2);
6742 dstreg1 = translate_rreg (SD_, RN1);
6743 dstreg2 = translate_rreg (SD_, RN2);
6745 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6746 State.regs[dstreg2] >>= State.regs[srcreg2];
6747 State.regs[dstreg1] = result1;
6750 // 1111 0111 1011 0110 imm4 Rn1 imm4 Rn2; sub_lsr imm4, Rn1, imm4, Rn2
6751 8.0xf7+8.0xb6+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_lsr
6756 int dstreg1, dstreg2;
6760 dstreg1 = translate_rreg (SD_, RN1);
6761 dstreg2 = translate_rreg (SD_, RN2);
6763 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6764 State.regs[dstreg2] >>= IMM4;
6765 State.regs[dstreg1] = result1;
6769 // 1111 0111 1100 0110 imm4 Rn1 Rm2 Rn2; sub_asl imm4, Rn1, Rm2, Rn2
6770 8.0xf7+8.0xc6+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::sub_asl
6775 int srcreg2, dstreg1, dstreg2;
6779 srcreg2 = translate_rreg (SD_, RM2);
6780 dstreg1 = translate_rreg (SD_, RN1);
6781 dstreg2 = translate_rreg (SD_, RN2);
6783 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6784 State.regs[dstreg2] <<= State.regs[srcreg2];
6785 State.regs[dstreg1] = result1;
6788 // 1111 0111 1101 0110 imm4 Rn1 imm4 Rn2; sub_asl imm4, Rn1, imm4, Rn2
6789 8.0xf7+8.0xd6+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::sub_asl
6794 int dstreg1, dstreg2;
6798 dstreg1 = translate_rreg (SD_, RN1);
6799 dstreg2 = translate_rreg (SD_, RN2);
6801 result1 = State.regs[dstreg1] - EXTEND4 (IMM4A);
6802 State.regs[dstreg2] <<= IMM4;
6803 State.regs[dstreg1] = result1;
6806 // 1111 0111 0000 0111 imm4 Rn1 Rm2 Rn2; mov_add imm4, Rn1, Rm2, Rn2
6807 8.0xf7+8.0x07+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_add
6812 int srcreg2, dstreg1, dstreg2;
6816 srcreg2 = translate_rreg (SD_, RM2);
6817 dstreg1 = translate_rreg (SD_, RN1);
6818 dstreg2 = translate_rreg (SD_, RN2);
6820 result1 = EXTEND4 (IMM4A);
6821 State.regs[dstreg2] += State.regs[srcreg2];
6822 State.regs[dstreg1] = result1;
6825 // 1111 0111 0001 0111 imm4 Rn1 imm4 Rn2; mov_add imm4, Rn1, imm4, Rn2
6826 8.0xf7+8.0x17+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_add
6831 int dstreg1, dstreg2;
6835 dstreg1 = translate_rreg (SD_, RN1);
6836 dstreg2 = translate_rreg (SD_, RN2);
6838 result1 = EXTEND4 (IMM4A);
6839 State.regs[dstreg2] += EXTEND4 (IMM4);
6840 State.regs[dstreg1] = result1;
6843 // 1111 0111 0010 0111 imm4 Rn1 Rm2 Rn2; mov_sub imm4, Rn1, Rm2, Rn2
6844 8.0xf7+8.0x27+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_sub
6849 int srcreg2, dstreg1, dstreg2;
6853 srcreg2 = translate_rreg (SD_, RM2);
6854 dstreg1 = translate_rreg (SD_, RN1);
6855 dstreg2 = translate_rreg (SD_, RN2);
6857 result1 = EXTEND4 (IMM4A);
6858 State.regs[dstreg2] -= State.regs[srcreg2];
6859 State.regs[dstreg1] = result1;
6862 // 1111 0111 0011 0111 imm4 Rn1 imm4 Rn2; mov_sub imm4, Rn1, imm4, Rn2
6863 8.0xf7+8.0x37+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_sub
6868 int dstreg1, dstreg2;
6872 dstreg1 = translate_rreg (SD_, RN1);
6873 dstreg2 = translate_rreg (SD_, RN2);
6875 result1 = EXTEND4 (IMM4A);
6876 State.regs[dstreg2] -= EXTEND4 (IMM4);
6877 State.regs[dstreg1] = result1;
6880 // 1111 0111 0100 0111 imm4 Rn1 Rm2 Rn2; mov_cmp imm4, Rn1, Rm2, Rn2
6881 8.0xf7+8.0x47+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_cmp
6886 int srcreg2, dstreg1, dstreg2;
6889 srcreg2 = translate_rreg (SD_, RM2);
6890 dstreg1 = translate_rreg (SD_, RN1);
6891 dstreg2 = translate_rreg (SD_, RN2);
6893 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
6894 State.regs[dstreg1] = EXTEND4 (IMM4A);
6897 // 1111 0111 0101 0111 imm4 Rn1 imm4 Rn2; mov_cmp imm4, Rn1, imm4, Rn2
6898 8.0xf7+8.0x57+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_cmp
6903 int dstreg1, dstreg2;
6906 dstreg1 = translate_rreg (SD_, RN1);
6907 dstreg2 = translate_rreg (SD_, RN2);
6909 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
6910 State.regs[dstreg1] = EXTEND4 (IMM4A);
6913 // 1111 0111 0110 0111 imm4 Rn1 Rm2 Rn2; mov_mov imm4, Rn1, Rm2, Rn2
6914 8.0xf7+8.0x67+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_mov
6919 int srcreg2, dstreg1, dstreg2;
6923 srcreg2 = translate_rreg (SD_, RM2);
6924 dstreg1 = translate_rreg (SD_, RN1);
6925 dstreg2 = translate_rreg (SD_, RN2);
6927 result1 = EXTEND4 (IMM4A);
6928 State.regs[dstreg2] = State.regs[srcreg2];
6929 State.regs[dstreg1] = result1;
6932 // 1111 0111 0111 0111 imm4 Rn1 imm4 Rn2; mov_mov imm4, Rn1, imm4, Rn2
6933 8.0xf7+8.0x77+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_mov
6938 int dstreg1, dstreg2;
6942 dstreg1 = translate_rreg (SD_, RN1);
6943 dstreg2 = translate_rreg (SD_, RN2);
6945 result1 = EXTEND4 (IMM4A);
6946 State.regs[dstreg2] = EXTEND4 (IMM4);
6947 State.regs[dstreg1] = result1;
6950 // 1111 0111 1000 0111 imm4 Rn1 Rm2 Rn2; mov_asr imm4, Rn1, Rm2, Rn2
6951 8.0xf7+8.0x87+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_asr
6956 int srcreg2, dstreg1, dstreg2;
6961 srcreg2 = translate_rreg (SD_, RM2);
6962 dstreg1 = translate_rreg (SD_, RN1);
6963 dstreg2 = translate_rreg (SD_, RN2);
6965 result1 = EXTEND4 (IMM4A);
6966 temp = State.regs[dstreg2];
6967 temp >>= State.regs[srcreg2];
6968 State.regs[dstreg2] = temp;
6969 State.regs[dstreg1] = result1;
6972 // 1111 0111 1001 0111 imm4 Rn1 imm4 Rn2; mov_asr imm4, Rn1, imm4, Rn2
6973 8.0xf7+8.0x97+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_asr
6978 int dstreg1, dstreg2;
6983 dstreg1 = translate_rreg (SD_, RN1);
6984 dstreg2 = translate_rreg (SD_, RN2);
6986 result1 = EXTEND4 (IMM4A);
6987 temp = State.regs[dstreg2];
6989 State.regs[dstreg2] = temp;
6990 State.regs[dstreg1] = result1;
6993 // 1111 0111 1010 0111 imm4 Rn1 Rm2 Rn2; mov_lsr imm4, Rn1, Rm2, Rn2
6994 8.0xf7+8.0xa7+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_lsr
6999 int srcreg2, dstreg1, dstreg2;
7003 srcreg2 = translate_rreg (SD_, RM2);
7004 dstreg1 = translate_rreg (SD_, RN1);
7005 dstreg2 = translate_rreg (SD_, RN2);
7007 result1 = EXTEND4 (IMM4A);
7008 State.regs[dstreg2] >>= State.regs[srcreg2];
7009 State.regs[dstreg1] = result1;
7012 // 1111 0111 1011 0111 imm4 Rn1 imm4 Rn2; mov_lsr imm4, Rn1, imm4, Rn2
7013 8.0xf7+8.0xb7+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_lsr
7018 int dstreg1, dstreg2;
7022 dstreg1 = translate_rreg (SD_, RN1);
7023 dstreg2 = translate_rreg (SD_, RN2);
7025 result1 = EXTEND4 (IMM4A);
7026 State.regs[dstreg2] >>= IMM4;
7027 State.regs[dstreg1] = result1;
7031 // 1111 0111 1100 0111 imm4 Rn1 Rm2 Rn2; mov_asl imm4, Rn1, Rm2, Rn2
7032 8.0xf7+8.0xc7+4.IMM4A,4.RN1+4.RM2,4.RN2!RN1:D2c:::mov_asl
7037 int srcreg2, dstreg1, dstreg2;
7041 srcreg2 = translate_rreg (SD_, RM2);
7042 dstreg1 = translate_rreg (SD_, RN1);
7043 dstreg2 = translate_rreg (SD_, RN2);
7045 result1 = EXTEND4 (IMM4A);
7046 State.regs[dstreg2] <<= State.regs[srcreg2];
7047 State.regs[dstreg1] = result1;
7050 // 1111 0111 1101 0111 imm4 Rn1 imm4 Rn2; mov_asl imm4, Rn1, imm4, Rn2
7051 8.0xf7+8.0xd7+4.IMM4A,4.RN1+4.IMM4,4.RN2!RN1:D2d:::mov_asl
7056 int dstreg1, dstreg2;
7060 dstreg1 = translate_rreg (SD_, RN1);
7061 dstreg2 = translate_rreg (SD_, RN2);
7063 result1 = EXTEND4 (IMM4A);
7064 State.regs[dstreg2] <<= IMM4;
7065 State.regs[dstreg1] = result1;
7068 // 1111 0111 0000 1000 Rm1 Rn1 Rm2 Rn2; and_add Rm1, Rn1, Rm2, Rn2
7069 8.0xf7+8.0x08+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_add
7074 int srcreg1, srcreg2, dstreg1, dstreg2;
7078 srcreg1 = translate_rreg (SD_, RM1);
7079 srcreg2 = translate_rreg (SD_, RM2);
7080 dstreg1 = translate_rreg (SD_, RN1);
7081 dstreg2 = translate_rreg (SD_, RN2);
7083 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7084 State.regs[dstreg2] += State.regs[srcreg2];
7085 State.regs[dstreg1] = result1;
7088 // 1111 0111 0001 1000 Rm1 Rn1 imm4 Rn2; and_add Rm1, Rn1, imm4, Rn2
7089 8.0xf7+8.0x18+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_add
7094 int srcreg1, dstreg1, dstreg2;
7098 srcreg1 = translate_rreg (SD_, RM1);
7099 dstreg1 = translate_rreg (SD_, RN1);
7100 dstreg2 = translate_rreg (SD_, RN2);
7102 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7103 State.regs[dstreg2] += EXTEND4 (IMM4);
7104 State.regs[dstreg1] = result1;
7107 // 1111 0111 0010 1000 Rm1 Rn1 Rm2 Rn2; and_sub Rm1, Rn1, Rm2, Rn2
7108 8.0xf7+8.0x28+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_sub
7113 int srcreg1, srcreg2, dstreg1, dstreg2;
7117 srcreg1 = translate_rreg (SD_, RM1);
7118 srcreg2 = translate_rreg (SD_, RM2);
7119 dstreg1 = translate_rreg (SD_, RN1);
7120 dstreg2 = translate_rreg (SD_, RN2);
7122 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7123 State.regs[dstreg2] -= State.regs[srcreg2];
7124 State.regs[dstreg1] = result1;
7127 // 1111 0111 0011 1000 Rm1 Rn1 imm4 Rn2; and_sub Rm1, Rn1, imm4, Rn2
7128 8.0xf7+8.0x38+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_sub
7133 int srcreg1, dstreg1, dstreg2;
7137 srcreg1 = translate_rreg (SD_, RM1);
7138 dstreg1 = translate_rreg (SD_, RN1);
7139 dstreg2 = translate_rreg (SD_, RN2);
7141 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7142 State.regs[dstreg2] -= EXTEND4 (IMM4);
7143 State.regs[dstreg1] = result1;
7146 // 1111 0111 0100 1000 Rm1 Rn1 Rm2 Rn2; and_cmp Rm1, Rn1, Rm2, Rn2
7147 8.0xf7+8.0x48+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_cmp
7152 int srcreg1, srcreg2, dstreg1, dstreg2;
7155 srcreg1 = translate_rreg (SD_, RM1);
7156 srcreg2 = translate_rreg (SD_, RM2);
7157 dstreg1 = translate_rreg (SD_, RN1);
7158 dstreg2 = translate_rreg (SD_, RN2);
7160 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
7161 State.regs[dstreg1] &= State.regs[srcreg1];
7164 // 1111 0111 0101 1000 Rm1 Rn1 imm4 Rn2; and_cmp Rm1, Rn1, imm4, Rn2
7165 8.0xf7+8.0x58+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_cmp
7170 int srcreg1, dstreg1, dstreg2;
7173 srcreg1 = translate_rreg (SD_, RM1);
7174 dstreg1 = translate_rreg (SD_, RN1);
7175 dstreg2 = translate_rreg (SD_, RN2);
7177 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
7178 State.regs[dstreg1] &= State.regs[srcreg1];
7181 // 1111 0111 0110 1000 Rm1 Rn1 Rm2 Rn2; and_mov Rm1, Rn1, Rm2, Rn2
7182 8.0xf7+8.0x68+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_mov
7187 int srcreg1, srcreg2, dstreg1, dstreg2;
7191 srcreg1 = translate_rreg (SD_, RM1);
7192 srcreg2 = translate_rreg (SD_, RM2);
7193 dstreg1 = translate_rreg (SD_, RN1);
7194 dstreg2 = translate_rreg (SD_, RN2);
7196 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7197 State.regs[dstreg2] = State.regs[srcreg2];
7198 State.regs[dstreg1] = result1;
7201 // 1111 0111 0111 1000 Rm1 Rn1 imm4 Rn2; and_mov Rm1, Rn1, imm4, Rn2
7202 8.0xf7+8.0x78+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_mov
7207 int srcreg1, dstreg1, dstreg2;
7211 srcreg1 = translate_rreg (SD_, RM1);
7212 dstreg1 = translate_rreg (SD_, RN1);
7213 dstreg2 = translate_rreg (SD_, RN2);
7215 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7216 State.regs[dstreg2] = EXTEND4 (IMM4);
7217 State.regs[dstreg1] = result1;
7220 // 1111 0111 1000 1000 Rm1 Rn1 Rm2 Rn2; and_asr Rm1, Rn1, Rm2, Rn2
7221 8.0xf7+8.0x88+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_asr
7226 int srcreg1, srcreg2, dstreg1, dstreg2;
7231 srcreg1 = translate_rreg (SD_, RM1);
7232 srcreg2 = translate_rreg (SD_, RM2);
7233 dstreg1 = translate_rreg (SD_, RN1);
7234 dstreg2 = translate_rreg (SD_, RN2);
7236 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7237 temp = State.regs[dstreg2];
7238 temp >>= State.regs[srcreg2];
7239 State.regs[dstreg2] = temp;
7240 State.regs[dstreg1] = result1;
7243 // 1111 0111 1001 1000 Rm1 Rn1 imm4 Rn2; and_asr Rm1, Rn1, imm4, Rn2
7244 8.0xf7+8.0x98+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_asr
7249 int srcreg1, dstreg1, dstreg2;
7254 srcreg1 = translate_rreg (SD_, RM1);
7255 dstreg1 = translate_rreg (SD_, RN1);
7256 dstreg2 = translate_rreg (SD_, RN2);
7258 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7259 temp = State.regs[dstreg2];
7261 State.regs[dstreg2] = temp;
7262 State.regs[dstreg1] = result1;
7265 // 1111 0111 1010 1000 Rm1 Rn1 Rm2 Rn2; and_lsr Rm1, Rn1, Rm2, Rn2
7266 8.0xf7+8.0xa8+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_lsr
7271 int srcreg1, srcreg2, dstreg1, dstreg2;
7275 srcreg1 = translate_rreg (SD_, RM1);
7276 srcreg2 = translate_rreg (SD_, RM2);
7277 dstreg1 = translate_rreg (SD_, RN1);
7278 dstreg2 = translate_rreg (SD_, RN2);
7280 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7281 State.regs[dstreg2] >>= State.regs[srcreg2];
7282 State.regs[dstreg1] = result1;
7285 // 1111 0111 1011 1000 Rm1 Rn1 imm4 Rn2; and_lsr Rm1, Rn1, imm4, Rn2
7286 8.0xf7+8.0xb8+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_lsr
7291 int srcreg1, dstreg1, dstreg2;
7295 srcreg1 = translate_rreg (SD_, RM1);
7296 dstreg1 = translate_rreg (SD_, RN1);
7297 dstreg2 = translate_rreg (SD_, RN2);
7299 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7300 State.regs[dstreg2] >>= IMM4;
7301 State.regs[dstreg1] = result1;
7305 // 1111 0111 1100 1000 Rm1 Rn1 Rm2 Rn2; and_asl Rm1, Rn1, Rm2, Rn2
7306 8.0xf7+8.0xc8+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::and_asl
7311 int srcreg1, srcreg2, dstreg1, dstreg2;
7315 srcreg1 = translate_rreg (SD_, RM1);
7316 srcreg2 = translate_rreg (SD_, RM2);
7317 dstreg1 = translate_rreg (SD_, RN1);
7318 dstreg2 = translate_rreg (SD_, RN2);
7320 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7321 State.regs[dstreg2] <<= State.regs[srcreg2];
7322 State.regs[dstreg1] = result1;
7325 // 1111 0111 1101 1000 Rm1 Rn1 imm4 Rn2; and_asl Rm1, Rn1, imm4, Rn2
7326 8.0xf7+8.0xd8+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::and_asl
7331 int srcreg1, dstreg1, dstreg2;
7335 srcreg1 = translate_rreg (SD_, RM1);
7336 dstreg1 = translate_rreg (SD_, RN1);
7337 dstreg2 = translate_rreg (SD_, RN2);
7339 result1 = State.regs[dstreg1] & State.regs[srcreg1];
7340 State.regs[dstreg2] <<= IMM4;
7341 State.regs[dstreg1] = result1;
7344 // 1111 0111 0000 1001 Rm1 Rn1 Rm2 Rn2; dmach_add Rm1, Rn1, Rm2, Rn2
7345 8.0xf7+8.0x09+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_add
7350 int srcreg1, srcreg2, dstreg1, dstreg2;
7351 int32_t temp, temp2, sum;
7354 srcreg1 = translate_rreg (SD_, RM1);
7355 srcreg2 = translate_rreg (SD_, RM2);
7356 dstreg1 = translate_rreg (SD_, RN1);
7357 dstreg2 = translate_rreg (SD_, RN2);
7359 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7360 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7361 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7362 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7363 sum = temp + temp2 + State.regs[REG_MCRL];
7365 State.regs[dstreg2] += State.regs[srcreg2];
7366 State.regs[dstreg1] = sum;
7369 // 1111 0111 0001 1001 Rm1 Rn1 imm4 Rn2; dmach_add Rm1, Rn1, imm4, Rn2
7370 8.0xf7+8.0x19+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_add
7375 int srcreg1, dstreg1, dstreg2;
7376 int32_t temp, temp2, sum;
7379 srcreg1 = translate_rreg (SD_, RM1);
7380 dstreg1 = translate_rreg (SD_, RN1);
7381 dstreg2 = translate_rreg (SD_, RN2);
7383 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7384 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7385 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7386 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7387 sum = temp + temp2 + State.regs[REG_MCRL];
7389 State.regs[dstreg2] += EXTEND4 (IMM4);
7390 State.regs[dstreg1] = sum;
7393 // 1111 0111 0010 1001 Rm1 Rn1 Rm2 Rn2; dmach_sub Rm1, Rn1, Rm2, Rn2
7394 8.0xf7+8.0x29+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_sub
7399 int srcreg1, srcreg2, dstreg1, dstreg2;
7400 int32_t temp, temp2, sum;
7403 srcreg1 = translate_rreg (SD_, RM1);
7404 srcreg2 = translate_rreg (SD_, RM2);
7405 dstreg1 = translate_rreg (SD_, RN1);
7406 dstreg2 = translate_rreg (SD_, RN2);
7408 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7409 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7410 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7411 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7412 sum = temp + temp2 + State.regs[REG_MCRL];
7414 State.regs[dstreg2] -= State.regs[srcreg2];
7415 State.regs[dstreg1] = sum;
7418 // 1111 0111 0011 1001 Rm1 Rn1 imm4 Rn2; dmach_sub Rm1, Rn1, imm4, Rn2
7419 8.0xf7+8.0x39+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_sub
7424 int srcreg1, dstreg1, dstreg2;
7425 int32_t temp, temp2, sum;
7428 srcreg1 = translate_rreg (SD_, RM1);
7429 dstreg1 = translate_rreg (SD_, RN1);
7430 dstreg2 = translate_rreg (SD_, RN2);
7432 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7433 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7434 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7435 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7436 sum = temp + temp2 + State.regs[REG_MCRL];
7438 State.regs[dstreg2] -= EXTEND4 (IMM4);
7439 State.regs[dstreg1] = sum;
7442 // 1111 0111 0100 1001 Rm1 Rn1 Rm2 Rn2; dmach_cmp Rm1, Rn1, Rm2, Rn2
7443 8.0xf7+8.0x49+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_cmp
7448 int srcreg1, srcreg2, dstreg1, dstreg2;
7449 int32_t temp, temp2, sum;
7452 srcreg1 = translate_rreg (SD_, RM1);
7453 srcreg2 = translate_rreg (SD_, RM2);
7454 dstreg1 = translate_rreg (SD_, RN1);
7455 dstreg2 = translate_rreg (SD_, RN2);
7457 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7458 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7459 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7460 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7461 sum = temp + temp2 + State.regs[REG_MCRL];
7463 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
7464 State.regs[dstreg1] = sum;
7467 // 1111 0111 0101 1001 Rm1 Rn1 imm4 Rn2; dmach_cmp Rm1, Rn1, imm4, Rn2
7468 8.0xf7+8.0x59+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_cmp
7473 int srcreg1, dstreg1, dstreg2;
7474 int32_t temp, temp2, sum;
7477 srcreg1 = translate_rreg (SD_, RM1);
7478 dstreg1 = translate_rreg (SD_, RN1);
7479 dstreg2 = translate_rreg (SD_, RN2);
7481 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7482 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7483 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7484 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7485 sum = temp + temp2 + State.regs[REG_MCRL];
7487 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
7488 State.regs[dstreg1] = sum;
7491 // 1111 0111 0110 1001 Rm1 Rn1 Rm2 Rn2; dmach_mov Rm1, Rn1, Rm2, Rn2
7492 8.0xf7+8.0x69+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_mov
7497 int srcreg1, srcreg2, dstreg1, dstreg2;
7498 int32_t temp, temp2, sum;
7501 srcreg1 = translate_rreg (SD_, RM1);
7502 srcreg2 = translate_rreg (SD_, RM2);
7503 dstreg1 = translate_rreg (SD_, RN1);
7504 dstreg2 = translate_rreg (SD_, RN2);
7506 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7507 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7508 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7509 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7510 sum = temp + temp2 + State.regs[REG_MCRL];
7512 State.regs[dstreg2] = State.regs[srcreg2];
7513 State.regs[dstreg1] = sum;
7516 // 1111 0111 0111 1001 Rm1 Rn1 imm4 Rn2; dmach_mov Rm1, Rn1, imm4, Rn2
7517 8.0xf7+8.0x79+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_mov
7522 int srcreg1, dstreg1, dstreg2;
7523 int32_t temp, temp2, sum;
7526 srcreg1 = translate_rreg (SD_, RM1);
7527 dstreg1 = translate_rreg (SD_, RN1);
7528 dstreg2 = translate_rreg (SD_, RN2);
7530 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7531 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7532 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7533 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7534 sum = temp + temp2 + State.regs[REG_MCRL];
7536 State.regs[dstreg2] = EXTEND4 (IMM4);
7537 State.regs[dstreg1] = sum;
7540 // 1111 0111 1000 1001 Rm1 Rn1 Rm2 Rn2; dmach_asr Rm1, Rn1, Rm2, Rn2
7541 8.0xf7+8.0x89+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_asr
7546 int srcreg1, srcreg2, dstreg1, dstreg2;
7547 int32_t temp, temp2, sum;
7550 srcreg1 = translate_rreg (SD_, RM1);
7551 srcreg2 = translate_rreg (SD_, RM2);
7552 dstreg1 = translate_rreg (SD_, RN1);
7553 dstreg2 = translate_rreg (SD_, RN2);
7555 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7556 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7557 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7558 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7559 sum = temp + temp2 + State.regs[REG_MCRL];
7561 temp = State.regs[dstreg2];
7562 temp >>= State.regs[srcreg2];
7563 State.regs[dstreg2] = temp;
7564 State.regs[dstreg1] = sum;
7567 // 1111 0111 1001 1001 Rm1 Rn1 imm4 Rn2; dmach_asr Rm1, Rn1, imm4, Rn2
7568 8.0xf7+8.0x99+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_asr
7573 int srcreg1, dstreg1, dstreg2;
7574 int32_t temp, temp2, sum;
7577 srcreg1 = translate_rreg (SD_, RM1);
7578 dstreg1 = translate_rreg (SD_, RN1);
7579 dstreg2 = translate_rreg (SD_, RN2);
7581 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7582 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7583 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7584 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7585 sum = temp + temp2 + State.regs[REG_MCRL];
7587 temp = State.regs[dstreg2];
7589 State.regs[dstreg2] = temp;
7590 State.regs[dstreg1] = sum;
7593 // 1111 0111 1010 1001 Rm1 Rn1 Rm2 Rn2; dmach_lsr Rm1, Rn1, Rm2, Rn2
7594 8.0xf7+8.0xa9+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_lsr
7599 int srcreg1, srcreg2, dstreg1, dstreg2;
7600 int32_t temp, temp2, sum;
7603 srcreg1 = translate_rreg (SD_, RM1);
7604 srcreg2 = translate_rreg (SD_, RM2);
7605 dstreg1 = translate_rreg (SD_, RN1);
7606 dstreg2 = translate_rreg (SD_, RN2);
7608 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7609 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7610 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7611 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7612 sum = temp + temp2 + State.regs[REG_MCRL];
7614 State.regs[dstreg2] >>= State.regs[srcreg2];
7615 State.regs[dstreg1] = sum;
7618 // 1111 0111 1011 1001 Rm1 Rn1 imm4 Rn2; dmach_lsr Rm1, Rn1, imm4, Rn2
7619 8.0xf7+8.0xb9+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_lsr
7624 int srcreg1, dstreg1, dstreg2;
7625 int32_t temp, temp2, sum;
7628 srcreg1 = translate_rreg (SD_, RM1);
7629 dstreg1 = translate_rreg (SD_, RN1);
7630 dstreg2 = translate_rreg (SD_, RN2);
7632 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7633 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7634 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7635 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7636 sum = temp + temp2 + State.regs[REG_MCRL];
7638 State.regs[dstreg2] >>= IMM4;
7639 State.regs[dstreg1] = sum;
7643 // 1111 0111 1100 1001 Rm1 Rn1 Rm2 Rn2; dmach_asl Rm1, Rn1, Rm2, Rn2
7644 8.0xf7+8.0xc9+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::dmach_asl
7649 int srcreg1, srcreg2, dstreg1, dstreg2;
7650 int32_t temp, temp2, sum;
7653 srcreg1 = translate_rreg (SD_, RM1);
7654 srcreg2 = translate_rreg (SD_, RM2);
7655 dstreg1 = translate_rreg (SD_, RN1);
7656 dstreg2 = translate_rreg (SD_, RN2);
7658 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7659 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7660 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7661 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7662 sum = temp + temp2 + State.regs[REG_MCRL];
7664 State.regs[dstreg2] <<= State.regs[srcreg2];
7665 State.regs[dstreg1] = sum;
7668 // 1111 0111 1101 1001 Rm1 Rn1 imm4 Rn2; dmach_asl Rm1, Rn1, imm4, Rn2
7669 8.0xf7+8.0xd9+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::dmach_asl
7674 int srcreg1, dstreg1, dstreg2;
7675 int32_t temp, temp2, sum;
7678 srcreg1 = translate_rreg (SD_, RM1);
7679 dstreg1 = translate_rreg (SD_, RN1);
7680 dstreg2 = translate_rreg (SD_, RN2);
7682 temp = ((int32_t)(int16_t)(State.regs[dstreg1] & 0xffff)
7683 * (int32_t)(int16_t)(State.regs[srcreg1] & 0xffff));
7684 temp2 = ((int32_t)(int16_t)((State.regs[srcreg1] >> 16) & 0xffff)
7685 * (int32_t)(int16_t)((State.regs[dstreg1] >> 16) & 0xffff));
7686 sum = temp + temp2 + State.regs[REG_MCRL];
7688 State.regs[dstreg2] <<= IMM4;
7689 State.regs[dstreg1] = sum;
7692 // 1111 0111 0000 1010 Rm1 Rn1 Rm2 Rn2; xor_add Rm1, Rn1, Rm2, Rn2
7693 8.0xf7+8.0x0a+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_add
7698 int srcreg1, srcreg2, dstreg1, dstreg2;
7702 srcreg1 = translate_rreg (SD_, RM1);
7703 srcreg2 = translate_rreg (SD_, RM2);
7704 dstreg1 = translate_rreg (SD_, RN1);
7705 dstreg2 = translate_rreg (SD_, RN2);
7707 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7708 State.regs[dstreg2] += State.regs[srcreg2];
7709 State.regs[dstreg1] = result1;
7712 // 1111 0111 0001 1010 Rm1 Rn1 imm4 Rn2; xor_add Rm1, Rn1, imm4, Rn2
7713 8.0xf7+8.0x1a+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_add
7718 int srcreg1, dstreg1, dstreg2;
7722 srcreg1 = translate_rreg (SD_, RM1);
7723 dstreg1 = translate_rreg (SD_, RN1);
7724 dstreg2 = translate_rreg (SD_, RN2);
7726 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7727 State.regs[dstreg2] += EXTEND4 (IMM4);
7728 State.regs[dstreg1] = result1;
7731 // 1111 0111 0010 1010 Rm1 Rn1 Rm2 Rn2; xor_sub Rm1, Rn1, Rm2, Rn2
7732 8.0xf7+8.0x2a+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_sub
7737 int srcreg1, srcreg2, dstreg1, dstreg2;
7741 srcreg1 = translate_rreg (SD_, RM1);
7742 srcreg2 = translate_rreg (SD_, RM2);
7743 dstreg1 = translate_rreg (SD_, RN1);
7744 dstreg2 = translate_rreg (SD_, RN2);
7746 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7747 State.regs[dstreg2] -= State.regs[srcreg2];
7748 State.regs[dstreg1] = result1;
7751 // 1111 0111 0011 1010 Rm1 Rn1 imm4 Rn2; xor_sub Rm1, Rn1, imm4, Rn2
7752 8.0xf7+8.0x3a+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_sub
7757 int srcreg1, dstreg1, dstreg2;
7761 srcreg1 = translate_rreg (SD_, RM1);
7762 dstreg1 = translate_rreg (SD_, RN1);
7763 dstreg2 = translate_rreg (SD_, RN2);
7765 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7766 State.regs[dstreg2] -= EXTEND4 (IMM4);
7767 State.regs[dstreg1] = result1;
7770 // 1111 0111 0100 1010 Rm1 Rn1 Rm2 Rn2; xor_cmp Rm1, Rn1, Rm2, Rn2
7771 8.0xf7+8.0x4a+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_cmp
7776 int srcreg1, srcreg2, dstreg1, dstreg2;
7779 srcreg1 = translate_rreg (SD_, RM1);
7780 srcreg2 = translate_rreg (SD_, RM2);
7781 dstreg1 = translate_rreg (SD_, RN1);
7782 dstreg2 = translate_rreg (SD_, RN2);
7784 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
7785 State.regs[dstreg1] ^= State.regs[srcreg1];
7788 // 1111 0111 0101 1010 Rm1 Rn1 imm4 Rn2; xor_cmp Rm1, Rn1, imm4, Rn2
7789 8.0xf7+8.0x5a+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_cmp
7794 int srcreg1, dstreg1, dstreg2;
7797 srcreg1 = translate_rreg (SD_, RM1);
7798 dstreg1 = translate_rreg (SD_, RN1);
7799 dstreg2 = translate_rreg (SD_, RN2);
7801 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
7802 State.regs[dstreg1] ^= State.regs[srcreg1];
7805 // 1111 0111 0110 1010 Rm1 Rn1 Rm2 Rn2; xor_mov Rm1, Rn1, Rm2, Rn2
7806 8.0xf7+8.0x6a+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_mov
7811 int srcreg1, srcreg2, dstreg1, dstreg2;
7815 srcreg1 = translate_rreg (SD_, RM1);
7816 srcreg2 = translate_rreg (SD_, RM2);
7817 dstreg1 = translate_rreg (SD_, RN1);
7818 dstreg2 = translate_rreg (SD_, RN2);
7820 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7821 State.regs[dstreg2] = State.regs[srcreg2];
7822 State.regs[dstreg1] = result1;
7825 // 1111 0111 0111 1010 Rm1 Rn1 imm4 Rn2; xor_mov Rm1, Rn1, imm4, Rn2
7826 8.0xf7+8.0x7a+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_mov
7831 int srcreg1, dstreg1, dstreg2;
7835 srcreg1 = translate_rreg (SD_, RM1);
7836 dstreg1 = translate_rreg (SD_, RN1);
7837 dstreg2 = translate_rreg (SD_, RN2);
7839 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7840 State.regs[dstreg2] = EXTEND4 (IMM4);
7841 State.regs[dstreg1] = result1;
7844 // 1111 0111 1000 1010 Rm1 Rn1 Rm2 Rn2; xor_asr Rm1, Rn1, Rm2, Rn2
7845 8.0xf7+8.0x8a+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_asr
7850 int srcreg1, srcreg2, dstreg1, dstreg2;
7855 srcreg1 = translate_rreg (SD_, RM1);
7856 srcreg2 = translate_rreg (SD_, RM2);
7857 dstreg1 = translate_rreg (SD_, RN1);
7858 dstreg2 = translate_rreg (SD_, RN2);
7860 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7861 temp = State.regs[dstreg2];
7862 temp >>= State.regs[srcreg2];
7863 State.regs[dstreg2] = temp;
7864 State.regs[dstreg1] = result1;
7867 // 1111 0111 1001 1010 Rm1 Rn1 imm4 Rn2; xor_asr Rm1, Rn1, imm4, Rn2
7868 8.0xf7+8.0x9a+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_asr
7873 int srcreg1, dstreg1, dstreg2;
7878 srcreg1 = translate_rreg (SD_, RM1);
7879 dstreg1 = translate_rreg (SD_, RN1);
7880 dstreg2 = translate_rreg (SD_, RN2);
7882 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7883 temp = State.regs[dstreg2];
7885 State.regs[dstreg2] = temp;
7886 State.regs[dstreg1] = result1;
7889 // 1111 0111 1010 1010 Rm1 Rn1 Rm2 Rn2; xor_lsr Rm1, Rn1, Rm2, Rn2
7890 8.0xf7+8.0xaa+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_lsr
7895 int srcreg1, srcreg2, dstreg1, dstreg2;
7899 srcreg1 = translate_rreg (SD_, RM1);
7900 srcreg2 = translate_rreg (SD_, RM2);
7901 dstreg1 = translate_rreg (SD_, RN1);
7902 dstreg2 = translate_rreg (SD_, RN2);
7904 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7905 State.regs[dstreg2] >>= State.regs[srcreg2];
7906 State.regs[dstreg1] = result1;
7909 // 1111 0111 1011 1010 Rm1 Rn1 imm4 Rn2; xor_lsr Rm1, Rn1, imm4, Rn2
7910 8.0xf7+8.0xba+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_lsr
7915 int srcreg1, dstreg1, dstreg2;
7919 srcreg1 = translate_rreg (SD_, RM1);
7920 dstreg1 = translate_rreg (SD_, RN1);
7921 dstreg2 = translate_rreg (SD_, RN2);
7923 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7924 State.regs[dstreg2] >>= IMM4;
7925 State.regs[dstreg1] = result1;
7929 // 1111 0111 1100 1010 Rm1 Rn1 Rm2 Rn2; xor_asl Rm1, Rn1, Rm2, Rn2
7930 8.0xf7+8.0xca+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::xor_asl
7935 int srcreg1, srcreg2, dstreg1, dstreg2;
7939 srcreg1 = translate_rreg (SD_, RM1);
7940 srcreg2 = translate_rreg (SD_, RM2);
7941 dstreg1 = translate_rreg (SD_, RN1);
7942 dstreg2 = translate_rreg (SD_, RN2);
7944 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7945 State.regs[dstreg2] <<= State.regs[srcreg2];
7946 State.regs[dstreg1] = result1;
7949 // 1111 0111 1101 1010 Rm1 Rn1 imm4 Rn2; xor_asl Rm1, Rn1, imm4, Rn2
7950 8.0xf7+8.0xda+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::xor_asl
7955 int srcreg1, dstreg1, dstreg2;
7959 srcreg1 = translate_rreg (SD_, RM1);
7960 dstreg1 = translate_rreg (SD_, RN1);
7961 dstreg2 = translate_rreg (SD_, RN2);
7963 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7964 State.regs[dstreg2] <<= IMM4;
7965 State.regs[dstreg1] = result1;
7968 // 1111 0111 0000 1011 Rm1 Rn1 Rm2 Rn2; swhw_add Rm1, Rn1, Rm2, Rn2
7969 8.0xf7+8.0x0b+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_add
7974 int srcreg1, srcreg2, dstreg1, dstreg2;
7978 srcreg1 = translate_rreg (SD_, RM1);
7979 srcreg2 = translate_rreg (SD_, RM2);
7980 dstreg1 = translate_rreg (SD_, RN1);
7981 dstreg2 = translate_rreg (SD_, RN2);
7983 result1 = State.regs[dstreg1] ^ State.regs[srcreg1];
7984 State.regs[dstreg2] += State.regs[srcreg2];
7985 State.regs[dstreg1] = result1;
7988 // 1111 0111 0001 1011 Rm1 Rn1 imm4 Rn2; swhw_add Rm1, Rn1, imm4, Rn2
7989 8.0xf7+8.0x1b+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_add
7994 int srcreg1, dstreg1, dstreg2;
7998 srcreg1 = translate_rreg (SD_, RM1);
7999 dstreg1 = translate_rreg (SD_, RN1);
8000 dstreg2 = translate_rreg (SD_, RN2);
8002 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8003 | ((State.regs[srcreg1] >> 16) & 0xffff));
8004 State.regs[dstreg2] += EXTEND4 (IMM4);
8005 State.regs[dstreg1] = result1;
8008 // 1111 0111 0010 1011 Rm1 Rn1 Rm2 Rn2; swhw_sub Rm1, Rn1, Rm2, Rn2
8009 8.0xf7+8.0x2b+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_sub
8014 int srcreg1, srcreg2, dstreg1, dstreg2;
8018 srcreg1 = translate_rreg (SD_, RM1);
8019 srcreg2 = translate_rreg (SD_, RM2);
8020 dstreg1 = translate_rreg (SD_, RN1);
8021 dstreg2 = translate_rreg (SD_, RN2);
8023 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8024 | ((State.regs[srcreg1] >> 16) & 0xffff));
8025 State.regs[dstreg2] -= State.regs[srcreg2];
8026 State.regs[dstreg1] = result1;
8029 // 1111 0111 0011 1011 Rm1 Rn1 imm4 Rn2; swhw_sub Rm1, Rn1, imm4, Rn2
8030 8.0xf7+8.0x3b+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_sub
8035 int srcreg1, dstreg1, dstreg2;
8039 srcreg1 = translate_rreg (SD_, RM1);
8040 dstreg1 = translate_rreg (SD_, RN1);
8041 dstreg2 = translate_rreg (SD_, RN2);
8043 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8044 | ((State.regs[srcreg1] >> 16) & 0xffff));
8045 State.regs[dstreg2] -= EXTEND4 (IMM4);
8046 State.regs[dstreg1] = result1;
8049 // 1111 0111 0100 1011 Rm1 Rn1 Rm2 Rn2; swhw_cmp Rm1, Rn1, Rm2, Rn2
8050 8.0xf7+8.0x4b+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_cmp
8055 int srcreg1, srcreg2, dstreg1, dstreg2;
8058 srcreg1 = translate_rreg (SD_, RM1);
8059 srcreg2 = translate_rreg (SD_, RM2);
8060 dstreg1 = translate_rreg (SD_, RN1);
8061 dstreg2 = translate_rreg (SD_, RN2);
8063 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
8064 State.regs[dstreg1] = (((State.regs[srcreg1] & 0xffff) << 16)
8065 | ((State.regs[srcreg1] >> 16) & 0xffff));
8068 // 1111 0111 0101 1011 Rm1 Rn1 imm4 Rn2; swhw_cmp Rm1, Rn1, imm4, Rn2
8069 8.0xf7+8.0x5b+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_cmp
8074 int srcreg1, dstreg1, dstreg2;
8077 srcreg1 = translate_rreg (SD_, RM1);
8078 dstreg1 = translate_rreg (SD_, RN1);
8079 dstreg2 = translate_rreg (SD_, RN2);
8081 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
8082 State.regs[dstreg1] = (((State.regs[srcreg1] & 0xffff) << 16)
8083 | ((State.regs[srcreg1] >> 16) & 0xffff));
8086 // 1111 0111 0110 1011 Rm1 Rn1 Rm2 Rn2; swhw_mov Rm1, Rn1, Rm2, Rn2
8087 8.0xf7+8.0x6b+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_mov
8092 int srcreg1, srcreg2, dstreg1, dstreg2;
8096 srcreg1 = translate_rreg (SD_, RM1);
8097 srcreg2 = translate_rreg (SD_, RM2);
8098 dstreg1 = translate_rreg (SD_, RN1);
8099 dstreg2 = translate_rreg (SD_, RN2);
8101 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8102 | ((State.regs[srcreg1] >> 16) & 0xffff));
8103 State.regs[dstreg2] = State.regs[srcreg2];
8104 State.regs[dstreg1] = result1;
8107 // 1111 0111 0111 1011 Rm1 Rn1 imm4 Rn2; swhw_mov Rm1, Rn1, imm4, Rn2
8108 8.0xf7+8.0x7b+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_mov
8113 int srcreg1, dstreg1, dstreg2;
8117 srcreg1 = translate_rreg (SD_, RM1);
8118 dstreg1 = translate_rreg (SD_, RN1);
8119 dstreg2 = translate_rreg (SD_, RN2);
8121 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8122 | ((State.regs[srcreg1] >> 16) & 0xffff));
8123 State.regs[dstreg2] = EXTEND4 (IMM4);
8124 State.regs[dstreg1] = result1;
8127 // 1111 0111 1000 1011 Rm1 Rn1 Rm2 Rn2; swhw_asr Rm1, Rn1, Rm2, Rn2
8128 8.0xf7+8.0x8b+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_asr
8133 int srcreg1, srcreg2, dstreg1, dstreg2;
8138 srcreg1 = translate_rreg (SD_, RM1);
8139 srcreg2 = translate_rreg (SD_, RM2);
8140 dstreg1 = translate_rreg (SD_, RN1);
8141 dstreg2 = translate_rreg (SD_, RN2);
8143 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8144 | ((State.regs[srcreg1] >> 16) & 0xffff));
8145 temp = State.regs[dstreg2];
8146 temp >>= State.regs[srcreg2];
8147 State.regs[dstreg2] = temp;
8148 State.regs[dstreg1] = result1;
8151 // 1111 0111 1001 1011 Rm1 Rn1 imm4 Rn2; swhw_asr Rm1, Rn1, imm4, Rn2
8152 8.0xf7+8.0x9b+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_asr
8157 int srcreg1, dstreg1, dstreg2;
8162 srcreg1 = translate_rreg (SD_, RM1);
8163 dstreg1 = translate_rreg (SD_, RN1);
8164 dstreg2 = translate_rreg (SD_, RN2);
8166 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8167 | ((State.regs[srcreg1] >> 16) & 0xffff));
8168 temp = State.regs[dstreg2];
8170 State.regs[dstreg2] = temp;
8171 State.regs[dstreg1] = result1;
8174 // 1111 0111 1010 1011 Rm1 Rn1 Rm2 Rn2; swhw_lsr Rm1, Rn1, Rm2, Rn2
8175 8.0xf7+8.0xab+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_lsr
8180 int srcreg1, srcreg2, dstreg1, dstreg2;
8184 srcreg1 = translate_rreg (SD_, RM1);
8185 srcreg2 = translate_rreg (SD_, RM2);
8186 dstreg1 = translate_rreg (SD_, RN1);
8187 dstreg2 = translate_rreg (SD_, RN2);
8189 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8190 | ((State.regs[srcreg1] >> 16) & 0xffff));
8191 State.regs[dstreg2] >>= State.regs[srcreg2];
8192 State.regs[dstreg1] = result1;
8195 // 1111 0111 1011 1011 Rm1 Rn1 imm4 Rn2; swhw_lsr Rm1, Rn1, imm4, Rn2
8196 8.0xf7+8.0xbb+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_lsr
8201 int srcreg1, dstreg1, dstreg2;
8205 srcreg1 = translate_rreg (SD_, RM1);
8206 dstreg1 = translate_rreg (SD_, RN1);
8207 dstreg2 = translate_rreg (SD_, RN2);
8209 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8210 | ((State.regs[srcreg1] >> 16) & 0xffff));
8211 State.regs[dstreg2] >>= IMM4;
8212 State.regs[dstreg1] = result1;
8216 // 1111 0111 1100 1011 Rm1 Rn1 Rm2 Rn2; swhw_asl Rm1, Rn1, Rm2, Rn2
8217 8.0xf7+8.0xcb+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::swhw_asl
8222 int srcreg1, srcreg2, dstreg1, dstreg2;
8226 srcreg1 = translate_rreg (SD_, RM1);
8227 srcreg2 = translate_rreg (SD_, RM2);
8228 dstreg1 = translate_rreg (SD_, RN1);
8229 dstreg2 = translate_rreg (SD_, RN2);
8231 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8232 | ((State.regs[srcreg1] >> 16) & 0xffff));
8233 State.regs[dstreg2] <<= State.regs[srcreg2];
8234 State.regs[dstreg1] = result1;
8237 // 1111 0111 1101 1011 Rm1 Rn1 imm4 Rn2; swhw_asl Rm1, Rn1, imm4, Rn2
8238 8.0xf7+8.0xdb+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::swhw_asl
8243 int srcreg1, dstreg1, dstreg2;
8247 srcreg1 = translate_rreg (SD_, RM1);
8248 dstreg1 = translate_rreg (SD_, RN1);
8249 dstreg2 = translate_rreg (SD_, RN2);
8251 result1 = (((State.regs[srcreg1] & 0xffff) << 16)
8252 | ((State.regs[srcreg1] >> 16) & 0xffff));
8253 State.regs[dstreg2] <<= IMM4;
8254 State.regs[dstreg1] = result1;
8257 // 1111 0111 0000 1100 Rm1 Rn1 Rm2 Rn2; or_add Rm1, Rn1, Rm2, Rn2
8258 8.0xf7+8.0x0c+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_add
8263 int srcreg1, srcreg2, dstreg1, dstreg2;
8267 srcreg1 = translate_rreg (SD_, RM1);
8268 srcreg2 = translate_rreg (SD_, RM2);
8269 dstreg1 = translate_rreg (SD_, RN1);
8270 dstreg2 = translate_rreg (SD_, RN2);
8272 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8273 State.regs[dstreg2] += State.regs[srcreg2];
8274 State.regs[dstreg1] = result1;
8277 // 1111 0111 0001 1100 Rm1 Rn1 imm4 Rn2; or_add Rm1, Rn1, imm4, Rn2
8278 8.0xf7+8.0x1c+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_add
8283 int srcreg1, dstreg1, dstreg2;
8287 srcreg1 = translate_rreg (SD_, RM1);
8288 dstreg1 = translate_rreg (SD_, RN1);
8289 dstreg2 = translate_rreg (SD_, RN2);
8291 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8292 State.regs[dstreg2] += EXTEND4 (IMM4);
8293 State.regs[dstreg1] = result1;
8296 // 1111 0111 0010 1100 Rm1 Rn1 Rm2 Rn2; or_sub Rm1, Rn1, Rm2, Rn2
8297 8.0xf7+8.0x2c+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_sub
8302 int srcreg1, srcreg2, dstreg1, dstreg2;
8306 srcreg1 = translate_rreg (SD_, RM1);
8307 srcreg2 = translate_rreg (SD_, RM2);
8308 dstreg1 = translate_rreg (SD_, RN1);
8309 dstreg2 = translate_rreg (SD_, RN2);
8311 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8312 State.regs[dstreg2] -= State.regs[srcreg2];
8313 State.regs[dstreg1] = result1;
8316 // 1111 0111 0011 1100 Rm1 Rn1 imm4 Rn2; or_sub Rm1, Rn1, imm4, Rn2
8317 8.0xf7+8.0x3c+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_sub
8322 int srcreg1, dstreg1, dstreg2;
8326 srcreg1 = translate_rreg (SD_, RM1);
8327 dstreg1 = translate_rreg (SD_, RN1);
8328 dstreg2 = translate_rreg (SD_, RN2);
8330 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8331 State.regs[dstreg2] -= EXTEND4 (IMM4);
8332 State.regs[dstreg1] = result1;
8335 // 1111 0111 0100 1100 Rm1 Rn1 Rm2 Rn2; or_cmp Rm1, Rn1, Rm2, Rn2
8336 8.0xf7+8.0x4c+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_cmp
8341 int srcreg1, srcreg2, dstreg1, dstreg2;
8344 srcreg1 = translate_rreg (SD_, RM1);
8345 srcreg2 = translate_rreg (SD_, RM2);
8346 dstreg1 = translate_rreg (SD_, RN1);
8347 dstreg2 = translate_rreg (SD_, RN2);
8349 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
8350 State.regs[dstreg1] |= State.regs[srcreg1];
8353 // 1111 0111 0101 1100 Rm1 Rn1 imm4 Rn2; or_cmp Rm1, Rn1, imm4, Rn2
8354 8.0xf7+8.0x5c+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_cmp
8359 int srcreg1, dstreg1, dstreg2;
8362 srcreg1 = translate_rreg (SD_, RM1);
8363 dstreg1 = translate_rreg (SD_, RN1);
8364 dstreg2 = translate_rreg (SD_, RN2);
8366 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
8367 State.regs[dstreg1] |= State.regs[srcreg1];
8370 // 1111 0111 0110 1100 Rm1 Rn1 Rm2 Rn2; or_mov Rm1, Rn1, Rm2, Rn2
8371 8.0xf7+8.0x6c+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_mov
8376 int srcreg1, srcreg2, dstreg1, dstreg2;
8380 srcreg1 = translate_rreg (SD_, RM1);
8381 srcreg2 = translate_rreg (SD_, RM2);
8382 dstreg1 = translate_rreg (SD_, RN1);
8383 dstreg2 = translate_rreg (SD_, RN2);
8385 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8386 State.regs[dstreg2] = State.regs[srcreg2];
8387 State.regs[dstreg1] = result1;
8390 // 1111 0111 0111 1100 Rm1 Rn1 imm4 Rn2; or_mov Rm1, Rn1, imm4, Rn2
8391 8.0xf7+8.0x7c+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_mov
8396 int srcreg1, dstreg1, dstreg2;
8400 srcreg1 = translate_rreg (SD_, RM1);
8401 dstreg1 = translate_rreg (SD_, RN1);
8402 dstreg2 = translate_rreg (SD_, RN2);
8404 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8405 State.regs[dstreg2] = EXTEND4 (IMM4);
8406 State.regs[dstreg1] = result1;
8409 // 1111 0111 1000 1100 Rm1 Rn1 Rm2 Rn2; or_asr Rm1, Rn1, Rm2, Rn2
8410 8.0xf7+8.0x8c+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_asr
8415 int srcreg1, srcreg2, dstreg1, dstreg2;
8420 srcreg1 = translate_rreg (SD_, RM1);
8421 srcreg2 = translate_rreg (SD_, RM2);
8422 dstreg1 = translate_rreg (SD_, RN1);
8423 dstreg2 = translate_rreg (SD_, RN2);
8425 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8426 temp = State.regs[dstreg2];
8427 temp >>= State.regs[srcreg2];
8428 State.regs[dstreg2] = temp;
8429 State.regs[dstreg1] = result1;
8432 // 1111 0111 1001 1100 Rm1 Rn1 imm4 Rn2; or_asr Rm1, Rn1, imm4, Rn2
8433 8.0xf7+8.0x9c+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_asr
8438 int srcreg1, dstreg1, dstreg2;
8443 srcreg1 = translate_rreg (SD_, RM1);
8444 dstreg1 = translate_rreg (SD_, RN1);
8445 dstreg2 = translate_rreg (SD_, RN2);
8447 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8448 temp = State.regs[dstreg2];
8450 State.regs[dstreg2] = temp;
8451 State.regs[dstreg1] = result1;
8454 // 1111 0111 1010 1100 Rm1 Rn1 Rm2 Rn2; or_lsr Rm1, Rn1, Rm2, Rn2
8455 8.0xf7+8.0xac+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_lsr
8460 int srcreg1, srcreg2, dstreg1, dstreg2;
8464 srcreg1 = translate_rreg (SD_, RM1);
8465 srcreg2 = translate_rreg (SD_, RM2);
8466 dstreg1 = translate_rreg (SD_, RN1);
8467 dstreg2 = translate_rreg (SD_, RN2);
8469 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8470 State.regs[dstreg2] >>= State.regs[srcreg2];
8471 State.regs[dstreg1] = result1;
8474 // 1111 0111 1011 1100 Rm1 Rn1 imm4 Rn2; or_lsr Rm1, Rn1, imm4, Rn2
8475 8.0xf7+8.0xbc+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_lsr
8480 int srcreg1, dstreg1, dstreg2;
8484 srcreg1 = translate_rreg (SD_, RM1);
8485 dstreg1 = translate_rreg (SD_, RN1);
8486 dstreg2 = translate_rreg (SD_, RN2);
8488 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8489 State.regs[dstreg2] >>= IMM4;
8490 State.regs[dstreg1] = result1;
8494 // 1111 0111 1100 1100 Rm1 Rn1 Rm2 Rn2; or_asl Rm1, Rn1, Rm2, Rn2
8495 8.0xf7+8.0xcc+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::or_asl
8500 int srcreg1, srcreg2, dstreg1, dstreg2;
8504 srcreg1 = translate_rreg (SD_, RM1);
8505 srcreg2 = translate_rreg (SD_, RM2);
8506 dstreg1 = translate_rreg (SD_, RN1);
8507 dstreg2 = translate_rreg (SD_, RN2);
8509 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8510 State.regs[dstreg2] <<= State.regs[srcreg2];
8511 State.regs[dstreg1] = result1;
8514 // 1111 0111 1101 1100 Rm1 Rn1 imm4 Rn2; or_asl Rm1, Rn1, imm4, Rn2
8515 8.0xf7+8.0xdc+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::or_asl
8520 int srcreg1, dstreg1, dstreg2;
8524 srcreg1 = translate_rreg (SD_, RM1);
8525 dstreg1 = translate_rreg (SD_, RN1);
8526 dstreg2 = translate_rreg (SD_, RN2);
8528 result1 = State.regs[dstreg1] | State.regs[srcreg1];
8529 State.regs[dstreg2] <<= IMM4;
8530 State.regs[dstreg1] = result1;
8533 // 1111 0111 0000 1101 Rm1 Rn1 Rm2 Rn2; sat16_add Rm1, Rn1, Rm2, Rn2
8534 8.0xf7+8.0x0d+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_add
8539 int srcreg1, srcreg2, dstreg1, dstreg2;
8543 srcreg1 = translate_rreg (SD_, RM1);
8544 srcreg2 = translate_rreg (SD_, RM2);
8545 dstreg1 = translate_rreg (SD_, RN1);
8546 dstreg2 = translate_rreg (SD_, RN2);
8548 if (State.regs[srcreg1] >= 0x7fff)
8550 else if (State.regs[srcreg1] <= 0xffff8000)
8551 result1 = 0xffff8000;
8553 result1 = State.regs[srcreg1];
8555 State.regs[dstreg2] += State.regs[srcreg2];
8556 State.regs[dstreg1] = result1;
8559 // 1111 0111 0001 1101 Rm1 Rn1 imm4 Rn2; sat16_add Rm1, Rn1, imm4, Rn2
8560 8.0xf7+8.0x1d+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_add
8565 int srcreg1, dstreg1, dstreg2;
8569 srcreg1 = translate_rreg (SD_, RM1);
8570 dstreg1 = translate_rreg (SD_, RN1);
8571 dstreg2 = translate_rreg (SD_, RN2);
8573 if (State.regs[srcreg1] >= 0x7fff)
8575 else if (State.regs[srcreg1] <= 0xffff8000)
8576 result1 = 0xffff8000;
8578 result1 = State.regs[srcreg1];
8580 State.regs[dstreg2] += EXTEND4 (IMM4);
8581 State.regs[dstreg1] = result1;
8584 // 1111 0111 0010 1101 Rm1 Rn1 Rm2 Rn2; sat16_sub Rm1, Rn1, Rm2, Rn2
8585 8.0xf7+8.0x2d+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_sub
8590 int srcreg1, srcreg2, dstreg1, dstreg2;
8594 srcreg1 = translate_rreg (SD_, RM1);
8595 srcreg2 = translate_rreg (SD_, RM2);
8596 dstreg1 = translate_rreg (SD_, RN1);
8597 dstreg2 = translate_rreg (SD_, RN2);
8599 if (State.regs[srcreg1] >= 0x7fff)
8601 else if (State.regs[srcreg1] <= 0xffff8000)
8602 result1 = 0xffff8000;
8604 result1 = State.regs[srcreg1];
8606 State.regs[dstreg2] -= State.regs[srcreg2];
8607 State.regs[dstreg1] = result1;
8610 // 1111 0111 0011 1101 Rm1 Rn1 imm4 Rn2; sat16_sub Rm1, Rn1, imm4, Rn2
8611 8.0xf7+8.0x3d+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_sub
8616 int srcreg1, dstreg1, dstreg2;
8620 srcreg1 = translate_rreg (SD_, RM1);
8621 dstreg1 = translate_rreg (SD_, RN1);
8622 dstreg2 = translate_rreg (SD_, RN2);
8624 if (State.regs[srcreg1] >= 0x7fff)
8626 else if (State.regs[srcreg1] <= 0xffff8000)
8627 result1 = 0xffff8000;
8629 result1 = State.regs[srcreg1];
8631 State.regs[dstreg2] -= EXTEND4 (IMM4);
8632 State.regs[dstreg1] = result1;
8635 // 1111 0111 0100 1101 Rm1 Rn1 Rm2 Rn2; sat16_cmp Rm1, Rn1, Rm2, Rn2
8636 8.0xf7+8.0x4d+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_cmp
8641 int srcreg1, srcreg2, dstreg1, dstreg2;
8644 srcreg1 = translate_rreg (SD_, RM1);
8645 srcreg2 = translate_rreg (SD_, RM2);
8646 dstreg1 = translate_rreg (SD_, RN1);
8647 dstreg2 = translate_rreg (SD_, RN2);
8649 genericCmp (State.regs[srcreg2], State.regs[dstreg2]);
8650 if (State.regs[srcreg1] >= 0x7fff)
8651 State.regs[dstreg1] = 0x7fff;
8652 else if (State.regs[srcreg1] <= 0xffff8000)
8653 State.regs[dstreg1] = 0xffff8000;
8655 State.regs[dstreg1] = State.regs[srcreg1];
8658 // 1111 0111 0101 1101 Rm1 Rn1 imm4 Rn2; sat16_cmp Rm1, Rn1, imm4, Rn2
8659 8.0xf7+8.0x5d+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_cmp
8664 int srcreg1, dstreg1, dstreg2;
8667 srcreg1 = translate_rreg (SD_, RM1);
8668 dstreg1 = translate_rreg (SD_, RN1);
8669 dstreg2 = translate_rreg (SD_, RN2);
8671 genericCmp (EXTEND4 (IMM4), State.regs[dstreg2]);
8672 if (State.regs[srcreg1] >= 0x7fff)
8673 State.regs[dstreg1] = 0x7fff;
8674 else if (State.regs[srcreg1] <= 0xffff8000)
8675 State.regs[dstreg1] = 0xffff8000;
8677 State.regs[dstreg1] = State.regs[srcreg1];
8680 // 1111 0111 0110 1101 Rm1 Rn1 Rm2 Rn2; sat16_mov Rm1, Rn1, Rm2, Rn2
8681 8.0xf7+8.0x6d+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_mov
8686 int srcreg1, srcreg2, dstreg1, dstreg2;
8690 srcreg1 = translate_rreg (SD_, RM1);
8691 srcreg2 = translate_rreg (SD_, RM2);
8692 dstreg1 = translate_rreg (SD_, RN1);
8693 dstreg2 = translate_rreg (SD_, RN2);
8695 if (State.regs[srcreg1] >= 0x7fff)
8697 else if (State.regs[srcreg1] <= 0xffff8000)
8698 result1 = 0xffff8000;
8700 result1 = State.regs[srcreg1];
8702 State.regs[dstreg2] = State.regs[srcreg2];
8703 State.regs[dstreg1] = result1;
8706 // 1111 0111 0111 1101 Rm1 Rn1 imm4 Rn2; sat16_mov Rm1, Rn1, imm4, Rn2
8707 8.0xf7+8.0x7d+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_mov
8712 int srcreg1, dstreg1, dstreg2;
8716 srcreg1 = translate_rreg (SD_, RM1);
8717 dstreg1 = translate_rreg (SD_, RN1);
8718 dstreg2 = translate_rreg (SD_, RN2);
8720 if (State.regs[srcreg1] >= 0x7fff)
8722 else if (State.regs[srcreg1] <= 0xffff8000)
8723 result1 = 0xffff8000;
8725 result1 = State.regs[srcreg1];
8727 State.regs[dstreg2] = EXTEND4 (IMM4);
8728 State.regs[dstreg1] = result1;
8731 // 1111 0111 1000 1101 Rm1 Rn1 Rm2 Rn2; sat16_asr Rm1, Rn1, Rm2, Rn2
8732 8.0xf7+8.0x8d+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_asr
8737 int srcreg1, srcreg2, dstreg1, dstreg2;
8742 srcreg1 = translate_rreg (SD_, RM1);
8743 srcreg2 = translate_rreg (SD_, RM2);
8744 dstreg1 = translate_rreg (SD_, RN1);
8745 dstreg2 = translate_rreg (SD_, RN2);
8747 if (State.regs[srcreg1] >= 0x7fff)
8749 else if (State.regs[srcreg1] <= 0xffff8000)
8750 result1 = 0xffff8000;
8752 result1 = State.regs[srcreg1];
8754 temp = State.regs[dstreg2];
8755 temp >>= State.regs[srcreg2];
8756 State.regs[dstreg2] = temp;
8757 State.regs[dstreg1] = result1;
8760 // 1111 0111 1001 1101 Rm1 Rn1 imm4 Rn2; sat16_asr Rm1, Rn1, imm4, Rn2
8761 8.0xf7+8.0x9d+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_asr
8766 int srcreg1, dstreg1, dstreg2;
8771 srcreg1 = translate_rreg (SD_, RM1);
8772 dstreg1 = translate_rreg (SD_, RN1);
8773 dstreg2 = translate_rreg (SD_, RN2);
8775 if (State.regs[srcreg1] >= 0x7fff)
8777 else if (State.regs[srcreg1] <= 0xffff8000)
8778 result1 = 0xffff8000;
8780 result1 = State.regs[srcreg1];
8782 temp = State.regs[dstreg2];
8784 State.regs[dstreg2] = temp;
8785 State.regs[dstreg1] = result1;
8788 // 1111 0111 1010 1101 Rm1 Rn1 Rm2 Rn2; sat16_lsr Rm1, Rn1, Rm2, Rn2
8789 8.0xf7+8.0xad+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_lsr
8794 int srcreg1, srcreg2, dstreg1, dstreg2;
8798 srcreg1 = translate_rreg (SD_, RM1);
8799 srcreg2 = translate_rreg (SD_, RM2);
8800 dstreg1 = translate_rreg (SD_, RN1);
8801 dstreg2 = translate_rreg (SD_, RN2);
8803 if (State.regs[srcreg1] >= 0x7fff)
8805 else if (State.regs[srcreg1] <= 0xffff8000)
8806 result1 = 0xffff8000;
8808 result1 = State.regs[srcreg1];
8810 State.regs[dstreg2] >>= State.regs[srcreg2];
8811 State.regs[dstreg1] = result1;
8814 // 1111 0111 1011 1101 Rm1 Rn1 imm4 Rn2; sat16_lsr Rm1, Rn1, imm4, Rn2
8815 8.0xf7+8.0xbd+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_lsr
8820 int srcreg1, dstreg1, dstreg2;
8824 srcreg1 = translate_rreg (SD_, RM1);
8825 dstreg1 = translate_rreg (SD_, RN1);
8826 dstreg2 = translate_rreg (SD_, RN2);
8828 if (State.regs[srcreg1] >= 0x7fff)
8830 else if (State.regs[srcreg1] <= 0xffff8000)
8831 result1 = 0xffff8000;
8833 result1 = State.regs[srcreg1];
8835 State.regs[dstreg2] >>= IMM4;
8836 State.regs[dstreg1] = result1;
8840 // 1111 0111 1100 1101 Rm1 Rn1 Rm2 Rn2; sat16_asl Rm1, Rn1, Rm2, Rn2
8841 8.0xf7+8.0xcd+4.RM1,4.RN1+4.RM2,4.RN2!RN1:D2:::sat16_asl
8846 int srcreg1, srcreg2, dstreg1, dstreg2;
8850 srcreg1 = translate_rreg (SD_, RM1);
8851 srcreg2 = translate_rreg (SD_, RM2);
8852 dstreg1 = translate_rreg (SD_, RN1);
8853 dstreg2 = translate_rreg (SD_, RN2);
8855 if (State.regs[srcreg1] >= 0x7fff)
8857 else if (State.regs[srcreg1] <= 0xffff8000)
8858 result1 = 0xffff8000;
8860 result1 = State.regs[srcreg1];
8862 State.regs[dstreg2] <<= State.regs[srcreg2];
8863 State.regs[dstreg1] = result1;
8866 // 1111 0111 1101 1101 Rm1 Rn1 imm4 Rn2; sat16_asl Rm1, Rn1, imm4, Rn2
8867 8.0xf7+8.0xdd+4.RM1,4.RN1+4.IMM4,4.RN2!RN1:D2b:::sat16_asl
8872 int srcreg1, dstreg1, dstreg2;
8876 srcreg1 = translate_rreg (SD_, RM1);
8877 dstreg1 = translate_rreg (SD_, RN1);
8878 dstreg2 = translate_rreg (SD_, RN2);
8880 if (State.regs[srcreg1] >= 0x7fff)
8882 else if (State.regs[srcreg1] <= 0xffff8000)
8883 result1 = 0xffff8000;
8885 result1 = State.regs[srcreg1];
8887 State.regs[dstreg2] <<= IMM4;
8888 State.regs[dstreg1] = result1;
8891 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0000; mov_llt (Rm+,imm4),Rn
8892 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x0:D2:::mov_llt
8900 srcreg = translate_rreg (SD_, RM);
8901 dstreg = translate_rreg (SD_, RN);
8903 State.regs[dstreg] = load_word (State.regs[srcreg]);
8904 State.regs[srcreg] += EXTEND4 (IMM4);
8906 if (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))
8908 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
8913 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0001; mov_lgt (Rm+,imm4),Rn
8914 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x1:D2:::mov_lgt
8922 srcreg = translate_rreg (SD_, RM);
8923 dstreg = translate_rreg (SD_, RN);
8925 State.regs[dstreg] = load_word (State.regs[srcreg]);
8926 State.regs[srcreg] += EXTEND4 (IMM4);
8929 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))))
8931 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
8936 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0010; mov_lge (Rm+,imm4),Rn
8937 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x2:D2:::mov_lge
8945 srcreg = translate_rreg (SD_, RM);
8946 dstreg = translate_rreg (SD_, RN);
8948 State.regs[dstreg] = load_word (State.regs[srcreg]);
8949 State.regs[srcreg] += EXTEND4 (IMM4);
8951 if (!(((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
8953 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
8958 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0011; mov_lle (Rm+,imm4),Rn
8959 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x3:D2:::mov_lle
8967 srcreg = translate_rreg (SD_, RM);
8968 dstreg = translate_rreg (SD_, RN);
8970 State.regs[dstreg] = load_word (State.regs[srcreg]);
8971 State.regs[srcreg] += EXTEND4 (IMM4);
8974 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
8976 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
8981 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0100; mov_lcs (Rm+,imm4),Rn
8982 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x4:D2:::mov_lcs
8990 srcreg = translate_rreg (SD_, RM);
8991 dstreg = translate_rreg (SD_, RN);
8993 State.regs[dstreg] = load_word (State.regs[srcreg]);
8994 State.regs[srcreg] += EXTEND4 (IMM4);
8998 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9003 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0101; mov_lhi (Rm+,imm4),Rn
9004 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x5:D2:::mov_lhi
9012 srcreg = translate_rreg (SD_, RM);
9013 dstreg = translate_rreg (SD_, RN);
9015 State.regs[dstreg] = load_word (State.regs[srcreg]);
9016 State.regs[srcreg] += EXTEND4 (IMM4);
9018 if (!(((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0))
9020 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9025 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0110; mov_lcc (Rm+,imm4),Rn
9026 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x6:D2:::mov_lcc
9034 srcreg = translate_rreg (SD_, RM);
9035 dstreg = translate_rreg (SD_, RN);
9037 State.regs[dstreg] = load_word (State.regs[srcreg]);
9038 State.regs[srcreg] += EXTEND4 (IMM4);
9042 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9047 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0111; mov_lls (Rm+,imm4),Rn
9048 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x7:D2:::mov_lls
9056 srcreg = translate_rreg (SD_, RM);
9057 dstreg = translate_rreg (SD_, RN);
9059 State.regs[dstreg] = load_word (State.regs[srcreg]);
9060 State.regs[srcreg] += EXTEND4 (IMM4);
9062 if (((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0)
9064 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9069 // 1111 0111 1110 0000 Rm1 Rn1 imm4 1000; mov_leq (Rm+,imm4),Rn
9070 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x8:D2:::mov_leq
9078 srcreg = translate_rreg (SD_, RM);
9079 dstreg = translate_rreg (SD_, RN);
9081 State.regs[dstreg] = load_word (State.regs[srcreg]);
9082 State.regs[srcreg] += EXTEND4 (IMM4);
9086 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9091 // 1111 0111 1110 0000 Rm1 Rn1 imm4 1001; mov_lne (Rm+,imm4),Rn
9092 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0x9:D2:::mov_lne
9100 srcreg = translate_rreg (SD_, RM);
9101 dstreg = translate_rreg (SD_, RN);
9103 State.regs[dstreg] = load_word (State.regs[srcreg]);
9104 State.regs[srcreg] += EXTEND4 (IMM4);
9108 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9113 // 1111 0111 1110 0000 Rm1 Rn1 imm4 1010; mov_lra (Rm+,imm4),Rn
9114 8.0xf7+8.0xe0+4.RN,4.RM!RN+4.IMM4,4.0xa:D2:::mov_lra
9122 srcreg = translate_rreg (SD_, RM);
9123 dstreg = translate_rreg (SD_, RN);
9125 State.regs[dstreg] = load_word (State.regs[srcreg]);
9126 State.regs[srcreg] += EXTEND4 (IMM4);
9128 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
9132 :include::am33_2:am33-2.igen