1 /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 /* Instruction opcode table for xstormy16.
4 THIS FILE IS MACHINE GENERATED WITH CGEN.
6 Copyright (C) 1996-2019 Free Software Foundation, Inc.
8 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
10 This file is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
15 It is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 License for more details.
20 You should have received a copy of the GNU General Public License along
21 with this program; if not, write to the Free Software Foundation, Inc.,
22 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
30 #include "xstormy16-desc.h"
31 #include "xstormy16-opc.h"
32 #include "libiberty.h"
34 /* The hash functions are recorded here to help keep assembler code out of
35 the disassembler and vice versa. */
37 static int asm_hash_insn_p (const CGEN_INSN *);
38 static unsigned int asm_hash_insn (const char *);
39 static int dis_hash_insn_p (const CGEN_INSN *);
40 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
42 /* Instruction formats. */
44 #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_##f]
45 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
49 static const CGEN_IFMT ifmt_movlmemimm ATTRIBUTE_UNUSED = {
50 32, 32, 0xfe000000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_LMEM8) }, { F (F_IMM16) }, { 0 } }
53 static const CGEN_IFMT ifmt_movhmemimm ATTRIBUTE_UNUSED = {
54 32, 32, 0xfe000000, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_HMEM8) }, { F (F_IMM16) }, { 0 } }
57 static const CGEN_IFMT ifmt_movlgrmem ATTRIBUTE_UNUSED = {
58 16, 16, 0xf000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_LMEM8) }, { 0 } }
61 static const CGEN_IFMT ifmt_movhgrmem ATTRIBUTE_UNUSED = {
62 16, 16, 0xf000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_HMEM8) }, { 0 } }
65 static const CGEN_IFMT ifmt_movgrgri ATTRIBUTE_UNUSED = {
66 16, 16, 0xfe08, { { F (F_OP1) }, { F (F_OP2A) }, { F (F_OP2M) }, { F (F_RS) }, { F (F_OP4M) }, { F (F_RDM) }, { 0 } }
69 static const CGEN_IFMT ifmt_movgrgrii ATTRIBUTE_UNUSED = {
70 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 } }
73 static const CGEN_IFMT ifmt_movgrgr ATTRIBUTE_UNUSED = {
74 16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { 0 } }
77 static const CGEN_IFMT ifmt_movwimm8 ATTRIBUTE_UNUSED = {
78 16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM8) }, { 0 } }
81 static const CGEN_IFMT ifmt_movwgrimm8 ATTRIBUTE_UNUSED = {
82 16, 16, 0xf100, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { 0 } }
85 static const CGEN_IFMT ifmt_movwgrimm16 ATTRIBUTE_UNUSED = {
86 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { F (F_IMM16) }, { 0 } }
89 static const CGEN_IFMT ifmt_movlowgr ATTRIBUTE_UNUSED = {
90 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { 0 } }
93 static const CGEN_IFMT ifmt_movfgrgrii ATTRIBUTE_UNUSED = {
94 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 } }
97 static const CGEN_IFMT ifmt_addgrimm4 ATTRIBUTE_UNUSED = {
98 16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM4) }, { F (F_RD) }, { 0 } }
101 static const CGEN_IFMT ifmt_incgrimm2 ATTRIBUTE_UNUSED = {
102 16, 16, 0xffc0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
105 static const CGEN_IFMT ifmt_set1lmemimm ATTRIBUTE_UNUSED = {
106 16, 16, 0xf100, { { F (F_OP1) }, { F (F_IMM3) }, { F (F_OP2M) }, { F (F_LMEM8) }, { 0 } }
109 static const CGEN_IFMT ifmt_set1hmemimm ATTRIBUTE_UNUSED = {
110 16, 16, 0xf100, { { F (F_OP1) }, { F (F_IMM3) }, { F (F_OP2M) }, { F (F_HMEM8) }, { 0 } }
113 static const CGEN_IFMT ifmt_bccgrgr ATTRIBUTE_UNUSED = {
114 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
117 static const CGEN_IFMT ifmt_bccgrimm8 ATTRIBUTE_UNUSED = {
118 32, 32, 0xf1000000, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
121 static const CGEN_IFMT ifmt_bccimm16 ATTRIBUTE_UNUSED = {
122 32, 32, 0xf0000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REL8_4) }, { F (F_IMM16) }, { 0 } }
125 static const CGEN_IFMT ifmt_bngrimm4 ATTRIBUTE_UNUSED = {
126 32, 32, 0xff00f000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM4) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
129 static const CGEN_IFMT ifmt_bngrgr ATTRIBUTE_UNUSED = {
130 32, 32, 0xff00f000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS) }, { F (F_RD) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
133 static const CGEN_IFMT ifmt_bnlmemimm ATTRIBUTE_UNUSED = {
134 32, 32, 0xff008000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_LMEM8) }, { F (F_OP5A) }, { F (F_IMM3B) }, { F (F_REL12) }, { 0 } }
137 static const CGEN_IFMT ifmt_bnhmemimm ATTRIBUTE_UNUSED = {
138 32, 32, 0xff008000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_HMEM8) }, { F (F_OP5A) }, { F (F_IMM3B) }, { F (F_REL12) }, { 0 } }
141 static const CGEN_IFMT ifmt_bcc ATTRIBUTE_UNUSED = {
142 16, 16, 0xf000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REL8_2) }, { 0 } }
145 static const CGEN_IFMT ifmt_br ATTRIBUTE_UNUSED = {
146 16, 16, 0xf001, { { F (F_OP1) }, { F (F_REL12A) }, { F (F_OP4B) }, { 0 } }
149 static const CGEN_IFMT ifmt_jmp ATTRIBUTE_UNUSED = {
150 16, 16, 0xffe0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3B) }, { F (F_RBJ) }, { F (F_RD) }, { 0 } }
153 static const CGEN_IFMT ifmt_jmpf ATTRIBUTE_UNUSED = {
154 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_ABS24) }, { 0 } }
157 static const CGEN_IFMT ifmt_iret ATTRIBUTE_UNUSED = {
158 16, 16, 0xffff, { { F (F_OP) }, { 0 } }
163 #define A(a) (1 << CGEN_INSN_##a)
164 #define OPERAND(op) XSTORMY16_OPERAND_##op
165 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
166 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
168 /* The instruction table. */
170 static const CGEN_OPCODE xstormy16_cgen_insn_opcode_table[MAX_INSNS] =
172 /* Special null first entry.
173 A `num' value of zero is thus invalid.
174 Also, the special `invalid' insn resides here. */
175 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
176 /* mov$ws2 $lmem8,#$imm16 */
179 { { MNEM, OP (WS2), ' ', OP (LMEM8), ',', '#', OP (IMM16), 0 } },
180 & ifmt_movlmemimm, { 0x78000000 }
182 /* mov$ws2 $hmem8,#$imm16 */
185 { { MNEM, OP (WS2), ' ', OP (HMEM8), ',', '#', OP (IMM16), 0 } },
186 & ifmt_movhmemimm, { 0x7a000000 }
188 /* mov$ws2 $Rm,$lmem8 */
191 { { MNEM, OP (WS2), ' ', OP (RM), ',', OP (LMEM8), 0 } },
192 & ifmt_movlgrmem, { 0x8000 }
194 /* mov$ws2 $Rm,$hmem8 */
197 { { MNEM, OP (WS2), ' ', OP (RM), ',', OP (HMEM8), 0 } },
198 & ifmt_movhgrmem, { 0xa000 }
200 /* mov$ws2 $lmem8,$Rm */
203 { { MNEM, OP (WS2), ' ', OP (LMEM8), ',', OP (RM), 0 } },
204 & ifmt_movlgrmem, { 0x9000 }
206 /* mov$ws2 $hmem8,$Rm */
209 { { MNEM, OP (WS2), ' ', OP (HMEM8), ',', OP (RM), 0 } },
210 & ifmt_movhgrmem, { 0xb000 }
212 /* mov$ws2 $Rdm,($Rs) */
215 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ')', 0 } },
216 & ifmt_movgrgri, { 0x7000 }
218 /* mov$ws2 $Rdm,($Rs++) */
221 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ')', 0 } },
222 & ifmt_movgrgri, { 0x6000 }
224 /* mov$ws2 $Rdm,(--$Rs) */
227 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ')', 0 } },
228 & ifmt_movgrgri, { 0x6800 }
230 /* mov$ws2 ($Rs),$Rdm */
233 { { MNEM, OP (WS2), ' ', '(', OP (RS), ')', ',', OP (RDM), 0 } },
234 & ifmt_movgrgri, { 0x7200 }
236 /* mov$ws2 ($Rs++),$Rdm */
239 { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ')', ',', OP (RDM), 0 } },
240 & ifmt_movgrgri, { 0x6200 }
242 /* mov$ws2 (--$Rs),$Rdm */
245 { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ')', ',', OP (RDM), 0 } },
246 & ifmt_movgrgri, { 0x6a00 }
248 /* mov$ws2 $Rdm,($Rs,$imm12) */
251 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ',', OP (IMM12), ')', 0 } },
252 & ifmt_movgrgrii, { 0x70080000 }
254 /* mov$ws2 $Rdm,($Rs++,$imm12) */
257 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ',', OP (IMM12), ')', 0 } },
258 & ifmt_movgrgrii, { 0x60080000 }
260 /* mov$ws2 $Rdm,(--$Rs,$imm12) */
263 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ',', OP (IMM12), ')', 0 } },
264 & ifmt_movgrgrii, { 0x68080000 }
266 /* mov$ws2 ($Rs,$imm12),$Rdm */
269 { { MNEM, OP (WS2), ' ', '(', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
270 & ifmt_movgrgrii, { 0x72080000 }
272 /* mov$ws2 ($Rs++,$imm12),$Rdm */
275 { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
276 & ifmt_movgrgrii, { 0x62080000 }
278 /* mov$ws2 (--$Rs,$imm12),$Rdm */
281 { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
282 & ifmt_movgrgrii, { 0x6a080000 }
287 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
288 & ifmt_movgrgr, { 0x4600 }
290 /* mov.w Rx,#$imm8 */
293 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
294 & ifmt_movwimm8, { 0x4700 }
296 /* mov.w $Rm,#$imm8small */
299 { { MNEM, ' ', OP (RM), ',', '#', OP (IMM8SMALL), 0 } },
300 & ifmt_movwgrimm8, { 0x2100 }
302 /* mov.w $Rd,#$imm16 */
305 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
306 & ifmt_movwgrimm16, { 0x31300000 }
311 { { MNEM, ' ', OP (RD), ',', 'R', 'x', 'L', 0 } },
312 & ifmt_movlowgr, { 0x30c0 }
317 { { MNEM, ' ', OP (RD), ',', 'R', 'x', 'H', 0 } },
318 & ifmt_movlowgr, { 0x30d0 }
320 /* movf$ws2 $Rdm,($Rs) */
323 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), ')', 0 } },
324 & ifmt_movgrgri, { 0x7400 }
326 /* movf$ws2 $Rdm,($Rs++) */
329 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RS), '+', '+', ')', 0 } },
330 & ifmt_movgrgri, { 0x6400 }
332 /* movf$ws2 $Rdm,(--$Rs) */
335 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', '-', '-', OP (RS), ')', 0 } },
336 & ifmt_movgrgri, { 0x6c00 }
338 /* movf$ws2 ($Rs),$Rdm */
341 { { MNEM, OP (WS2), ' ', '(', OP (RS), ')', ',', OP (RDM), 0 } },
342 & ifmt_movgrgri, { 0x7600 }
344 /* movf$ws2 ($Rs++),$Rdm */
347 { { MNEM, OP (WS2), ' ', '(', OP (RS), '+', '+', ')', ',', OP (RDM), 0 } },
348 & ifmt_movgrgri, { 0x6600 }
350 /* movf$ws2 (--$Rs),$Rdm */
353 { { MNEM, OP (WS2), ' ', '(', '-', '-', OP (RS), ')', ',', OP (RDM), 0 } },
354 & ifmt_movgrgri, { 0x6e00 }
356 /* movf$ws2 $Rdm,($Rb,$Rs,$imm12) */
359 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', OP (RS), ',', OP (IMM12), ')', 0 } },
360 & ifmt_movfgrgrii, { 0x74080000 }
362 /* movf$ws2 $Rdm,($Rb,$Rs++,$imm12) */
365 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', OP (RS), '+', '+', ',', OP (IMM12), ')', 0 } },
366 & ifmt_movfgrgrii, { 0x64080000 }
368 /* movf$ws2 $Rdm,($Rb,--$Rs,$imm12) */
371 { { MNEM, OP (WS2), ' ', OP (RDM), ',', '(', OP (RB), ',', '-', '-', OP (RS), ',', OP (IMM12), ')', 0 } },
372 & ifmt_movfgrgrii, { 0x6c080000 }
374 /* movf$ws2 ($Rb,$Rs,$imm12),$Rdm */
377 { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
378 & ifmt_movfgrgrii, { 0x76080000 }
380 /* movf$ws2 ($Rb,$Rs++,$imm12),$Rdm */
383 { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', OP (RS), '+', '+', ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
384 & ifmt_movfgrgrii, { 0x66080000 }
386 /* movf$ws2 ($Rb,--$Rs,$imm12),$Rdm */
389 { { MNEM, OP (WS2), ' ', '(', OP (RB), ',', '-', '-', OP (RS), ',', OP (IMM12), ')', ',', OP (RDM), 0 } },
390 & ifmt_movfgrgrii, { 0x6e080000 }
395 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
396 & ifmt_movgrgr, { 0x3300 }
398 /* mask $Rd,#$imm16 */
401 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
402 & ifmt_movwgrimm16, { 0x30e00000 }
407 { { MNEM, ' ', OP (RD), 0 } },
408 & ifmt_movlowgr, { 0x80 }
413 { { MNEM, ' ', OP (RD), 0 } },
414 & ifmt_movlowgr, { 0x90 }
419 { { MNEM, ' ', OP (RD), 0 } },
420 & ifmt_movlowgr, { 0x3090 }
425 { { MNEM, ' ', OP (RD), 0 } },
426 & ifmt_movlowgr, { 0x3080 }
431 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
432 & ifmt_movgrgr, { 0x3200 }
437 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
438 & ifmt_movgrgr, { 0x4000 }
443 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
444 & ifmt_movwimm8, { 0x4100 }
446 /* and $Rd,#$imm16 */
449 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
450 & ifmt_movwgrimm16, { 0x31000000 }
455 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
456 & ifmt_movgrgr, { 0x4200 }
461 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
462 & ifmt_movwimm8, { 0x4300 }
467 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
468 & ifmt_movwgrimm16, { 0x31100000 }
473 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
474 & ifmt_movgrgr, { 0x4400 }
479 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
480 & ifmt_movwimm8, { 0x4500 }
482 /* xor $Rd,#$imm16 */
485 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
486 & ifmt_movwgrimm16, { 0x31200000 }
491 { { MNEM, ' ', OP (RD), 0 } },
492 & ifmt_movlowgr, { 0x30b0 }
497 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
498 & ifmt_movgrgr, { 0x4900 }
503 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
504 & ifmt_addgrimm4, { 0x5100 }
509 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
510 & ifmt_movwimm8, { 0x5900 }
512 /* add $Rd,#$imm16 */
515 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
516 & ifmt_movwgrimm16, { 0x31400000 }
521 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
522 & ifmt_movgrgr, { 0x4b00 }
527 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
528 & ifmt_addgrimm4, { 0x5300 }
533 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
534 & ifmt_movwimm8, { 0x5b00 }
536 /* adc $Rd,#$imm16 */
539 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
540 & ifmt_movwgrimm16, { 0x31500000 }
545 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
546 & ifmt_movgrgr, { 0x4d00 }
551 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
552 & ifmt_addgrimm4, { 0x5500 }
557 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
558 & ifmt_movwimm8, { 0x5d00 }
560 /* sub $Rd,#$imm16 */
563 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
564 & ifmt_movwgrimm16, { 0x31600000 }
569 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
570 & ifmt_movgrgr, { 0x4f00 }
575 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
576 & ifmt_addgrimm4, { 0x5700 }
581 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
582 & ifmt_movwimm8, { 0x5f00 }
584 /* sbc $Rd,#$imm16 */
587 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
588 & ifmt_movwgrimm16, { 0x31700000 }
593 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM2), 0 } },
594 & ifmt_incgrimm2, { 0x3000 }
599 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM2), 0 } },
600 & ifmt_incgrimm2, { 0x3040 }
605 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
606 & ifmt_movgrgr, { 0x3800 }
611 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
612 & ifmt_addgrimm4, { 0x3900 }
617 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
618 & ifmt_movgrgr, { 0x3a00 }
623 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
624 & ifmt_addgrimm4, { 0x3b00 }
629 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
630 & ifmt_movgrgr, { 0x3c00 }
635 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
636 & ifmt_addgrimm4, { 0x3d00 }
641 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
642 & ifmt_movgrgr, { 0x3e00 }
647 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
648 & ifmt_addgrimm4, { 0x3f00 }
653 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
654 & ifmt_movgrgr, { 0x3600 }
659 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
660 & ifmt_addgrimm4, { 0x3700 }
662 /* set1 $Rd,#$imm4 */
665 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
666 & ifmt_addgrimm4, { 0x900 }
671 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
672 & ifmt_movgrgr, { 0xb00 }
674 /* set1 $lmem8,#$imm3 */
677 { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3), 0 } },
678 & ifmt_set1lmemimm, { 0xe100 }
680 /* set1 $hmem8,#$imm3 */
683 { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3), 0 } },
684 & ifmt_set1hmemimm, { 0xf100 }
686 /* clr1 $Rd,#$imm4 */
689 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), 0 } },
690 & ifmt_addgrimm4, { 0x800 }
695 { { MNEM, ' ', OP (RD), ',', OP (RS), 0 } },
696 & ifmt_movgrgr, { 0xa00 }
698 /* clr1 $lmem8,#$imm3 */
701 { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3), 0 } },
702 & ifmt_set1lmemimm, { 0xe000 }
704 /* clr1 $hmem8,#$imm3 */
707 { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3), 0 } },
708 & ifmt_set1hmemimm, { 0xf000 }
713 { { MNEM, ' ', OP (RD), 0 } },
714 & ifmt_movlowgr, { 0x30a0 }
719 { { MNEM, ' ', OP (RD), 0 } },
720 & ifmt_movlowgr, { 0x30f0 }
722 /* b$bcond5 $Rd,$Rs,$rel12 */
725 { { MNEM, OP (BCOND5), ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
726 & ifmt_bccgrgr, { 0xd000000 }
728 /* b$bcond5 $Rm,#$imm8,$rel12 */
731 { { MNEM, OP (BCOND5), ' ', OP (RM), ',', '#', OP (IMM8), ',', OP (REL12), 0 } },
732 & ifmt_bccgrimm8, { 0x20000000 }
734 /* b$bcond2 Rx,#$imm16,${rel8-4} */
737 { { MNEM, OP (BCOND2), ' ', 'R', 'x', ',', '#', OP (IMM16), ',', OP (REL8_4), 0 } },
738 & ifmt_bccimm16, { 0xc0000000 }
740 /* bn $Rd,#$imm4,$rel12 */
743 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), ',', OP (REL12), 0 } },
744 & ifmt_bngrimm4, { 0x4000000 }
746 /* bn $Rd,$Rs,$rel12 */
749 { { MNEM, ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
750 & ifmt_bngrgr, { 0x6000000 }
752 /* bn $lmem8,#$imm3b,$rel12 */
755 { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
756 & ifmt_bnlmemimm, { 0x7c000000 }
758 /* bn $hmem8,#$imm3b,$rel12 */
761 { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
762 & ifmt_bnhmemimm, { 0x7e000000 }
764 /* bp $Rd,#$imm4,$rel12 */
767 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM4), ',', OP (REL12), 0 } },
768 & ifmt_bngrimm4, { 0x5000000 }
770 /* bp $Rd,$Rs,$rel12 */
773 { { MNEM, ' ', OP (RD), ',', OP (RS), ',', OP (REL12), 0 } },
774 & ifmt_bngrgr, { 0x7000000 }
776 /* bp $lmem8,#$imm3b,$rel12 */
779 { { MNEM, ' ', OP (LMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
780 & ifmt_bnlmemimm, { 0x7d000000 }
782 /* bp $hmem8,#$imm3b,$rel12 */
785 { { MNEM, ' ', OP (HMEM8), ',', '#', OP (IMM3B), ',', OP (REL12), 0 } },
786 & ifmt_bnhmemimm, { 0x7f000000 }
788 /* b$bcond2 ${rel8-2} */
791 { { MNEM, OP (BCOND2), ' ', OP (REL8_2), 0 } },
792 & ifmt_bcc, { 0xd000 }
797 { { MNEM, ' ', OP (RD), 0 } },
798 & ifmt_movlowgr, { 0x20 }
803 { { MNEM, ' ', OP (REL12A), 0 } },
804 & ifmt_br, { 0x1000 }
809 { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
815 { { MNEM, ' ', OP (ABS24), 0 } },
816 & ifmt_jmpf, { 0x2000000 }
821 { { MNEM, ' ', OP (RD), 0 } },
822 & ifmt_movlowgr, { 0x10 }
827 { { MNEM, ' ', OP (REL12A), 0 } },
828 & ifmt_br, { 0x1001 }
833 { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
839 { { MNEM, ' ', OP (ABS24), 0 } },
840 & ifmt_jmpf, { 0x1000000 }
845 { { MNEM, ' ', OP (RD), 0 } },
846 & ifmt_movlowgr, { 0x30 }
851 { { MNEM, ' ', OP (RBJ), ',', OP (RD), 0 } },
857 { { MNEM, ' ', OP (ABS24), 0 } },
858 & ifmt_jmpf, { 0x3000000 }
876 & ifmt_iret, { 0xd0 }
882 & ifmt_iret, { 0xc0 }
888 & ifmt_iret, { 0xc8 }
894 & ifmt_iret, { 0xe8 }
900 & ifmt_iret, { 0xe0 }
951 /* Formats for ALIAS macro-insns. */
953 #define F(f) & xstormy16_cgen_ifld_table[XSTORMY16_##f]
954 static const CGEN_IFMT ifmt_movimm8 ATTRIBUTE_UNUSED = {
955 16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_IMM8) }, { 0 } }
958 static const CGEN_IFMT ifmt_movgrimm8 ATTRIBUTE_UNUSED = {
959 16, 16, 0xf100, { { F (F_OP1) }, { F (F_RM) }, { F (F_OP2M) }, { F (F_IMM8) }, { 0 } }
962 static const CGEN_IFMT ifmt_movgrimm16 ATTRIBUTE_UNUSED = {
963 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RD) }, { F (F_IMM16) }, { 0 } }
966 static const CGEN_IFMT ifmt_incgr ATTRIBUTE_UNUSED = {
967 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
970 static const CGEN_IFMT ifmt_decgr ATTRIBUTE_UNUSED = {
971 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3A) }, { F (F_IMM2) }, { F (F_RD) }, { 0 } }
976 /* Each non-simple macro entry points to an array of expansion possibilities. */
978 #define A(a) (1 << CGEN_INSN_##a)
979 #define OPERAND(op) XSTORMY16_OPERAND_##op
980 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
981 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
983 /* The macro instruction table. */
985 static const CGEN_IBASE xstormy16_cgen_macro_insn_table[] =
989 -1, "movimm8", "mov", 16,
990 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
992 /* mov $Rm,#$imm8small */
994 -1, "movgrimm8", "mov", 16,
995 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
997 /* mov $Rd,#$imm16 */
999 -1, "movgrimm16", "mov", 32,
1000 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1004 -1, "incgr", "inc", 16,
1005 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1009 -1, "decgr", "dec", 16,
1010 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
1014 /* The macro instruction opcode table. */
1016 static const CGEN_OPCODE xstormy16_cgen_macro_insn_opcode_table[] =
1021 { { MNEM, ' ', 'R', 'x', ',', '#', OP (IMM8), 0 } },
1022 & ifmt_movimm8, { 0x4700 }
1024 /* mov $Rm,#$imm8small */
1027 { { MNEM, ' ', OP (RM), ',', '#', OP (IMM8SMALL), 0 } },
1028 & ifmt_movgrimm8, { 0x2100 }
1030 /* mov $Rd,#$imm16 */
1033 { { MNEM, ' ', OP (RD), ',', '#', OP (IMM16), 0 } },
1034 & ifmt_movgrimm16, { 0x31300000 }
1039 { { MNEM, ' ', OP (RD), 0 } },
1040 & ifmt_incgr, { 0x3000 }
1045 { { MNEM, ' ', OP (RD), 0 } },
1046 & ifmt_decgr, { 0x3040 }
1055 #ifndef CGEN_ASM_HASH_P
1056 #define CGEN_ASM_HASH_P(insn) 1
1059 #ifndef CGEN_DIS_HASH_P
1060 #define CGEN_DIS_HASH_P(insn) 1
1063 /* Return non-zero if INSN is to be added to the hash table.
1064 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1067 asm_hash_insn_p (const CGEN_INSN *insn ATTRIBUTE_UNUSED)
1069 return CGEN_ASM_HASH_P (insn);
1073 dis_hash_insn_p (const CGEN_INSN *insn)
1075 /* If building the hash table and the NO-DIS attribute is present,
1077 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1079 return CGEN_DIS_HASH_P (insn);
1082 #ifndef CGEN_ASM_HASH
1083 #define CGEN_ASM_HASH_SIZE 127
1084 #ifdef CGEN_MNEMONIC_OPERANDS
1085 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1087 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1091 /* It doesn't make much sense to provide a default here,
1092 but while this is under development we do.
1093 BUFFER is a pointer to the bytes of the insn, target order.
1094 VALUE is the first base_insn_bitsize bits as an int in host order. */
1096 #ifndef CGEN_DIS_HASH
1097 #define CGEN_DIS_HASH_SIZE 256
1098 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1101 /* The result is the hash value of the insn.
1102 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1105 asm_hash_insn (const char *mnem)
1107 return CGEN_ASM_HASH (mnem);
1110 /* BUF is a pointer to the bytes of the insn, target order.
1111 VALUE is the first base_insn_bitsize bits as an int in host order. */
1114 dis_hash_insn (const char *buf ATTRIBUTE_UNUSED,
1115 CGEN_INSN_INT value ATTRIBUTE_UNUSED)
1117 return CGEN_DIS_HASH (buf, value);
1120 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1123 set_fields_bitsize (CGEN_FIELDS *fields, int size)
1125 CGEN_FIELDS_BITSIZE (fields) = size;
1128 /* Function to call before using the operand instance table.
1129 This plugs the opcode entries and macro instructions into the cpu table. */
1132 xstormy16_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1135 int num_macros = (sizeof (xstormy16_cgen_macro_insn_table) /
1136 sizeof (xstormy16_cgen_macro_insn_table[0]));
1137 const CGEN_IBASE *ib = & xstormy16_cgen_macro_insn_table[0];
1138 const CGEN_OPCODE *oc = & xstormy16_cgen_macro_insn_opcode_table[0];
1139 CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
1141 /* This test has been added to avoid a warning generated
1142 if memset is called with a third argument of value zero. */
1143 if (num_macros >= 1)
1144 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1145 for (i = 0; i < num_macros; ++i)
1147 insns[i].base = &ib[i];
1148 insns[i].opcode = &oc[i];
1149 xstormy16_cgen_build_insn_regex (& insns[i]);
1151 cd->macro_insn_table.init_entries = insns;
1152 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1153 cd->macro_insn_table.num_init_entries = num_macros;
1155 oc = & xstormy16_cgen_insn_opcode_table[0];
1156 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1157 for (i = 0; i < MAX_INSNS; ++i)
1159 insns[i].opcode = &oc[i];
1160 xstormy16_cgen_build_insn_regex (& insns[i]);
1163 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1164 cd->set_fields_bitsize = set_fields_bitsize;
1166 cd->asm_hash_p = asm_hash_insn_p;
1167 cd->asm_hash = asm_hash_insn;
1168 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1170 cd->dis_hash_p = dis_hash_insn_p;
1171 cd->dis_hash = dis_hash_insn;
1172 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;