1 /* TILE-Gx opcode information.
3 * Copyright 2011 Tilera Corporation. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation, version 2.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for
24 #include <arch/opcode.h>
29 TILEGX_MAX_OPERANDS
= 4 /* bfexts */
41 TILEGX_OPC_PREFETCH_ADD_L1
,
42 TILEGX_OPC_PREFETCH_ADD_L1_FAULT
,
43 TILEGX_OPC_PREFETCH_ADD_L2
,
44 TILEGX_OPC_PREFETCH_ADD_L2_FAULT
,
45 TILEGX_OPC_PREFETCH_ADD_L3
,
46 TILEGX_OPC_PREFETCH_ADD_L3_FAULT
,
47 TILEGX_OPC_PREFETCH_L1
,
48 TILEGX_OPC_PREFETCH_L1_FAULT
,
49 TILEGX_OPC_PREFETCH_L2
,
50 TILEGX_OPC_PREFETCH_L2_FAULT
,
51 TILEGX_OPC_PREFETCH_L3
,
52 TILEGX_OPC_PREFETCH_L3_FAULT
,
107 TILEGX_OPC_DBLALIGN2
,
108 TILEGX_OPC_DBLALIGN4
,
109 TILEGX_OPC_DBLALIGN6
,
114 TILEGX_OPC_FDOUBLE_ADD_FLAGS
,
115 TILEGX_OPC_FDOUBLE_ADDSUB
,
116 TILEGX_OPC_FDOUBLE_MUL_FLAGS
,
117 TILEGX_OPC_FDOUBLE_PACK1
,
118 TILEGX_OPC_FDOUBLE_PACK2
,
119 TILEGX_OPC_FDOUBLE_SUB_FLAGS
,
120 TILEGX_OPC_FDOUBLE_UNPACK_MAX
,
121 TILEGX_OPC_FDOUBLE_UNPACK_MIN
,
123 TILEGX_OPC_FETCHADD4
,
124 TILEGX_OPC_FETCHADDGEZ
,
125 TILEGX_OPC_FETCHADDGEZ4
,
127 TILEGX_OPC_FETCHAND4
,
134 TILEGX_OPC_FSINGLE_ADD1
,
135 TILEGX_OPC_FSINGLE_ADDSUB2
,
136 TILEGX_OPC_FSINGLE_MUL1
,
137 TILEGX_OPC_FSINGLE_MUL2
,
138 TILEGX_OPC_FSINGLE_PACK1
,
139 TILEGX_OPC_FSINGLE_PACK2
,
140 TILEGX_OPC_FSINGLE_SUB1
,
169 TILEGX_OPC_LDNT1S_ADD
,
171 TILEGX_OPC_LDNT1U_ADD
,
173 TILEGX_OPC_LDNT2S_ADD
,
175 TILEGX_OPC_LDNT2U_ADD
,
177 TILEGX_OPC_LDNT4S_ADD
,
179 TILEGX_OPC_LDNT4U_ADD
,
187 TILEGX_OPC_MUL_HS_HS
,
188 TILEGX_OPC_MUL_HS_HU
,
189 TILEGX_OPC_MUL_HS_LS
,
190 TILEGX_OPC_MUL_HS_LU
,
191 TILEGX_OPC_MUL_HU_HU
,
192 TILEGX_OPC_MUL_HU_LS
,
193 TILEGX_OPC_MUL_HU_LU
,
194 TILEGX_OPC_MUL_LS_LS
,
195 TILEGX_OPC_MUL_LS_LU
,
196 TILEGX_OPC_MUL_LU_LU
,
197 TILEGX_OPC_MULA_HS_HS
,
198 TILEGX_OPC_MULA_HS_HU
,
199 TILEGX_OPC_MULA_HS_LS
,
200 TILEGX_OPC_MULA_HS_LU
,
201 TILEGX_OPC_MULA_HU_HU
,
202 TILEGX_OPC_MULA_HU_LS
,
203 TILEGX_OPC_MULA_HU_LU
,
204 TILEGX_OPC_MULA_LS_LS
,
205 TILEGX_OPC_MULA_LS_LU
,
206 TILEGX_OPC_MULA_LU_LU
,
221 TILEGX_OPC_SHL16INSLI
,
237 TILEGX_OPC_SHUFFLEBYTES
,
248 TILEGX_OPC_STNT1_ADD
,
250 TILEGX_OPC_STNT2_ADD
,
252 TILEGX_OPC_STNT4_ADD
,
275 TILEGX_OPC_V1CMPLTSI
,
277 TILEGX_OPC_V1CMPLTUI
,
280 TILEGX_OPC_V1DDOTPUA
,
281 TILEGX_OPC_V1DDOTPUS
,
282 TILEGX_OPC_V1DDOTPUSA
,
288 TILEGX_OPC_V1DOTPUSA
,
320 TILEGX_OPC_V2CMPLTSI
,
322 TILEGX_OPC_V2CMPLTUI
,
381 #define tilegx_is_x_pipeline(p) ((int)(p) <= (int)TILEGX_PIPELINE_X1)
385 TILEGX_OP_TYPE_REGISTER
,
386 TILEGX_OP_TYPE_IMMEDIATE
,
387 TILEGX_OP_TYPE_ADDRESS
,
389 } tilegx_operand_type
;
391 struct tilegx_operand
393 /* Is this operand a register, immediate or address? */
394 tilegx_operand_type type
;
396 /* The default relocation type for this operand. */
397 signed int default_reloc
: 16;
399 /* How many bits is this value? (used for range checking) */
400 unsigned int num_bits
: 5;
402 /* Is the value signed? (used for range checking) */
403 unsigned int is_signed
: 1;
405 /* Is this operand a source register? */
406 unsigned int is_src_reg
: 1;
408 /* Is this operand written? (i.e. is it a destination register) */
409 unsigned int is_dest_reg
: 1;
411 /* Is this operand PC-relative? */
412 unsigned int is_pc_relative
: 1;
414 /* By how many bits do we right shift the value before inserting? */
415 unsigned int rightshift
: 2;
417 /* Return the bits for this operand to be ORed into an existing bundle. */
418 tilegx_bundle_bits (*insert
) (int op
);
420 /* Extract this operand and return it. */
421 unsigned int (*extract
) (tilegx_bundle_bits bundle
);
425 extern const struct tilegx_operand tilegx_operands
[];
427 /* One finite-state machine per pipe for rapid instruction decoding. */
428 extern const unsigned short * const
429 tilegx_bundle_decoder_fsms
[TILEGX_NUM_PIPELINE_ENCODINGS
];
434 /* The opcode mnemonic, e.g. "add" */
437 /* The enum value for this mnemonic. */
438 tilegx_mnemonic mnemonic
;
440 /* A bit mask of which of the five pipes this instruction
449 /* How many operands are there? */
450 unsigned char num_operands
;
452 /* Which register does this write implicitly, or TREG_ZERO if none? */
453 unsigned char implicitly_written_register
;
455 /* Can this be bundled with other instructions (almost always true). */
456 unsigned char can_bundle
;
458 /* The description of the operands. Each of these is an
459 * index into the tilegx_operands[] table. */
460 unsigned char operands
[TILEGX_NUM_PIPELINE_ENCODINGS
][TILEGX_MAX_OPERANDS
];
464 extern const struct tilegx_opcode tilegx_opcodes
[];
466 /* Used for non-textual disassembly into structs. */
467 struct tilegx_decoded_instruction
469 const struct tilegx_opcode
*opcode
;
470 const struct tilegx_operand
*operands
[TILEGX_MAX_OPERANDS
];
471 long long operand_values
[TILEGX_MAX_OPERANDS
];
475 /* Disassemble a bundle into a struct for machine processing. */
476 extern int parse_insn_tilegx(tilegx_bundle_bits bits
,
477 unsigned long long pc
,
478 struct tilegx_decoded_instruction
479 decoded
[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE
]);
483 #endif /* opcode_tilegx_h */