1 /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 /* Instruction opcode table for or1k.
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 "or1k-desc.h"
32 #include "libiberty.h"
36 /* The hash functions are recorded here to help keep assembler code out of
37 the disassembler and vice versa. */
39 static int asm_hash_insn_p (const CGEN_INSN *);
40 static unsigned int asm_hash_insn (const char *);
41 static int dis_hash_insn_p (const CGEN_INSN *);
42 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
44 /* Instruction formats. */
46 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
47 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
51 static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED = {
52 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_DISP26) }, { 0 } }
55 static const CGEN_IFMT ifmt_l_adrp ATTRIBUTE_UNUSED = {
56 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_DISP21) }, { 0 } }
59 static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED = {
60 32, 32, 0xffff07ff, { { F (F_OPCODE) }, { F (F_RESV_25_10) }, { F (F_R3) }, { F (F_RESV_10_11) }, { 0 } }
63 static const CGEN_IFMT ifmt_l_trap ATTRIBUTE_UNUSED = {
64 32, 32, 0xffff0000, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_RESV_20_5) }, { F (F_UIMM16) }, { 0 } }
67 static const CGEN_IFMT ifmt_l_msync ATTRIBUTE_UNUSED = {
68 32, 32, 0xffffffff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_RESV_20_21) }, { 0 } }
71 static const CGEN_IFMT ifmt_l_rfe ATTRIBUTE_UNUSED = {
72 32, 32, 0xffffffff, { { F (F_OPCODE) }, { F (F_RESV_25_26) }, { 0 } }
75 static const CGEN_IFMT ifmt_l_nop_imm ATTRIBUTE_UNUSED = {
76 32, 32, 0xffff0000, { { F (F_OPCODE) }, { F (F_OP_25_2) }, { F (F_RESV_23_8) }, { F (F_UIMM16) }, { 0 } }
79 static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED = {
80 32, 32, 0xfc1f0000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_RESV_20_4) }, { F (F_OP_16_1) }, { F (F_UIMM16) }, { 0 } }
83 static const CGEN_IFMT ifmt_l_macrc ATTRIBUTE_UNUSED = {
84 32, 32, 0xfc1fffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_RESV_20_4) }, { F (F_OP_16_1) }, { F (F_UIMM16) }, { 0 } }
87 static const CGEN_IFMT ifmt_l_mfspr ATTRIBUTE_UNUSED = {
88 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
91 static const CGEN_IFMT ifmt_l_mtspr ATTRIBUTE_UNUSED = {
92 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_UIMM16_SPLIT) }, { 0 } }
95 static const CGEN_IFMT ifmt_l_lwz ATTRIBUTE_UNUSED = {
96 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
99 static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED = {
100 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_SIMM16_SPLIT) }, { 0 } }
103 static const CGEN_IFMT ifmt_l_swa ATTRIBUTE_UNUSED = {
104 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_SIMM16) }, { 0 } }
107 static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED = {
108 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_2) }, { F (F_RESV_5_2) }, { F (F_OP_3_4) }, { 0 } }
111 static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED = {
112 32, 32, 0xfc00ffc0, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_RESV_15_8) }, { F (F_OP_7_2) }, { F (F_UIMM6) }, { 0 } }
115 static const CGEN_IFMT ifmt_l_and ATTRIBUTE_UNUSED = {
116 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_7) }, { F (F_OP_3_4) }, { 0 } }
119 static const CGEN_IFMT ifmt_l_muld ATTRIBUTE_UNUSED = {
120 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_7) }, { F (F_OP_3_4) }, { 0 } }
123 static const CGEN_IFMT ifmt_l_exths ATTRIBUTE_UNUSED = {
124 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_RESV_15_6) }, { F (F_OP_9_4) }, { F (F_RESV_5_2) }, { F (F_OP_3_4) }, { 0 } }
127 static const CGEN_IFMT ifmt_l_cmov ATTRIBUTE_UNUSED = {
128 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_1) }, { F (F_OP_9_2) }, { F (F_RESV_7_4) }, { F (F_OP_3_4) }, { 0 } }
131 static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED = {
132 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_11) }, { 0 } }
135 static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED = {
136 32, 32, 0xffe00000, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
139 static const CGEN_IFMT ifmt_l_mac ATTRIBUTE_UNUSED = {
140 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_7) }, { F (F_OP_3_4) }, { 0 } }
143 static const CGEN_IFMT ifmt_l_maci ATTRIBUTE_UNUSED = {
144 32, 32, 0xffe00000, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
147 static const CGEN_IFMT ifmt_lf_add_s ATTRIBUTE_UNUSED = {
148 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
151 static const CGEN_IFMT ifmt_lf_add_d ATTRIBUTE_UNUSED = {
152 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R1) }, { F (F_R1) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
155 static const CGEN_IFMT ifmt_lf_itof_s ATTRIBUTE_UNUSED = {
156 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
159 static const CGEN_IFMT ifmt_lf_ftoi_s ATTRIBUTE_UNUSED = {
160 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
163 static const CGEN_IFMT ifmt_lf_ftoi_d ATTRIBUTE_UNUSED = {
164 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R1) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
167 static const CGEN_IFMT ifmt_lf_eq_s ATTRIBUTE_UNUSED = {
168 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
171 static const CGEN_IFMT ifmt_lf_cust1_s ATTRIBUTE_UNUSED = {
172 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
175 static const CGEN_IFMT ifmt_lf_cust1_d ATTRIBUTE_UNUSED = {
176 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R1) }, { F (F_R1) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
181 #define A(a) (1 << CGEN_INSN_##a)
182 #define OPERAND(op) OR1K_OPERAND_##op
183 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
184 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
186 /* The instruction table. */
188 static const CGEN_OPCODE or1k_cgen_insn_opcode_table[MAX_INSNS] =
190 /* Special null first entry.
191 A `num' value of zero is thus invalid.
192 Also, the special `invalid' insn resides here. */
193 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
197 { { MNEM, ' ', OP (DISP26), 0 } },
200 /* l.adrp $rD,${disp21} */
203 { { MNEM, ' ', OP (RD), ',', OP (DISP21), 0 } },
204 & ifmt_l_adrp, { 0x8000000 }
206 /* l.jal ${disp26} */
209 { { MNEM, ' ', OP (DISP26), 0 } },
210 & ifmt_l_j, { 0x4000000 }
215 { { MNEM, ' ', OP (RB), 0 } },
216 & ifmt_l_jr, { 0x44000000 }
221 { { MNEM, ' ', OP (RB), 0 } },
222 & ifmt_l_jr, { 0x48000000 }
224 /* l.bnf ${disp26} */
227 { { MNEM, ' ', OP (DISP26), 0 } },
228 & ifmt_l_j, { 0xc000000 }
233 { { MNEM, ' ', OP (DISP26), 0 } },
234 & ifmt_l_j, { 0x10000000 }
236 /* l.trap ${uimm16} */
239 { { MNEM, ' ', OP (UIMM16), 0 } },
240 & ifmt_l_trap, { 0x21000000 }
242 /* l.sys ${uimm16} */
245 { { MNEM, ' ', OP (UIMM16), 0 } },
246 & ifmt_l_trap, { 0x20000000 }
252 & ifmt_l_msync, { 0x22000000 }
258 & ifmt_l_msync, { 0x22800000 }
264 & ifmt_l_msync, { 0x23000000 }
270 & ifmt_l_rfe, { 0x24000000 }
272 /* l.nop ${uimm16} */
275 { { MNEM, ' ', OP (UIMM16), 0 } },
276 & ifmt_l_nop_imm, { 0x15000000 }
282 & ifmt_l_nop_imm, { 0x15000000 }
284 /* l.movhi $rD,$uimm16 */
287 { { MNEM, ' ', OP (RD), ',', OP (UIMM16), 0 } },
288 & ifmt_l_movhi, { 0x18000000 }
293 { { MNEM, ' ', OP (RD), 0 } },
294 & ifmt_l_macrc, { 0x18010000 }
296 /* l.mfspr $rD,$rA,${uimm16} */
299 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
300 & ifmt_l_mfspr, { 0xb4000000 }
302 /* l.mtspr $rA,$rB,${uimm16-split} */
305 { { MNEM, ' ', OP (RA), ',', OP (RB), ',', OP (UIMM16_SPLIT), 0 } },
306 & ifmt_l_mtspr, { 0xc0000000 }
308 /* l.lwz $rD,${simm16}($rA) */
311 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
312 & ifmt_l_lwz, { 0x84000000 }
314 /* l.lws $rD,${simm16}($rA) */
317 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
318 & ifmt_l_lwz, { 0x88000000 }
320 /* l.lwa $rD,${simm16}($rA) */
323 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
324 & ifmt_l_lwz, { 0x6c000000 }
326 /* l.lbz $rD,${simm16}($rA) */
329 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
330 & ifmt_l_lwz, { 0x8c000000 }
332 /* l.lbs $rD,${simm16}($rA) */
335 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
336 & ifmt_l_lwz, { 0x90000000 }
338 /* l.lhz $rD,${simm16}($rA) */
341 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
342 & ifmt_l_lwz, { 0x94000000 }
344 /* l.lhs $rD,${simm16}($rA) */
347 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
348 & ifmt_l_lwz, { 0x98000000 }
350 /* l.sw ${simm16-split}($rA),$rB */
353 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
354 & ifmt_l_sw, { 0xd4000000 }
356 /* l.sb ${simm16-split}($rA),$rB */
359 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
360 & ifmt_l_sw, { 0xd8000000 }
362 /* l.sh ${simm16-split}($rA),$rB */
365 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
366 & ifmt_l_sw, { 0xdc000000 }
368 /* l.swa ${simm16-split}($rA),$rB */
371 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
372 & ifmt_l_swa, { 0xcc000000 }
374 /* l.sll $rD,$rA,$rB */
377 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
378 & ifmt_l_sll, { 0xe0000008 }
380 /* l.slli $rD,$rA,${uimm6} */
383 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
384 & ifmt_l_slli, { 0xb8000000 }
386 /* l.srl $rD,$rA,$rB */
389 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
390 & ifmt_l_sll, { 0xe0000048 }
392 /* l.srli $rD,$rA,${uimm6} */
395 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
396 & ifmt_l_slli, { 0xb8000040 }
398 /* l.sra $rD,$rA,$rB */
401 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
402 & ifmt_l_sll, { 0xe0000088 }
404 /* l.srai $rD,$rA,${uimm6} */
407 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
408 & ifmt_l_slli, { 0xb8000080 }
410 /* l.ror $rD,$rA,$rB */
413 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
414 & ifmt_l_sll, { 0xe00000c8 }
416 /* l.rori $rD,$rA,${uimm6} */
419 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
420 & ifmt_l_slli, { 0xb80000c0 }
422 /* l.and $rD,$rA,$rB */
425 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
426 & ifmt_l_and, { 0xe0000003 }
428 /* l.or $rD,$rA,$rB */
431 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
432 & ifmt_l_and, { 0xe0000004 }
434 /* l.xor $rD,$rA,$rB */
437 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
438 & ifmt_l_and, { 0xe0000005 }
440 /* l.add $rD,$rA,$rB */
443 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
444 & ifmt_l_and, { 0xe0000000 }
446 /* l.sub $rD,$rA,$rB */
449 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
450 & ifmt_l_and, { 0xe0000002 }
452 /* l.addc $rD,$rA,$rB */
455 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
456 & ifmt_l_and, { 0xe0000001 }
458 /* l.mul $rD,$rA,$rB */
461 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
462 & ifmt_l_and, { 0xe0000306 }
467 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
468 & ifmt_l_muld, { 0xe0000307 }
470 /* l.mulu $rD,$rA,$rB */
473 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
474 & ifmt_l_and, { 0xe000030b }
476 /* l.muldu $rA,$rB */
479 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
480 & ifmt_l_muld, { 0xe000030d }
482 /* l.div $rD,$rA,$rB */
485 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
486 & ifmt_l_and, { 0xe0000309 }
488 /* l.divu $rD,$rA,$rB */
491 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
492 & ifmt_l_and, { 0xe000030a }
497 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
498 & ifmt_l_and, { 0xe000000f }
503 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
504 & ifmt_l_and, { 0xe000010f }
506 /* l.andi $rD,$rA,$uimm16 */
509 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
510 & ifmt_l_mfspr, { 0xa4000000 }
512 /* l.ori $rD,$rA,$uimm16 */
515 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
516 & ifmt_l_mfspr, { 0xa8000000 }
518 /* l.xori $rD,$rA,$simm16 */
521 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
522 & ifmt_l_lwz, { 0xac000000 }
524 /* l.addi $rD,$rA,$simm16 */
527 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
528 & ifmt_l_lwz, { 0x9c000000 }
530 /* l.addic $rD,$rA,$simm16 */
533 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
534 & ifmt_l_lwz, { 0xa0000000 }
536 /* l.muli $rD,$rA,$simm16 */
539 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
540 & ifmt_l_lwz, { 0xb0000000 }
542 /* l.exths $rD,$rA */
545 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
546 & ifmt_l_exths, { 0xe000000c }
548 /* l.extbs $rD,$rA */
551 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
552 & ifmt_l_exths, { 0xe000004c }
554 /* l.exthz $rD,$rA */
557 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
558 & ifmt_l_exths, { 0xe000008c }
560 /* l.extbz $rD,$rA */
563 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
564 & ifmt_l_exths, { 0xe00000cc }
566 /* l.extws $rD,$rA */
569 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
570 & ifmt_l_exths, { 0xe000000d }
572 /* l.extwz $rD,$rA */
575 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
576 & ifmt_l_exths, { 0xe000004d }
578 /* l.cmov $rD,$rA,$rB */
581 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
582 & ifmt_l_cmov, { 0xe000000e }
584 /* l.sfgts $rA,$rB */
587 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
588 & ifmt_l_sfgts, { 0xe5400000 }
590 /* l.sfgtsi $rA,$simm16 */
593 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
594 & ifmt_l_sfgtsi, { 0xbd400000 }
596 /* l.sfgtu $rA,$rB */
599 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
600 & ifmt_l_sfgts, { 0xe4400000 }
602 /* l.sfgtui $rA,$simm16 */
605 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
606 & ifmt_l_sfgtsi, { 0xbc400000 }
608 /* l.sfges $rA,$rB */
611 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
612 & ifmt_l_sfgts, { 0xe5600000 }
614 /* l.sfgesi $rA,$simm16 */
617 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
618 & ifmt_l_sfgtsi, { 0xbd600000 }
620 /* l.sfgeu $rA,$rB */
623 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
624 & ifmt_l_sfgts, { 0xe4600000 }
626 /* l.sfgeui $rA,$simm16 */
629 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
630 & ifmt_l_sfgtsi, { 0xbc600000 }
632 /* l.sflts $rA,$rB */
635 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
636 & ifmt_l_sfgts, { 0xe5800000 }
638 /* l.sfltsi $rA,$simm16 */
641 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
642 & ifmt_l_sfgtsi, { 0xbd800000 }
644 /* l.sfltu $rA,$rB */
647 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
648 & ifmt_l_sfgts, { 0xe4800000 }
650 /* l.sfltui $rA,$simm16 */
653 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
654 & ifmt_l_sfgtsi, { 0xbc800000 }
656 /* l.sfles $rA,$rB */
659 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
660 & ifmt_l_sfgts, { 0xe5a00000 }
662 /* l.sflesi $rA,$simm16 */
665 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
666 & ifmt_l_sfgtsi, { 0xbda00000 }
668 /* l.sfleu $rA,$rB */
671 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
672 & ifmt_l_sfgts, { 0xe4a00000 }
674 /* l.sfleui $rA,$simm16 */
677 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
678 & ifmt_l_sfgtsi, { 0xbca00000 }
683 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
684 & ifmt_l_sfgts, { 0xe4000000 }
686 /* l.sfeqi $rA,$simm16 */
689 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
690 & ifmt_l_sfgtsi, { 0xbc000000 }
695 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
696 & ifmt_l_sfgts, { 0xe4200000 }
698 /* l.sfnei $rA,$simm16 */
701 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
702 & ifmt_l_sfgtsi, { 0xbc200000 }
707 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
708 & ifmt_l_mac, { 0xc4000001 }
710 /* l.maci $rA,${simm16} */
713 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
714 & ifmt_l_maci, { 0x4c000000 }
719 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
720 & ifmt_l_mac, { 0xc4000003 }
725 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
726 & ifmt_l_mac, { 0xc4000002 }
731 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
732 & ifmt_l_mac, { 0xc4000004 }
738 & ifmt_l_rfe, { 0x70000000 }
744 & ifmt_l_rfe, { 0x74000000 }
750 & ifmt_l_rfe, { 0x78000000 }
756 & ifmt_l_rfe, { 0x7c000000 }
762 & ifmt_l_rfe, { 0xf0000000 }
768 & ifmt_l_rfe, { 0xf4000000 }
774 & ifmt_l_rfe, { 0xf8000000 }
780 & ifmt_l_rfe, { 0xfc000000 }
782 /* lf.add.s $rDSF,$rASF,$rBSF */
785 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
786 & ifmt_lf_add_s, { 0xc8000000 }
788 /* lf.add.d $rDDF,$rADF,$rBDF */
791 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
792 & ifmt_lf_add_d, { 0xc8000010 }
794 /* lf.sub.s $rDSF,$rASF,$rBSF */
797 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
798 & ifmt_lf_add_s, { 0xc8000001 }
800 /* lf.sub.d $rDDF,$rADF,$rBDF */
803 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
804 & ifmt_lf_add_d, { 0xc8000011 }
806 /* lf.mul.s $rDSF,$rASF,$rBSF */
809 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
810 & ifmt_lf_add_s, { 0xc8000002 }
812 /* lf.mul.d $rDDF,$rADF,$rBDF */
815 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
816 & ifmt_lf_add_d, { 0xc8000012 }
818 /* lf.div.s $rDSF,$rASF,$rBSF */
821 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
822 & ifmt_lf_add_s, { 0xc8000003 }
824 /* lf.div.d $rDDF,$rADF,$rBDF */
827 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
828 & ifmt_lf_add_d, { 0xc8000013 }
830 /* lf.rem.s $rDSF,$rASF,$rBSF */
833 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
834 & ifmt_lf_add_s, { 0xc8000006 }
836 /* lf.rem.d $rDDF,$rADF,$rBDF */
839 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
840 & ifmt_lf_add_d, { 0xc8000016 }
842 /* lf.itof.s $rDSF,$rA */
845 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
846 & ifmt_lf_itof_s, { 0xc8000004 }
848 /* lf.itof.d $rDSF,$rA */
851 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
852 & ifmt_lf_itof_s, { 0xc8000014 }
854 /* lf.ftoi.s $rD,$rASF */
857 { { MNEM, ' ', OP (RD), ',', OP (RASF), 0 } },
858 & ifmt_lf_ftoi_s, { 0xc8000005 }
860 /* lf.ftoi.d $rD,$rADF */
863 { { MNEM, ' ', OP (RD), ',', OP (RADF), 0 } },
864 & ifmt_lf_ftoi_d, { 0xc8000015 }
866 /* lf.sfeq.s $rASF,$rBSF */
869 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
870 & ifmt_lf_eq_s, { 0xc8000008 }
872 /* lf.sfeq.d $rASF,$rBSF */
875 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
876 & ifmt_lf_eq_s, { 0xc8000018 }
878 /* lf.sfne.s $rASF,$rBSF */
881 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
882 & ifmt_lf_eq_s, { 0xc8000009 }
884 /* lf.sfne.d $rASF,$rBSF */
887 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
888 & ifmt_lf_eq_s, { 0xc8000019 }
890 /* lf.sfge.s $rASF,$rBSF */
893 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
894 & ifmt_lf_eq_s, { 0xc800000b }
896 /* lf.sfge.d $rASF,$rBSF */
899 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
900 & ifmt_lf_eq_s, { 0xc800001b }
902 /* lf.sfgt.s $rASF,$rBSF */
905 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
906 & ifmt_lf_eq_s, { 0xc800000a }
908 /* lf.sfgt.d $rASF,$rBSF */
911 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
912 & ifmt_lf_eq_s, { 0xc800001a }
914 /* lf.sflt.s $rASF,$rBSF */
917 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
918 & ifmt_lf_eq_s, { 0xc800000c }
920 /* lf.sflt.d $rASF,$rBSF */
923 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
924 & ifmt_lf_eq_s, { 0xc800001c }
926 /* lf.sfle.s $rASF,$rBSF */
929 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
930 & ifmt_lf_eq_s, { 0xc800000d }
932 /* lf.sfle.d $rASF,$rBSF */
935 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
936 & ifmt_lf_eq_s, { 0xc800001d }
938 /* lf.madd.s $rDSF,$rASF,$rBSF */
941 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
942 & ifmt_lf_add_s, { 0xc8000007 }
944 /* lf.madd.d $rDDF,$rADF,$rBDF */
947 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
948 & ifmt_lf_add_d, { 0xc8000017 }
950 /* lf.cust1.s $rASF,$rBSF */
953 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
954 & ifmt_lf_cust1_s, { 0xc80000d0 }
960 & ifmt_lf_cust1_d, { 0xc80000e0 }
969 /* Formats for ALIAS macro-insns. */
971 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
974 /* Each non-simple macro entry points to an array of expansion possibilities. */
976 #define A(a) (1 << CGEN_INSN_##a)
977 #define OPERAND(op) OR1K_OPERAND_##op
978 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
979 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
981 /* The macro instruction table. */
983 static const CGEN_IBASE or1k_cgen_macro_insn_table[] =
987 /* The macro instruction opcode table. */
989 static const CGEN_OPCODE or1k_cgen_macro_insn_opcode_table[] =
998 #ifndef CGEN_ASM_HASH_P
999 #define CGEN_ASM_HASH_P(insn) 1
1002 #ifndef CGEN_DIS_HASH_P
1003 #define CGEN_DIS_HASH_P(insn) 1
1006 /* Return non-zero if INSN is to be added to the hash table.
1007 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1010 asm_hash_insn_p (const CGEN_INSN *insn ATTRIBUTE_UNUSED)
1012 return CGEN_ASM_HASH_P (insn);
1016 dis_hash_insn_p (const CGEN_INSN *insn)
1018 /* If building the hash table and the NO-DIS attribute is present,
1020 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1022 return CGEN_DIS_HASH_P (insn);
1025 #ifndef CGEN_ASM_HASH
1026 #define CGEN_ASM_HASH_SIZE 127
1027 #ifdef CGEN_MNEMONIC_OPERANDS
1028 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1030 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1034 /* It doesn't make much sense to provide a default here,
1035 but while this is under development we do.
1036 BUFFER is a pointer to the bytes of the insn, target order.
1037 VALUE is the first base_insn_bitsize bits as an int in host order. */
1039 #ifndef CGEN_DIS_HASH
1040 #define CGEN_DIS_HASH_SIZE 256
1041 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1044 /* The result is the hash value of the insn.
1045 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1048 asm_hash_insn (const char *mnem)
1050 return CGEN_ASM_HASH (mnem);
1053 /* BUF is a pointer to the bytes of the insn, target order.
1054 VALUE is the first base_insn_bitsize bits as an int in host order. */
1057 dis_hash_insn (const char *buf ATTRIBUTE_UNUSED,
1058 CGEN_INSN_INT value ATTRIBUTE_UNUSED)
1060 return CGEN_DIS_HASH (buf, value);
1063 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1066 set_fields_bitsize (CGEN_FIELDS *fields, int size)
1068 CGEN_FIELDS_BITSIZE (fields) = size;
1071 /* Function to call before using the operand instance table.
1072 This plugs the opcode entries and macro instructions into the cpu table. */
1075 or1k_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1078 int num_macros = (sizeof (or1k_cgen_macro_insn_table) /
1079 sizeof (or1k_cgen_macro_insn_table[0]));
1080 const CGEN_IBASE *ib = & or1k_cgen_macro_insn_table[0];
1081 const CGEN_OPCODE *oc = & or1k_cgen_macro_insn_opcode_table[0];
1082 CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
1084 /* This test has been added to avoid a warning generated
1085 if memset is called with a third argument of value zero. */
1086 if (num_macros >= 1)
1087 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1088 for (i = 0; i < num_macros; ++i)
1090 insns[i].base = &ib[i];
1091 insns[i].opcode = &oc[i];
1092 or1k_cgen_build_insn_regex (& insns[i]);
1094 cd->macro_insn_table.init_entries = insns;
1095 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1096 cd->macro_insn_table.num_init_entries = num_macros;
1098 oc = & or1k_cgen_insn_opcode_table[0];
1099 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1100 for (i = 0; i < MAX_INSNS; ++i)
1102 insns[i].opcode = &oc[i];
1103 or1k_cgen_build_insn_regex (& insns[i]);
1106 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1107 cd->set_fields_bitsize = set_fields_bitsize;
1109 cd->asm_hash_p = asm_hash_insn_p;
1110 cd->asm_hash = asm_hash_insn;
1111 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1113 cd->dis_hash_p = dis_hash_insn_p;
1114 cd->dis_hash = dis_hash_insn;
1115 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;