xref: /openbsd-src/gnu/usr.bin/binutils-2.17/opcodes/xstormy16-opc.c (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* Instruction opcode table for xstormy16.
2*3d8817e4Smiod 
3*3d8817e4Smiod THIS FILE IS MACHINE GENERATED WITH CGEN.
4*3d8817e4Smiod 
5*3d8817e4Smiod Copyright 1996-2005 Free Software Foundation, Inc.
6*3d8817e4Smiod 
7*3d8817e4Smiod This file is part of the GNU Binutils and/or GDB, the GNU debugger.
8*3d8817e4Smiod 
9*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
10*3d8817e4Smiod it under the terms of the GNU General Public License as published by
11*3d8817e4Smiod the Free Software Foundation; either version 2, or (at your option)
12*3d8817e4Smiod any later version.
13*3d8817e4Smiod 
14*3d8817e4Smiod This program is distributed in the hope that it will be useful,
15*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
16*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*3d8817e4Smiod GNU General Public License for more details.
18*3d8817e4Smiod 
19*3d8817e4Smiod You should have received a copy of the GNU General Public License along
20*3d8817e4Smiod with this program; if not, write to the Free Software Foundation, Inc.,
21*3d8817e4Smiod 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22*3d8817e4Smiod 
23*3d8817e4Smiod */
24*3d8817e4Smiod 
25*3d8817e4Smiod #include "sysdep.h"
26*3d8817e4Smiod #include "ansidecl.h"
27*3d8817e4Smiod #include "bfd.h"
28*3d8817e4Smiod #include "symcat.h"
29*3d8817e4Smiod #include "xstormy16-desc.h"
30*3d8817e4Smiod #include "xstormy16-opc.h"
31*3d8817e4Smiod #include "libiberty.h"
32*3d8817e4Smiod 
33*3d8817e4Smiod /* The hash functions are recorded here to help keep assembler code out of
34*3d8817e4Smiod    the disassembler and vice versa.  */
35*3d8817e4Smiod 
36*3d8817e4Smiod static int asm_hash_insn_p        (const CGEN_INSN *);
37*3d8817e4Smiod static unsigned int asm_hash_insn (const char *);
38*3d8817e4Smiod static int dis_hash_insn_p        (const CGEN_INSN *);
39*3d8817e4Smiod static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
40*3d8817e4Smiod 
41*3d8817e4Smiod /* Instruction formats.  */
42*3d8817e4Smiod 
43*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
44*3d8817e4Smiod #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_##f]
45*3d8817e4Smiod #else
46*3d8817e4Smiod #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_/**/f]
47*3d8817e4Smiod #endif
48*3d8817e4Smiod static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
49*3d8817e4Smiod   0, 0, 0x0, { { 0 } }
50*3d8817e4Smiod };
51*3d8817e4Smiod 
52*3d8817e4Smiod static const CGEN_IFMT ifmt_movlmemimm ATTRIBUTE_UNUSED = {
53*3d8817e4Smiod   32, 32, 0xfe000000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_LMEM8) }, { F (F_IMM16) }, { 0 } }
54*3d8817e4Smiod };
55*3d8817e4Smiod 
56*3d8817e4Smiod static const CGEN_IFMT ifmt_movhmemimm ATTRIBUTE_UNUSED = {
57*3d8817e4Smiod   32, 32, 0xfe000000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_HMEM8) }, { F (F_IMM16) }, { 0 } }
58*3d8817e4Smiod };
59*3d8817e4Smiod 
60*3d8817e4Smiod static const CGEN_IFMT ifmt_movlgrmem ATTRIBUTE_UNUSED = {
61*3d8817e4Smiod   16, 16, 0xf000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_LMEM8) }, { 0 } }
62*3d8817e4Smiod };
63*3d8817e4Smiod 
64*3d8817e4Smiod static const CGEN_IFMT ifmt_movhgrmem ATTRIBUTE_UNUSED = {
65*3d8817e4Smiod   16, 16, 0xf000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_HMEM8) }, { 0 } }
66*3d8817e4Smiod };
67*3d8817e4Smiod 
68*3d8817e4Smiod static const CGEN_IFMT ifmt_movgrgri ATTRIBUTE_UNUSED = {
69*3d8817e4Smiod   16, 16, 0xfe08, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_RS) }, { F (F_OP4M) }, { F (F_RDM) }, { 0 } }
70*3d8817e4Smiod };
71*3d8817e4Smiod 
72*3d8817e4Smiod static const CGEN_IFMT ifmt_movgrgrii ATTRIBUTE_UNUSED = {
73*3d8817e4Smiod   32, 32, 0xfe08f000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_RS) }, { F (F_OP4M) }, { F (F_RDM) }, { F (F_OP5) }, { F (F_IMM12) }, { 0 } }
74*3d8817e4Smiod };
75*3d8817e4Smiod 
76*3d8817e4Smiod static const CGEN_IFMT ifmt_movgrgr ATTRIBUTE_UNUSED = {
77*3d8817e4Smiod   16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { 0 } }
78*3d8817e4Smiod };
79*3d8817e4Smiod 
80*3d8817e4Smiod static const CGEN_IFMT ifmt_movwimm8 ATTRIBUTE_UNUSED = {
81*3d8817e4Smiod   16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM8) }, { 0 } }
82*3d8817e4Smiod };
83*3d8817e4Smiod 
84*3d8817e4Smiod static const CGEN_IFMT ifmt_movwgrimm8 ATTRIBUTE_UNUSED = {
85*3d8817e4Smiod   16, 16, 0xf100, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { 0 } }
86*3d8817e4Smiod };
87*3d8817e4Smiod 
88*3d8817e4Smiod static const CGEN_IFMT ifmt_movwgrimm16 ATTRIBUTE_UNUSED = {
89*3d8817e4Smiod   32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { F (F_IMM16) }, { 0 } }
90*3d8817e4Smiod };
91*3d8817e4Smiod 
92*3d8817e4Smiod static const CGEN_IFMT ifmt_movlowgr ATTRIBUTE_UNUSED = {
93*3d8817e4Smiod   16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { 0 } }
94*3d8817e4Smiod };
95*3d8817e4Smiod 
96*3d8817e4Smiod static const CGEN_IFMT ifmt_movfgrgrii ATTRIBUTE_UNUSED = {
97*3d8817e4Smiod   32, 32, 0xfe088000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_RS) }, { F (F_OP4M) }, { F (F_RDM) }, { F (F_OP5A) }, { F (F_RB) }, { F (F_IMM12) }, { 0 } }
98*3d8817e4Smiod };
99*3d8817e4Smiod 
100*3d8817e4Smiod static const CGEN_IFMT ifmt_addgrimm4 ATTRIBUTE_UNUSED = {
101*3d8817e4Smiod   16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM4) }, { F (F_RD) }, { 0 } }
102*3d8817e4Smiod };
103*3d8817e4Smiod 
104*3d8817e4Smiod static const CGEN_IFMT ifmt_incgrimm2 ATTRIBUTE_UNUSED = {
105*3d8817e4Smiod   16, 16, 0xffc0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
106*3d8817e4Smiod };
107*3d8817e4Smiod 
108*3d8817e4Smiod static const CGEN_IFMT ifmt_set1lmemimm ATTRIBUTE_UNUSED = {
109*3d8817e4Smiod   16, 16, 0xf100, { { F (F_OP1) }, { F (F_IMM3) }, { F (F_OP2M) }, { F (F_LMEM8) }, { 0 } }
110*3d8817e4Smiod };
111*3d8817e4Smiod 
112*3d8817e4Smiod static const CGEN_IFMT ifmt_set1hmemimm ATTRIBUTE_UNUSED = {
113*3d8817e4Smiod   16, 16, 0xf100, { { F (F_OP1) }, { F (F_IMM3) }, { F (F_OP2M) }, { F (F_HMEM8) }, { 0 } }
114*3d8817e4Smiod };
115*3d8817e4Smiod 
116*3d8817e4Smiod static const CGEN_IFMT ifmt_bccgrgr ATTRIBUTE_UNUSED = {
117*3d8817e4Smiod   32, 32, 0xff000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
118*3d8817e4Smiod };
119*3d8817e4Smiod 
120*3d8817e4Smiod static const CGEN_IFMT ifmt_bccgrimm8 ATTRIBUTE_UNUSED = {
121*3d8817e4Smiod   32, 32, 0xf1000000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
122*3d8817e4Smiod };
123*3d8817e4Smiod 
124*3d8817e4Smiod static const CGEN_IFMT ifmt_bccimm16 ATTRIBUTE_UNUSED = {
125*3d8817e4Smiod   32, 32, 0xf0000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REL8_4) }, { F (F_IMM16) }, { 0 } }
126*3d8817e4Smiod };
127*3d8817e4Smiod 
128*3d8817e4Smiod static const CGEN_IFMT ifmt_bngrimm4 ATTRIBUTE_UNUSED = {
129*3d8817e4Smiod   32, 32, 0xff00f000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM4) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
130*3d8817e4Smiod };
131*3d8817e4Smiod 
132*3d8817e4Smiod static const CGEN_IFMT ifmt_bngrgr ATTRIBUTE_UNUSED = {
133*3d8817e4Smiod   32, 32, 0xff00f000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
134*3d8817e4Smiod };
135*3d8817e4Smiod 
136*3d8817e4Smiod static const CGEN_IFMT ifmt_bnlmemimm ATTRIBUTE_UNUSED = {
137*3d8817e4Smiod   32, 32, 0xff008000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_LMEM8) }, { F (F_OP5A) }, { F (F_IMM3B) }, { F (F_REL12) }, { 0 } }
138*3d8817e4Smiod };
139*3d8817e4Smiod 
140*3d8817e4Smiod static const CGEN_IFMT ifmt_bnhmemimm ATTRIBUTE_UNUSED = {
141*3d8817e4Smiod   32, 32, 0xff008000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_HMEM8) }, { F (F_OP5A) }, { F (F_IMM3B) }, { F (F_REL12) }, { 0 } }
142*3d8817e4Smiod };
143*3d8817e4Smiod 
144*3d8817e4Smiod static const CGEN_IFMT ifmt_bcc ATTRIBUTE_UNUSED = {
145*3d8817e4Smiod   16, 16, 0xf000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REL8_2) }, { 0 } }
146*3d8817e4Smiod };
147*3d8817e4Smiod 
148*3d8817e4Smiod static const CGEN_IFMT ifmt_br ATTRIBUTE_UNUSED = {
149*3d8817e4Smiod   16, 16, 0xf001, { { F (F_OP1) }, { F (F_REL12A) }, { F (F_OP4B) }, { 0 } }
150*3d8817e4Smiod };
151*3d8817e4Smiod 
152*3d8817e4Smiod static const CGEN_IFMT ifmt_jmp ATTRIBUTE_UNUSED = {
153*3d8817e4Smiod   16, 16, 0xffe0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3B) }, { F (F_RBJ) }, { F (F_RD) }, { 0 } }
154*3d8817e4Smiod };
155*3d8817e4Smiod 
156*3d8817e4Smiod static const CGEN_IFMT ifmt_jmpf ATTRIBUTE_UNUSED = {
157*3d8817e4Smiod   32, 32, 0xff000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_ABS24) }, { 0 } }
158*3d8817e4Smiod };
159*3d8817e4Smiod 
160*3d8817e4Smiod static const CGEN_IFMT ifmt_iret ATTRIBUTE_UNUSED = {
161*3d8817e4Smiod   16, 16, 0xffff, { { F (F_OP) }, { 0 } }
162*3d8817e4Smiod };
163*3d8817e4Smiod 
164*3d8817e4Smiod #undef F
165*3d8817e4Smiod 
166*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
167*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_##a)
168*3d8817e4Smiod #else
169*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_/**/a)
170*3d8817e4Smiod #endif
171*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
172*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_##op
173*3d8817e4Smiod #else
174*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_/**/op
175*3d8817e4Smiod #endif
176*3d8817e4Smiod #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
177*3d8817e4Smiod #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
178*3d8817e4Smiod 
179*3d8817e4Smiod /* The instruction table.  */
180*3d8817e4Smiod 
181*3d8817e4Smiod static const CGEN_OPCODE xstormy16_cgen_insn_opcode_table[MAX_INSNS] =
182*3d8817e4Smiod {
183*3d8817e4Smiod   /* Special null first entry.
184*3d8817e4Smiod      A `num' value of zero is thus invalid.
185*3d8817e4Smiod      Also, the special `invalid' insn resides here.  */
186*3d8817e4Smiod   { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
187*3d8817e4Smiod /* mov$ws2 $lmem8,#$imm16 */
188*3d8817e4Smiod   {
189*3d8817e4Smiod     { 0, 0, 0, 0 },
190*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (LMEM8), ',', '#', OP (IMM16), 0 } },
191*3d8817e4Smiod     & ifmt_movlmemimm, { 0x78000000 }
192*3d8817e4Smiod   },
193*3d8817e4Smiod /* mov$ws2 $hmem8,#$imm16 */
194*3d8817e4Smiod   {
195*3d8817e4Smiod     { 0, 0, 0, 0 },
196*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (HMEM8), ',', '#', OP (IMM16), 0 } },
197*3d8817e4Smiod     & ifmt_movhmemimm, { 0x7a000000 }
198*3d8817e4Smiod   },
199*3d8817e4Smiod /* mov$ws2 $Rm,$lmem8 */
200*3d8817e4Smiod   {
201*3d8817e4Smiod     { 0, 0, 0, 0 },
202*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RM), ',', OP (LMEM8), 0 } },
203*3d8817e4Smiod     & ifmt_movlgrmem, { 0x8000 }
204*3d8817e4Smiod   },
205*3d8817e4Smiod /* mov$ws2 $Rm,$hmem8 */
206*3d8817e4Smiod   {
207*3d8817e4Smiod     { 0, 0, 0, 0 },
208*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RM), ',', OP (HMEM8), 0 } },
209*3d8817e4Smiod     & ifmt_movhgrmem, { 0xa000 }
210*3d8817e4Smiod   },
211*3d8817e4Smiod /* mov$ws2 $lmem8,$Rm */
212*3d8817e4Smiod   {
213*3d8817e4Smiod     { 0, 0, 0, 0 },
214*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (LMEM8), ',', OP (RM), 0 } },
215*3d8817e4Smiod     & ifmt_movlgrmem, { 0x9000 }
216*3d8817e4Smiod   },
217*3d8817e4Smiod /* mov$ws2 $hmem8,$Rm */
218*3d8817e4Smiod   {
219*3d8817e4Smiod     { 0, 0, 0, 0 },
220*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (HMEM8), ',', OP (RM), 0 } },
221*3d8817e4Smiod     & ifmt_movhgrmem, { 0xb000 }
222*3d8817e4Smiod   },
223*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs) */
224*3d8817e4Smiod   {
225*3d8817e4Smiod     { 0, 0, 0, 0 },
226*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ')', 0 } },
227*3d8817e4Smiod     & ifmt_movgrgri, { 0x7000 }
228*3d8817e4Smiod   },
229*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs++) */
230*3d8817e4Smiod   {
231*3d8817e4Smiod     { 0, 0, 0, 0 },
232*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ')', 0 } },
233*3d8817e4Smiod     & ifmt_movgrgri, { 0x6000 }
234*3d8817e4Smiod   },
235*3d8817e4Smiod /* mov$ws2 $Rdm,(--$Rs) */
236*3d8817e4Smiod   {
237*3d8817e4Smiod     { 0, 0, 0, 0 },
238*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ')', 0 } },
239*3d8817e4Smiod     & ifmt_movgrgri, { 0x6800 }
240*3d8817e4Smiod   },
241*3d8817e4Smiod /* mov$ws2 ($Rs),$Rdm */
242*3d8817e4Smiod   {
243*3d8817e4Smiod     { 0, 0, 0, 0 },
244*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), ')', ',', OP (RDM), 0 } },
245*3d8817e4Smiod     & ifmt_movgrgri, { 0x7200 }
246*3d8817e4Smiod   },
247*3d8817e4Smiod /* mov$ws2 ($Rs++),$Rdm */
248*3d8817e4Smiod   {
249*3d8817e4Smiod     { 0, 0, 0, 0 },
250*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ')', ',', OP (RDM), 0 } },
251*3d8817e4Smiod     & ifmt_movgrgri, { 0x6200 }
252*3d8817e4Smiod   },
253*3d8817e4Smiod /* mov$ws2 (--$Rs),$Rdm */
254*3d8817e4Smiod   {
255*3d8817e4Smiod     { 0, 0, 0, 0 },
256*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ')', ',', OP (RDM), 0 } },
257*3d8817e4Smiod     & ifmt_movgrgri, { 0x6a00 }
258*3d8817e4Smiod   },
259*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs,$imm12) */
260*3d8817e4Smiod   {
261*3d8817e4Smiod     { 0, 0, 0, 0 },
262*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ',', OP (IMM12), ')', 0 } },
263*3d8817e4Smiod     & ifmt_movgrgrii, { 0x70080000 }
264*3d8817e4Smiod   },
265*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs++,$imm12) */
266*3d8817e4Smiod   {
267*3d8817e4Smiod     { 0, 0, 0, 0 },
268*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ',', OP (IMM12), ')', 0 } },
269*3d8817e4Smiod     & ifmt_movgrgrii, { 0x60080000 }
270*3d8817e4Smiod   },
271*3d8817e4Smiod /* mov$ws2 $Rdm,(--$Rs,$imm12) */
272*3d8817e4Smiod   {
273*3d8817e4Smiod     { 0, 0, 0, 0 },
274*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ',', OP (IMM12), ')', 0 } },
275*3d8817e4Smiod     & ifmt_movgrgrii, { 0x68080000 }
276*3d8817e4Smiod   },
277*3d8817e4Smiod /* mov$ws2 ($Rs,$imm12),$Rdm */
278*3d8817e4Smiod   {
279*3d8817e4Smiod     { 0, 0, 0, 0 },
280*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
281*3d8817e4Smiod     & ifmt_movgrgrii, { 0x72080000 }
282*3d8817e4Smiod   },
283*3d8817e4Smiod /* mov$ws2 ($Rs++,$imm12),$Rdm */
284*3d8817e4Smiod   {
285*3d8817e4Smiod     { 0, 0, 0, 0 },
286*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
287*3d8817e4Smiod     & ifmt_movgrgrii, { 0x62080000 }
288*3d8817e4Smiod   },
289*3d8817e4Smiod /* mov$ws2 (--$Rs,$imm12),$Rdm */
290*3d8817e4Smiod   {
291*3d8817e4Smiod     { 0, 0, 0, 0 },
292*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
293*3d8817e4Smiod     & ifmt_movgrgrii, { 0x6a080000 }
294*3d8817e4Smiod   },
295*3d8817e4Smiod /* mov $Rd,$Rs */
296*3d8817e4Smiod   {
297*3d8817e4Smiod     { 0, 0, 0, 0 },
298*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
299*3d8817e4Smiod     & ifmt_movgrgr, { 0x4600 }
300*3d8817e4Smiod   },
301*3d8817e4Smiod /* mov.w Rx,#$imm8 */
302*3d8817e4Smiod   {
303*3d8817e4Smiod     { 0, 0, 0, 0 },
304*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
305*3d8817e4Smiod     & ifmt_movwimm8, { 0x4700 }
306*3d8817e4Smiod   },
307*3d8817e4Smiod /* mov.w $Rm,#$imm8small */
308*3d8817e4Smiod   {
309*3d8817e4Smiod     { 0, 0, 0, 0 },
310*3d8817e4Smiod     { { MNEM, ' ', OP (RM), ',', '#', OP (IMM8SMALL), 0 } },
311*3d8817e4Smiod     & ifmt_movwgrimm8, { 0x2100 }
312*3d8817e4Smiod   },
313*3d8817e4Smiod /* mov.w $Rd,#$imm16 */
314*3d8817e4Smiod   {
315*3d8817e4Smiod     { 0, 0, 0, 0 },
316*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
317*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31300000 }
318*3d8817e4Smiod   },
319*3d8817e4Smiod /* mov.b $Rd,RxL */
320*3d8817e4Smiod   {
321*3d8817e4Smiod     { 0, 0, 0, 0 },
322*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', 'R', 'x', 'L', 0 } },
323*3d8817e4Smiod     & ifmt_movlowgr, { 0x30c0 }
324*3d8817e4Smiod   },
325*3d8817e4Smiod /* mov.b $Rd,RxH */
326*3d8817e4Smiod   {
327*3d8817e4Smiod     { 0, 0, 0, 0 },
328*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', 'R', 'x', 'H', 0 } },
329*3d8817e4Smiod     & ifmt_movlowgr, { 0x30d0 }
330*3d8817e4Smiod   },
331*3d8817e4Smiod /* movf$ws2 $Rdm,($Rs) */
332*3d8817e4Smiod   {
333*3d8817e4Smiod     { 0, 0, 0, 0 },
334*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ')', 0 } },
335*3d8817e4Smiod     & ifmt_movgrgri, { 0x7400 }
336*3d8817e4Smiod   },
337*3d8817e4Smiod /* movf$ws2 $Rdm,($Rs++) */
338*3d8817e4Smiod   {
339*3d8817e4Smiod     { 0, 0, 0, 0 },
340*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ')', 0 } },
341*3d8817e4Smiod     & ifmt_movgrgri, { 0x6400 }
342*3d8817e4Smiod   },
343*3d8817e4Smiod /* movf$ws2 $Rdm,(--$Rs) */
344*3d8817e4Smiod   {
345*3d8817e4Smiod     { 0, 0, 0, 0 },
346*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ')', 0 } },
347*3d8817e4Smiod     & ifmt_movgrgri, { 0x6c00 }
348*3d8817e4Smiod   },
349*3d8817e4Smiod /* movf$ws2 ($Rs),$Rdm */
350*3d8817e4Smiod   {
351*3d8817e4Smiod     { 0, 0, 0, 0 },
352*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), ')', ',', OP (RDM), 0 } },
353*3d8817e4Smiod     & ifmt_movgrgri, { 0x7600 }
354*3d8817e4Smiod   },
355*3d8817e4Smiod /* movf$ws2 ($Rs++),$Rdm */
356*3d8817e4Smiod   {
357*3d8817e4Smiod     { 0, 0, 0, 0 },
358*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ')', ',', OP (RDM), 0 } },
359*3d8817e4Smiod     & ifmt_movgrgri, { 0x6600 }
360*3d8817e4Smiod   },
361*3d8817e4Smiod /* movf$ws2 (--$Rs),$Rdm */
362*3d8817e4Smiod   {
363*3d8817e4Smiod     { 0, 0, 0, 0 },
364*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ')', ',', OP (RDM), 0 } },
365*3d8817e4Smiod     & ifmt_movgrgri, { 0x6e00 }
366*3d8817e4Smiod   },
367*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,$Rs,$imm12) */
368*3d8817e4Smiod   {
369*3d8817e4Smiod     { 0, 0, 0, 0 },
370*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', OP (RS), ',', OP (IMM12), ')', 0 } },
371*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x74080000 }
372*3d8817e4Smiod   },
373*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,$Rs++,$imm12) */
374*3d8817e4Smiod   {
375*3d8817e4Smiod     { 0, 0, 0, 0 },
376*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', OP (RS), '+', '+', ',', OP (IMM12), ')', 0 } },
377*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x64080000 }
378*3d8817e4Smiod   },
379*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,--$Rs,$imm12) */
380*3d8817e4Smiod   {
381*3d8817e4Smiod     { 0, 0, 0, 0 },
382*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', '-', '-', OP (RS), ',', OP (IMM12), ')', 0 } },
383*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x6c080000 }
384*3d8817e4Smiod   },
385*3d8817e4Smiod /* movf$ws2 ($Rb,$Rs,$imm12),$Rdm */
386*3d8817e4Smiod   {
387*3d8817e4Smiod     { 0, 0, 0, 0 },
388*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
389*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x76080000 }
390*3d8817e4Smiod   },
391*3d8817e4Smiod /* movf$ws2 ($Rb,$Rs++,$imm12),$Rdm */
392*3d8817e4Smiod   {
393*3d8817e4Smiod     { 0, 0, 0, 0 },
394*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', OP (RS), '+', '+', ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
395*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x66080000 }
396*3d8817e4Smiod   },
397*3d8817e4Smiod /* movf$ws2 ($Rb,--$Rs,$imm12),$Rdm */
398*3d8817e4Smiod   {
399*3d8817e4Smiod     { 0, 0, 0, 0 },
400*3d8817e4Smiod     { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', '-', '-', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
401*3d8817e4Smiod     & ifmt_movfgrgrii, { 0x6e080000 }
402*3d8817e4Smiod   },
403*3d8817e4Smiod /* mask $Rd,$Rs */
404*3d8817e4Smiod   {
405*3d8817e4Smiod     { 0, 0, 0, 0 },
406*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
407*3d8817e4Smiod     & ifmt_movgrgr, { 0x3300 }
408*3d8817e4Smiod   },
409*3d8817e4Smiod /* mask $Rd,#$imm16 */
410*3d8817e4Smiod   {
411*3d8817e4Smiod     { 0, 0, 0, 0 },
412*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
413*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x30e00000 }
414*3d8817e4Smiod   },
415*3d8817e4Smiod /* push $Rd */
416*3d8817e4Smiod   {
417*3d8817e4Smiod     { 0, 0, 0, 0 },
418*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
419*3d8817e4Smiod     & ifmt_movlowgr, { 0x80 }
420*3d8817e4Smiod   },
421*3d8817e4Smiod /* pop $Rd */
422*3d8817e4Smiod   {
423*3d8817e4Smiod     { 0, 0, 0, 0 },
424*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
425*3d8817e4Smiod     & ifmt_movlowgr, { 0x90 }
426*3d8817e4Smiod   },
427*3d8817e4Smiod /* swpn $Rd */
428*3d8817e4Smiod   {
429*3d8817e4Smiod     { 0, 0, 0, 0 },
430*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
431*3d8817e4Smiod     & ifmt_movlowgr, { 0x3090 }
432*3d8817e4Smiod   },
433*3d8817e4Smiod /* swpb $Rd */
434*3d8817e4Smiod   {
435*3d8817e4Smiod     { 0, 0, 0, 0 },
436*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
437*3d8817e4Smiod     & ifmt_movlowgr, { 0x3080 }
438*3d8817e4Smiod   },
439*3d8817e4Smiod /* swpw $Rd,$Rs */
440*3d8817e4Smiod   {
441*3d8817e4Smiod     { 0, 0, 0, 0 },
442*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
443*3d8817e4Smiod     & ifmt_movgrgr, { 0x3200 }
444*3d8817e4Smiod   },
445*3d8817e4Smiod /* and $Rd,$Rs */
446*3d8817e4Smiod   {
447*3d8817e4Smiod     { 0, 0, 0, 0 },
448*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
449*3d8817e4Smiod     & ifmt_movgrgr, { 0x4000 }
450*3d8817e4Smiod   },
451*3d8817e4Smiod /* and Rx,#$imm8 */
452*3d8817e4Smiod   {
453*3d8817e4Smiod     { 0, 0, 0, 0 },
454*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
455*3d8817e4Smiod     & ifmt_movwimm8, { 0x4100 }
456*3d8817e4Smiod   },
457*3d8817e4Smiod /* and $Rd,#$imm16 */
458*3d8817e4Smiod   {
459*3d8817e4Smiod     { 0, 0, 0, 0 },
460*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
461*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31000000 }
462*3d8817e4Smiod   },
463*3d8817e4Smiod /* or $Rd,$Rs */
464*3d8817e4Smiod   {
465*3d8817e4Smiod     { 0, 0, 0, 0 },
466*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
467*3d8817e4Smiod     & ifmt_movgrgr, { 0x4200 }
468*3d8817e4Smiod   },
469*3d8817e4Smiod /* or Rx,#$imm8 */
470*3d8817e4Smiod   {
471*3d8817e4Smiod     { 0, 0, 0, 0 },
472*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
473*3d8817e4Smiod     & ifmt_movwimm8, { 0x4300 }
474*3d8817e4Smiod   },
475*3d8817e4Smiod /* or $Rd,#$imm16 */
476*3d8817e4Smiod   {
477*3d8817e4Smiod     { 0, 0, 0, 0 },
478*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
479*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31100000 }
480*3d8817e4Smiod   },
481*3d8817e4Smiod /* xor $Rd,$Rs */
482*3d8817e4Smiod   {
483*3d8817e4Smiod     { 0, 0, 0, 0 },
484*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
485*3d8817e4Smiod     & ifmt_movgrgr, { 0x4400 }
486*3d8817e4Smiod   },
487*3d8817e4Smiod /* xor Rx,#$imm8 */
488*3d8817e4Smiod   {
489*3d8817e4Smiod     { 0, 0, 0, 0 },
490*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
491*3d8817e4Smiod     & ifmt_movwimm8, { 0x4500 }
492*3d8817e4Smiod   },
493*3d8817e4Smiod /* xor $Rd,#$imm16 */
494*3d8817e4Smiod   {
495*3d8817e4Smiod     { 0, 0, 0, 0 },
496*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
497*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31200000 }
498*3d8817e4Smiod   },
499*3d8817e4Smiod /* not $Rd */
500*3d8817e4Smiod   {
501*3d8817e4Smiod     { 0, 0, 0, 0 },
502*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
503*3d8817e4Smiod     & ifmt_movlowgr, { 0x30b0 }
504*3d8817e4Smiod   },
505*3d8817e4Smiod /* add $Rd,$Rs */
506*3d8817e4Smiod   {
507*3d8817e4Smiod     { 0, 0, 0, 0 },
508*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
509*3d8817e4Smiod     & ifmt_movgrgr, { 0x4900 }
510*3d8817e4Smiod   },
511*3d8817e4Smiod /* add $Rd,#$imm4 */
512*3d8817e4Smiod   {
513*3d8817e4Smiod     { 0, 0, 0, 0 },
514*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
515*3d8817e4Smiod     & ifmt_addgrimm4, { 0x5100 }
516*3d8817e4Smiod   },
517*3d8817e4Smiod /* add Rx,#$imm8 */
518*3d8817e4Smiod   {
519*3d8817e4Smiod     { 0, 0, 0, 0 },
520*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
521*3d8817e4Smiod     & ifmt_movwimm8, { 0x5900 }
522*3d8817e4Smiod   },
523*3d8817e4Smiod /* add $Rd,#$imm16 */
524*3d8817e4Smiod   {
525*3d8817e4Smiod     { 0, 0, 0, 0 },
526*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
527*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31400000 }
528*3d8817e4Smiod   },
529*3d8817e4Smiod /* adc $Rd,$Rs */
530*3d8817e4Smiod   {
531*3d8817e4Smiod     { 0, 0, 0, 0 },
532*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
533*3d8817e4Smiod     & ifmt_movgrgr, { 0x4b00 }
534*3d8817e4Smiod   },
535*3d8817e4Smiod /* adc $Rd,#$imm4 */
536*3d8817e4Smiod   {
537*3d8817e4Smiod     { 0, 0, 0, 0 },
538*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
539*3d8817e4Smiod     & ifmt_addgrimm4, { 0x5300 }
540*3d8817e4Smiod   },
541*3d8817e4Smiod /* adc Rx,#$imm8 */
542*3d8817e4Smiod   {
543*3d8817e4Smiod     { 0, 0, 0, 0 },
544*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
545*3d8817e4Smiod     & ifmt_movwimm8, { 0x5b00 }
546*3d8817e4Smiod   },
547*3d8817e4Smiod /* adc $Rd,#$imm16 */
548*3d8817e4Smiod   {
549*3d8817e4Smiod     { 0, 0, 0, 0 },
550*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
551*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31500000 }
552*3d8817e4Smiod   },
553*3d8817e4Smiod /* sub $Rd,$Rs */
554*3d8817e4Smiod   {
555*3d8817e4Smiod     { 0, 0, 0, 0 },
556*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
557*3d8817e4Smiod     & ifmt_movgrgr, { 0x4d00 }
558*3d8817e4Smiod   },
559*3d8817e4Smiod /* sub $Rd,#$imm4 */
560*3d8817e4Smiod   {
561*3d8817e4Smiod     { 0, 0, 0, 0 },
562*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
563*3d8817e4Smiod     & ifmt_addgrimm4, { 0x5500 }
564*3d8817e4Smiod   },
565*3d8817e4Smiod /* sub Rx,#$imm8 */
566*3d8817e4Smiod   {
567*3d8817e4Smiod     { 0, 0, 0, 0 },
568*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
569*3d8817e4Smiod     & ifmt_movwimm8, { 0x5d00 }
570*3d8817e4Smiod   },
571*3d8817e4Smiod /* sub $Rd,#$imm16 */
572*3d8817e4Smiod   {
573*3d8817e4Smiod     { 0, 0, 0, 0 },
574*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
575*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31600000 }
576*3d8817e4Smiod   },
577*3d8817e4Smiod /* sbc $Rd,$Rs */
578*3d8817e4Smiod   {
579*3d8817e4Smiod     { 0, 0, 0, 0 },
580*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
581*3d8817e4Smiod     & ifmt_movgrgr, { 0x4f00 }
582*3d8817e4Smiod   },
583*3d8817e4Smiod /* sbc $Rd,#$imm4 */
584*3d8817e4Smiod   {
585*3d8817e4Smiod     { 0, 0, 0, 0 },
586*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
587*3d8817e4Smiod     & ifmt_addgrimm4, { 0x5700 }
588*3d8817e4Smiod   },
589*3d8817e4Smiod /* sbc Rx,#$imm8 */
590*3d8817e4Smiod   {
591*3d8817e4Smiod     { 0, 0, 0, 0 },
592*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
593*3d8817e4Smiod     & ifmt_movwimm8, { 0x5f00 }
594*3d8817e4Smiod   },
595*3d8817e4Smiod /* sbc $Rd,#$imm16 */
596*3d8817e4Smiod   {
597*3d8817e4Smiod     { 0, 0, 0, 0 },
598*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
599*3d8817e4Smiod     & ifmt_movwgrimm16, { 0x31700000 }
600*3d8817e4Smiod   },
601*3d8817e4Smiod /* inc $Rd,#$imm2 */
602*3d8817e4Smiod   {
603*3d8817e4Smiod     { 0, 0, 0, 0 },
604*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM2), 0 } },
605*3d8817e4Smiod     & ifmt_incgrimm2, { 0x3000 }
606*3d8817e4Smiod   },
607*3d8817e4Smiod /* dec $Rd,#$imm2 */
608*3d8817e4Smiod   {
609*3d8817e4Smiod     { 0, 0, 0, 0 },
610*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM2), 0 } },
611*3d8817e4Smiod     & ifmt_incgrimm2, { 0x3040 }
612*3d8817e4Smiod   },
613*3d8817e4Smiod /* rrc $Rd,$Rs */
614*3d8817e4Smiod   {
615*3d8817e4Smiod     { 0, 0, 0, 0 },
616*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
617*3d8817e4Smiod     & ifmt_movgrgr, { 0x3800 }
618*3d8817e4Smiod   },
619*3d8817e4Smiod /* rrc $Rd,#$imm4 */
620*3d8817e4Smiod   {
621*3d8817e4Smiod     { 0, 0, 0, 0 },
622*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
623*3d8817e4Smiod     & ifmt_addgrimm4, { 0x3900 }
624*3d8817e4Smiod   },
625*3d8817e4Smiod /* rlc $Rd,$Rs */
626*3d8817e4Smiod   {
627*3d8817e4Smiod     { 0, 0, 0, 0 },
628*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
629*3d8817e4Smiod     & ifmt_movgrgr, { 0x3a00 }
630*3d8817e4Smiod   },
631*3d8817e4Smiod /* rlc $Rd,#$imm4 */
632*3d8817e4Smiod   {
633*3d8817e4Smiod     { 0, 0, 0, 0 },
634*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
635*3d8817e4Smiod     & ifmt_addgrimm4, { 0x3b00 }
636*3d8817e4Smiod   },
637*3d8817e4Smiod /* shr $Rd,$Rs */
638*3d8817e4Smiod   {
639*3d8817e4Smiod     { 0, 0, 0, 0 },
640*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
641*3d8817e4Smiod     & ifmt_movgrgr, { 0x3c00 }
642*3d8817e4Smiod   },
643*3d8817e4Smiod /* shr $Rd,#$imm4 */
644*3d8817e4Smiod   {
645*3d8817e4Smiod     { 0, 0, 0, 0 },
646*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
647*3d8817e4Smiod     & ifmt_addgrimm4, { 0x3d00 }
648*3d8817e4Smiod   },
649*3d8817e4Smiod /* shl $Rd,$Rs */
650*3d8817e4Smiod   {
651*3d8817e4Smiod     { 0, 0, 0, 0 },
652*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
653*3d8817e4Smiod     & ifmt_movgrgr, { 0x3e00 }
654*3d8817e4Smiod   },
655*3d8817e4Smiod /* shl $Rd,#$imm4 */
656*3d8817e4Smiod   {
657*3d8817e4Smiod     { 0, 0, 0, 0 },
658*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
659*3d8817e4Smiod     & ifmt_addgrimm4, { 0x3f00 }
660*3d8817e4Smiod   },
661*3d8817e4Smiod /* asr $Rd,$Rs */
662*3d8817e4Smiod   {
663*3d8817e4Smiod     { 0, 0, 0, 0 },
664*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
665*3d8817e4Smiod     & ifmt_movgrgr, { 0x3600 }
666*3d8817e4Smiod   },
667*3d8817e4Smiod /* asr $Rd,#$imm4 */
668*3d8817e4Smiod   {
669*3d8817e4Smiod     { 0, 0, 0, 0 },
670*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
671*3d8817e4Smiod     & ifmt_addgrimm4, { 0x3700 }
672*3d8817e4Smiod   },
673*3d8817e4Smiod /* set1 $Rd,#$imm4 */
674*3d8817e4Smiod   {
675*3d8817e4Smiod     { 0, 0, 0, 0 },
676*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
677*3d8817e4Smiod     & ifmt_addgrimm4, { 0x900 }
678*3d8817e4Smiod   },
679*3d8817e4Smiod /* set1 $Rd,$Rs */
680*3d8817e4Smiod   {
681*3d8817e4Smiod     { 0, 0, 0, 0 },
682*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
683*3d8817e4Smiod     & ifmt_movgrgr, { 0xb00 }
684*3d8817e4Smiod   },
685*3d8817e4Smiod /* set1 $lmem8,#$imm3 */
686*3d8817e4Smiod   {
687*3d8817e4Smiod     { 0, 0, 0, 0 },
688*3d8817e4Smiod     { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3), 0 } },
689*3d8817e4Smiod     & ifmt_set1lmemimm, { 0xe100 }
690*3d8817e4Smiod   },
691*3d8817e4Smiod /* set1 $hmem8,#$imm3 */
692*3d8817e4Smiod   {
693*3d8817e4Smiod     { 0, 0, 0, 0 },
694*3d8817e4Smiod     { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3), 0 } },
695*3d8817e4Smiod     & ifmt_set1hmemimm, { 0xf100 }
696*3d8817e4Smiod   },
697*3d8817e4Smiod /* clr1 $Rd,#$imm4 */
698*3d8817e4Smiod   {
699*3d8817e4Smiod     { 0, 0, 0, 0 },
700*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
701*3d8817e4Smiod     & ifmt_addgrimm4, { 0x800 }
702*3d8817e4Smiod   },
703*3d8817e4Smiod /* clr1 $Rd,$Rs */
704*3d8817e4Smiod   {
705*3d8817e4Smiod     { 0, 0, 0, 0 },
706*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
707*3d8817e4Smiod     & ifmt_movgrgr, { 0xa00 }
708*3d8817e4Smiod   },
709*3d8817e4Smiod /* clr1 $lmem8,#$imm3 */
710*3d8817e4Smiod   {
711*3d8817e4Smiod     { 0, 0, 0, 0 },
712*3d8817e4Smiod     { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3), 0 } },
713*3d8817e4Smiod     & ifmt_set1lmemimm, { 0xe000 }
714*3d8817e4Smiod   },
715*3d8817e4Smiod /* clr1 $hmem8,#$imm3 */
716*3d8817e4Smiod   {
717*3d8817e4Smiod     { 0, 0, 0, 0 },
718*3d8817e4Smiod     { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3), 0 } },
719*3d8817e4Smiod     & ifmt_set1hmemimm, { 0xf000 }
720*3d8817e4Smiod   },
721*3d8817e4Smiod /* cbw $Rd */
722*3d8817e4Smiod   {
723*3d8817e4Smiod     { 0, 0, 0, 0 },
724*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
725*3d8817e4Smiod     & ifmt_movlowgr, { 0x30a0 }
726*3d8817e4Smiod   },
727*3d8817e4Smiod /* rev $Rd */
728*3d8817e4Smiod   {
729*3d8817e4Smiod     { 0, 0, 0, 0 },
730*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
731*3d8817e4Smiod     & ifmt_movlowgr, { 0x30f0 }
732*3d8817e4Smiod   },
733*3d8817e4Smiod /* b$bcond5 $Rd,$Rs,$rel12 */
734*3d8817e4Smiod   {
735*3d8817e4Smiod     { 0, 0, 0, 0 },
736*3d8817e4Smiod     { { MNEM, OP (BCOND5), ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
737*3d8817e4Smiod     & ifmt_bccgrgr, { 0xd000000 }
738*3d8817e4Smiod   },
739*3d8817e4Smiod /* b$bcond5 $Rm,#$imm8,$rel12 */
740*3d8817e4Smiod   {
741*3d8817e4Smiod     { 0, 0, 0, 0 },
742*3d8817e4Smiod     { { MNEM, OP (BCOND5), ' ', OP (RM), ',', '#', OP (IMM8), ',', OP (REL12), 0 } },
743*3d8817e4Smiod     & ifmt_bccgrimm8, { 0x20000000 }
744*3d8817e4Smiod   },
745*3d8817e4Smiod /* b$bcond2 Rx,#$imm16,${rel8-4} */
746*3d8817e4Smiod   {
747*3d8817e4Smiod     { 0, 0, 0, 0 },
748*3d8817e4Smiod     { { MNEM, OP (BCOND2), ' ', 'R', 'x', ',', '#', OP (IMM16), ',', OP (REL8_4), 0 } },
749*3d8817e4Smiod     & ifmt_bccimm16, { 0xc0000000 }
750*3d8817e4Smiod   },
751*3d8817e4Smiod /* bn $Rd,#$imm4,$rel12 */
752*3d8817e4Smiod   {
753*3d8817e4Smiod     { 0, 0, 0, 0 },
754*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), ',', OP (REL12), 0 } },
755*3d8817e4Smiod     & ifmt_bngrimm4, { 0x4000000 }
756*3d8817e4Smiod   },
757*3d8817e4Smiod /* bn $Rd,$Rs,$rel12 */
758*3d8817e4Smiod   {
759*3d8817e4Smiod     { 0, 0, 0, 0 },
760*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
761*3d8817e4Smiod     & ifmt_bngrgr, { 0x6000000 }
762*3d8817e4Smiod   },
763*3d8817e4Smiod /* bn $lmem8,#$imm3b,$rel12 */
764*3d8817e4Smiod   {
765*3d8817e4Smiod     { 0, 0, 0, 0 },
766*3d8817e4Smiod     { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
767*3d8817e4Smiod     & ifmt_bnlmemimm, { 0x7c000000 }
768*3d8817e4Smiod   },
769*3d8817e4Smiod /* bn $hmem8,#$imm3b,$rel12 */
770*3d8817e4Smiod   {
771*3d8817e4Smiod     { 0, 0, 0, 0 },
772*3d8817e4Smiod     { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
773*3d8817e4Smiod     & ifmt_bnhmemimm, { 0x7e000000 }
774*3d8817e4Smiod   },
775*3d8817e4Smiod /* bp $Rd,#$imm4,$rel12 */
776*3d8817e4Smiod   {
777*3d8817e4Smiod     { 0, 0, 0, 0 },
778*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), ',', OP (REL12), 0 } },
779*3d8817e4Smiod     & ifmt_bngrimm4, { 0x5000000 }
780*3d8817e4Smiod   },
781*3d8817e4Smiod /* bp $Rd,$Rs,$rel12 */
782*3d8817e4Smiod   {
783*3d8817e4Smiod     { 0, 0, 0, 0 },
784*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
785*3d8817e4Smiod     & ifmt_bngrgr, { 0x7000000 }
786*3d8817e4Smiod   },
787*3d8817e4Smiod /* bp $lmem8,#$imm3b,$rel12 */
788*3d8817e4Smiod   {
789*3d8817e4Smiod     { 0, 0, 0, 0 },
790*3d8817e4Smiod     { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
791*3d8817e4Smiod     & ifmt_bnlmemimm, { 0x7d000000 }
792*3d8817e4Smiod   },
793*3d8817e4Smiod /* bp $hmem8,#$imm3b,$rel12 */
794*3d8817e4Smiod   {
795*3d8817e4Smiod     { 0, 0, 0, 0 },
796*3d8817e4Smiod     { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
797*3d8817e4Smiod     & ifmt_bnhmemimm, { 0x7f000000 }
798*3d8817e4Smiod   },
799*3d8817e4Smiod /* b$bcond2 ${rel8-2} */
800*3d8817e4Smiod   {
801*3d8817e4Smiod     { 0, 0, 0, 0 },
802*3d8817e4Smiod     { { MNEM, OP (BCOND2), ' ', OP (REL8_2), 0 } },
803*3d8817e4Smiod     & ifmt_bcc, { 0xd000 }
804*3d8817e4Smiod   },
805*3d8817e4Smiod /* br $Rd */
806*3d8817e4Smiod   {
807*3d8817e4Smiod     { 0, 0, 0, 0 },
808*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
809*3d8817e4Smiod     & ifmt_movlowgr, { 0x20 }
810*3d8817e4Smiod   },
811*3d8817e4Smiod /* br $rel12a */
812*3d8817e4Smiod   {
813*3d8817e4Smiod     { 0, 0, 0, 0 },
814*3d8817e4Smiod     { { MNEM, ' ', OP (REL12A), 0 } },
815*3d8817e4Smiod     & ifmt_br, { 0x1000 }
816*3d8817e4Smiod   },
817*3d8817e4Smiod /* jmp $Rbj,$Rd */
818*3d8817e4Smiod   {
819*3d8817e4Smiod     { 0, 0, 0, 0 },
820*3d8817e4Smiod     { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
821*3d8817e4Smiod     & ifmt_jmp, { 0x40 }
822*3d8817e4Smiod   },
823*3d8817e4Smiod /* jmpf $abs24 */
824*3d8817e4Smiod   {
825*3d8817e4Smiod     { 0, 0, 0, 0 },
826*3d8817e4Smiod     { { MNEM, ' ', OP (ABS24), 0 } },
827*3d8817e4Smiod     & ifmt_jmpf, { 0x2000000 }
828*3d8817e4Smiod   },
829*3d8817e4Smiod /* callr $Rd */
830*3d8817e4Smiod   {
831*3d8817e4Smiod     { 0, 0, 0, 0 },
832*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
833*3d8817e4Smiod     & ifmt_movlowgr, { 0x10 }
834*3d8817e4Smiod   },
835*3d8817e4Smiod /* callr $rel12a */
836*3d8817e4Smiod   {
837*3d8817e4Smiod     { 0, 0, 0, 0 },
838*3d8817e4Smiod     { { MNEM, ' ', OP (REL12A), 0 } },
839*3d8817e4Smiod     & ifmt_br, { 0x1001 }
840*3d8817e4Smiod   },
841*3d8817e4Smiod /* call $Rbj,$Rd */
842*3d8817e4Smiod   {
843*3d8817e4Smiod     { 0, 0, 0, 0 },
844*3d8817e4Smiod     { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
845*3d8817e4Smiod     & ifmt_jmp, { 0xa0 }
846*3d8817e4Smiod   },
847*3d8817e4Smiod /* callf $abs24 */
848*3d8817e4Smiod   {
849*3d8817e4Smiod     { 0, 0, 0, 0 },
850*3d8817e4Smiod     { { MNEM, ' ', OP (ABS24), 0 } },
851*3d8817e4Smiod     & ifmt_jmpf, { 0x1000000 }
852*3d8817e4Smiod   },
853*3d8817e4Smiod /* icallr $Rd */
854*3d8817e4Smiod   {
855*3d8817e4Smiod     { 0, 0, 0, 0 },
856*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
857*3d8817e4Smiod     & ifmt_movlowgr, { 0x30 }
858*3d8817e4Smiod   },
859*3d8817e4Smiod /* icall $Rbj,$Rd */
860*3d8817e4Smiod   {
861*3d8817e4Smiod     { 0, 0, 0, 0 },
862*3d8817e4Smiod     { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
863*3d8817e4Smiod     & ifmt_jmp, { 0x60 }
864*3d8817e4Smiod   },
865*3d8817e4Smiod /* icallf $abs24 */
866*3d8817e4Smiod   {
867*3d8817e4Smiod     { 0, 0, 0, 0 },
868*3d8817e4Smiod     { { MNEM, ' ', OP (ABS24), 0 } },
869*3d8817e4Smiod     & ifmt_jmpf, { 0x3000000 }
870*3d8817e4Smiod   },
871*3d8817e4Smiod /* iret */
872*3d8817e4Smiod   {
873*3d8817e4Smiod     { 0, 0, 0, 0 },
874*3d8817e4Smiod     { { MNEM, 0 } },
875*3d8817e4Smiod     & ifmt_iret, { 0x2 }
876*3d8817e4Smiod   },
877*3d8817e4Smiod /* ret */
878*3d8817e4Smiod   {
879*3d8817e4Smiod     { 0, 0, 0, 0 },
880*3d8817e4Smiod     { { MNEM, 0 } },
881*3d8817e4Smiod     & ifmt_iret, { 0x3 }
882*3d8817e4Smiod   },
883*3d8817e4Smiod /* mul */
884*3d8817e4Smiod   {
885*3d8817e4Smiod     { 0, 0, 0, 0 },
886*3d8817e4Smiod     { { MNEM, 0 } },
887*3d8817e4Smiod     & ifmt_iret, { 0xd0 }
888*3d8817e4Smiod   },
889*3d8817e4Smiod /* div */
890*3d8817e4Smiod   {
891*3d8817e4Smiod     { 0, 0, 0, 0 },
892*3d8817e4Smiod     { { MNEM, 0 } },
893*3d8817e4Smiod     & ifmt_iret, { 0xc0 }
894*3d8817e4Smiod   },
895*3d8817e4Smiod /* sdiv */
896*3d8817e4Smiod   {
897*3d8817e4Smiod     { 0, 0, 0, 0 },
898*3d8817e4Smiod     { { MNEM, 0 } },
899*3d8817e4Smiod     & ifmt_iret, { 0xc8 }
900*3d8817e4Smiod   },
901*3d8817e4Smiod /* sdivlh */
902*3d8817e4Smiod   {
903*3d8817e4Smiod     { 0, 0, 0, 0 },
904*3d8817e4Smiod     { { MNEM, 0 } },
905*3d8817e4Smiod     & ifmt_iret, { 0xe8 }
906*3d8817e4Smiod   },
907*3d8817e4Smiod /* divlh */
908*3d8817e4Smiod   {
909*3d8817e4Smiod     { 0, 0, 0, 0 },
910*3d8817e4Smiod     { { MNEM, 0 } },
911*3d8817e4Smiod     & ifmt_iret, { 0xe0 }
912*3d8817e4Smiod   },
913*3d8817e4Smiod /* reset */
914*3d8817e4Smiod   {
915*3d8817e4Smiod     { 0, 0, 0, 0 },
916*3d8817e4Smiod     { { MNEM, 0 } },
917*3d8817e4Smiod     & ifmt_iret, { 0xf }
918*3d8817e4Smiod   },
919*3d8817e4Smiod /* nop */
920*3d8817e4Smiod   {
921*3d8817e4Smiod     { 0, 0, 0, 0 },
922*3d8817e4Smiod     { { MNEM, 0 } },
923*3d8817e4Smiod     & ifmt_iret, { 0x0 }
924*3d8817e4Smiod   },
925*3d8817e4Smiod /* halt */
926*3d8817e4Smiod   {
927*3d8817e4Smiod     { 0, 0, 0, 0 },
928*3d8817e4Smiod     { { MNEM, 0 } },
929*3d8817e4Smiod     & ifmt_iret, { 0x8 }
930*3d8817e4Smiod   },
931*3d8817e4Smiod /* hold */
932*3d8817e4Smiod   {
933*3d8817e4Smiod     { 0, 0, 0, 0 },
934*3d8817e4Smiod     { { MNEM, 0 } },
935*3d8817e4Smiod     & ifmt_iret, { 0xa }
936*3d8817e4Smiod   },
937*3d8817e4Smiod /* holdx */
938*3d8817e4Smiod   {
939*3d8817e4Smiod     { 0, 0, 0, 0 },
940*3d8817e4Smiod     { { MNEM, 0 } },
941*3d8817e4Smiod     & ifmt_iret, { 0xb }
942*3d8817e4Smiod   },
943*3d8817e4Smiod /* brk */
944*3d8817e4Smiod   {
945*3d8817e4Smiod     { 0, 0, 0, 0 },
946*3d8817e4Smiod     { { MNEM, 0 } },
947*3d8817e4Smiod     & ifmt_iret, { 0x5 }
948*3d8817e4Smiod   },
949*3d8817e4Smiod /* --unused-- */
950*3d8817e4Smiod   {
951*3d8817e4Smiod     { 0, 0, 0, 0 },
952*3d8817e4Smiod     { { MNEM, 0 } },
953*3d8817e4Smiod     & ifmt_iret, { 0x1 }
954*3d8817e4Smiod   },
955*3d8817e4Smiod };
956*3d8817e4Smiod 
957*3d8817e4Smiod #undef A
958*3d8817e4Smiod #undef OPERAND
959*3d8817e4Smiod #undef MNEM
960*3d8817e4Smiod #undef OP
961*3d8817e4Smiod 
962*3d8817e4Smiod /* Formats for ALIAS macro-insns.  */
963*3d8817e4Smiod 
964*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
965*3d8817e4Smiod #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_##f]
966*3d8817e4Smiod #else
967*3d8817e4Smiod #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_/**/f]
968*3d8817e4Smiod #endif
969*3d8817e4Smiod static const CGEN_IFMT ifmt_movimm8 ATTRIBUTE_UNUSED = {
970*3d8817e4Smiod   16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM8) }, { 0 } }
971*3d8817e4Smiod };
972*3d8817e4Smiod 
973*3d8817e4Smiod static const CGEN_IFMT ifmt_movgrimm8 ATTRIBUTE_UNUSED = {
974*3d8817e4Smiod   16, 16, 0xf100, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { 0 } }
975*3d8817e4Smiod };
976*3d8817e4Smiod 
977*3d8817e4Smiod static const CGEN_IFMT ifmt_movgrimm16 ATTRIBUTE_UNUSED = {
978*3d8817e4Smiod   32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { F (F_IMM16) }, { 0 } }
979*3d8817e4Smiod };
980*3d8817e4Smiod 
981*3d8817e4Smiod static const CGEN_IFMT ifmt_incgr ATTRIBUTE_UNUSED = {
982*3d8817e4Smiod   16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
983*3d8817e4Smiod };
984*3d8817e4Smiod 
985*3d8817e4Smiod static const CGEN_IFMT ifmt_decgr ATTRIBUTE_UNUSED = {
986*3d8817e4Smiod   16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
987*3d8817e4Smiod };
988*3d8817e4Smiod 
989*3d8817e4Smiod #undef F
990*3d8817e4Smiod 
991*3d8817e4Smiod /* Each non-simple macro entry points to an array of expansion possibilities.  */
992*3d8817e4Smiod 
993*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
994*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_##a)
995*3d8817e4Smiod #else
996*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_/**/a)
997*3d8817e4Smiod #endif
998*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
999*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_##op
1000*3d8817e4Smiod #else
1001*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_/**/op
1002*3d8817e4Smiod #endif
1003*3d8817e4Smiod #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1004*3d8817e4Smiod #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1005*3d8817e4Smiod 
1006*3d8817e4Smiod /* The macro instruction table.  */
1007*3d8817e4Smiod 
1008*3d8817e4Smiod static const CGEN_IBASE xstormy16_cgen_macro_insn_table[] =
1009*3d8817e4Smiod {
1010*3d8817e4Smiod /* mov Rx,#$imm8 */
1011*3d8817e4Smiod   {
1012*3d8817e4Smiod     -1, "movimm8", "mov", 16,
1013*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1014*3d8817e4Smiod   },
1015*3d8817e4Smiod /* mov $Rm,#$imm8small */
1016*3d8817e4Smiod   {
1017*3d8817e4Smiod     -1, "movgrimm8", "mov", 16,
1018*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1019*3d8817e4Smiod   },
1020*3d8817e4Smiod /* mov $Rd,#$imm16 */
1021*3d8817e4Smiod   {
1022*3d8817e4Smiod     -1, "movgrimm16", "mov", 32,
1023*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1024*3d8817e4Smiod   },
1025*3d8817e4Smiod /* inc $Rd */
1026*3d8817e4Smiod   {
1027*3d8817e4Smiod     -1, "incgr", "inc", 16,
1028*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1029*3d8817e4Smiod   },
1030*3d8817e4Smiod /* dec $Rd */
1031*3d8817e4Smiod   {
1032*3d8817e4Smiod     -1, "decgr", "dec", 16,
1033*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1034*3d8817e4Smiod   },
1035*3d8817e4Smiod };
1036*3d8817e4Smiod 
1037*3d8817e4Smiod /* The macro instruction opcode table.  */
1038*3d8817e4Smiod 
1039*3d8817e4Smiod static const CGEN_OPCODE xstormy16_cgen_macro_insn_opcode_table[] =
1040*3d8817e4Smiod {
1041*3d8817e4Smiod /* mov Rx,#$imm8 */
1042*3d8817e4Smiod   {
1043*3d8817e4Smiod     { 0, 0, 0, 0 },
1044*3d8817e4Smiod     { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
1045*3d8817e4Smiod     & ifmt_movimm8, { 0x4700 }
1046*3d8817e4Smiod   },
1047*3d8817e4Smiod /* mov $Rm,#$imm8small */
1048*3d8817e4Smiod   {
1049*3d8817e4Smiod     { 0, 0, 0, 0 },
1050*3d8817e4Smiod     { { MNEM, ' ', OP (RM), ',', '#', OP (IMM8SMALL), 0 } },
1051*3d8817e4Smiod     & ifmt_movgrimm8, { 0x2100 }
1052*3d8817e4Smiod   },
1053*3d8817e4Smiod /* mov $Rd,#$imm16 */
1054*3d8817e4Smiod   {
1055*3d8817e4Smiod     { 0, 0, 0, 0 },
1056*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
1057*3d8817e4Smiod     & ifmt_movgrimm16, { 0x31300000 }
1058*3d8817e4Smiod   },
1059*3d8817e4Smiod /* inc $Rd */
1060*3d8817e4Smiod   {
1061*3d8817e4Smiod     { 0, 0, 0, 0 },
1062*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
1063*3d8817e4Smiod     & ifmt_incgr, { 0x3000 }
1064*3d8817e4Smiod   },
1065*3d8817e4Smiod /* dec $Rd */
1066*3d8817e4Smiod   {
1067*3d8817e4Smiod     { 0, 0, 0, 0 },
1068*3d8817e4Smiod     { { MNEM, ' ', OP (RD), 0 } },
1069*3d8817e4Smiod     & ifmt_decgr, { 0x3040 }
1070*3d8817e4Smiod   },
1071*3d8817e4Smiod };
1072*3d8817e4Smiod 
1073*3d8817e4Smiod #undef A
1074*3d8817e4Smiod #undef OPERAND
1075*3d8817e4Smiod #undef MNEM
1076*3d8817e4Smiod #undef OP
1077*3d8817e4Smiod 
1078*3d8817e4Smiod #ifndef CGEN_ASM_HASH_P
1079*3d8817e4Smiod #define CGEN_ASM_HASH_P(insn) 1
1080*3d8817e4Smiod #endif
1081*3d8817e4Smiod 
1082*3d8817e4Smiod #ifndef CGEN_DIS_HASH_P
1083*3d8817e4Smiod #define CGEN_DIS_HASH_P(insn) 1
1084*3d8817e4Smiod #endif
1085*3d8817e4Smiod 
1086*3d8817e4Smiod /* Return non-zero if INSN is to be added to the hash table.
1087*3d8817e4Smiod    Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file.  */
1088*3d8817e4Smiod 
1089*3d8817e4Smiod static int
asm_hash_insn_p(insn)1090*3d8817e4Smiod asm_hash_insn_p (insn)
1091*3d8817e4Smiod      const CGEN_INSN *insn ATTRIBUTE_UNUSED;
1092*3d8817e4Smiod {
1093*3d8817e4Smiod   return CGEN_ASM_HASH_P (insn);
1094*3d8817e4Smiod }
1095*3d8817e4Smiod 
1096*3d8817e4Smiod static int
dis_hash_insn_p(insn)1097*3d8817e4Smiod dis_hash_insn_p (insn)
1098*3d8817e4Smiod      const CGEN_INSN *insn;
1099*3d8817e4Smiod {
1100*3d8817e4Smiod   /* If building the hash table and the NO-DIS attribute is present,
1101*3d8817e4Smiod      ignore.  */
1102*3d8817e4Smiod   if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1103*3d8817e4Smiod     return 0;
1104*3d8817e4Smiod   return CGEN_DIS_HASH_P (insn);
1105*3d8817e4Smiod }
1106*3d8817e4Smiod 
1107*3d8817e4Smiod #ifndef CGEN_ASM_HASH
1108*3d8817e4Smiod #define CGEN_ASM_HASH_SIZE 127
1109*3d8817e4Smiod #ifdef CGEN_MNEMONIC_OPERANDS
1110*3d8817e4Smiod #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1111*3d8817e4Smiod #else
1112*3d8817e4Smiod #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1113*3d8817e4Smiod #endif
1114*3d8817e4Smiod #endif
1115*3d8817e4Smiod 
1116*3d8817e4Smiod /* It doesn't make much sense to provide a default here,
1117*3d8817e4Smiod    but while this is under development we do.
1118*3d8817e4Smiod    BUFFER is a pointer to the bytes of the insn, target order.
1119*3d8817e4Smiod    VALUE is the first base_insn_bitsize bits as an int in host order.  */
1120*3d8817e4Smiod 
1121*3d8817e4Smiod #ifndef CGEN_DIS_HASH
1122*3d8817e4Smiod #define CGEN_DIS_HASH_SIZE 256
1123*3d8817e4Smiod #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1124*3d8817e4Smiod #endif
1125*3d8817e4Smiod 
1126*3d8817e4Smiod /* The result is the hash value of the insn.
1127*3d8817e4Smiod    Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file.  */
1128*3d8817e4Smiod 
1129*3d8817e4Smiod static unsigned int
asm_hash_insn(mnem)1130*3d8817e4Smiod asm_hash_insn (mnem)
1131*3d8817e4Smiod      const char * mnem;
1132*3d8817e4Smiod {
1133*3d8817e4Smiod   return CGEN_ASM_HASH (mnem);
1134*3d8817e4Smiod }
1135*3d8817e4Smiod 
1136*3d8817e4Smiod /* BUF is a pointer to the bytes of the insn, target order.
1137*3d8817e4Smiod    VALUE is the first base_insn_bitsize bits as an int in host order.  */
1138*3d8817e4Smiod 
1139*3d8817e4Smiod static unsigned int
dis_hash_insn(buf,value)1140*3d8817e4Smiod dis_hash_insn (buf, value)
1141*3d8817e4Smiod      const char * buf ATTRIBUTE_UNUSED;
1142*3d8817e4Smiod      CGEN_INSN_INT value ATTRIBUTE_UNUSED;
1143*3d8817e4Smiod {
1144*3d8817e4Smiod   return CGEN_DIS_HASH (buf, value);
1145*3d8817e4Smiod }
1146*3d8817e4Smiod 
1147*3d8817e4Smiod /* Set the recorded length of the insn in the CGEN_FIELDS struct.  */
1148*3d8817e4Smiod 
1149*3d8817e4Smiod static void
set_fields_bitsize(CGEN_FIELDS * fields,int size)1150*3d8817e4Smiod set_fields_bitsize (CGEN_FIELDS *fields, int size)
1151*3d8817e4Smiod {
1152*3d8817e4Smiod   CGEN_FIELDS_BITSIZE (fields) = size;
1153*3d8817e4Smiod }
1154*3d8817e4Smiod 
1155*3d8817e4Smiod /* Function to call before using the operand instance table.
1156*3d8817e4Smiod    This plugs the opcode entries and macro instructions into the cpu table.  */
1157*3d8817e4Smiod 
1158*3d8817e4Smiod void
xstormy16_cgen_init_opcode_table(CGEN_CPU_DESC cd)1159*3d8817e4Smiod xstormy16_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1160*3d8817e4Smiod {
1161*3d8817e4Smiod   int i;
1162*3d8817e4Smiod   int num_macros = (sizeof (xstormy16_cgen_macro_insn_table) /
1163*3d8817e4Smiod 		    sizeof (xstormy16_cgen_macro_insn_table[0]));
1164*3d8817e4Smiod   const CGEN_IBASE *ib = & xstormy16_cgen_macro_insn_table[0];
1165*3d8817e4Smiod   const CGEN_OPCODE *oc = & xstormy16_cgen_macro_insn_opcode_table[0];
1166*3d8817e4Smiod   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
1167*3d8817e4Smiod 
1168*3d8817e4Smiod   memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1169*3d8817e4Smiod   for (i = 0; i < num_macros; ++i)
1170*3d8817e4Smiod     {
1171*3d8817e4Smiod       insns[i].base = &ib[i];
1172*3d8817e4Smiod       insns[i].opcode = &oc[i];
1173*3d8817e4Smiod       xstormy16_cgen_build_insn_regex (& insns[i]);
1174*3d8817e4Smiod     }
1175*3d8817e4Smiod   cd->macro_insn_table.init_entries = insns;
1176*3d8817e4Smiod   cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1177*3d8817e4Smiod   cd->macro_insn_table.num_init_entries = num_macros;
1178*3d8817e4Smiod 
1179*3d8817e4Smiod   oc = & xstormy16_cgen_insn_opcode_table[0];
1180*3d8817e4Smiod   insns = (CGEN_INSN *) cd->insn_table.init_entries;
1181*3d8817e4Smiod   for (i = 0; i < MAX_INSNS; ++i)
1182*3d8817e4Smiod     {
1183*3d8817e4Smiod       insns[i].opcode = &oc[i];
1184*3d8817e4Smiod       xstormy16_cgen_build_insn_regex (& insns[i]);
1185*3d8817e4Smiod     }
1186*3d8817e4Smiod 
1187*3d8817e4Smiod   cd->sizeof_fields = sizeof (CGEN_FIELDS);
1188*3d8817e4Smiod   cd->set_fields_bitsize = set_fields_bitsize;
1189*3d8817e4Smiod 
1190*3d8817e4Smiod   cd->asm_hash_p = asm_hash_insn_p;
1191*3d8817e4Smiod   cd->asm_hash = asm_hash_insn;
1192*3d8817e4Smiod   cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1193*3d8817e4Smiod 
1194*3d8817e4Smiod   cd->dis_hash_p = dis_hash_insn_p;
1195*3d8817e4Smiod   cd->dis_hash = dis_hash_insn;
1196*3d8817e4Smiod   cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
1197*3d8817e4Smiod }
1198