[binutils, ARM, 5/16] BF insns infrastructure with new global reloc R_ARM_THM_BF16
[binutils-gdb.git] / opcodes / or1k-opc.c
blob36aed256d66c140fd989515e0670eb366284a483
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)
13 any later version.
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.
26 #include "sysdep.h"
27 #include "ansidecl.h"
28 #include "bfd.h"
29 #include "symcat.h"
30 #include "or1k-desc.h"
31 #include "or1k-opc.h"
32 #include "libiberty.h"
34 /* -- opc.c */
35 /* -- */
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 = {
48 0, 0, 0x0, { { 0 } }
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 } }
179 #undef F
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}},
194 /* l.j ${disp26} */
196 { 0, 0, 0, 0 },
197 { { MNEM, ' ', OP (DISP26), 0 } },
198 & ifmt_l_j, { 0x0 }
200 /* l.adrp $rD,${disp21} */
202 { 0, 0, 0, 0 },
203 { { MNEM, ' ', OP (RD), ',', OP (DISP21), 0 } },
204 & ifmt_l_adrp, { 0x8000000 }
206 /* l.jal ${disp26} */
208 { 0, 0, 0, 0 },
209 { { MNEM, ' ', OP (DISP26), 0 } },
210 & ifmt_l_j, { 0x4000000 }
212 /* l.jr $rB */
214 { 0, 0, 0, 0 },
215 { { MNEM, ' ', OP (RB), 0 } },
216 & ifmt_l_jr, { 0x44000000 }
218 /* l.jalr $rB */
220 { 0, 0, 0, 0 },
221 { { MNEM, ' ', OP (RB), 0 } },
222 & ifmt_l_jr, { 0x48000000 }
224 /* l.bnf ${disp26} */
226 { 0, 0, 0, 0 },
227 { { MNEM, ' ', OP (DISP26), 0 } },
228 & ifmt_l_j, { 0xc000000 }
230 /* l.bf ${disp26} */
232 { 0, 0, 0, 0 },
233 { { MNEM, ' ', OP (DISP26), 0 } },
234 & ifmt_l_j, { 0x10000000 }
236 /* l.trap ${uimm16} */
238 { 0, 0, 0, 0 },
239 { { MNEM, ' ', OP (UIMM16), 0 } },
240 & ifmt_l_trap, { 0x21000000 }
242 /* l.sys ${uimm16} */
244 { 0, 0, 0, 0 },
245 { { MNEM, ' ', OP (UIMM16), 0 } },
246 & ifmt_l_trap, { 0x20000000 }
248 /* l.msync */
250 { 0, 0, 0, 0 },
251 { { MNEM, 0 } },
252 & ifmt_l_msync, { 0x22000000 }
254 /* l.psync */
256 { 0, 0, 0, 0 },
257 { { MNEM, 0 } },
258 & ifmt_l_msync, { 0x22800000 }
260 /* l.csync */
262 { 0, 0, 0, 0 },
263 { { MNEM, 0 } },
264 & ifmt_l_msync, { 0x23000000 }
266 /* l.rfe */
268 { 0, 0, 0, 0 },
269 { { MNEM, 0 } },
270 & ifmt_l_rfe, { 0x24000000 }
272 /* l.nop ${uimm16} */
274 { 0, 0, 0, 0 },
275 { { MNEM, ' ', OP (UIMM16), 0 } },
276 & ifmt_l_nop_imm, { 0x15000000 }
278 /* l.nop */
280 { 0, 0, 0, 0 },
281 { { MNEM, 0 } },
282 & ifmt_l_nop_imm, { 0x15000000 }
284 /* l.movhi $rD,$uimm16 */
286 { 0, 0, 0, 0 },
287 { { MNEM, ' ', OP (RD), ',', OP (UIMM16), 0 } },
288 & ifmt_l_movhi, { 0x18000000 }
290 /* l.macrc $rD */
292 { 0, 0, 0, 0 },
293 { { MNEM, ' ', OP (RD), 0 } },
294 & ifmt_l_macrc, { 0x18010000 }
296 /* l.mfspr $rD,$rA,${uimm16} */
298 { 0, 0, 0, 0 },
299 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
300 & ifmt_l_mfspr, { 0xb4000000 }
302 /* l.mtspr $rA,$rB,${uimm16-split} */
304 { 0, 0, 0, 0 },
305 { { MNEM, ' ', OP (RA), ',', OP (RB), ',', OP (UIMM16_SPLIT), 0 } },
306 & ifmt_l_mtspr, { 0xc0000000 }
308 /* l.lwz $rD,${simm16}($rA) */
310 { 0, 0, 0, 0 },
311 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
312 & ifmt_l_lwz, { 0x84000000 }
314 /* l.lws $rD,${simm16}($rA) */
316 { 0, 0, 0, 0 },
317 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
318 & ifmt_l_lwz, { 0x88000000 }
320 /* l.lwa $rD,${simm16}($rA) */
322 { 0, 0, 0, 0 },
323 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
324 & ifmt_l_lwz, { 0x6c000000 }
326 /* l.lbz $rD,${simm16}($rA) */
328 { 0, 0, 0, 0 },
329 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
330 & ifmt_l_lwz, { 0x8c000000 }
332 /* l.lbs $rD,${simm16}($rA) */
334 { 0, 0, 0, 0 },
335 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
336 & ifmt_l_lwz, { 0x90000000 }
338 /* l.lhz $rD,${simm16}($rA) */
340 { 0, 0, 0, 0 },
341 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
342 & ifmt_l_lwz, { 0x94000000 }
344 /* l.lhs $rD,${simm16}($rA) */
346 { 0, 0, 0, 0 },
347 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
348 & ifmt_l_lwz, { 0x98000000 }
350 /* l.sw ${simm16-split}($rA),$rB */
352 { 0, 0, 0, 0 },
353 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
354 & ifmt_l_sw, { 0xd4000000 }
356 /* l.sb ${simm16-split}($rA),$rB */
358 { 0, 0, 0, 0 },
359 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
360 & ifmt_l_sw, { 0xd8000000 }
362 /* l.sh ${simm16-split}($rA),$rB */
364 { 0, 0, 0, 0 },
365 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
366 & ifmt_l_sw, { 0xdc000000 }
368 /* l.swa ${simm16-split}($rA),$rB */
370 { 0, 0, 0, 0 },
371 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
372 & ifmt_l_swa, { 0xcc000000 }
374 /* l.sll $rD,$rA,$rB */
376 { 0, 0, 0, 0 },
377 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
378 & ifmt_l_sll, { 0xe0000008 }
380 /* l.slli $rD,$rA,${uimm6} */
382 { 0, 0, 0, 0 },
383 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
384 & ifmt_l_slli, { 0xb8000000 }
386 /* l.srl $rD,$rA,$rB */
388 { 0, 0, 0, 0 },
389 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
390 & ifmt_l_sll, { 0xe0000048 }
392 /* l.srli $rD,$rA,${uimm6} */
394 { 0, 0, 0, 0 },
395 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
396 & ifmt_l_slli, { 0xb8000040 }
398 /* l.sra $rD,$rA,$rB */
400 { 0, 0, 0, 0 },
401 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
402 & ifmt_l_sll, { 0xe0000088 }
404 /* l.srai $rD,$rA,${uimm6} */
406 { 0, 0, 0, 0 },
407 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
408 & ifmt_l_slli, { 0xb8000080 }
410 /* l.ror $rD,$rA,$rB */
412 { 0, 0, 0, 0 },
413 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
414 & ifmt_l_sll, { 0xe00000c8 }
416 /* l.rori $rD,$rA,${uimm6} */
418 { 0, 0, 0, 0 },
419 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
420 & ifmt_l_slli, { 0xb80000c0 }
422 /* l.and $rD,$rA,$rB */
424 { 0, 0, 0, 0 },
425 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
426 & ifmt_l_and, { 0xe0000003 }
428 /* l.or $rD,$rA,$rB */
430 { 0, 0, 0, 0 },
431 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
432 & ifmt_l_and, { 0xe0000004 }
434 /* l.xor $rD,$rA,$rB */
436 { 0, 0, 0, 0 },
437 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
438 & ifmt_l_and, { 0xe0000005 }
440 /* l.add $rD,$rA,$rB */
442 { 0, 0, 0, 0 },
443 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
444 & ifmt_l_and, { 0xe0000000 }
446 /* l.sub $rD,$rA,$rB */
448 { 0, 0, 0, 0 },
449 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
450 & ifmt_l_and, { 0xe0000002 }
452 /* l.addc $rD,$rA,$rB */
454 { 0, 0, 0, 0 },
455 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
456 & ifmt_l_and, { 0xe0000001 }
458 /* l.mul $rD,$rA,$rB */
460 { 0, 0, 0, 0 },
461 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
462 & ifmt_l_and, { 0xe0000306 }
464 /* l.muld $rA,$rB */
466 { 0, 0, 0, 0 },
467 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
468 & ifmt_l_muld, { 0xe0000307 }
470 /* l.mulu $rD,$rA,$rB */
472 { 0, 0, 0, 0 },
473 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
474 & ifmt_l_and, { 0xe000030b }
476 /* l.muldu $rA,$rB */
478 { 0, 0, 0, 0 },
479 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
480 & ifmt_l_muld, { 0xe000030d }
482 /* l.div $rD,$rA,$rB */
484 { 0, 0, 0, 0 },
485 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
486 & ifmt_l_and, { 0xe0000309 }
488 /* l.divu $rD,$rA,$rB */
490 { 0, 0, 0, 0 },
491 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
492 & ifmt_l_and, { 0xe000030a }
494 /* l.ff1 $rD,$rA */
496 { 0, 0, 0, 0 },
497 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
498 & ifmt_l_and, { 0xe000000f }
500 /* l.fl1 $rD,$rA */
502 { 0, 0, 0, 0 },
503 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
504 & ifmt_l_and, { 0xe000010f }
506 /* l.andi $rD,$rA,$uimm16 */
508 { 0, 0, 0, 0 },
509 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
510 & ifmt_l_mfspr, { 0xa4000000 }
512 /* l.ori $rD,$rA,$uimm16 */
514 { 0, 0, 0, 0 },
515 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
516 & ifmt_l_mfspr, { 0xa8000000 }
518 /* l.xori $rD,$rA,$simm16 */
520 { 0, 0, 0, 0 },
521 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
522 & ifmt_l_lwz, { 0xac000000 }
524 /* l.addi $rD,$rA,$simm16 */
526 { 0, 0, 0, 0 },
527 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
528 & ifmt_l_lwz, { 0x9c000000 }
530 /* l.addic $rD,$rA,$simm16 */
532 { 0, 0, 0, 0 },
533 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
534 & ifmt_l_lwz, { 0xa0000000 }
536 /* l.muli $rD,$rA,$simm16 */
538 { 0, 0, 0, 0 },
539 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
540 & ifmt_l_lwz, { 0xb0000000 }
542 /* l.exths $rD,$rA */
544 { 0, 0, 0, 0 },
545 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
546 & ifmt_l_exths, { 0xe000000c }
548 /* l.extbs $rD,$rA */
550 { 0, 0, 0, 0 },
551 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
552 & ifmt_l_exths, { 0xe000004c }
554 /* l.exthz $rD,$rA */
556 { 0, 0, 0, 0 },
557 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
558 & ifmt_l_exths, { 0xe000008c }
560 /* l.extbz $rD,$rA */
562 { 0, 0, 0, 0 },
563 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
564 & ifmt_l_exths, { 0xe00000cc }
566 /* l.extws $rD,$rA */
568 { 0, 0, 0, 0 },
569 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
570 & ifmt_l_exths, { 0xe000000d }
572 /* l.extwz $rD,$rA */
574 { 0, 0, 0, 0 },
575 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
576 & ifmt_l_exths, { 0xe000004d }
578 /* l.cmov $rD,$rA,$rB */
580 { 0, 0, 0, 0 },
581 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
582 & ifmt_l_cmov, { 0xe000000e }
584 /* l.sfgts $rA,$rB */
586 { 0, 0, 0, 0 },
587 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
588 & ifmt_l_sfgts, { 0xe5400000 }
590 /* l.sfgtsi $rA,$simm16 */
592 { 0, 0, 0, 0 },
593 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
594 & ifmt_l_sfgtsi, { 0xbd400000 }
596 /* l.sfgtu $rA,$rB */
598 { 0, 0, 0, 0 },
599 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
600 & ifmt_l_sfgts, { 0xe4400000 }
602 /* l.sfgtui $rA,$simm16 */
604 { 0, 0, 0, 0 },
605 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
606 & ifmt_l_sfgtsi, { 0xbc400000 }
608 /* l.sfges $rA,$rB */
610 { 0, 0, 0, 0 },
611 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
612 & ifmt_l_sfgts, { 0xe5600000 }
614 /* l.sfgesi $rA,$simm16 */
616 { 0, 0, 0, 0 },
617 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
618 & ifmt_l_sfgtsi, { 0xbd600000 }
620 /* l.sfgeu $rA,$rB */
622 { 0, 0, 0, 0 },
623 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
624 & ifmt_l_sfgts, { 0xe4600000 }
626 /* l.sfgeui $rA,$simm16 */
628 { 0, 0, 0, 0 },
629 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
630 & ifmt_l_sfgtsi, { 0xbc600000 }
632 /* l.sflts $rA,$rB */
634 { 0, 0, 0, 0 },
635 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
636 & ifmt_l_sfgts, { 0xe5800000 }
638 /* l.sfltsi $rA,$simm16 */
640 { 0, 0, 0, 0 },
641 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
642 & ifmt_l_sfgtsi, { 0xbd800000 }
644 /* l.sfltu $rA,$rB */
646 { 0, 0, 0, 0 },
647 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
648 & ifmt_l_sfgts, { 0xe4800000 }
650 /* l.sfltui $rA,$simm16 */
652 { 0, 0, 0, 0 },
653 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
654 & ifmt_l_sfgtsi, { 0xbc800000 }
656 /* l.sfles $rA,$rB */
658 { 0, 0, 0, 0 },
659 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
660 & ifmt_l_sfgts, { 0xe5a00000 }
662 /* l.sflesi $rA,$simm16 */
664 { 0, 0, 0, 0 },
665 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
666 & ifmt_l_sfgtsi, { 0xbda00000 }
668 /* l.sfleu $rA,$rB */
670 { 0, 0, 0, 0 },
671 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
672 & ifmt_l_sfgts, { 0xe4a00000 }
674 /* l.sfleui $rA,$simm16 */
676 { 0, 0, 0, 0 },
677 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
678 & ifmt_l_sfgtsi, { 0xbca00000 }
680 /* l.sfeq $rA,$rB */
682 { 0, 0, 0, 0 },
683 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
684 & ifmt_l_sfgts, { 0xe4000000 }
686 /* l.sfeqi $rA,$simm16 */
688 { 0, 0, 0, 0 },
689 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
690 & ifmt_l_sfgtsi, { 0xbc000000 }
692 /* l.sfne $rA,$rB */
694 { 0, 0, 0, 0 },
695 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
696 & ifmt_l_sfgts, { 0xe4200000 }
698 /* l.sfnei $rA,$simm16 */
700 { 0, 0, 0, 0 },
701 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
702 & ifmt_l_sfgtsi, { 0xbc200000 }
704 /* l.mac $rA,$rB */
706 { 0, 0, 0, 0 },
707 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
708 & ifmt_l_mac, { 0xc4000001 }
710 /* l.maci $rA,${simm16} */
712 { 0, 0, 0, 0 },
713 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
714 & ifmt_l_maci, { 0x4c000000 }
716 /* l.macu $rA,$rB */
718 { 0, 0, 0, 0 },
719 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
720 & ifmt_l_mac, { 0xc4000003 }
722 /* l.msb $rA,$rB */
724 { 0, 0, 0, 0 },
725 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
726 & ifmt_l_mac, { 0xc4000002 }
728 /* l.msbu $rA,$rB */
730 { 0, 0, 0, 0 },
731 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
732 & ifmt_l_mac, { 0xc4000004 }
734 /* l.cust1 */
736 { 0, 0, 0, 0 },
737 { { MNEM, 0 } },
738 & ifmt_l_rfe, { 0x70000000 }
740 /* l.cust2 */
742 { 0, 0, 0, 0 },
743 { { MNEM, 0 } },
744 & ifmt_l_rfe, { 0x74000000 }
746 /* l.cust3 */
748 { 0, 0, 0, 0 },
749 { { MNEM, 0 } },
750 & ifmt_l_rfe, { 0x78000000 }
752 /* l.cust4 */
754 { 0, 0, 0, 0 },
755 { { MNEM, 0 } },
756 & ifmt_l_rfe, { 0x7c000000 }
758 /* l.cust5 */
760 { 0, 0, 0, 0 },
761 { { MNEM, 0 } },
762 & ifmt_l_rfe, { 0xf0000000 }
764 /* l.cust6 */
766 { 0, 0, 0, 0 },
767 { { MNEM, 0 } },
768 & ifmt_l_rfe, { 0xf4000000 }
770 /* l.cust7 */
772 { 0, 0, 0, 0 },
773 { { MNEM, 0 } },
774 & ifmt_l_rfe, { 0xf8000000 }
776 /* l.cust8 */
778 { 0, 0, 0, 0 },
779 { { MNEM, 0 } },
780 & ifmt_l_rfe, { 0xfc000000 }
782 /* lf.add.s $rDSF,$rASF,$rBSF */
784 { 0, 0, 0, 0 },
785 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
786 & ifmt_lf_add_s, { 0xc8000000 }
788 /* lf.add.d $rDDF,$rADF,$rBDF */
790 { 0, 0, 0, 0 },
791 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
792 & ifmt_lf_add_d, { 0xc8000010 }
794 /* lf.sub.s $rDSF,$rASF,$rBSF */
796 { 0, 0, 0, 0 },
797 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
798 & ifmt_lf_add_s, { 0xc8000001 }
800 /* lf.sub.d $rDDF,$rADF,$rBDF */
802 { 0, 0, 0, 0 },
803 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
804 & ifmt_lf_add_d, { 0xc8000011 }
806 /* lf.mul.s $rDSF,$rASF,$rBSF */
808 { 0, 0, 0, 0 },
809 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
810 & ifmt_lf_add_s, { 0xc8000002 }
812 /* lf.mul.d $rDDF,$rADF,$rBDF */
814 { 0, 0, 0, 0 },
815 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
816 & ifmt_lf_add_d, { 0xc8000012 }
818 /* lf.div.s $rDSF,$rASF,$rBSF */
820 { 0, 0, 0, 0 },
821 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
822 & ifmt_lf_add_s, { 0xc8000003 }
824 /* lf.div.d $rDDF,$rADF,$rBDF */
826 { 0, 0, 0, 0 },
827 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
828 & ifmt_lf_add_d, { 0xc8000013 }
830 /* lf.rem.s $rDSF,$rASF,$rBSF */
832 { 0, 0, 0, 0 },
833 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
834 & ifmt_lf_add_s, { 0xc8000006 }
836 /* lf.rem.d $rDDF,$rADF,$rBDF */
838 { 0, 0, 0, 0 },
839 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
840 & ifmt_lf_add_d, { 0xc8000016 }
842 /* lf.itof.s $rDSF,$rA */
844 { 0, 0, 0, 0 },
845 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
846 & ifmt_lf_itof_s, { 0xc8000004 }
848 /* lf.itof.d $rDSF,$rA */
850 { 0, 0, 0, 0 },
851 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
852 & ifmt_lf_itof_s, { 0xc8000014 }
854 /* lf.ftoi.s $rD,$rASF */
856 { 0, 0, 0, 0 },
857 { { MNEM, ' ', OP (RD), ',', OP (RASF), 0 } },
858 & ifmt_lf_ftoi_s, { 0xc8000005 }
860 /* lf.ftoi.d $rD,$rADF */
862 { 0, 0, 0, 0 },
863 { { MNEM, ' ', OP (RD), ',', OP (RADF), 0 } },
864 & ifmt_lf_ftoi_d, { 0xc8000015 }
866 /* lf.sfeq.s $rASF,$rBSF */
868 { 0, 0, 0, 0 },
869 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
870 & ifmt_lf_eq_s, { 0xc8000008 }
872 /* lf.sfeq.d $rASF,$rBSF */
874 { 0, 0, 0, 0 },
875 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
876 & ifmt_lf_eq_s, { 0xc8000018 }
878 /* lf.sfne.s $rASF,$rBSF */
880 { 0, 0, 0, 0 },
881 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
882 & ifmt_lf_eq_s, { 0xc8000009 }
884 /* lf.sfne.d $rASF,$rBSF */
886 { 0, 0, 0, 0 },
887 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
888 & ifmt_lf_eq_s, { 0xc8000019 }
890 /* lf.sfge.s $rASF,$rBSF */
892 { 0, 0, 0, 0 },
893 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
894 & ifmt_lf_eq_s, { 0xc800000b }
896 /* lf.sfge.d $rASF,$rBSF */
898 { 0, 0, 0, 0 },
899 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
900 & ifmt_lf_eq_s, { 0xc800001b }
902 /* lf.sfgt.s $rASF,$rBSF */
904 { 0, 0, 0, 0 },
905 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
906 & ifmt_lf_eq_s, { 0xc800000a }
908 /* lf.sfgt.d $rASF,$rBSF */
910 { 0, 0, 0, 0 },
911 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
912 & ifmt_lf_eq_s, { 0xc800001a }
914 /* lf.sflt.s $rASF,$rBSF */
916 { 0, 0, 0, 0 },
917 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
918 & ifmt_lf_eq_s, { 0xc800000c }
920 /* lf.sflt.d $rASF,$rBSF */
922 { 0, 0, 0, 0 },
923 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
924 & ifmt_lf_eq_s, { 0xc800001c }
926 /* lf.sfle.s $rASF,$rBSF */
928 { 0, 0, 0, 0 },
929 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
930 & ifmt_lf_eq_s, { 0xc800000d }
932 /* lf.sfle.d $rASF,$rBSF */
934 { 0, 0, 0, 0 },
935 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
936 & ifmt_lf_eq_s, { 0xc800001d }
938 /* lf.madd.s $rDSF,$rASF,$rBSF */
940 { 0, 0, 0, 0 },
941 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
942 & ifmt_lf_add_s, { 0xc8000007 }
944 /* lf.madd.d $rDDF,$rADF,$rBDF */
946 { 0, 0, 0, 0 },
947 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
948 & ifmt_lf_add_d, { 0xc8000017 }
950 /* lf.cust1.s $rASF,$rBSF */
952 { 0, 0, 0, 0 },
953 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
954 & ifmt_lf_cust1_s, { 0xc80000d0 }
956 /* lf.cust1.d */
958 { 0, 0, 0, 0 },
959 { { MNEM, 0 } },
960 & ifmt_lf_cust1_d, { 0xc80000e0 }
964 #undef A
965 #undef OPERAND
966 #undef MNEM
967 #undef OP
969 /* Formats for ALIAS macro-insns. */
971 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
972 #undef 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[] =
993 #undef A
994 #undef OPERAND
995 #undef MNEM
996 #undef OP
998 #ifndef CGEN_ASM_HASH_P
999 #define CGEN_ASM_HASH_P(insn) 1
1000 #endif
1002 #ifndef CGEN_DIS_HASH_P
1003 #define CGEN_DIS_HASH_P(insn) 1
1004 #endif
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. */
1009 static int
1010 asm_hash_insn_p (const CGEN_INSN *insn ATTRIBUTE_UNUSED)
1012 return CGEN_ASM_HASH_P (insn);
1015 static int
1016 dis_hash_insn_p (const CGEN_INSN *insn)
1018 /* If building the hash table and the NO-DIS attribute is present,
1019 ignore. */
1020 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1021 return 0;
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)
1029 #else
1030 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1031 #endif
1032 #endif
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))
1042 #endif
1044 /* The result is the hash value of the insn.
1045 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1047 static unsigned int
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. */
1056 static unsigned int
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. */
1065 static void
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. */
1074 void
1075 or1k_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1077 int i;
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;