1 /* m32c.opc --- semantics for m32c opcodes. -*- mode: c -*-
3 Copyright (C) 2005, 2007 Free Software Foundation, Inc.
4 Contributed by Red Hat, Inc.
6 This file is part of the GNU simulators.
8 The GNU simulators are free software; you can redistribute them and/or
9 modify them under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 The GNU simulators are distributed in the hope that they will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with the GNU simulators; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 #define AU __attribute__((unused))
34 #define tprintf if (trace) printf
50 #define M32C_ONLY() /* FIXME: add something here */
52 #define GETBYTE() (op[opi++] = getbyte())
54 #define UNSUPPORTED() unsupported("unsupported", orig_pc)
55 #define NOTYET() unsupported("unimplemented", orig_pc)
58 unsupported (char *tag, int orig_pc)
61 printf("%s opcode at %08x\n", tag, orig_pc);
66 printf(" %s", bits(b>>4, 4));
67 printf(" %s", bits(b, 4));
74 printf(" %02x", mem_get_pc ());
88 rv = mem_get_qi (get_reg(pc));
91 rv = mem_get_hi (get_reg(pc));
94 rv = mem_get_psi (get_reg(pc));
97 rv = mem_get_si (get_reg(pc));
104 #define IMM4() (immm >= 8 ? 7 - immm : immm + 1)
106 #define NO_PREFIX() PREFIX(0,0,0)
108 /* Indicate which sorts of prefixes are allowed for the current
111 prefix (src_allowed, dest_allowed, index_bytewidth)
113 /* At the moment, we don't do anything with this information. We
114 just wanted to get the information entered in some
115 machine-readable form while we were going through all the
119 #define MATH_OP(dc,s,c,op) \
123 mb = s & b2mask[dc.bytes]; \
124 ll = (long long)ma op (long long)mb op c; \
125 tprintf("0x%x " #op " 0x%x " #op " 0x%x = 0x%llx\n", ma, mb, c, ll); \
126 ma = sign_ext (ma, dc.bytes * 8); \
127 mb = sign_ext (s, dc.bytes * 8); \
129 tprintf("%d " #op " %d " #op " %d = %d\n", ma, mb, c, v); \
130 set_oszc (v, dc.bytes, ll > ((1 op 1) ? b2mask[dc.bytes] : 0)); \
134 #define LOGIC_OP(dc,s,op) \
138 mb = s & b2mask[dc.bytes]; \
140 tprintf("0x%x " #op " 0x%x = 0x%x\n", ma, mb, v); \
141 set_sz (v, dc.bytes); \
145 #define BIT_OP(dc,bit,expr) \
146 b = get_bit2 (dc, bitindex == -1 ? bit : bitindex); \
148 tprintf ("b=%d, bit=%d, carry=%d, %s = %d\n", \
149 b, bitindex == -1 ? bit : bitindex, carry, #expr, v); \
150 put_bit2 (dc, bitindex == -1 ? bit : bitindex, v);
152 #define BIT_OPC(dc,bit,expr) \
153 b = get_bit2 (dc, bitindex == -1 ? bit : bitindex); \
155 tprintf ("b=%d, bit=%d, carry=%d, %s = %d\n", \
156 b, bitindex == -1 ? bit : bitindex, carry, #expr, v); \
159 #define carry (FLAG_C ? 1 : 0)
162 cmp (int d, int s, int bytes)
166 b = sign_ext (d, bytes*8) - sign_ext (s, bytes*8);
167 tprintf ("cmp: %x - %x = %08x, %x - %x = %d\n",
169 sign_ext(d,bytes*8), sign_ext(s,bytes*8), b);
173 if (b & b2signbit[bytes])
175 if ((d & b2mask[bytes]) >= (s & b2mask[bytes]))
177 if (b < b2minsigned[bytes] || b > b2maxsigned[bytes])
180 set_flags (FLAGBIT_Z | FLAGBIT_S | FLAGBIT_O | FLAGBIT_C, f);
184 dadd_op (int ddd, int dd, int sss, int ss, int imm, int add, int cy, int w)
193 sc = decode_src23 (sss, ss, w+1);
196 dc = decode_dest23 (ddd, dd, w+1);
204 tprintf("decimal: %d %s %d", a, add?"+":"-", b);
206 tprintf(" c=%d", carry);
213 cy = res > (w ? 9999 : 99);
222 res += w ? 10000 : 100;
225 res = int2bcd (res, w);
226 tprintf(" = %x\n", res);
228 set_szc (res, w+1, cy);
232 #define DADDV(A,C) dadd_op(ddd, dd, sss, ss, 0, A, C, w)
233 #define DADDI(A,C) dadd_op(ddd, dd, 0, 0, 1, A, C, w)
236 div_op (int sss, int ss, int u, int x, int bytes)
245 sc = decode_dest23 (sss, ss, bytes);
249 v = get_reg (bytes > 1 ? r2r0 : r0);
253 /* FIXME? do we sign extend a0/a1 to .L? Docs say zero extend. */
254 s = sign_ext (s, bytes*8);
255 v = sign_ext (v, bytes*8);
260 set_flags (FLAGBIT_O, FLAGBIT_O);
266 a = (unsigned int)v / (unsigned int)s;
267 b = (unsigned int)v % (unsigned int)s;
283 tprintf ("%d / %d = %d rem %d\n", v, s, a, b);
284 if ((!u && (a > b2maxsigned[bytes]
285 || a < b2minsigned[bytes]))
286 || (u && (a > b2mask[bytes])))
287 set_flags (FLAGBIT_O, FLAGBIT_O);
289 set_flags (FLAGBIT_O, 0);
308 index_op (int sss, int ss, int do_s, int do_d, int scale, int w)
310 srcdest sc = decode_src23 (sss, ss, w+1);
311 int v = get_src (sc) * scale;
312 tprintf("%d = %d * %d, %d %d\n", v, get_src(sc), scale, do_s, do_d);
313 decode_index (do_s * v, do_d * v);
315 #define INDEXOP(scale,do_s,do_d) \
316 index_op (sss, ss, do_s, do_d, scale, w); goto next_opcode
319 rot_op (srcdest sd, int rotc, int count)
321 int mask = (sd.bytes == 2) ? 0xffff : 0xff;
322 int msb = (sd.bytes == 2) ? 0x8000 : 0x80;
323 int v = get_src (sd);
326 tprintf("%s %x by %d\n", rotc ? "rotc" : "rot", v, count);
327 tprintf (": %s %d\n", bits(v, 8*sd.bytes), c);
330 ct = (v & msb) ? 1 : 0;
335 tprintf (": %s %d\n", bits(v, 8*sd.bytes), c);
342 v |= (rotc ? c : ct) * msb;
344 tprintf (": %s %d\n", bits(v, 8*sd.bytes), c);
348 set_szc (v, sd.bytes, c);
352 shift_op (srcdest sd, int arith, int count, int setc)
354 int mask = (sd.bytes == 2) ? 0xffff : 0xff;
355 int msb = (sd.bytes == 2) ? 0x8000 : 0x80;
356 int v = get_src (sd);
366 tprintf("%s %x by %d\n", arith ? "sha" : "shl", v, count);
367 tprintf (": %s %d %d\n", bits(v, 8*sd.bytes), c, o);
370 c = (v & msb) ? 1 : 0;
373 if (c != ((v & msb) ? 1 : 0))
375 tprintf (": %s %d %d\n", bits(v, 8*sd.bytes), c, o);
382 v = (v & msb) | (v >> 1);
384 v = (v >> 1) & (msb - 1);
385 tprintf (": %s %d %d\n", bits(v, 8*sd.bytes), c, o);
389 set_sz (v, sd.bytes);
392 set_flags (FLAGBIT_O, o ? FLAGBIT_O : 0);
398 unsigned char op[40];
406 int t0, t1=0, t2, t3=0;
409 step_result = M32C_MAKE_STEPPED ();
411 decode_indirect (0, 0);
416 orig_pc = get_reg (pc);
418 tprintf("trace: decode pc = %06x\n", orig_pc);
420 /** VARY sss 000 001 010 011 100 */
421 /** VARY ddd 000 001 010 011 100 */
423 /** 0000 1001 indirect dest */
425 decode_indirect (0, 1);
428 /** 0100 0001 indirect src */
430 decode_indirect (1, 0);
433 /** 0100 1001 indirect src and dest */
435 decode_indirect (1, 1);
438 /** 1010 ddd w dd01 1111 ABS.size dest */
441 dc = decode_dest23 (ddd, dd, w+1);
442 v = sign_ext (get_src (dc), w?16:8);
444 tprintf("abs(%d) = %d\n", v, a);
448 /** 0000 0001 1000 ddd w dd10 1110 ADC.size #IMM,dest */
451 dc = decode_dest23 (ddd, dd, w+1);
453 MATH_OP (dc, imm, carry, +);
455 /** 0000 0001 1sss ddd w dd ss 0100 ADC.size src,dest */
458 sc = decode_src23 (sss, ss, w+1);
459 dc = decode_dest23 (ddd, dd, w+1);
461 MATH_OP (dc, b, carry, +);
463 /** 1011 ddd w dd01 1110 ADCF.size dest */
466 dc = decode_dest23 (ddd, dd, w+1);
467 MATH_OP (dc, 0, carry, +);
469 /** 1000 ddd w dd10 1110 ADD.size:G #IMM,dest */
472 dc = decode_dest23(ddd, dd, w+1);
474 MATH_OP (dc, imm, 0, +);
476 /** 1000 ddd0 dd11 0001 ADD.L:G #IMM,dest */
479 dc = decode_dest23(ddd, dd, 4);
481 MATH_OP (dc, imm, 0, +);
483 /** 111L ddd w dd11 immm ADD.size:Q #IMM,dest */
486 dc = decode_dest23(ddd, dd, L ? 4 : (w+1));
487 imm = sign_ext (immm, 4);
488 MATH_OP (dc, imm, 0, +);
490 /** 00dd 011w ADD.size:S #IMM,dest */
493 dc = decode_dest2(dd, w+1);
495 MATH_OP (dc, imm, 0, +);
497 /** 10i0 110d ADD.L:S #IMM,A0/A1 */
500 dc = reg_sd (d ? a1 : a0);
502 MATH_OP (dc, imm, 0, +);
504 /** 1sss ddd w dd ss 1000 ADD.size:G src,dest */
507 sc = decode_src23(sss, ss, w+1);
508 dc = decode_dest23(ddd, dd, w+1);
510 MATH_OP (dc, b, 0, +);
512 /** 1sss ddd1 dd ss 0010 ADD.L:G src,dest */
515 sc = decode_src23(sss, ss, 4);
516 dc = decode_dest23(ddd, dd, 4);
518 MATH_OP (dc, b, 0, +);
520 /** 1011 0110 0001 0011 ADD.L:G #IMM16,SP */
524 b = sign_ext (IMM(2), 16);
525 MATH_OP (dc, b, 0, +);
527 /** 01ii 001i ADD.L:Q #IMM3,SP */
532 MATH_OP (dc, b, 0, +);
534 /** 1011 0110 0000 0011 ADD.L:S #IMM8,SP */
538 b = sign_ext (IMM(1), 8);
539 MATH_OP (dc, b, 0, +);
541 /** 1000 ddd0 dd01 0001 ADDX #IMM,dest */
544 dc = decode_dest23(ddd, dd, 4);
545 imm = sign_ext (IMM(1), 8);
546 MATH_OP (dc, imm, 0, +);
548 /** 1sss ddd0 dd ss 0010 ADDX src,dest */
551 sc = decode_src23(sss, ss, 1);
552 dc = decode_dest23(ddd, dd, 4);
553 b = sign_ext (get_src (sc), 8);
554 MATH_OP (dc, b, 0, +);
556 /** 1111 ddd w dd01 immm ADJNZ.size #IMM,dest,label */
559 dc = decode_dest23 (ddd, dd, w+1);
561 imm = sign_ext(immm, 4);
562 tprintf("%d + %d = %d\n", v, imm, v+imm);
565 a = sign_ext (IMM(1), 8);
566 if ((v & (w ? 0xffff : 0xff)) != 0)
568 tprintf("jmp: %x + 2 + %d = ", get_reg (pc), a);
569 put_reg (pc, orig_pc + 2 + a);
570 tprintf("%x\n", get_reg (pc));
573 /** 1000 ddd w dd11 1111 AND.size:G #IMM,dest */
576 dc = decode_dest23(ddd, dd, w+1);
578 LOGIC_OP (dc, imm, &);
580 /** 01dd 110w AND.size:S #IMM,dest */
583 dc = decode_dest2(dd, w+1);
585 LOGIC_OP (dc, imm, &);
587 /** 1sss ddd w dd ss 1101 AND.size:G src,dest */
590 sc = decode_src23(sss, ss, w+1);
591 dc = decode_dest23(ddd, dd, w+1);
595 /** 0000 0001 1101 sss0 ss00 1bit BAND src */
597 sc = decode_src23 (sss, ss, 1);
598 BIT_OPC (sc, bit, b & carry);
600 /** 1101 ddd0 dd11 0bit BCLR dest */
602 dc = decode_dest23 (ddd, dd, 1);
605 /** 1100 ddd w dd10 1110 BITINDEX.size src */
608 dc = decode_dest23 (ddd, dd, w+1);
609 bitindex = get_src (dc);
610 tprintf ("bitindex set to %d\n", bitindex);
613 /** 1101 ddd0 dd01 0bit BMcnd dest */
616 dc = decode_dest23 (ddd, dd, 1);
617 if (condition_true (IMM (1)))
618 put_bit2 (dc, bit, 1);
620 put_bit2 (dc, bit, 0);
622 /** 1101 1001 0c10 1cnd BMcnd C */
625 if (condition_true (c * 8 + cnd))
630 /** 0000 0001 1101 sss0 ss01 1bit BNAND src */
633 sc = decode_src23 (sss, ss, 1);
634 BIT_OPC (sc, bit, !b & carry);
636 /** 0000 0001 1101 sss0 ss11 0bit BNOR src */
639 sc = decode_src23 (sss, ss, 1);
640 BIT_OPC (sc, bit, !b | carry);
642 /** 1101 ddd0 dd01 1bit BNOT dest */
645 dc = decode_dest23 (ddd, dd, 1);
646 BIT_OP (dc, bit, !b);
648 /** 0000 0001 1101 sss0 ss00 0bit BNTST src */
651 sc = decode_dest23 (sss, ss, 1);
652 b = get_bit2 (sc, bit);
655 /** 0000 0001 1101 sss0 ss11 1bit BNXOR src */
658 sc = decode_src23 (sss, ss, 1);
659 BIT_OPC (sc, bit, !b ^ carry);
661 /** 0000 0001 1101 sss0 ss10 0bit BOR src */
664 sc = decode_src23 (sss, ss, 1);
665 BIT_OPC (sc, bit, b | carry);
669 /* We report the break to our caller with the PC still pointing at the
670 breakpoint instruction. */
671 put_reg (pc, orig_pc);
674 return M32C_MAKE_HIT_BREAK ();
679 printf("[break2]\n");
680 return M32C_MAKE_HIT_BREAK ();
682 /** 1101 ddd0 dd11 1bit BSET dest */
684 dc = decode_dest23 (ddd, dd, 1);
687 /** 1101 sss0 ss00 0bit BTST:G src */
690 sc = decode_src23 (sss, ss, 1);
691 b = get_bit2 (sc, bit);
694 /** 00bb 101b BTST:S src */
696 sc = decode_src23 (3, 3, 1); /* bit,base:19 */
697 b = get_bit2 (sc, bb*2 + b);
700 /** 1101 ddd0 dd10 0bit BTSTC dest */
703 sc = decode_dest23 (ddd, dd, 1);
704 b = get_bit2 (sc, bit);
706 put_bit2 (sc, bit, 0);
708 /** 1101 ddd0 dd10 1bit BTSTS dest */
711 sc = decode_dest23 (ddd, dd, 1);
712 b = get_bit2 (sc, bit);
714 put_bit2 (sc, bit, 1);
716 /** 0000 0001 1101 sss0 ss10 1bit BXOR src */
719 sc = decode_src23 (sss, ss, 1);
720 BIT_OPC (sc, bit, b ^ carry);
722 /** 0000 0001 1000 ddd w dd11 1110 CLIP.size #IMM1,#IMM2,dest */
725 dc = decode_dest23 (ddd, dd, w+1);
726 a = sign_ext (IMM(w+1), w*8+8);
727 b = sign_ext (IMM(w+1), w*8+8);
728 v = sign_ext (get_src (dc), w*8+8);
729 tprintf("clip %d <= %d <= %d : ", a, v, b);
737 /** 1001 ddd w dd10 1110 CMP.size:G #IMM,dest */
740 dc = decode_dest23 (ddd, dd, w+1);
745 /** 1010 ddd0 dd11 0001 CMP.L:G #IMM32,dest */
748 dc = decode_dest23 (ddd, dd, 4);
753 /** 1110 ddd w dd01 immm CMP.size:Q #IMM,dest */
756 dc = decode_dest23 (ddd, dd, w+1);
758 immm = sign_ext (immm, 4);
761 /** 01dd 011w CMP.size:S #IMM,dest */
764 dc = decode_dest2 (dd, w+1);
766 imm = sign_ext (IMM(w+1),w*8+8);
769 /** 1sss ddd w dd ss 0110 CMP.size:G src,dest */
772 sc = decode_src23 (sss, ss, w+1);
773 dc = decode_dest23 (ddd, dd, w+1);
778 /** 1sss ddd1 dd ss 0001 CMP.L:G src,dest */
781 sc = decode_src23 (sss, ss, 4);
782 dc = decode_dest23 (ddd, dd, 4);
787 /** 01dd 000w CMP.size:S src,R0/R0L */
790 dc = decode_dest2 (dd, w+1);
791 a = get_reg (w ? r0 : r0l);
795 /** 1010 ddd0 dd01 0001 CMPX #IMM,dest */
798 dc = decode_dest23 (ddd, dd, 4);
800 imm = sign_ext (IMM(1), 8);
803 /** 0000 0001 1000 ddd w dd00 1110 DADC.size #IMM,dest */
807 /** 0000 0001 1sss ddd w dd ss 1000 DADC.size src,dest */
811 /** 0000 0001 1000 ddd w dd01 1110 DADD.size #IMM,dest */
815 /** 0000 0001 1sss ddd w dd ss 0000 DADD.size src,dest */
819 /** 1011 ddd w dd00 1110 DEC.size dest */
822 dc = decode_dest23 (ddd, dd, w+1);
825 tprintf ("%x -- = %x\n", a, v);
829 /** 1011 0000 010w 0011 DIV.size #IMM */
832 div_op (-1, 0, 0, 0, w+1);
834 /** 1000 sss w ss01 1110 DIV.size src */
837 div_op (sss, ss, 0, 0, w+1);
839 /** 0000 0001 1010 sss1 ss01 1111 DIV.L src */
843 div_op (sss, ss, 0, 0, 4);
845 /** 1011 0000 000w 0011 DIVU.size #IMM */
848 div_op (-1, 0, 1, 0, w+1);
850 /** 1000 sss w ss00 1110 DIVU.size src */
853 div_op (sss, ss, 1, 0, w+1);
855 /** 0000 0001 1010 sss1 ss00 1111 DIVU.L src */
859 div_op (sss, ss, 1, 0, 4);
861 /** 1011 0010 010w 0011 DIVX.size #IMM */
864 div_op (-1, 0, 0, 1, w+1);
866 /** 1001 sss w ss01 1110 DIVX.size src */
869 div_op (sss, ss, 0, 1, w+1);
871 /** 0000 0001 1010 sss1 ss10 1111 DIVX.L src */
875 div_op (sss, ss, 0, 1, 4);
877 /** 0000 0001 1001 ddd w dd00 1110 DSBB.size #IMM,dest */
881 /** 0000 0001 1sss ddd w dd ss 1010 DSBB.size src,dest */
885 /** 0000 0001 1001 ddd w dd01 1110 DSUB.size #IMM,dest */
889 /** 0000 0001 1sss ddd w dd ss 0010 DSUB.size src,dest */
893 /** 1110 1100 ENTER #IMM */
896 put_reg (sp, get_reg (sp) - 4);
897 mem_put_si (get_reg (sp), get_reg (fb));
898 put_reg (fb, get_reg (sp));
899 put_reg (sp, get_reg (sp) - imm);
901 /** 1111 1100 EXITD */
903 put_reg (sp, get_reg (fb));
904 put_reg (fb, mem_get_si (get_reg (sp)));
905 put_reg (sp, get_reg (sp) + 4);
906 put_reg (pc, mem_get_si (get_reg (sp)));
907 put_reg (sp, get_reg (sp) + 4);
909 /** 1100 ddd w dd01 1110 EXTS.size dest */
912 dc = decode_dest23 (ddd, dd, w+1);
913 v = sign_ext (get_src (dc), (w+1)*8);
918 /** 0000 0001 1sss ddd0 dd ss 0111 EXTS.B src,dest */
921 sc = decode_src23 (sss, ss, 1);
922 dc = decode_dest23 (ddd, dd, 2);
923 v = sign_ext (get_src (sc), 8);
927 /** 0000 0001 1sss ddd0 dd ss 1011 EXTZ src,dest */
930 sc = decode_src23 (sss, ss, 1);
931 dc = decode_dest23 (ddd, dd, 2);
936 /** 1101 0011 1110 1dst FCLR dest */
938 set_flags (1 << dst, 0);
940 /** 1001 1111 FREIT */
944 /** 1101 0001 1110 1dst FSET dest */
946 set_flags (1 << dst, 1 << dst);
948 /** 1010 ddd w dd00 1110 INC.size dest */
951 dc = decode_dest23 (ddd, dd, w+1);
954 tprintf ("%x ++ = %x\n", a, v);
958 /** 1000 sss0 ss0w 0011 INDEXB.size src */
960 /** 1010 sss0 ss0w 0011 INDEXBD.size src */
962 /** 1100 sss0 ss0w 0011 INDEXBS.size src */
964 /** 1001 sss0 ss1w 0011 INDEXL.size src */
966 /** 1011 sss0 ss1w 0011 INDEXLD.size src */
968 /** 1001 sss0 ss0w 0011 INDEXLS.size src */
970 /** 1000 sss0 ss1w 0011 INDEXW.size src */
972 /** 1010 sss0 ss1w 0011 INDEXWD.size src */
974 /** 1100 sss0 ss1w 0011 INDEXWS.size src */
977 /** 1011 1110 vector00 INT #IMM */
980 trigger_based_interrupt (vector);
982 /** 1011 1111 INTO */
986 trigger_fixed_interrupt (0xffffe0);
988 /** 1ccc 101c Jcnd label */
991 v = sign_ext (IMM(1), 8);
992 if (condition_true (ccc*2+c))
993 put_reg (pc, orig_pc + 1 + v);
995 /** 01dd 101d JMP.S label */
998 put_reg (pc, orig_pc + (dd*2+d) + 2);
1000 /** 1011 1011 JMP.B label */
1003 imm = sign_ext (IMM(1), 8);
1007 printf("[jmp-to-self detected as exit]\n");
1008 return M32C_MAKE_HIT_BREAK ();
1010 put_reg (pc, orig_pc + 1 + imm);
1012 /** 1100 1110 JMP.W label */
1015 imm = sign_ext (IMM(2), 16);
1016 put_reg (pc, orig_pc + 1 + imm);
1018 /** 1100 1100 JMP.A label */
1024 /** 1100 sss1 ss00 1111 JMPI.W src */
1027 sc = decode_src23 (sss, ss, 2);
1029 a = sign_ext (a, 16);
1030 put_reg (pc, orig_pc + a);
1032 /** 1000 sss0 ss00 0001 JMPI.A src */
1035 sc = decode_src23 (sss, ss, 3);
1039 /** 1101 1100 JMPS #IMM8 */
1043 a = 0xff0000 + mem_get_hi (0xfffe00 - imm * 2);
1046 /** 1100 1111 JSR.W label */
1049 imm = sign_ext (IMM(2), 16);
1050 put_reg (sp, get_reg (sp) - 4);
1051 mem_put_si (get_reg (sp), get_reg (pc));
1052 put_reg (pc, orig_pc + imm + 1);
1054 /** 1100 1101 JSR.A label */
1058 put_reg (sp, get_reg (sp) - 4);
1059 mem_put_si (get_reg (sp), get_reg (pc));
1062 /** 1100 sss1 ss01 1111 JSRI.W src */
1065 sc = decode_src23 (sss, ss, 2);
1067 a = sign_ext (a, 16);
1068 put_reg (sp, get_reg (sp) - 4);
1069 mem_put_si (get_reg (sp), get_reg (pc));
1070 put_reg (pc, orig_pc + a);
1072 /** 1001 sss0 ss00 0001 JSRI.A src */
1075 sc = decode_src23 (sss, ss, 3);
1077 put_reg (sp, get_reg (sp) - 4);
1078 mem_put_si (get_reg (sp), get_reg (pc));
1081 /** 1101 1101 JSRS #IMM8 */
1085 a = 0xff0000 + mem_get_hi (0xfffe00 - imm * 2);
1086 put_reg (sp, get_reg (sp) - 4);
1087 mem_put_si (get_reg (sp), get_reg (pc));
1090 /** 1101 0101 1010 1dst LDC #IMM16,dest */
1093 dc = decode_cr_b (dst, CR_B_DCT0);
1096 /** 1101 0101 0010 1dst LDC #IMM24,dest */
1099 dc = decode_cr_b (dst, CR_B_INTB);
1102 /** 1101 0101 0110 1dst LDC #IMM24,dest */
1105 dc = decode_cr_b (dst, CR_B_DMA0);
1108 /** 0000 0001 1101 sss1 ss00 1dst LDC src,dest */
1111 sc = decode_src23 (sss, ss, 2);
1112 dc = decode_cr_b (dst, CR_B_DCT0);
1116 /** 1101 sss1 ss00 0dst LDC src,dest */
1119 sc = decode_src23 (sss, ss, 3);
1120 dc = decode_cr_b (dst, CR_B_INTB);
1124 /** 0000 0001 1101 sss1 ss00 0dst LDC src,dest */
1127 sc = decode_src23 (sss, ss, 3);
1128 dc = decode_cr_b (dst, CR_B_DMA0);
1132 /** 1011 0110 1100 0011 LDCTX */
1136 /** 1101 0101 1110 1imm LDIPL #IMM */
1138 set_flags (0x7000, imm*0x1000);
1140 /** 0000 0001 1000 ddd w dd11 1111 MAX.size #IMM,dest */
1144 dc = decode_dest23 (ddd, dd, w);
1145 imm = sign_ext (IMM(w), w*8);
1146 a = sign_ext (get_src (dc), w*8);
1147 tprintf ("max %d %d\n", imm, a);
1151 /** 0000 0001 1sss ddd w dd ss 1101 MAX.size src,dest */
1155 sc = decode_src23 (sss, ss, w);
1156 dc = decode_dest23 (ddd, dd, w);
1157 b = sign_ext (get_src (sc), w*8);
1158 a = sign_ext (get_src (dc), w*8);
1159 tprintf ("max %d %d\n", b, a);
1163 /** 0000 0001 1000 ddd w dd10 1111 MIN.size #IMM,dest */
1167 dc = decode_dest23 (ddd, dd, w);
1168 imm = sign_ext (IMM(w), w*8);
1169 a = sign_ext (get_src (dc), w*8);
1170 tprintf ("min %d %d\n", imm, a);
1174 /** 0000 0001 1sss ddd w dd ss 1100 MIN.size src,dest */
1178 sc = decode_src23 (sss, ss, w);
1179 dc = decode_dest23 (ddd, dd, w);
1180 b = sign_ext (get_src (sc), w*8);
1181 a = sign_ext (get_src (dc), w*8);
1182 tprintf ("min %d %d\n", b, a);
1186 /** 1001 ddd w dd10 1111 MOV.size:G #IMM,dest */
1188 dc = decode_dest23 (ddd, dd, w+1);
1191 tprintf("%x = %x\n", v, v);
1195 /** 1011 ddd0 dd11 0001 MOV.L:G #IMM,dest */
1197 dc = decode_dest23 (ddd, dd, 4);
1200 tprintf("%x = %x\n", v, v);
1204 /** 1111 ddd w dd10 immm MOV.size:Q #IMM4,dest */
1206 dc = decode_dest23 (ddd, dd, w+1);
1207 imm = sign_ext (immm, 4);
1209 tprintf("%x = %d\n", v, v);
1213 /** 00dd 010w MOV.size:S #IMM,dest */
1216 dc = decode_dest2 (dd, w+1);
1221 /** 10w1 110d MOV.size:S #IMM,a0/a1 */
1223 imm = IMM(w ? 3 : 2);
1224 put_reg (d ? a1 : a0, imm);
1225 set_sz (imm & addr_mask, w+1);
1227 /** 00dd 001w MOV.size:Z #0,dest */
1230 dc = decode_dest2 (dd, w+1);
1234 /** 1sss ddd w dd ss 1011 MOV.size:G src,dest */
1237 sc = decode_src23 (sss, ss, w+1);
1238 dc = decode_dest23 (ddd, dd, w+1);
1243 /** 1sss ddd1 dd ss 0011 MOV.L:G src,dest */
1246 sc = decode_src23 (sss, ss, 4);
1247 dc = decode_dest23 (ddd, dd, 4);
1252 /** VARY SS 01 10 11 */
1253 /** 00SS 100w MOV.size:S src,R0L/R0 */
1256 sc = decode_dest2 (SS, w+1);
1258 put_reg (w ? r0 : r0l, v);
1261 /** 01ss 111w MOV.size:S src,R1L/R1 */
1264 sc = decode_dest2 (ss, w+1);
1266 put_reg (w ? r1 : r1l, v);
1269 /** VARY DD 01 10 11 */
1270 /** 00DD 000w MOV.size:S R0L/R0,dest */
1273 dc = decode_dest2 (DD, w+1);
1274 v = get_reg (w ? r0 : r0l);
1278 /** 01ss 100d MOV.L:S src,A0/A1 */
1281 sc = decode_dest2 (ss, 4);
1283 put_reg (d ? a1 : a0, v);
1286 /** 1011 ddd w dd00 1111 MOV.size:G dsp:8[SP], dest */
1290 dc = decode_dest23 (ddd, dd, w+1);
1291 a = get_reg (sp) + sign_ext (imm, 8);
1300 /** 1010 sss w ss00 1111 MOV.size:G src,dsp:8[SP] */
1303 sc = decode_dest23 (sss, ss, w+1);
1305 a = get_reg (sp) + sign_ext (imm, 8);
1314 /** 1101 sss1 ss01 1dst MOVA src,dest */
1316 static reg_id map[8] = { r2r0, r3r1, a0, a1 };
1318 sc = decode_src23 (sss, ss, 1);
1319 if (!sc.mem || !map[dst])
1321 put_reg (map[dst], sc.u.addr);
1323 /** 0000 0001 1011 ddd0 dd hl 1110 MOVdir R0L,dest */
1326 dc = decode_dest23 (ddd, dd, 1);
1331 case 0: a = (a & 0xf0) | (b & 0x0f); break;
1332 case 1: a = (a & 0xf0) | ((b>>4) & 0x0f); break;
1333 case 2: a = (a & 0x0f) | ((b & 0x0f)<<4); break;
1334 case 3: a = (a & 0x0f) | (b & 0xf0); break;
1338 /** 0000 0001 1010 sss0 ss hl 1110 MOVdir src,R0L */
1341 sc = decode_dest23 (sss, ss, 1);
1346 case 0: a = (a & 0xf0) | (b & 0x0f); break;
1347 case 1: a = (a & 0xf0) | ((b>>4) & 0x0f); break;
1348 case 2: a = (a & 0x0f) | ((b & 0x0f)<<4); break;
1349 case 3: a = (a & 0x0f) | (b & 0xf0); break;
1353 /** 1011 ddd0 dd01 0001 MOVX #IMM,dest */
1356 dc = decode_dest23 (ddd, dd, 4);
1357 imm = sign_ext (IMM(1), 8);
1361 /** 1000 ddd w dd01 1111 MUL.size #IMM,dest */
1365 dc = decode_dest23 (ddd, dd, w);
1366 v = sign_ext (get_src (dc), w*8);
1367 imm = sign_ext (IMM(w), w*8);
1368 tprintf("%d * %d = %d\n", v, imm, v*imm);
1373 /** 1sss ddd w dd ss 1100 MUL.size src,dest */
1377 sc = decode_src23 (sss, ss, w);
1378 dc = decode_dest23 (ddd, dd, w);
1379 a = sign_ext (get_src (sc), w*8);
1380 b = sign_ext (get_src (dc), w*8);
1381 tprintf("%d * %d = %d\n", a, b, a*b);
1386 /** 0000 0001 1000 sss1 ss01 1111 MUL.L src,R2R0 */
1390 sc = decode_src23 (sss, ss, 4);
1391 a = sign_ext (get_src (sc), 32);
1392 b = sign_ext (get_reg (r2r0), 32);
1393 ll = (long long)a * (long long)b;
1394 tprintf("%d * %d = %lld (%llx)\n", a, b, ll, ll);
1395 if (ll < b2minsigned[4] || ll > b2maxsigned[4])
1396 set_flags (FLAGBIT_O, FLAGBIT_O);
1398 set_flags (FLAGBIT_O, 0);
1399 put_reg (r2r0, (int)ll);
1401 /** 1100 sss1 ss11 1110 MULEX src */
1404 sc = decode_dest23 (sss, ss, 2);
1405 a = sign_ext (get_src (sc), 16);
1406 b = sign_ext (get_reg (r2r0), 32);
1407 ll = (long long)a * (long long)b;
1408 tprintf("%d * %d = %lld (%llx)\n", a, b, ll, ll);
1409 put_reg (r2r0, (int)ll);
1410 put_reg (r1, (int)(ll >> 32));
1412 /** 1000 ddd w dd00 1111 MULU.size #IMM,dest */
1416 dc = decode_dest23 (ddd, dd, w);
1419 tprintf("%d * %d = %d\n", v, imm, v*imm);
1424 /** 1sss ddd w dd ss 0100 MULU.size src,dest */
1428 sc = decode_src23 (sss, ss, w);
1429 dc = decode_dest23 (ddd, dd, w);
1432 tprintf("%d * %d = %d\n", a, b, a*b);
1437 /** 0000 0001 1000 sss1 ss00 1111 MULU.L src,R2R0 */
1441 sc = decode_src23 (sss, ss, 4);
1444 ll = (long long)a * (long long)b;
1445 tprintf("%d * %d = %lld (%llx)\n", a, b, ll, ll);
1446 if (ll < b2minsigned[4] || ll > b2maxsigned[4])
1447 set_flags (FLAGBIT_O, FLAGBIT_O);
1449 set_flags (FLAGBIT_O, 0);
1450 put_reg (r2r0, (int)ll);
1452 /** 1010 ddd w dd10 1111 NEG.size dest */
1455 dc = decode_dest23 (ddd, dd, w+1);
1456 a = sign_ext (get_src (dc), (w+1)*8);
1458 tprintf("%d * -1 = %d\n", a, v);
1459 set_oszc(v, w+1, v==0);
1462 /** 1101 1110 NOP */
1466 /** 1010 ddd w dd01 1110 NOT.size dest */
1469 dc = decode_dest23 (ddd, dd, w+1);
1472 tprintf("~ %x = %x\n", a, v);
1476 /** 1000 ddd w dd10 1111 OR.size:G #IMM,dest */
1479 dc = decode_dest23(ddd, dd, w+1);
1481 LOGIC_OP (dc, imm, |);
1483 /** 01dd 010w OR.size:S #IMM,dest */
1486 dc = decode_dest2(dd, w+1);
1488 LOGIC_OP (dc, imm, |);
1490 /** 1sss ddd w dd ss 0101 OR.size:G src,dest */
1493 sc = decode_src23(sss, ss, w+1);
1494 dc = decode_dest23(ddd, dd, w+1);
1496 LOGIC_OP (dc, b, |);
1498 /** 1011 ddd w dd10 1111 POP.size dest */
1501 dc = decode_dest23 (ddd, dd, w+1);
1503 a = mem_get_hi (get_reg (sp));
1505 a = mem_get_qi (get_reg (sp));
1506 put_reg (sp, get_reg (sp) + 2);
1507 tprintf("pop%s: %x\n", w ? "hi" : "qi", a);
1510 /** 1101 0011 1010 1dst POPC dest */
1513 dc = decode_cr_b (dst, CR_B_DCT0);
1514 a = mem_get_hi (get_reg (sp));
1515 put_reg (sp, get_reg (sp) + 2);
1516 tprintf("pophi: %x\n", a);
1519 /** 1101 0011 0010 1dst POPC dest */
1522 dc = decode_cr_b (dst, CR_B_INTB);
1523 a = mem_get_si (get_reg (sp));
1524 put_reg (sp, get_reg (sp) + 4);
1525 tprintf("popsi: %x\n", a);
1528 /** 1000 1110 POPM dest */
1530 static int map[] = { r0, r1, r2, r3, a0, a1, sb, fb };
1533 tprintf("popm: %x\n", imm);
1537 v = mem_get_hi (get_reg (sp));
1538 put_reg (map[a], v);
1539 put_reg (sp, get_reg (sp) + 2);
1544 v = mem_get_si (get_reg (sp));
1545 put_reg (map[a], v);
1546 put_reg (sp, get_reg (sp) + 4);
1549 /** 1010 111w PUSH.size #IMM */
1553 tprintf("push%s: %x\n", w ? "hi" : "qi", imm);
1554 int a = get_reg (sp) - 2;
1556 mem_put_hi (a, imm);
1558 mem_put_qi (a, imm);
1561 /** 1100 sss w ss00 1110 PUSH.size src */
1564 sc = decode_dest23 (sss, ss, w+1);
1566 put_reg (sp, get_reg (sp) - 2);
1568 mem_put_hi (get_reg (sp), a);
1570 mem_put_qi (get_reg (sp), a);
1571 tprintf("push%s: %x\n", w ? "hi" : "qi", a);
1573 /** 1011 0110 0101 0011 PUSH.L #IMM32 */
1576 put_reg (sp, get_reg (sp) - 4);
1577 mem_put_si (get_reg (sp), imm);
1579 /** 1010 sss0 ss00 0001 PUSH.L src */
1582 sc = decode_dest23 (sss, ss, 4);
1584 put_reg (sp, get_reg (sp) - 4);
1585 mem_put_si (get_reg (sp), a);
1587 /** 1011 0sa0 ss00 0001 PUSHA src */
1590 sc = decode_dest23 (sa, ss, 1);
1591 put_reg (sp, get_reg (sp) - 4);
1592 mem_put_hi (get_reg (sp), sc.u.addr);
1593 tprintf("pushsi: %x\n", sc.u.addr);
1595 /** 1101 0001 1010 1src PUSHC src */
1598 sc = decode_cr_b (src, CR_B_DCT0);
1600 put_reg (sp, get_reg (sp) - 2);
1601 mem_put_hi (get_reg (sp), a);
1602 tprintf("pushhi: %x\n", a);
1604 /** 1101 0001 0010 1src PUSHC src */
1607 sc = decode_cr_b (src, CR_B_INTB);
1609 put_reg (sp, get_reg (sp) - 4);
1610 mem_put_si (get_reg (sp), a);
1611 tprintf("pushsi: %x\n", a);
1613 /** 1000 1111 PUSHM src */
1615 static int map[] = { fb, sb, a1, a0, r3, r2, r1, r0 };
1617 tprintf("pushm: %x\n", imm);
1621 put_reg (sp, get_reg (sp) - 4);
1622 v = get_reg (map[a]);
1623 mem_put_si (get_reg (sp), v);
1628 put_reg (sp, get_reg (sp) - 2);
1629 v = get_reg (map[a]);
1630 mem_put_hi (get_reg (sp), v);
1633 /** 1001 1110 REIT */
1636 put_reg (pc, mem_get_si (a));
1638 put_reg (flags, mem_get_hi (a));
1642 /** 1011 1000 010w 0011 RMPA.size */
1644 int count = get_reg (r3);
1645 int list1 = get_reg (a0);
1646 int list2 = get_reg (a1);
1647 long long sum = get_reg_ll (r3r1r2r0) & 0xffffff;
1653 a = sign_ext (mem_get_hi (list1), 16);
1654 b = sign_ext (mem_get_hi (list2), 16);
1658 a = sign_ext (mem_get_qi (list1), 8);
1659 b = sign_ext (mem_get_qi (list2), 8);
1661 tprintf("%lld + %d * %d = ", sum, a, b);
1663 tprintf("%lld\n", sum);
1668 put_reg (r3, count);
1669 put_reg (a0, list1);
1670 put_reg (a1, list2);
1671 put_reg (r2r0, (int)(sum & 0xffffffffU));
1672 put_reg (r1, (int)(sum >> 32));
1674 /** 1011 ddd w dd10 1110 ROLC.size dest */
1677 dc = decode_dest23 (ddd, dd, w+1);
1680 /** 1010 ddd w dd10 1110 RORC.size dest */
1683 dc = decode_dest23 (ddd, dd, w+1);
1686 /** 1110 ddd w dd10 immm ROT.size #IMM, dest */
1689 dc = decode_dest23 (ddd, dd, w+1);
1690 rot_op (dc, IMM4(), -1);
1692 /** 1010 ddd w dd11 1111 ROT.size R1H,dest */
1695 dc = decode_dest23 (ddd, dd, w+1);
1696 a = sign_ext (get_reg (r1h), 8);
1699 /** 1101 1111 RTS */
1701 put_reg (pc, mem_get_si (get_reg (sp)));
1702 put_reg (sp, get_reg (sp) + 4);
1704 /** 0000 0001 1001 ddd w dd10 1110 SBB.size #IMM, dest */
1707 dc = decode_dest23 (ddd, dd, w+1);
1709 MATH_OP (dc, imm, !carry, -);
1711 /** 0000 0001 1sss ddd w dd ss 0110 SBB.size src,dest */
1714 sc = decode_src23 (sss, ss, w+1);
1715 dc = decode_dest23 (ddd, dd, w+1);
1716 MATH_OP (dc, get_src (sc), !carry, -);
1718 /** 1101 ddd1 dd11 cond SCcond dest */
1721 dc = decode_dest23 (ddd, dd, 2);
1722 if (condition_true (cond))
1727 /** 1011 1000 110w 0011 SCMPU.size */
1734 t0 = mem_get_qi (ta0);
1735 t2 = mem_get_qi (ta1);
1738 t1 = mem_get_qi (ta0 + 1);
1739 t3 = mem_get_qi (ta1 + 1);
1742 if (dif == 0 && t0 != 0 && w)
1744 set_oszc (dif, 1, dif > 0);
1749 if (t0 == 0 || t0 != t2)
1751 if (w && (t1 == 0 || t1 != t3))
1755 /** 1111 ddd w dd00 immm SHA.size #IMM,dest */
1758 dc = decode_dest23 (ddd, dd, w+1);
1759 shift_op (dc, 1, IMM4(), 1);
1761 /** 1010 ddd0 dd10 0001 SHA.L #IMM,dest */
1764 dc = decode_dest23 (ddd, dd, 4);
1765 imm = sign_ext (IMM(1), 8);
1766 shift_op (dc, 1, imm, 1);
1768 /** 1011 ddd w dd11 1110 SHA.size R1H,dest */
1771 dc = decode_dest23 (ddd, dd, w+1);
1772 a = sign_ext (get_reg (r1h), 8);
1773 shift_op (dc, 1, a, 1);
1775 /** 1100 ddd0 dd01 0001 SHA.L R1H,dest */
1778 dc = decode_dest23 (ddd, dd, 4);
1779 a = sign_ext (get_reg (r1h), 8);
1780 shift_op (dc, 1, a, 1);
1782 /** 1100 ddd0 dd10 0001 SHANC.L #IMM,dest */
1786 dc = decode_dest23 (ddd, dd, 4);
1787 imm = sign_ext (IMM(1), 8);
1788 shift_op (dc, 1, imm, 0);
1790 /** 1110 ddd w dd00 immm SHL.size #IMM, dest */
1793 dc = decode_dest23 (ddd, dd, w+1);
1794 shift_op (dc, 0, IMM4(), 1);
1796 /** 1001 ddd0 dd10 0001 SHL.L #IMM, dest */
1799 dc = decode_dest23 (ddd, dd, 4);
1800 imm = sign_ext (IMM(1), 8);
1801 shift_op (dc, 0, imm, 1);
1803 /** 1010 ddd w dd11 1110 SHL.size R1H,dest */
1806 dc = decode_dest23 (ddd, dd, w+1);
1807 a = sign_ext (get_reg (r1h), 8);
1808 shift_op (dc, 0, a, 1);
1810 /** 1100 ddd0 dd00 0001 SHL.L R1H,dest */
1813 dc = decode_dest23 (ddd, dd, 4);
1814 a = sign_ext (get_reg (r1h), 8);
1815 shift_op (dc, 0, a, 1);
1817 /** 1000 ddd0 dd10 0001 SHLNC.L #IMM,dest */
1821 dc = decode_dest23 (ddd, dd, 4);
1822 imm = sign_ext (IMM(1), 8);
1823 shift_op (dc, 0, imm, 0);
1825 /** 1011 0010 100w 0011 SIN.size */
1833 mem_put_hi(a, mem_get_hi (v));
1835 mem_put_qi(a, mem_get_qi (v));
1843 /** 1011 0110 100w 0011 SMOVB.size */
1851 mem_put_hi(a, mem_get_hi (v));
1853 mem_put_qi(a, mem_get_qi (v));
1862 /** 1011 0000 100w 0011 SMOVF.size */
1870 mem_put_hi(a, mem_get_hi (v));
1872 mem_put_qi(a, mem_get_qi (v));
1881 /** 1011 1000 100w 0011 SMOVU.size */
1888 mem_put_hi(a, (t0 = mem_get_hi (v)));
1890 mem_put_qi(a, (t0 = mem_get_qi (v)));
1894 || (w && ((t0 & 0xff) == 0 || (t0 & 0xff00) == 0)))
1900 /** 1011 0100 100w 0011 SOUT.size */
1908 mem_put_hi(a, mem_get_hi (v));
1910 mem_put_qi(a, mem_get_qi (v));
1918 /** 1011 1000 000w 0011 SSTR.size */
1927 mem_put_qi(a, r0 & 0xff);
1934 /** 0000 0001 1101 ddd1 dd01 0src STC src,dest */
1937 dc = decode_dest23 (ddd, dd, 4);
1938 sc = decode_cr_b (src, CR_B_DMA0);
1942 /** 0000 0001 1101 ddd1 dd01 1src STC src,dest */
1945 dc = decode_dest23 (ddd, dd, 2);
1946 sc = decode_cr_b (src, CR_B_DCT0);
1950 /** 1101 ddd1 dd01 0src STC src,dest */
1953 dc = decode_dest23 (ddd, dd, 4);
1954 sc = decode_cr_b (src, CR_B_INTB);
1958 /** 1011 0110 1101 0011 STCX abs16,abs24 */
1962 /** 1001 ddd w dd01 1111 STNZ.size #IMM,dest */
1965 dc = decode_dest23 (ddd, dd, w+1);
1970 /** 1001 ddd w dd00 1111 STZ.size #IMM,dest */
1973 dc = decode_dest23 (ddd, dd, w+1);
1978 /** 1001 ddd w dd11 1111 STZX.size #IMM1,#IMM2,dest */
1981 dc = decode_dest23 (ddd, dd, w+1);
1989 /** 1000 ddd w dd11 1110 SUB.size:G #IMM,dest */
1992 dc = decode_dest23(ddd, dd, w+1);
1994 MATH_OP (dc, imm, 0, -);
1996 /** 1001 ddd0 dd11 0001 SUB.L:G #IMM,dest */
1999 dc = decode_dest23(ddd, dd, 4);
2001 MATH_OP (dc, imm, 0, -);
2003 /** 00dd 111w SUB.size:S #IMM,dest */
2006 dc = decode_dest2(dd, w+1);
2008 MATH_OP (dc, imm, 0, -);
2010 /** 1sss ddd w dd ss 1010 SUB.size:G src,dest */
2013 sc = decode_src23(sss, ss, w+1);
2014 dc = decode_dest23(ddd, dd, w+1);
2016 MATH_OP (dc, b, 0, -);
2018 /** 1sss ddd1 dd ss 0000 SUB.L:G src,dest */
2021 sc = decode_src23(sss, ss, 4);
2022 dc = decode_dest23(ddd, dd, 4);
2024 MATH_OP (dc, b, 0, -);
2026 /** 1001 ddd0 dd01 0001 SUBX #IMM,dest */
2029 dc = decode_dest23(ddd, dd, 4);
2030 imm = sign_ext (IMM(1), 8);
2031 MATH_OP (dc, imm, 0, -);
2033 /** 1sss ddd0 dd ss 0000 SUBX src,dest */
2036 sc = decode_src23(sss, ss, 1);
2037 dc = decode_dest23(ddd, dd, 4);
2038 b = sign_ext (get_src (sc), 8);
2039 MATH_OP (dc, b, 0, -);
2041 /** 1001 ddd w dd11 1110 TST.size:G #IMM,dest */
2044 dc = decode_dest23 (ddd, dd, w+1);
2050 /** 00dd 110w TST.size:S #IMM,dest */
2053 dc = decode_dest2 (dd, w+1);
2059 /** 0000 0001 1sss ddd w dd ss 1001 TST.size:G src,dest */
2062 sc = decode_src23 (sss, ss, w+1);
2063 dc = decode_dest23 (ddd, dd, w+1);
2069 /** 1111 1111 UND */
2071 trigger_fixed_interrupt (0xffffdc);
2073 /** 1011 0010 0000 0011 WAIT */
2077 /** 1101 ddd w dd00 1src XCHG.size src,dest */
2079 dc = decode_dest23 (ddd, dd, w+1);
2080 sc = decode_src3 (src, w+1);
2086 /** 1001 ddd w dd00 1110 XOR.size #IMM,dest */
2089 dc = decode_dest23(ddd, dd, w+1);
2091 LOGIC_OP (dc, imm, ^);
2093 /** 1sss ddd w dd ss 1001 XOR.size src,dest */
2096 sc = decode_src23(sss, ss, w+1);
2097 dc = decode_dest23(ddd, dd, w+1);
2099 LOGIC_OP (dc, b, ^);