1
/* TILEPro 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
21
#ifndef opcode_tilepro_h
22
#define opcode_tilepro_h
24
#include <arch/opcode.h>
29
TILEPRO_MAX_OPERANDS = 5 /* mm */
44
TILEPRO_OPC_MOVELI_SN,
53
TILEPRO_OPC_ADDBS_U_SN,
70
TILEPRO_OPC_ADIFFB_U_SN,
72
TILEPRO_OPC_ADIFFH_SN,
79
TILEPRO_OPC_AVGB_U_SN,
103
TILEPRO_OPC_BLEZT_SN,
113
TILEPRO_OPC_BYTEX_SN,
120
TILEPRO_OPC_CRC32_32,
121
TILEPRO_OPC_CRC32_32_SN,
123
TILEPRO_OPC_CRC32_8_SN,
128
TILEPRO_OPC_DWORD_ALIGN,
129
TILEPRO_OPC_DWORD_ALIGN_SN,
136
TILEPRO_OPC_INTHB_SN,
138
TILEPRO_OPC_INTHH_SN,
140
TILEPRO_OPC_INTLB_SN,
142
TILEPRO_OPC_INTLH_SN,
158
TILEPRO_OPC_LBADD_SN,
160
TILEPRO_OPC_LBADD_U_SN,
166
TILEPRO_OPC_LHADD_SN,
168
TILEPRO_OPC_LHADD_U_SN,
174
TILEPRO_OPC_LW_NA_SN,
176
TILEPRO_OPC_LWADD_SN,
177
TILEPRO_OPC_LWADD_NA,
178
TILEPRO_OPC_LWADD_NA_SN,
180
TILEPRO_OPC_MAXB_U_SN,
184
TILEPRO_OPC_MAXIB_U_SN,
186
TILEPRO_OPC_MAXIH_SN,
190
TILEPRO_OPC_MINB_U_SN,
194
TILEPRO_OPC_MINIB_U_SN,
196
TILEPRO_OPC_MINIH_SN,
205
TILEPRO_OPC_MULHH_SS,
206
TILEPRO_OPC_MULHH_SS_SN,
207
TILEPRO_OPC_MULHH_SU,
208
TILEPRO_OPC_MULHH_SU_SN,
209
TILEPRO_OPC_MULHH_UU,
210
TILEPRO_OPC_MULHH_UU_SN,
211
TILEPRO_OPC_MULHHA_SS,
212
TILEPRO_OPC_MULHHA_SS_SN,
213
TILEPRO_OPC_MULHHA_SU,
214
TILEPRO_OPC_MULHHA_SU_SN,
215
TILEPRO_OPC_MULHHA_UU,
216
TILEPRO_OPC_MULHHA_UU_SN,
217
TILEPRO_OPC_MULHHSA_UU,
218
TILEPRO_OPC_MULHHSA_UU_SN,
219
TILEPRO_OPC_MULHL_SS,
220
TILEPRO_OPC_MULHL_SS_SN,
221
TILEPRO_OPC_MULHL_SU,
222
TILEPRO_OPC_MULHL_SU_SN,
223
TILEPRO_OPC_MULHL_US,
224
TILEPRO_OPC_MULHL_US_SN,
225
TILEPRO_OPC_MULHL_UU,
226
TILEPRO_OPC_MULHL_UU_SN,
227
TILEPRO_OPC_MULHLA_SS,
228
TILEPRO_OPC_MULHLA_SS_SN,
229
TILEPRO_OPC_MULHLA_SU,
230
TILEPRO_OPC_MULHLA_SU_SN,
231
TILEPRO_OPC_MULHLA_US,
232
TILEPRO_OPC_MULHLA_US_SN,
233
TILEPRO_OPC_MULHLA_UU,
234
TILEPRO_OPC_MULHLA_UU_SN,
235
TILEPRO_OPC_MULHLSA_UU,
236
TILEPRO_OPC_MULHLSA_UU_SN,
237
TILEPRO_OPC_MULLL_SS,
238
TILEPRO_OPC_MULLL_SS_SN,
239
TILEPRO_OPC_MULLL_SU,
240
TILEPRO_OPC_MULLL_SU_SN,
241
TILEPRO_OPC_MULLL_UU,
242
TILEPRO_OPC_MULLL_UU_SN,
243
TILEPRO_OPC_MULLLA_SS,
244
TILEPRO_OPC_MULLLA_SS_SN,
245
TILEPRO_OPC_MULLLA_SU,
246
TILEPRO_OPC_MULLLA_SU_SN,
247
TILEPRO_OPC_MULLLA_UU,
248
TILEPRO_OPC_MULLLA_UU_SN,
249
TILEPRO_OPC_MULLLSA_UU,
250
TILEPRO_OPC_MULLLSA_UU_SN,
269
TILEPRO_OPC_PACKBS_U,
270
TILEPRO_OPC_PACKBS_U_SN,
272
TILEPRO_OPC_PACKHB_SN,
274
TILEPRO_OPC_PACKHS_SN,
276
TILEPRO_OPC_PACKLB_SN,
290
TILEPRO_OPC_SADAB_U_SN,
292
TILEPRO_OPC_SADAH_SN,
294
TILEPRO_OPC_SADAH_U_SN,
296
TILEPRO_OPC_SADB_U_SN,
300
TILEPRO_OPC_SADH_U_SN,
312
TILEPRO_OPC_SEQIB_SN,
314
TILEPRO_OPC_SEQIH_SN,
326
TILEPRO_OPC_SHLIB_SN,
328
TILEPRO_OPC_SHLIH_SN,
338
TILEPRO_OPC_SHRIB_SN,
340
TILEPRO_OPC_SHRIH_SN,
344
TILEPRO_OPC_SLT_U_SN,
348
TILEPRO_OPC_SLTB_U_SN,
352
TILEPRO_OPC_SLTE_U_SN,
354
TILEPRO_OPC_SLTEB_SN,
356
TILEPRO_OPC_SLTEB_U_SN,
358
TILEPRO_OPC_SLTEH_SN,
360
TILEPRO_OPC_SLTEH_U_SN,
364
TILEPRO_OPC_SLTH_U_SN,
368
TILEPRO_OPC_SLTI_U_SN,
370
TILEPRO_OPC_SLTIB_SN,
372
TILEPRO_OPC_SLTIB_U_SN,
374
TILEPRO_OPC_SLTIH_SN,
376
TILEPRO_OPC_SLTIH_U_SN,
392
TILEPRO_OPC_SRAIB_SN,
394
TILEPRO_OPC_SRAIH_SN,
400
TILEPRO_OPC_SUBBS_U_SN,
404
TILEPRO_OPC_SUBHS_SN,
413
TILEPRO_OPC_TBLIDXB0,
414
TILEPRO_OPC_TBLIDXB0_SN,
415
TILEPRO_OPC_TBLIDXB1,
416
TILEPRO_OPC_TBLIDXB1_SN,
417
TILEPRO_OPC_TBLIDXB2,
418
TILEPRO_OPC_TBLIDXB2_SN,
419
TILEPRO_OPC_TBLIDXB3,
420
TILEPRO_OPC_TBLIDXB3_SN,
443
#define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
447
TILEPRO_OP_TYPE_REGISTER,
448
TILEPRO_OP_TYPE_IMMEDIATE,
449
TILEPRO_OP_TYPE_ADDRESS,
451
} tilepro_operand_type;
453
struct tilepro_operand
455
/* Is this operand a register, immediate or address? */
456
tilepro_operand_type type;
458
/* The default relocation type for this operand. */
459
signed int default_reloc : 16;
461
/* How many bits is this value? (used for range checking) */
462
unsigned int num_bits : 5;
464
/* Is the value signed? (used for range checking) */
465
unsigned int is_signed : 1;
467
/* Is this operand a source register? */
468
unsigned int is_src_reg : 1;
470
/* Is this operand written? (i.e. is it a destination register) */
471
unsigned int is_dest_reg : 1;
473
/* Is this operand PC-relative? */
474
unsigned int is_pc_relative : 1;
476
/* By how many bits do we right shift the value before inserting? */
477
unsigned int rightshift : 2;
479
/* Return the bits for this operand to be ORed into an existing bundle. */
480
tilepro_bundle_bits (*insert) (int op);
482
/* Extract this operand and return it. */
483
unsigned int (*extract) (tilepro_bundle_bits bundle);
487
extern const struct tilepro_operand tilepro_operands[];
489
/* One finite-state machine per pipe for rapid instruction decoding. */
490
extern const unsigned short * const
491
tilepro_bundle_decoder_fsms[TILEPRO_NUM_PIPELINE_ENCODINGS];
494
struct tilepro_opcode
496
/* The opcode mnemonic, e.g. "add" */
499
/* The enum value for this mnemonic. */
500
tilepro_mnemonic mnemonic;
502
/* A bit mask of which of the five pipes this instruction
511
/* How many operands are there? */
512
unsigned char num_operands;
514
/* Which register does this write implicitly, or TREG_ZERO if none? */
515
unsigned char implicitly_written_register;
517
/* Can this be bundled with other instructions (almost always true). */
518
unsigned char can_bundle;
520
/* The description of the operands. Each of these is an
521
* index into the tilepro_operands[] table. */
522
unsigned char operands[TILEPRO_NUM_PIPELINE_ENCODINGS][TILEPRO_MAX_OPERANDS];
526
extern const struct tilepro_opcode tilepro_opcodes[];
529
/* Used for non-textual disassembly into structs. */
530
struct tilepro_decoded_instruction
532
const struct tilepro_opcode *opcode;
533
const struct tilepro_operand *operands[TILEPRO_MAX_OPERANDS];
534
int operand_values[TILEPRO_MAX_OPERANDS];
538
/* Disassemble a bundle into a struct for machine processing. */
539
extern int parse_insn_tilepro(tilepro_bundle_bits bits,
541
struct tilepro_decoded_instruction
542
decoded[TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE]);
545
/* Given a set of bundle bits and a specific pipe, returns which
546
* instruction the bundle contains in that pipe.
548
extern const struct tilepro_opcode *
549
find_opcode(tilepro_bundle_bits bits, tilepro_pipeline pipe);
553
#endif /* opcode_tilepro_h */