1 /* Instruction opcode table for or1k.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2010 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_rfe ATTRIBUTE_UNUSED
= {
63 32, 32, 0xffffffff, { { F (F_OPCODE
) }, { F (F_RESV_25_26
) }, { 0 } }
66 static const CGEN_IFMT ifmt_l_nop_imm ATTRIBUTE_UNUSED
= {
67 32, 32, 0xffff0000, { { F (F_OPCODE
) }, { F (F_OP_25_2
) }, { F (F_RESV_23_8
) }, { F (F_UIMM16
) }, { 0 } }
70 static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED
= {
71 32, 32, 0xfc1f0000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_RESV_20_4
) }, { F (F_OP_16_1
) }, { F (F_UIMM16
) }, { 0 } }
74 static const CGEN_IFMT ifmt_l_macrc ATTRIBUTE_UNUSED
= {
75 32, 32, 0xfc1fffff, { { 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_mfspr ATTRIBUTE_UNUSED
= {
79 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
82 static const CGEN_IFMT ifmt_l_mtspr ATTRIBUTE_UNUSED
= {
83 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_UIMM16_SPLIT
) }, { 0 } }
86 static const CGEN_IFMT ifmt_l_lwz ATTRIBUTE_UNUSED
= {
87 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
90 static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED
= {
91 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_SIMM16_SPLIT
) }, { 0 } }
94 static const CGEN_IFMT ifmt_l_swa ATTRIBUTE_UNUSED
= {
95 32, 32, 0xfc000000, { { F (F_OPCODE
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_SIMM16
) }, { 0 } }
98 static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED
= {
99 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 } }
102 static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED
= {
103 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 } }
106 static const CGEN_IFMT ifmt_l_and ATTRIBUTE_UNUSED
= {
107 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 } }
110 static const CGEN_IFMT ifmt_l_exths ATTRIBUTE_UNUSED
= {
111 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 } }
114 static const CGEN_IFMT ifmt_l_cmov ATTRIBUTE_UNUSED
= {
115 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 } }
118 static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED
= {
119 32, 32, 0xffe007ff, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_RESV_10_11
) }, { 0 } }
122 static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED
= {
123 32, 32, 0xffe00000, { { F (F_OPCODE
) }, { F (F_OP_25_5
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
126 static const CGEN_IFMT ifmt_l_mac ATTRIBUTE_UNUSED
= {
127 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 } }
130 static const CGEN_IFMT ifmt_l_maci ATTRIBUTE_UNUSED
= {
131 32, 32, 0xffe00000, { { F (F_OPCODE
) }, { F (F_RESV_25_5
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
134 static const CGEN_IFMT ifmt_lf_add_s ATTRIBUTE_UNUSED
= {
135 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 } }
138 static const CGEN_IFMT ifmt_lf_add_d ATTRIBUTE_UNUSED
= {
139 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 } }
142 static const CGEN_IFMT ifmt_lf_itof_s ATTRIBUTE_UNUSED
= {
143 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 } }
146 static const CGEN_IFMT ifmt_lf_ftoi_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_d ATTRIBUTE_UNUSED
= {
151 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 } }
154 static const CGEN_IFMT ifmt_lf_eq_s ATTRIBUTE_UNUSED
= {
155 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 } }
158 static const CGEN_IFMT ifmt_lf_cust1_s ATTRIBUTE_UNUSED
= {
159 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 } }
162 static const CGEN_IFMT ifmt_lf_cust1_d ATTRIBUTE_UNUSED
= {
163 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 } }
168 #define A(a) (1 << CGEN_INSN_##a)
169 #define OPERAND(op) OR1K_OPERAND_##op
170 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
171 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
173 /* The instruction table. */
175 static const CGEN_OPCODE or1k_cgen_insn_opcode_table
[MAX_INSNS
] =
177 /* Special null first entry.
178 A `num' value of zero is thus invalid.
179 Also, the special `invalid' insn resides here. */
180 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
184 { { MNEM
, ' ', OP (DISP26
), 0 } },
187 /* l.jal ${disp26} */
190 { { MNEM
, ' ', OP (DISP26
), 0 } },
191 & ifmt_l_j
, { 0x4000000 }
196 { { MNEM
, ' ', OP (RB
), 0 } },
197 & ifmt_l_jr
, { 0x44000000 }
202 { { MNEM
, ' ', OP (RB
), 0 } },
203 & ifmt_l_jr
, { 0x48000000 }
205 /* l.bnf ${disp26} */
208 { { MNEM
, ' ', OP (DISP26
), 0 } },
209 & ifmt_l_j
, { 0xc000000 }
214 { { MNEM
, ' ', OP (DISP26
), 0 } },
215 & ifmt_l_j
, { 0x10000000 }
217 /* l.trap ${uimm16} */
220 { { MNEM
, ' ', OP (UIMM16
), 0 } },
221 & ifmt_l_trap
, { 0x21000000 }
223 /* l.sys ${uimm16} */
226 { { MNEM
, ' ', OP (UIMM16
), 0 } },
227 & ifmt_l_trap
, { 0x20000000 }
233 & ifmt_l_rfe
, { 0x24000000 }
235 /* l.nop ${uimm16} */
238 { { MNEM
, ' ', OP (UIMM16
), 0 } },
239 & ifmt_l_nop_imm
, { 0x15000000 }
245 & ifmt_l_nop_imm
, { 0x15000000 }
247 /* l.movhi $rD,$uimm16 */
250 { { MNEM
, ' ', OP (RD
), ',', OP (UIMM16
), 0 } },
251 & ifmt_l_movhi
, { 0x18000000 }
256 { { MNEM
, ' ', OP (RD
), 0 } },
257 & ifmt_l_macrc
, { 0x18010000 }
259 /* l.mfspr $rD,$rA,${uimm16} */
262 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
263 & ifmt_l_mfspr
, { 0xb4000000 }
265 /* l.mtspr $rA,$rB,${uimm16-split} */
268 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), ',', OP (UIMM16_SPLIT
), 0 } },
269 & ifmt_l_mtspr
, { 0xc0000000 }
271 /* l.lwz $rD,${simm16}($rA) */
274 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
275 & ifmt_l_lwz
, { 0x84000000 }
277 /* l.lws $rD,${simm16}($rA) */
280 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
281 & ifmt_l_lwz
, { 0x88000000 }
283 /* l.lwa $rD,${simm16}($rA) */
286 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
287 & ifmt_l_lwz
, { 0x6c000000 }
289 /* l.lbz $rD,${simm16}($rA) */
292 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
293 & ifmt_l_lwz
, { 0x8c000000 }
295 /* l.lbs $rD,${simm16}($rA) */
298 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
299 & ifmt_l_lwz
, { 0x90000000 }
301 /* l.lhz $rD,${simm16}($rA) */
304 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
305 & ifmt_l_lwz
, { 0x94000000 }
307 /* l.lhs $rD,${simm16}($rA) */
310 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM16
), '(', OP (RA
), ')', 0 } },
311 & ifmt_l_lwz
, { 0x98000000 }
313 /* l.sw ${simm16-split}($rA),$rB */
316 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
317 & ifmt_l_sw
, { 0xd4000000 }
319 /* l.sb ${simm16-split}($rA),$rB */
322 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
323 & ifmt_l_sw
, { 0xd8000000 }
325 /* l.sh ${simm16-split}($rA),$rB */
328 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
329 & ifmt_l_sw
, { 0xdc000000 }
331 /* l.swa ${simm16-split}($rA),$rB */
334 { { MNEM
, ' ', OP (SIMM16_SPLIT
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
335 & ifmt_l_swa
, { 0xcc000000 }
337 /* l.sll $rD,$rA,$rB */
340 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
341 & ifmt_l_sll
, { 0xe0000008 }
343 /* l.slli $rD,$rA,${uimm6} */
346 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
347 & ifmt_l_slli
, { 0xb8000000 }
349 /* l.srl $rD,$rA,$rB */
352 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
353 & ifmt_l_sll
, { 0xe0000048 }
355 /* l.srli $rD,$rA,${uimm6} */
358 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
359 & ifmt_l_slli
, { 0xb8000040 }
361 /* l.sra $rD,$rA,$rB */
364 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
365 & ifmt_l_sll
, { 0xe0000088 }
367 /* l.srai $rD,$rA,${uimm6} */
370 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
371 & ifmt_l_slli
, { 0xb8000080 }
373 /* l.ror $rD,$rA,$rB */
376 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
377 & ifmt_l_sll
, { 0xe00000c8 }
379 /* l.rori $rD,$rA,${uimm6} */
382 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM6
), 0 } },
383 & ifmt_l_slli
, { 0xb80000c0 }
385 /* l.and $rD,$rA,$rB */
388 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
389 & ifmt_l_and
, { 0xe0000003 }
391 /* l.or $rD,$rA,$rB */
394 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
395 & ifmt_l_and
, { 0xe0000004 }
397 /* l.xor $rD,$rA,$rB */
400 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
401 & ifmt_l_and
, { 0xe0000005 }
403 /* l.add $rD,$rA,$rB */
406 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
407 & ifmt_l_and
, { 0xe0000000 }
409 /* l.sub $rD,$rA,$rB */
412 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
413 & ifmt_l_and
, { 0xe0000002 }
415 /* l.addc $rD,$rA,$rB */
418 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
419 & ifmt_l_and
, { 0xe0000001 }
421 /* l.mul $rD,$rA,$rB */
424 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
425 & ifmt_l_and
, { 0xe0000306 }
427 /* l.mulu $rD,$rA,$rB */
430 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
431 & ifmt_l_and
, { 0xe000030b }
433 /* l.div $rD,$rA,$rB */
436 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
437 & ifmt_l_and
, { 0xe0000309 }
439 /* l.divu $rD,$rA,$rB */
442 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
443 & ifmt_l_and
, { 0xe000030a }
448 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
449 & ifmt_l_and
, { 0xe000000f }
454 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
455 & ifmt_l_and
, { 0xe000010f }
457 /* l.andi $rD,$rA,$uimm16 */
460 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
461 & ifmt_l_mfspr
, { 0xa4000000 }
463 /* l.ori $rD,$rA,$uimm16 */
466 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM16
), 0 } },
467 & ifmt_l_mfspr
, { 0xa8000000 }
469 /* l.xori $rD,$rA,$simm16 */
472 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
473 & ifmt_l_lwz
, { 0xac000000 }
475 /* l.addi $rD,$rA,$simm16 */
478 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
479 & ifmt_l_lwz
, { 0x9c000000 }
481 /* l.addic $rD,$rA,$simm16 */
484 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
485 & ifmt_l_lwz
, { 0xa0000000 }
487 /* l.muli $rD,$rA,$simm16 */
490 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (SIMM16
), 0 } },
491 & ifmt_l_lwz
, { 0xb0000000 }
493 /* l.exths $rD,$rA */
496 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
497 & ifmt_l_exths
, { 0xe000000c }
499 /* l.extbs $rD,$rA */
502 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
503 & ifmt_l_exths
, { 0xe000004c }
505 /* l.exthz $rD,$rA */
508 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
509 & ifmt_l_exths
, { 0xe000008c }
511 /* l.extbz $rD,$rA */
514 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
515 & ifmt_l_exths
, { 0xe00000cc }
517 /* l.extws $rD,$rA */
520 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
521 & ifmt_l_exths
, { 0xe000000d }
523 /* l.extwz $rD,$rA */
526 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
527 & ifmt_l_exths
, { 0xe000004d }
529 /* l.cmov $rD,$rA,$rB */
532 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
533 & ifmt_l_cmov
, { 0xe000000e }
535 /* l.sfgts $rA,$rB */
538 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
539 & ifmt_l_sfgts
, { 0xe5400000 }
541 /* l.sfgtsi $rA,$simm16 */
544 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
545 & ifmt_l_sfgtsi
, { 0xbd400000 }
547 /* l.sfgtu $rA,$rB */
550 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
551 & ifmt_l_sfgts
, { 0xe4400000 }
553 /* l.sfgtui $rA,$simm16 */
556 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
557 & ifmt_l_sfgtsi
, { 0xbc400000 }
559 /* l.sfges $rA,$rB */
562 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
563 & ifmt_l_sfgts
, { 0xe5600000 }
565 /* l.sfgesi $rA,$simm16 */
568 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
569 & ifmt_l_sfgtsi
, { 0xbd600000 }
571 /* l.sfgeu $rA,$rB */
574 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
575 & ifmt_l_sfgts
, { 0xe4600000 }
577 /* l.sfgeui $rA,$simm16 */
580 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
581 & ifmt_l_sfgtsi
, { 0xbc600000 }
583 /* l.sflts $rA,$rB */
586 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
587 & ifmt_l_sfgts
, { 0xe5800000 }
589 /* l.sfltsi $rA,$simm16 */
592 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
593 & ifmt_l_sfgtsi
, { 0xbd800000 }
595 /* l.sfltu $rA,$rB */
598 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
599 & ifmt_l_sfgts
, { 0xe4800000 }
601 /* l.sfltui $rA,$simm16 */
604 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
605 & ifmt_l_sfgtsi
, { 0xbc800000 }
607 /* l.sfles $rA,$rB */
610 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
611 & ifmt_l_sfgts
, { 0xe5a00000 }
613 /* l.sflesi $rA,$simm16 */
616 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
617 & ifmt_l_sfgtsi
, { 0xbda00000 }
619 /* l.sfleu $rA,$rB */
622 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
623 & ifmt_l_sfgts
, { 0xe4a00000 }
625 /* l.sfleui $rA,$simm16 */
628 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
629 & ifmt_l_sfgtsi
, { 0xbca00000 }
634 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
635 & ifmt_l_sfgts
, { 0xe4000000 }
637 /* l.sfeqi $rA,$simm16 */
640 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
641 & ifmt_l_sfgtsi
, { 0xbc000000 }
646 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
647 & ifmt_l_sfgts
, { 0xe4200000 }
649 /* l.sfnei $rA,$simm16 */
652 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
653 & ifmt_l_sfgtsi
, { 0xbc200000 }
658 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
659 & ifmt_l_mac
, { 0xc4000001 }
664 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
665 & ifmt_l_mac
, { 0xc4000002 }
667 /* l.maci $rA,${simm16} */
670 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM16
), 0 } },
671 & ifmt_l_maci
, { 0x4c000000 }
677 & ifmt_l_rfe
, { 0x70000000 }
683 & ifmt_l_rfe
, { 0x74000000 }
689 & ifmt_l_rfe
, { 0x78000000 }
695 & ifmt_l_rfe
, { 0x7c000000 }
701 & ifmt_l_rfe
, { 0xf0000000 }
707 & ifmt_l_rfe
, { 0xf4000000 }
713 & ifmt_l_rfe
, { 0xf8000000 }
719 & ifmt_l_rfe
, { 0xfc000000 }
721 /* lf.add.s $rDSF,$rASF,$rBSF */
724 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
725 & ifmt_lf_add_s
, { 0xc8000000 }
727 /* lf.add.d $rDDF,$rADF,$rBDF */
730 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
731 & ifmt_lf_add_d
, { 0xc8000010 }
733 /* lf.sub.s $rDSF,$rASF,$rBSF */
736 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
737 & ifmt_lf_add_s
, { 0xc8000001 }
739 /* lf.sub.d $rDDF,$rADF,$rBDF */
742 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
743 & ifmt_lf_add_d
, { 0xc8000011 }
745 /* lf.mul.s $rDSF,$rASF,$rBSF */
748 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
749 & ifmt_lf_add_s
, { 0xc8000002 }
751 /* lf.mul.d $rDDF,$rADF,$rBDF */
754 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
755 & ifmt_lf_add_d
, { 0xc8000012 }
757 /* lf.div.s $rDSF,$rASF,$rBSF */
760 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
761 & ifmt_lf_add_s
, { 0xc8000003 }
763 /* lf.div.d $rDDF,$rADF,$rBDF */
766 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
767 & ifmt_lf_add_d
, { 0xc8000013 }
769 /* lf.rem.s $rDSF,$rASF,$rBSF */
772 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
773 & ifmt_lf_add_s
, { 0xc8000006 }
775 /* lf.rem.d $rDDF,$rADF,$rBDF */
778 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
779 & ifmt_lf_add_d
, { 0xc8000016 }
781 /* lf.itof.s $rDSF,$rA */
784 { { MNEM
, ' ', OP (RDSF
), ',', OP (RA
), 0 } },
785 & ifmt_lf_itof_s
, { 0xc8000004 }
787 /* lf.itof.d $rDSF,$rA */
790 { { MNEM
, ' ', OP (RDSF
), ',', OP (RA
), 0 } },
791 & ifmt_lf_itof_s
, { 0xc8000014 }
793 /* lf.ftoi.s $rD,$rASF */
796 { { MNEM
, ' ', OP (RD
), ',', OP (RASF
), 0 } },
797 & ifmt_lf_ftoi_s
, { 0xc8000005 }
799 /* lf.ftoi.d $rD,$rADF */
802 { { MNEM
, ' ', OP (RD
), ',', OP (RADF
), 0 } },
803 & ifmt_lf_ftoi_d
, { 0xc8000015 }
805 /* lf.sfeq.s $rASF,$rBSF */
808 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
809 & ifmt_lf_eq_s
, { 0xc8000008 }
811 /* lf.sfeq.d $rASF,$rBSF */
814 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
815 & ifmt_lf_eq_s
, { 0xc8000018 }
817 /* lf.sfne.s $rASF,$rBSF */
820 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
821 & ifmt_lf_eq_s
, { 0xc8000009 }
823 /* lf.sfne.d $rASF,$rBSF */
826 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
827 & ifmt_lf_eq_s
, { 0xc8000019 }
829 /* lf.sfge.s $rASF,$rBSF */
832 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
833 & ifmt_lf_eq_s
, { 0xc800000b }
835 /* lf.sfge.d $rASF,$rBSF */
838 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
839 & ifmt_lf_eq_s
, { 0xc800001b }
841 /* lf.sfgt.s $rASF,$rBSF */
844 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
845 & ifmt_lf_eq_s
, { 0xc800000a }
847 /* lf.sfgt.d $rASF,$rBSF */
850 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
851 & ifmt_lf_eq_s
, { 0xc800001a }
853 /* lf.sflt.s $rASF,$rBSF */
856 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
857 & ifmt_lf_eq_s
, { 0xc800000c }
859 /* lf.sflt.d $rASF,$rBSF */
862 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
863 & ifmt_lf_eq_s
, { 0xc800001c }
865 /* lf.sfle.s $rASF,$rBSF */
868 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
869 & ifmt_lf_eq_s
, { 0xc800000d }
871 /* lf.sfle.d $rASF,$rBSF */
874 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
875 & ifmt_lf_eq_s
, { 0xc800001d }
877 /* lf.madd.s $rDSF,$rASF,$rBSF */
880 { { MNEM
, ' ', OP (RDSF
), ',', OP (RASF
), ',', OP (RBSF
), 0 } },
881 & ifmt_lf_add_s
, { 0xc8000007 }
883 /* lf.madd.d $rDDF,$rADF,$rBDF */
886 { { MNEM
, ' ', OP (RDDF
), ',', OP (RADF
), ',', OP (RBDF
), 0 } },
887 & ifmt_lf_add_d
, { 0xc8000017 }
889 /* lf.cust1.s $rASF,$rBSF */
892 { { MNEM
, ' ', OP (RASF
), ',', OP (RBSF
), 0 } },
893 & ifmt_lf_cust1_s
, { 0xc80000d0 }
899 & ifmt_lf_cust1_d
, { 0xc80000e0 }
908 /* Formats for ALIAS macro-insns. */
910 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
913 /* Each non-simple macro entry points to an array of expansion possibilities. */
915 #define A(a) (1 << CGEN_INSN_##a)
916 #define OPERAND(op) OR1K_OPERAND_##op
917 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
918 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
920 /* The macro instruction table. */
922 static const CGEN_IBASE or1k_cgen_macro_insn_table
[] =
926 /* The macro instruction opcode table. */
928 static const CGEN_OPCODE or1k_cgen_macro_insn_opcode_table
[] =
937 #ifndef CGEN_ASM_HASH_P
938 #define CGEN_ASM_HASH_P(insn) 1
941 #ifndef CGEN_DIS_HASH_P
942 #define CGEN_DIS_HASH_P(insn) 1
945 /* Return non-zero if INSN is to be added to the hash table.
946 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
949 asm_hash_insn_p (insn
)
950 const CGEN_INSN
*insn ATTRIBUTE_UNUSED
;
952 return CGEN_ASM_HASH_P (insn
);
956 dis_hash_insn_p (insn
)
957 const CGEN_INSN
*insn
;
959 /* If building the hash table and the NO-DIS attribute is present,
961 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
963 return CGEN_DIS_HASH_P (insn
);
966 #ifndef CGEN_ASM_HASH
967 #define CGEN_ASM_HASH_SIZE 127
968 #ifdef CGEN_MNEMONIC_OPERANDS
969 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
971 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
975 /* It doesn't make much sense to provide a default here,
976 but while this is under development we do.
977 BUFFER is a pointer to the bytes of the insn, target order.
978 VALUE is the first base_insn_bitsize bits as an int in host order. */
980 #ifndef CGEN_DIS_HASH
981 #define CGEN_DIS_HASH_SIZE 256
982 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
985 /* The result is the hash value of the insn.
986 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
992 return CGEN_ASM_HASH (mnem
);
995 /* BUF is a pointer to the bytes of the insn, target order.
996 VALUE is the first base_insn_bitsize bits as an int in host order. */
999 dis_hash_insn (buf
, value
)
1000 const char * buf ATTRIBUTE_UNUSED
;
1001 CGEN_INSN_INT value ATTRIBUTE_UNUSED
;
1003 return CGEN_DIS_HASH (buf
, value
);
1006 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1009 set_fields_bitsize (CGEN_FIELDS
*fields
, int size
)
1011 CGEN_FIELDS_BITSIZE (fields
) = size
;
1014 /* Function to call before using the operand instance table.
1015 This plugs the opcode entries and macro instructions into the cpu table. */
1018 or1k_cgen_init_opcode_table (CGEN_CPU_DESC cd
)
1021 int num_macros
= (sizeof (or1k_cgen_macro_insn_table
) /
1022 sizeof (or1k_cgen_macro_insn_table
[0]));
1023 const CGEN_IBASE
*ib
= & or1k_cgen_macro_insn_table
[0];
1024 const CGEN_OPCODE
*oc
= & or1k_cgen_macro_insn_opcode_table
[0];
1025 CGEN_INSN
*insns
= xmalloc (num_macros
* sizeof (CGEN_INSN
));
1027 /* This test has been added to avoid a warning generated
1028 if memset is called with a third argument of value zero. */
1029 if (num_macros
>= 1)
1030 memset (insns
, 0, num_macros
* sizeof (CGEN_INSN
));
1031 for (i
= 0; i
< num_macros
; ++i
)
1033 insns
[i
].base
= &ib
[i
];
1034 insns
[i
].opcode
= &oc
[i
];
1035 or1k_cgen_build_insn_regex (& insns
[i
]);
1037 cd
->macro_insn_table
.init_entries
= insns
;
1038 cd
->macro_insn_table
.entry_size
= sizeof (CGEN_IBASE
);
1039 cd
->macro_insn_table
.num_init_entries
= num_macros
;
1041 oc
= & or1k_cgen_insn_opcode_table
[0];
1042 insns
= (CGEN_INSN
*) cd
->insn_table
.init_entries
;
1043 for (i
= 0; i
< MAX_INSNS
; ++i
)
1045 insns
[i
].opcode
= &oc
[i
];
1046 or1k_cgen_build_insn_regex (& insns
[i
]);
1049 cd
->sizeof_fields
= sizeof (CGEN_FIELDS
);
1050 cd
->set_fields_bitsize
= set_fields_bitsize
;
1052 cd
->asm_hash_p
= asm_hash_insn_p
;
1053 cd
->asm_hash
= asm_hash_insn
;
1054 cd
->asm_hash_size
= CGEN_ASM_HASH_SIZE
;
1056 cd
->dis_hash_p
= dis_hash_insn_p
;
1057 cd
->dis_hash
= dis_hash_insn
;
1058 cd
->dis_hash_size
= CGEN_DIS_HASH_SIZE
;