1 /* Instruction opcode table for or1k.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996-2017 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 This file is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
29 #include "or1k-desc.h"
31 #include "libiberty.h"
35 /* The hash functions are recorded here to help keep assembler code out of
36 the disassembler and vice versa. */
38 static int asm_hash_insn_p (const CGEN_INSN
*);
39 static unsigned int asm_hash_insn (const char *);
40 static int dis_hash_insn_p (const CGEN_INSN
*);
41 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT
);
43 /* Instruction formats. */
45 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
46 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED
= {
50 static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED
= {
51 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_DISP26
) }, { 0 } }
54 static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED
= {
55 32, 32, 0xffff07ff, { { F (F_OPCODE
) }, { F (F_RESV_25_10
) }, { F (F_R3
) }, { F (F_RESV_10_11
) }, { 0 } }
58 static const CGEN_IFMT ifmt_l_trap ATTRIBUTE_UNUSED
= {
59 32, 32, 0xffff0000, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_RESV_20_5
) }, { F (F_UIMM16
) }, { 0 } }
62 static const CGEN_IFMT ifmt_l_msync ATTRIBUTE_UNUSED
= {
63 32, 32, 0xffffffff, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_RESV_20_21
) }, { 0 } }
66 static const CGEN_IFMT ifmt_l_rfe ATTRIBUTE_UNUSED
= {
67 32, 32, 0xffffffff, { { F (F_OPCODE
) }, { F (F_RESV_25_26
) }, { 0 } }
70 static const CGEN_IFMT ifmt_l_nop_imm ATTRIBUTE_UNUSED
= {
71 32, 32, 0xffff0000, { { F (F_OPCODE
) }, { F (F_OP_25_2
) }, { F (F_RESV_23_8
) }, { F (F_UIMM16
) }, { 0 } }
74 static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED
= {
75 32, 32, 0xfc1f0000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_RESV_20_4
) }, { F (F_OP_16_1
) }, { F (F_UIMM16
) }, { 0 } }
78 static const CGEN_IFMT ifmt_l_macrc ATTRIBUTE_UNUSED
= {
79 32, 32, 0xfc1fffff, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_RESV_20_4
) }, { F (F_OP_16_1
) }, { F (F_UIMM16
) }, { 0 } }
82 static const CGEN_IFMT ifmt_l_mfspr ATTRIBUTE_UNUSED
= {
83 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
86 static const CGEN_IFMT ifmt_l_mtspr ATTRIBUTE_UNUSED
= {
87 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_UIMM16_SPLIT
) }, { 0 } }
90 static const CGEN_IFMT ifmt_l_lwz ATTRIBUTE_UNUSED
= {
91 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
94 static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED
= {
95 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_SIMM16_SPLIT
) }, { 0 } }
98 static const CGEN_IFMT ifmt_l_swa ATTRIBUTE_UNUSED
= {
99 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_SIMM16
) }, { 0 } }
102 static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED
= {
103 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 } }
106 static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED
= {
107 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 } }
110 static const CGEN_IFMT ifmt_l_and ATTRIBUTE_UNUSED
= {
111 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 } }
114 static const CGEN_IFMT ifmt_l_exths ATTRIBUTE_UNUSED
= {
115 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 } }
118 static const CGEN_IFMT ifmt_l_cmov ATTRIBUTE_UNUSED
= {
119 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 } }
122 static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED
= {
123 32, 32, 0xffe007ff, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_RESV_10_11
) }, { 0 } }
126 static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED
= {
127 32, 32, 0xffe00000, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
130 static const CGEN_IFMT ifmt_l_mac ATTRIBUTE_UNUSED
= {
131 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 } }
134 static const CGEN_IFMT ifmt_l_maci ATTRIBUTE_UNUSED
= {
135 32, 32, 0xffe00000, { { F (F_OPCODE
) }, { F (F_RESV_25_5
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
138 static const CGEN_IFMT ifmt_lf_add_s ATTRIBUTE_UNUSED
= {
139 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 } }
142 static const CGEN_IFMT ifmt_lf_add_d ATTRIBUTE_UNUSED
= {
143 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 } }
146 static const CGEN_IFMT ifmt_lf_itof_s ATTRIBUTE_UNUSED
= {
147 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 } }
150 static const CGEN_IFMT ifmt_lf_ftoi_s ATTRIBUTE_UNUSED
= {
151 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 } }
154 static const CGEN_IFMT ifmt_lf_ftoi_d ATTRIBUTE_UNUSED
= {
155 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 } }
158 static const CGEN_IFMT ifmt_lf_eq_s ATTRIBUTE_UNUSED
= {
159 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 } }
162 static const CGEN_IFMT ifmt_lf_cust1_s ATTRIBUTE_UNUSED
= {
163 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 } }
166 static const CGEN_IFMT ifmt_lf_cust1_d ATTRIBUTE_UNUSED
= {
167 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 } }
172 #define A(a) (1 << CGEN_INSN_##a)
173 #define OPERAND(op) OR1K_OPERAND_##op
174 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
175 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
177 /* The instruction table. */
179 static const CGEN_OPCODE or1k_cgen_insn_opcode_table
[MAX_INSNS
] =
181 /* Special null first entry.
182 A `num' value of zero is thus invalid.
183 Also, the special `invalid' insn resides here. */
184 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
188 { { MNEM
, ' ', OP (DISP26
), 0 } },
191 /* l.jal ${disp26} */
194 { { MNEM
, ' ', OP (DISP26
), 0 } },
195 & ifmt_l_j
, { 0x4000000 }
200 { { MNEM
, ' ', OP (RB
), 0 } },
201 & ifmt_l_jr
, { 0x44000000 }
206 { { MNEM
, ' ', OP (RB
), 0 } },
207 & ifmt_l_jr
, { 0x48000000 }
209 /* l.bnf ${disp26} */
212 { { MNEM
, ' ', OP (DISP26
), 0 } },
213 & ifmt_l_j
, { 0xc000000 }
218 { { MNEM
, ' ', OP (DISP26
), 0 } },
219 & ifmt_l_j
, { 0x10000000 }
221 /* l.trap ${uimm16} */
224 { { MNEM
, ' ', OP (UIMM16
), 0 } },
225 & ifmt_l_trap
, { 0x21000000 }
227 /* l.sys ${uimm16} */
230 { { MNEM
, ' ', OP (UIMM16
), 0 } },
231 & ifmt_l_trap
, { 0x20000000 }
237 & ifmt_l_msync
, { 0x22000000 }
243 & ifmt_l_msync
, { 0x22800000 }
249 & ifmt_l_msync
, { 0x23000000 }
255 & ifmt_l_rfe
, { 0x24000000 }
257 /* l.nop ${uimm16} */
260 { { MNEM
, ' ', OP (UIMM16
), 0 } },
261 & ifmt_l_nop_imm
, { 0x15000000 }
267 & ifmt_l_nop_imm
, { 0x15000000 }
269 /* l.movhi $rD,$uimm16 */
272 { { MNEM
, ' ', OP (RD
), ',', OP (UIMM16
), 0 } },
273 & ifmt_l_movhi
, { 0x18000000 }
278 { { MNEM
, ' ', OP (RD
), 0 } },
279 & ifmt_l_macrc
, { 0x18010000 }
281 /* l.mfspr $rD,$rA,${uimm16} */
284 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
285 & ifmt_l_mfspr
, { 0xb4000000 }
287 /* l.mtspr $rA,$rB,${uimm16-split} */
290 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), ',', OP (UIMM16_SPLIT
), 0 } },
291 & ifmt_l_mtspr
, { 0xc0000000 }
293 /* l.lwz $rD,${simm16}($rA) */
296 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
297 & ifmt_l_lwz
, { 0x84000000 }
299 /* l.lws $rD,${simm16}($rA) */
302 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
303 & ifmt_l_lwz
, { 0x88000000 }
305 /* l.lwa $rD,${simm16}($rA) */
308 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
309 & ifmt_l_lwz
, { 0x6c000000 }
311 /* l.lbz $rD,${simm16}($rA) */
314 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
315 & ifmt_l_lwz
, { 0x8c000000 }
317 /* l.lbs $rD,${simm16}($rA) */
320 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
321 & ifmt_l_lwz
, { 0x90000000 }
323 /* l.lhz $rD,${simm16}($rA) */
326 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
327 & ifmt_l_lwz
, { 0x94000000 }
329 /* l.lhs $rD,${simm16}($rA) */
332 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
333 & ifmt_l_lwz
, { 0x98000000 }
335 /* l.sw ${simm16-split}($rA),$rB */
338 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
339 & ifmt_l_sw
, { 0xd4000000 }
341 /* l.sb ${simm16-split}($rA),$rB */
344 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
345 & ifmt_l_sw
, { 0xd8000000 }
347 /* l.sh ${simm16-split}($rA),$rB */
350 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
351 & ifmt_l_sw
, { 0xdc000000 }
353 /* l.swa ${simm16-split}($rA),$rB */
356 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
357 & ifmt_l_swa
, { 0xcc000000 }
359 /* l.sll $rD,$rA,$rB */
362 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
363 & ifmt_l_sll
, { 0xe0000008 }
365 /* l.slli $rD,$rA,${uimm6} */
368 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
369 & ifmt_l_slli
, { 0xb8000000 }
371 /* l.srl $rD,$rA,$rB */
374 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
375 & ifmt_l_sll
, { 0xe0000048 }
377 /* l.srli $rD,$rA,${uimm6} */
380 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
381 & ifmt_l_slli
, { 0xb8000040 }
383 /* l.sra $rD,$rA,$rB */
386 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
387 & ifmt_l_sll
, { 0xe0000088 }
389 /* l.srai $rD,$rA,${uimm6} */
392 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
393 & ifmt_l_slli
, { 0xb8000080 }
395 /* l.ror $rD,$rA,$rB */
398 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
399 & ifmt_l_sll
, { 0xe00000c8 }
401 /* l.rori $rD,$rA,${uimm6} */
404 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
405 & ifmt_l_slli
, { 0xb80000c0 }
407 /* l.and $rD,$rA,$rB */
410 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
411 & ifmt_l_and
, { 0xe0000003 }
413 /* l.or $rD,$rA,$rB */
416 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
417 & ifmt_l_and
, { 0xe0000004 }
419 /* l.xor $rD,$rA,$rB */
422 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
423 & ifmt_l_and
, { 0xe0000005 }
425 /* l.add $rD,$rA,$rB */
428 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
429 & ifmt_l_and
, { 0xe0000000 }
431 /* l.sub $rD,$rA,$rB */
434 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
435 & ifmt_l_and
, { 0xe0000002 }
437 /* l.addc $rD,$rA,$rB */
440 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
441 & ifmt_l_and
, { 0xe0000001 }
443 /* l.mul $rD,$rA,$rB */
446 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
447 & ifmt_l_and
, { 0xe0000306 }
449 /* l.mulu $rD,$rA,$rB */
452 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
453 & ifmt_l_and
, { 0xe000030b }
455 /* l.div $rD,$rA,$rB */
458 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
459 & ifmt_l_and
, { 0xe0000309 }
461 /* l.divu $rD,$rA,$rB */
464 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
465 & ifmt_l_and
, { 0xe000030a }
470 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
471 & ifmt_l_and
, { 0xe000000f }
476 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
477 & ifmt_l_and
, { 0xe000010f }
479 /* l.andi $rD,$rA,$uimm16 */
482 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
483 & ifmt_l_mfspr
, { 0xa4000000 }
485 /* l.ori $rD,$rA,$uimm16 */
488 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
489 & ifmt_l_mfspr
, { 0xa8000000 }
491 /* l.xori $rD,$rA,$simm16 */
494 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
495 & ifmt_l_lwz
, { 0xac000000 }
497 /* l.addi $rD,$rA,$simm16 */
500 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
501 & ifmt_l_lwz
, { 0x9c000000 }
503 /* l.addic $rD,$rA,$simm16 */
506 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
507 & ifmt_l_lwz
, { 0xa0000000 }
509 /* l.muli $rD,$rA,$simm16 */
512 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
513 & ifmt_l_lwz
, { 0xb0000000 }
515 /* l.exths $rD,$rA */
518 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
519 & ifmt_l_exths
, { 0xe000000c }
521 /* l.extbs $rD,$rA */
524 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
525 & ifmt_l_exths
, { 0xe000004c }
527 /* l.exthz $rD,$rA */
530 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
531 & ifmt_l_exths
, { 0xe000008c }
533 /* l.extbz $rD,$rA */
536 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
537 & ifmt_l_exths
, { 0xe00000cc }
539 /* l.extws $rD,$rA */
542 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
543 & ifmt_l_exths
, { 0xe000000d }
545 /* l.extwz $rD,$rA */
548 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
549 & ifmt_l_exths
, { 0xe000004d }
551 /* l.cmov $rD,$rA,$rB */
554 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
555 & ifmt_l_cmov
, { 0xe000000e }
557 /* l.sfgts $rA,$rB */
560 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
561 & ifmt_l_sfgts
, { 0xe5400000 }
563 /* l.sfgtsi $rA,$simm16 */
566 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
567 & ifmt_l_sfgtsi
, { 0xbd400000 }
569 /* l.sfgtu $rA,$rB */
572 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
573 & ifmt_l_sfgts
, { 0xe4400000 }
575 /* l.sfgtui $rA,$simm16 */
578 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
579 & ifmt_l_sfgtsi
, { 0xbc400000 }
581 /* l.sfges $rA,$rB */
584 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
585 & ifmt_l_sfgts
, { 0xe5600000 }
587 /* l.sfgesi $rA,$simm16 */
590 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
591 & ifmt_l_sfgtsi
, { 0xbd600000 }
593 /* l.sfgeu $rA,$rB */
596 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
597 & ifmt_l_sfgts
, { 0xe4600000 }
599 /* l.sfgeui $rA,$simm16 */
602 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
603 & ifmt_l_sfgtsi
, { 0xbc600000 }
605 /* l.sflts $rA,$rB */
608 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
609 & ifmt_l_sfgts
, { 0xe5800000 }
611 /* l.sfltsi $rA,$simm16 */
614 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
615 & ifmt_l_sfgtsi
, { 0xbd800000 }
617 /* l.sfltu $rA,$rB */
620 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
621 & ifmt_l_sfgts
, { 0xe4800000 }
623 /* l.sfltui $rA,$simm16 */
626 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
627 & ifmt_l_sfgtsi
, { 0xbc800000 }
629 /* l.sfles $rA,$rB */
632 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
633 & ifmt_l_sfgts
, { 0xe5a00000 }
635 /* l.sflesi $rA,$simm16 */
638 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
639 & ifmt_l_sfgtsi
, { 0xbda00000 }
641 /* l.sfleu $rA,$rB */
644 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
645 & ifmt_l_sfgts
, { 0xe4a00000 }
647 /* l.sfleui $rA,$simm16 */
650 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
651 & ifmt_l_sfgtsi
, { 0xbca00000 }
656 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
657 & ifmt_l_sfgts
, { 0xe4000000 }
659 /* l.sfeqi $rA,$simm16 */
662 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
663 & ifmt_l_sfgtsi
, { 0xbc000000 }
668 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
669 & ifmt_l_sfgts
, { 0xe4200000 }
671 /* l.sfnei $rA,$simm16 */
674 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
675 & ifmt_l_sfgtsi
, { 0xbc200000 }
680 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
681 & ifmt_l_mac
, { 0xc4000001 }
686 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
687 & ifmt_l_mac
, { 0xc4000002 }
689 /* l.maci $rA,${simm16} */
692 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
693 & ifmt_l_maci
, { 0x4c000000 }
699 & ifmt_l_rfe
, { 0x70000000 }
705 & ifmt_l_rfe
, { 0x74000000 }
711 & ifmt_l_rfe
, { 0x78000000 }
717 & ifmt_l_rfe
, { 0x7c000000 }
723 & ifmt_l_rfe
, { 0xf0000000 }
729 & ifmt_l_rfe
, { 0xf4000000 }
735 & ifmt_l_rfe
, { 0xf8000000 }
741 & ifmt_l_rfe
, { 0xfc000000 }
743 /* lf.add.s $rDSF,$rASF,$rBSF */
746 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
747 & ifmt_lf_add_s
, { 0xc8000000 }
749 /* lf.add.d $rDDF,$rADF,$rBDF */
752 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
753 & ifmt_lf_add_d
, { 0xc8000010 }
755 /* lf.sub.s $rDSF,$rASF,$rBSF */
758 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
759 & ifmt_lf_add_s
, { 0xc8000001 }
761 /* lf.sub.d $rDDF,$rADF,$rBDF */
764 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
765 & ifmt_lf_add_d
, { 0xc8000011 }
767 /* lf.mul.s $rDSF,$rASF,$rBSF */
770 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
771 & ifmt_lf_add_s
, { 0xc8000002 }
773 /* lf.mul.d $rDDF,$rADF,$rBDF */
776 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
777 & ifmt_lf_add_d
, { 0xc8000012 }
779 /* lf.div.s $rDSF,$rASF,$rBSF */
782 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
783 & ifmt_lf_add_s
, { 0xc8000003 }
785 /* lf.div.d $rDDF,$rADF,$rBDF */
788 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
789 & ifmt_lf_add_d
, { 0xc8000013 }
791 /* lf.rem.s $rDSF,$rASF,$rBSF */
794 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
795 & ifmt_lf_add_s
, { 0xc8000006 }
797 /* lf.rem.d $rDDF,$rADF,$rBDF */
800 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
801 & ifmt_lf_add_d
, { 0xc8000016 }
803 /* lf.itof.s $rDSF,$rA */
806 { { MNEM
, ' ', OP (RDSF
), ',', OP (RA
), 0 } },
807 & ifmt_lf_itof_s
, { 0xc8000004 }
809 /* lf.itof.d $rDSF,$rA */
812 { { MNEM
, ' ', OP (RDSF
), ',', OP (RA
), 0 } },
813 & ifmt_lf_itof_s
, { 0xc8000014 }
815 /* lf.ftoi.s $rD,$rASF */
818 { { MNEM
, ' ', OP (RD
), ',', OP (RASF
), 0 } },
819 & ifmt_lf_ftoi_s
, { 0xc8000005 }
821 /* lf.ftoi.d $rD,$rADF */
824 { { MNEM
, ' ', OP (RD
), ',', OP (RADF
), 0 } },
825 & ifmt_lf_ftoi_d
, { 0xc8000015 }
827 /* lf.sfeq.s $rASF,$rBSF */
830 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
831 & ifmt_lf_eq_s
, { 0xc8000008 }
833 /* lf.sfeq.d $rASF,$rBSF */
836 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
837 & ifmt_lf_eq_s
, { 0xc8000018 }
839 /* lf.sfne.s $rASF,$rBSF */
842 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
843 & ifmt_lf_eq_s
, { 0xc8000009 }
845 /* lf.sfne.d $rASF,$rBSF */
848 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
849 & ifmt_lf_eq_s
, { 0xc8000019 }
851 /* lf.sfge.s $rASF,$rBSF */
854 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
855 & ifmt_lf_eq_s
, { 0xc800000b }
857 /* lf.sfge.d $rASF,$rBSF */
860 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
861 & ifmt_lf_eq_s
, { 0xc800001b }
863 /* lf.sfgt.s $rASF,$rBSF */
866 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
867 & ifmt_lf_eq_s
, { 0xc800000a }
869 /* lf.sfgt.d $rASF,$rBSF */
872 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
873 & ifmt_lf_eq_s
, { 0xc800001a }
875 /* lf.sflt.s $rASF,$rBSF */
878 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
879 & ifmt_lf_eq_s
, { 0xc800000c }
881 /* lf.sflt.d $rASF,$rBSF */
884 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
885 & ifmt_lf_eq_s
, { 0xc800001c }
887 /* lf.sfle.s $rASF,$rBSF */
890 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
891 & ifmt_lf_eq_s
, { 0xc800000d }
893 /* lf.sfle.d $rASF,$rBSF */
896 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
897 & ifmt_lf_eq_s
, { 0xc800001d }
899 /* lf.madd.s $rDSF,$rASF,$rBSF */
902 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
903 & ifmt_lf_add_s
, { 0xc8000007 }
905 /* lf.madd.d $rDDF,$rADF,$rBDF */
908 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
909 & ifmt_lf_add_d
, { 0xc8000017 }
911 /* lf.cust1.s $rASF,$rBSF */
914 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
915 & ifmt_lf_cust1_s
, { 0xc80000d0 }
921 & ifmt_lf_cust1_d
, { 0xc80000e0 }
930 /* Formats for ALIAS macro-insns. */
932 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
935 /* Each non-simple macro entry points to an array of expansion possibilities. */
937 #define A(a) (1 << CGEN_INSN_##a)
938 #define OPERAND(op) OR1K_OPERAND_##op
939 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
940 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
942 /* The macro instruction table. */
944 static const CGEN_IBASE or1k_cgen_macro_insn_table
[] =
948 /* The macro instruction opcode table. */
950 static const CGEN_OPCODE or1k_cgen_macro_insn_opcode_table
[] =
959 #ifndef CGEN_ASM_HASH_P
960 #define CGEN_ASM_HASH_P(insn) 1
963 #ifndef CGEN_DIS_HASH_P
964 #define CGEN_DIS_HASH_P(insn) 1
967 /* Return non-zero if INSN is to be added to the hash table.
968 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
971 asm_hash_insn_p (const CGEN_INSN
*insn ATTRIBUTE_UNUSED
)
973 return CGEN_ASM_HASH_P (insn
);
977 dis_hash_insn_p (const CGEN_INSN
*insn
)
979 /* If building the hash table and the NO-DIS attribute is present,
981 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
983 return CGEN_DIS_HASH_P (insn
);
986 #ifndef CGEN_ASM_HASH
987 #define CGEN_ASM_HASH_SIZE 127
988 #ifdef CGEN_MNEMONIC_OPERANDS
989 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
991 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
995 /* It doesn't make much sense to provide a default here,
996 but while this is under development we do.
997 BUFFER is a pointer to the bytes of the insn, target order.
998 VALUE is the first base_insn_bitsize bits as an int in host order. */
1000 #ifndef CGEN_DIS_HASH
1001 #define CGEN_DIS_HASH_SIZE 256
1002 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1005 /* The result is the hash value of the insn.
1006 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1009 asm_hash_insn (const char *mnem
)
1011 return CGEN_ASM_HASH (mnem
);
1014 /* BUF is a pointer to the bytes of the insn, target order.
1015 VALUE is the first base_insn_bitsize bits as an int in host order. */
1018 dis_hash_insn (const char *buf ATTRIBUTE_UNUSED
,
1019 CGEN_INSN_INT value ATTRIBUTE_UNUSED
)
1021 return CGEN_DIS_HASH (buf
, value
);
1024 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1027 set_fields_bitsize (CGEN_FIELDS
*fields
, int size
)
1029 CGEN_FIELDS_BITSIZE (fields
) = size
;
1032 /* Function to call before using the operand instance table.
1033 This plugs the opcode entries and macro instructions into the cpu table. */
1036 or1k_cgen_init_opcode_table (CGEN_CPU_DESC cd
)
1039 int num_macros
= (sizeof (or1k_cgen_macro_insn_table
) /
1040 sizeof (or1k_cgen_macro_insn_table
[0]));
1041 const CGEN_IBASE
*ib
= & or1k_cgen_macro_insn_table
[0];
1042 const CGEN_OPCODE
*oc
= & or1k_cgen_macro_insn_opcode_table
[0];
1043 CGEN_INSN
*insns
= xmalloc (num_macros
* sizeof (CGEN_INSN
));
1045 /* This test has been added to avoid a warning generated
1046 if memset is called with a third argument of value zero. */
1047 if (num_macros
>= 1)
1048 memset (insns
, 0, num_macros
* sizeof (CGEN_INSN
));
1049 for (i
= 0; i
< num_macros
; ++i
)
1051 insns
[i
].base
= &ib
[i
];
1052 insns
[i
].opcode
= &oc
[i
];
1053 or1k_cgen_build_insn_regex (& insns
[i
]);
1055 cd
->macro_insn_table
.init_entries
= insns
;
1056 cd
->macro_insn_table
.entry_size
= sizeof (CGEN_IBASE
);
1057 cd
->macro_insn_table
.num_init_entries
= num_macros
;
1059 oc
= & or1k_cgen_insn_opcode_table
[0];
1060 insns
= (CGEN_INSN
*) cd
->insn_table
.init_entries
;
1061 for (i
= 0; i
< MAX_INSNS
; ++i
)
1063 insns
[i
].opcode
= &oc
[i
];
1064 or1k_cgen_build_insn_regex (& insns
[i
]);
1067 cd
->sizeof_fields
= sizeof (CGEN_FIELDS
);
1068 cd
->set_fields_bitsize
= set_fields_bitsize
;
1070 cd
->asm_hash_p
= asm_hash_insn_p
;
1071 cd
->asm_hash
= asm_hash_insn
;
1072 cd
->asm_hash_size
= CGEN_ASM_HASH_SIZE
;
1074 cd
->dis_hash_p
= dis_hash_insn_p
;
1075 cd
->dis_hash
= dis_hash_insn
;
1076 cd
->dis_hash_size
= CGEN_DIS_HASH_SIZE
;