1a5a4af3bSchristos /* Table of opcodes for the Texas Instruments TMS320C[34]X family. 2a5a4af3bSchristos 3*8b657b07Schristos Copyright (C) 2002-2022 Free Software Foundation, Inc. 4a5a4af3bSchristos 5a5a4af3bSchristos Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) 6a5a4af3bSchristos 7a5a4af3bSchristos This program is free software; you can redistribute it and/or modify 8a5a4af3bSchristos it under the terms of the GNU General Public License as published by 9a5a4af3bSchristos the Free Software Foundation; either version 3 of the License, or 10a5a4af3bSchristos (at your option) any later version. 11a5a4af3bSchristos 12a5a4af3bSchristos This program is distributed in the hope that it will be useful, 13a5a4af3bSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 14a5a4af3bSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15a5a4af3bSchristos GNU General Public License for more details. 16a5a4af3bSchristos 17a5a4af3bSchristos You should have received a copy of the GNU General Public License 18a5a4af3bSchristos along with this program; if not, write to the Free Software 19a5a4af3bSchristos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 20a5a4af3bSchristos MA 02110-1301, USA. */ 21a5a4af3bSchristos 22a5a4af3bSchristos #define IS_CPU_TIC3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33) 23a5a4af3bSchristos #define IS_CPU_TIC4X(v) ((v) == 0 || (v) == 40 || (v) == 44) 24a5a4af3bSchristos 25a5a4af3bSchristos /* Define some bitfield extraction/insertion macros. */ 2682650ea5Schristos #define EXTRU(inst, m, l) \ 2782650ea5Schristos (((inst) >> (l)) & ((2u << ((m) - (l))) - 1)) 2882650ea5Schristos #define EXTRS(inst, m, l) \ 2982650ea5Schristos ((int) ((EXTRU (inst, m, l) ^ (1u << ((m) - (l)))) - (1u << ((m) - (l))))) 3082650ea5Schristos #define INSERTU(inst, val, m, l) \ 3182650ea5Schristos ((inst) |= ((val) & ((2u << ((m) - (l))) - 1)) << (l)) 3282650ea5Schristos #define INSERTS INSERTU 33a5a4af3bSchristos 34a5a4af3bSchristos /* Define register numbers. */ 35a5a4af3bSchristos typedef enum 36a5a4af3bSchristos { 37a5a4af3bSchristos REG_R0, REG_R1, REG_R2, REG_R3, 38a5a4af3bSchristos REG_R4, REG_R5, REG_R6, REG_R7, 39a5a4af3bSchristos REG_AR0, REG_AR1, REG_AR2, REG_AR3, 40a5a4af3bSchristos REG_AR4, REG_AR5, REG_AR6, REG_AR7, 41a5a4af3bSchristos REG_DP, REG_IR0, REG_IR1, REG_BK, 42a5a4af3bSchristos REG_SP, REG_ST, REG_DIE, REG_IIE, 43a5a4af3bSchristos REG_IIF, REG_RS, REG_RE, REG_RC, 44a5a4af3bSchristos REG_R8, REG_R9, REG_R10, REG_R11, 45a5a4af3bSchristos REG_IVTP, REG_TVTP 46a5a4af3bSchristos } 47a5a4af3bSchristos c4x_reg_t; 48a5a4af3bSchristos 49a5a4af3bSchristos /* Note that the actual register numbers for IVTP is 0 and TVTP is 1. */ 50a5a4af3bSchristos 51a5a4af3bSchristos #define REG_IE REG_DIE /* C3x only */ 52a5a4af3bSchristos #define REG_IF REG_IIE /* C3x only */ 53a5a4af3bSchristos #define REG_IOF REG_IIF /* C3x only */ 54a5a4af3bSchristos 55a5a4af3bSchristos #define TIC3X_REG_MAX REG_RC 56a5a4af3bSchristos #define TIC4X_REG_MAX REG_TVTP 57a5a4af3bSchristos 58a5a4af3bSchristos /* Register table size including C4x expansion regs. */ 59a5a4af3bSchristos #define REG_TABLE_SIZE (TIC4X_REG_MAX + 1) 60a5a4af3bSchristos 61a5a4af3bSchristos struct tic4x_register 62a5a4af3bSchristos { 63e5cb852cSchristos const char * name; 64a5a4af3bSchristos unsigned long regno; 65a5a4af3bSchristos }; 66a5a4af3bSchristos 67a5a4af3bSchristos typedef struct tic4x_register tic4x_register_t; 68a5a4af3bSchristos 69a5a4af3bSchristos /* We could store register synonyms here. */ 70a5a4af3bSchristos static const tic4x_register_t tic3x_registers[] = 71a5a4af3bSchristos { 72a5a4af3bSchristos {"f0", REG_R0}, 73a5a4af3bSchristos {"r0", REG_R0}, 74a5a4af3bSchristos {"f1", REG_R1}, 75a5a4af3bSchristos {"r1", REG_R1}, 76a5a4af3bSchristos {"f2", REG_R2}, 77a5a4af3bSchristos {"r2", REG_R2}, 78a5a4af3bSchristos {"f3", REG_R3}, 79a5a4af3bSchristos {"r3", REG_R3}, 80a5a4af3bSchristos {"f4", REG_R4}, 81a5a4af3bSchristos {"r4", REG_R4}, 82a5a4af3bSchristos {"f5", REG_R5}, 83a5a4af3bSchristos {"r5", REG_R5}, 84a5a4af3bSchristos {"f6", REG_R6}, 85a5a4af3bSchristos {"r6", REG_R6}, 86a5a4af3bSchristos {"f7", REG_R7}, 87a5a4af3bSchristos {"r7", REG_R7}, 88a5a4af3bSchristos {"ar0", REG_AR0}, 89a5a4af3bSchristos {"ar1", REG_AR1}, 90a5a4af3bSchristos {"ar2", REG_AR2}, 91a5a4af3bSchristos {"ar3", REG_AR3}, 92a5a4af3bSchristos {"ar4", REG_AR4}, 93a5a4af3bSchristos {"ar5", REG_AR5}, 94a5a4af3bSchristos {"ar6", REG_AR6}, 95a5a4af3bSchristos {"ar7", REG_AR7}, 96a5a4af3bSchristos {"dp", REG_DP}, 97a5a4af3bSchristos {"ir0", REG_IR0}, 98a5a4af3bSchristos {"ir1", REG_IR1}, 99a5a4af3bSchristos {"bk", REG_BK}, 100a5a4af3bSchristos {"sp", REG_SP}, 101a5a4af3bSchristos {"st", REG_ST}, 102a5a4af3bSchristos {"ie", REG_IE}, 103a5a4af3bSchristos {"if", REG_IF}, 104a5a4af3bSchristos {"iof", REG_IOF}, 105a5a4af3bSchristos {"rs", REG_RS}, 106a5a4af3bSchristos {"re", REG_RE}, 107a5a4af3bSchristos {"rc", REG_RC}, 108a5a4af3bSchristos {"", 0} 109a5a4af3bSchristos }; 110a5a4af3bSchristos 111a5a4af3bSchristos const unsigned int tic3x_num_registers = (((sizeof tic3x_registers) / (sizeof tic3x_registers[0])) - 1); 112a5a4af3bSchristos 113a5a4af3bSchristos /* Define C4x registers in addition to C3x registers. */ 114a5a4af3bSchristos static const tic4x_register_t tic4x_registers[] = 115a5a4af3bSchristos { 116a5a4af3bSchristos {"die", REG_DIE}, /* Clobbers C3x REG_IE */ 117a5a4af3bSchristos {"iie", REG_IIE}, /* Clobbers C3x REG_IF */ 118a5a4af3bSchristos {"iif", REG_IIF}, /* Clobbers C3x REG_IOF */ 119a5a4af3bSchristos {"f8", REG_R8}, 120a5a4af3bSchristos {"r8", REG_R8}, 121a5a4af3bSchristos {"f9", REG_R9}, 122a5a4af3bSchristos {"r9", REG_R9}, 123a5a4af3bSchristos {"f10", REG_R10}, 124a5a4af3bSchristos {"r10", REG_R10}, 125a5a4af3bSchristos {"f11", REG_R11}, 126a5a4af3bSchristos {"r11", REG_R11}, 127a5a4af3bSchristos {"ivtp", REG_IVTP}, 128a5a4af3bSchristos {"tvtp", REG_TVTP}, 129a5a4af3bSchristos {"", 0} 130a5a4af3bSchristos }; 131a5a4af3bSchristos 132a5a4af3bSchristos const unsigned int tic4x_num_registers = (((sizeof tic4x_registers) / (sizeof tic4x_registers[0])) - 1); 133a5a4af3bSchristos 134a5a4af3bSchristos struct tic4x_cond 135a5a4af3bSchristos { 136e5cb852cSchristos const char * name; 137a5a4af3bSchristos unsigned long cond; 138a5a4af3bSchristos }; 139a5a4af3bSchristos 140a5a4af3bSchristos typedef struct tic4x_cond tic4x_cond_t; 141a5a4af3bSchristos 142a5a4af3bSchristos /* Define conditional branch/load suffixes. Put desired form for 143a5a4af3bSchristos disassembler last. */ 144a5a4af3bSchristos static const tic4x_cond_t tic4x_conds[] = 145a5a4af3bSchristos { 146a5a4af3bSchristos { "u", 0x00 }, 147a5a4af3bSchristos { "c", 0x01 }, { "lo", 0x01 }, 148a5a4af3bSchristos { "ls", 0x02 }, 149a5a4af3bSchristos { "hi", 0x03 }, 150a5a4af3bSchristos { "nc", 0x04 }, { "hs", 0x04 }, 151a5a4af3bSchristos { "z", 0x05 }, { "eq", 0x05 }, 152a5a4af3bSchristos { "nz", 0x06 }, { "ne", 0x06 }, 153a5a4af3bSchristos { "n", 0x07 }, { "l", 0x07 }, { "lt", 0x07 }, 154a5a4af3bSchristos { "le", 0x08 }, 155a5a4af3bSchristos { "p", 0x09 }, { "gt", 0x09 }, 156a5a4af3bSchristos { "nn", 0x0a }, { "ge", 0x0a }, 157a5a4af3bSchristos { "nv", 0x0c }, 158a5a4af3bSchristos { "v", 0x0d }, 159a5a4af3bSchristos { "nuf", 0x0e }, 160a5a4af3bSchristos { "uf", 0x0f }, 161a5a4af3bSchristos { "nlv", 0x10 }, 162a5a4af3bSchristos { "lv", 0x11 }, 163a5a4af3bSchristos { "nluf", 0x12 }, 164a5a4af3bSchristos { "luf", 0x13 }, 165a5a4af3bSchristos { "zuf", 0x14 }, 166a5a4af3bSchristos /* Dummy entry, not included in num_conds. This 167a5a4af3bSchristos lets code examine entry i+1 without checking 168a5a4af3bSchristos if we've run off the end of the table. */ 169a5a4af3bSchristos { "", 0x0} 170a5a4af3bSchristos }; 171a5a4af3bSchristos 172a5a4af3bSchristos const unsigned int tic4x_num_conds = (((sizeof tic4x_conds) / (sizeof tic4x_conds[0])) - 1); 173a5a4af3bSchristos 174a5a4af3bSchristos struct tic4x_indirect 175a5a4af3bSchristos { 176e5cb852cSchristos const char * name; 177a5a4af3bSchristos unsigned long modn; 178a5a4af3bSchristos }; 179a5a4af3bSchristos 180a5a4af3bSchristos typedef struct tic4x_indirect tic4x_indirect_t; 181a5a4af3bSchristos 182a5a4af3bSchristos /* Define indirect addressing modes where: 183a5a4af3bSchristos d displacement (signed) 184a5a4af3bSchristos y ir0 185a5a4af3bSchristos z ir1 */ 186a5a4af3bSchristos 187a5a4af3bSchristos static const tic4x_indirect_t tic4x_indirects[] = 188a5a4af3bSchristos { 189a5a4af3bSchristos { "*+a(d)", 0x00 }, 190a5a4af3bSchristos { "*-a(d)", 0x01 }, 191a5a4af3bSchristos { "*++a(d)", 0x02 }, 192a5a4af3bSchristos { "*--a(d)", 0x03 }, 193a5a4af3bSchristos { "*a++(d)", 0x04 }, 194a5a4af3bSchristos { "*a--(d)", 0x05 }, 195a5a4af3bSchristos { "*a++(d)%", 0x06 }, 196a5a4af3bSchristos { "*a--(d)%", 0x07 }, 197a5a4af3bSchristos { "*+a(y)", 0x08 }, 198a5a4af3bSchristos { "*-a(y)", 0x09 }, 199a5a4af3bSchristos { "*++a(y)", 0x0a }, 200a5a4af3bSchristos { "*--a(y)", 0x0b }, 201a5a4af3bSchristos { "*a++(y)", 0x0c }, 202a5a4af3bSchristos { "*a--(y)", 0x0d }, 203a5a4af3bSchristos { "*a++(y)%", 0x0e }, 204a5a4af3bSchristos { "*a--(y)%", 0x0f }, 205a5a4af3bSchristos { "*+a(z)", 0x10 }, 206a5a4af3bSchristos { "*-a(z)", 0x11 }, 207a5a4af3bSchristos { "*++a(z)", 0x12 }, 208a5a4af3bSchristos { "*--a(z)", 0x13 }, 209a5a4af3bSchristos { "*a++(z)", 0x14 }, 210a5a4af3bSchristos { "*a--(z)", 0x15 }, 211a5a4af3bSchristos { "*a++(z)%", 0x16 }, 212a5a4af3bSchristos { "*a--(z)%", 0x17 }, 213a5a4af3bSchristos { "*a", 0x18 }, 214a5a4af3bSchristos { "*a++(y)b", 0x19 }, 215a5a4af3bSchristos /* Dummy entry, not included in num_indirects. This 216a5a4af3bSchristos lets code examine entry i+1 without checking 217a5a4af3bSchristos if we've run off the end of the table. */ 218a5a4af3bSchristos { "", 0x0} 219a5a4af3bSchristos }; 220a5a4af3bSchristos 221a5a4af3bSchristos #define TIC3X_MODN_MAX 0x19 222a5a4af3bSchristos 223a5a4af3bSchristos const unsigned int tic4x_num_indirects = (((sizeof tic4x_indirects) / (sizeof tic4x_indirects[0])) - 1); 224a5a4af3bSchristos 225a5a4af3bSchristos /* Instruction template. */ 226a5a4af3bSchristos struct tic4x_inst 227a5a4af3bSchristos { 228e5cb852cSchristos const char * name; 229a5a4af3bSchristos unsigned long opcode; 230a5a4af3bSchristos unsigned long opmask; 231e5cb852cSchristos const char * args; 232a5a4af3bSchristos unsigned long oplevel; 233a5a4af3bSchristos }; 234a5a4af3bSchristos 235a5a4af3bSchristos typedef struct tic4x_inst tic4x_inst_t; 236a5a4af3bSchristos 237a5a4af3bSchristos /* Opcode infix 238a5a4af3bSchristos B condition 16--20 U,C,Z,LO,HI, etc. 239a5a4af3bSchristos C condition 23--27 U,C,Z,LO,HI, etc. 240a5a4af3bSchristos 241a5a4af3bSchristos Arguments 242a5a4af3bSchristos , required arg follows 243a5a4af3bSchristos ; optional arg follows 244a5a4af3bSchristos 245a5a4af3bSchristos Argument types bits [classes] - example 246a5a4af3bSchristos ----------------------------------------------------------- 247a5a4af3bSchristos * indirect (all) 0--15 [A,AB,AU,AF,A2,A3,A6,A7,AY,B,BA,BB,BI,B6,B7] - *+AR0(5), *++AR0(IR0) 248a5a4af3bSchristos # direct (for LDP) 0--15 [Z] - @start, start 249a5a4af3bSchristos @ direct 0--15 [A,AB,AU,AF,A3,A6,A7,AY,B,BA,BB,BI,B6,B7] - @start, start 250a5a4af3bSchristos A address register 22--24 [D] - AR0, AR7 251a5a4af3bSchristos B unsigned integer 0--23 [I,I2] - @start, start (absolute on C3x, relative on C4x) 252a5a4af3bSchristos C indirect (disp - C4x) 0--7 [S,SC,S2,T,TC,T2,T2C] - *+AR0(5) 253a5a4af3bSchristos E register (all) 0--7 [T,TC,T2,T2C] - R0, R7, R11, AR0, DP 254a5a4af3bSchristos e register (0-11) 0--7 [S,SC,S2] - R0, R7, R11 255a5a4af3bSchristos F short float immediate 0--15 [AF,B,BA,BB] - 3.5, 0e-3.5e-1 256a5a4af3bSchristos G register (all) 8--15 [T,TC,T2,T2C] - R0, R7, R11, AR0, DP 257a5a4af3bSchristos g register (0-11) 0--7 [S,SC,S2] - R0, R7, R11 258a5a4af3bSchristos H register (0-7) 18--16 [LS,M,P,Q] - R0, R7 259a5a4af3bSchristos I indirect (no disp) 0--7 [S,SC,S2,T,TC,T2,T2C] - *+AR0(1), *+AR0(IR0) 260a5a4af3bSchristos i indirect (enhanced) 0--7 [LL,LS,M,P,Q,QC] - *+AR0(1), R5 261a5a4af3bSchristos J indirect (no disp) 8--15 [LL,LS,P,Q,QC,S,SC,S2,T,TC,T2,T2C] - *+AR0(1), *+AR0(IR0) 262a5a4af3bSchristos j indirect (enhanced) 8--15 [M] - *+AR0(1), R5 263a5a4af3bSchristos K register 19--21 [LL,M,Q,QC] - R0, R7 264a5a4af3bSchristos L register 22--24 [LL,LS,P,Q,QC] - R0, R7 265a5a4af3bSchristos M register (R2,R3) 22--22 [M] R2, R3 266a5a4af3bSchristos N register (R0,R1) 23--23 [M] R0, R1 267a5a4af3bSchristos O indirect(disp - C4x) 8--15 [S,SC,S2,T,TC,T2] - *+AR0(5) 268a5a4af3bSchristos P displacement (PC Rel) 0--15 [D,J,JS] - @start, start 269a5a4af3bSchristos Q register (all) 0--15 [A,AB,AU,A2,A3,AY,BA,BI,D,I2,J,JS] - R0, AR0, DP, SP 270a5a4af3bSchristos q register (0-11) 0--15 [AF,B,BB] - R0, R7, R11 271a5a4af3bSchristos R register (all) 16--20 [A,AB,AU,AF,A6,A7,R,T,TC] - R0, AR0, DP, SP 272a5a4af3bSchristos r register (0-11) 16--20 [B,BA,BB,BI,B6,B7,RF,S,SC] - R0, R1, R11 273a5a4af3bSchristos S short int immediate 0--15 [A,AB,AY,BI] - -5, 5 274a5a4af3bSchristos T integer (C4x) 16--20 [Z] - -5, 12 275a5a4af3bSchristos U unsigned integer 0--15 [AU,A3] - 0, 65535 276a5a4af3bSchristos V vector (C4x: 0--8) 0--4 [Z] - 25, 7 277a5a4af3bSchristos W short int (C4x) 0--7 [T,TC,T2,T2C] - -3, 5 278a5a4af3bSchristos X expansion reg (C4x) 0--4 [Z] - IVTP, TVTP 279a5a4af3bSchristos Y address reg (C4x) 16--20 [Z] - AR0, DP, SP, IR0 280a5a4af3bSchristos Z expansion reg (C4x) 16--20 [Z] - IVTP, TVTP 281a5a4af3bSchristos */ 282a5a4af3bSchristos 283a5a4af3bSchristos #define TIC4X_OPERANDS_MAX 7 /* Max number of operands for an inst. */ 284a5a4af3bSchristos #define TIC4X_NAME_MAX 16 /* Max number of chars in parallel name. */ 285a5a4af3bSchristos 286a5a4af3bSchristos /* Define the instruction level */ 287a5a4af3bSchristos #define OP_C3X 0x1 /* C30 support - supported by all */ 288a5a4af3bSchristos #define OP_C4X 0x2 /* C40 support - C40, C44 */ 289a5a4af3bSchristos #define OP_ENH 0x4 /* Class LL,LS,M,P,Q,QC enhancements. Argument type 290a5a4af3bSchristos I and J is enhanced in these classes - C31>=6.0, 291a5a4af3bSchristos C32>=2.0, C33 */ 292a5a4af3bSchristos #define OP_LPWR 0x8 /* Low power support (LOPOWER, MAXSPEED) - C30>=7.0, 293a5a4af3bSchristos LC31, C31>=5.0, C32 */ 294a5a4af3bSchristos #define OP_IDLE2 0x10 /* Idle2 support (IDLE2) - C30>=7.0, LC31, C31>=5.0, 295a5a4af3bSchristos C32, C33, C40>=5.0, C44 */ 296a5a4af3bSchristos 297a5a4af3bSchristos /* The following class definition is a classification scheme for 298a5a4af3bSchristos putting instructions with similar type of arguments together. It 299a5a4af3bSchristos simplifies the op-code definitions significantly, as we then only 300a5a4af3bSchristos need to use the class macroes for 95% of the DSP's opcodes. 301a5a4af3bSchristos */ 302a5a4af3bSchristos 303a5a4af3bSchristos /* A: General 2-operand integer operations 304a5a4af3bSchristos Syntax: <i> src, dst 305a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Signed immediate (S) 306a5a4af3bSchristos dst = Register (R) 307a5a4af3bSchristos Instr: 15/8 - ABSI, ADDC, ADDI, ASH, CMPI, LDI, LSH, MPYI, NEGB, NEGI, 308a5a4af3bSchristos SUBB, SUBC, SUBI, SUBRB, SUBRI, C4x: LBn, LHn, LWLn, LWRn, 309a5a4af3bSchristos MBn, MHn, MPYSHI, MPYUHI 310a5a4af3bSchristos */ 311a5a4af3bSchristos #define A_CLASS_INSN(name, opcode, level) \ 312a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q;R", level }, \ 313a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,R", level }, \ 314a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,R", level }, \ 315a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "S,R", level } 316a5a4af3bSchristos 317a5a4af3bSchristos /* AB: General 2-operand integer operation with condition 318a5a4af3bSchristos Syntax: <i>c src, dst 319a5a4af3bSchristos c = Condition 320a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Signed immediate (S) 321a5a4af3bSchristos dst = Register (R) 322a5a4af3bSchristos Instr: 1/0 - LDIc 323a5a4af3bSchristos */ 324a5a4af3bSchristos #define AB_CLASS_INSN(name, opcode, level) \ 325a5a4af3bSchristos { name, opcode|0x40000000, 0xf0600000, "Q;R", level }, \ 326a5a4af3bSchristos { name, opcode|0x40200000, 0xf0600000, "@,R", level }, \ 327a5a4af3bSchristos { name, opcode|0x40400000, 0xf0600000, "*,R", level }, \ 328a5a4af3bSchristos { name, opcode|0x40600000, 0xf0600000, "S,R", level } 329a5a4af3bSchristos 330a5a4af3bSchristos /* AU: General 2-operand unsigned integer operation 331a5a4af3bSchristos Syntax: <i> src, dst 332a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Unsigned immediate (U) 333a5a4af3bSchristos dst = Register (R) 334a5a4af3bSchristos Instr: 6/2 - AND, ANDN, NOT, OR, TSTB, XOR, C4x: LBUn, LHUn 335a5a4af3bSchristos */ 336a5a4af3bSchristos #define AU_CLASS_INSN(name, opcode, level) \ 337a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q;R", level }, \ 338a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,R", level }, \ 339a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,R", level }, \ 340a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "U,R", level } 341a5a4af3bSchristos 342a5a4af3bSchristos /* AF: General 2-operand float to integer operation 343a5a4af3bSchristos Syntax: <i> src, dst 344a5a4af3bSchristos src = Register 0-11 (q), Direct (@), Indirect (*), Float immediate (F) 345a5a4af3bSchristos dst = Register (R) 346a5a4af3bSchristos Instr: 1/0 - FIX 347a5a4af3bSchristos */ 348a5a4af3bSchristos #define AF_CLASS_INSN(name, opcode, level) \ 349a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "q;R", level }, \ 350a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,R", level }, \ 351a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,R", level }, \ 352a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "F,R", level } 353a5a4af3bSchristos 354a5a4af3bSchristos /* A2: Limited 1-operand (integer) operation 355a5a4af3bSchristos Syntax: <i> src 356a5a4af3bSchristos src = Register (Q), Indirect (*), None 357a5a4af3bSchristos Instr: 1/0 - NOP 358a5a4af3bSchristos */ 359a5a4af3bSchristos #define A2_CLASS_INSN(name, opcode, level) \ 360a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q", level }, \ 361a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*", level }, \ 362a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "" , level } 363a5a4af3bSchristos 364a5a4af3bSchristos /* A3: General 1-operand unsigned integer operation 365a5a4af3bSchristos Syntax: <i> src 366a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Unsigned immediate (U) 367a5a4af3bSchristos Instr: 1/0 - RPTS 368a5a4af3bSchristos */ 369a5a4af3bSchristos #define A3_CLASS_INSN(name, opcode, level) \ 370a5a4af3bSchristos { name, opcode|0x00000000, 0xffff0000, "Q", level }, \ 371a5a4af3bSchristos { name, opcode|0x00200000, 0xffff0000, "@", level }, \ 372a5a4af3bSchristos { name, opcode|0x00400000, 0xffff0000, "*", level }, \ 373a5a4af3bSchristos { name, opcode|0x00600000, 0xffff0000, "U", level } 374a5a4af3bSchristos 375a5a4af3bSchristos /* A6: Limited 2-operand integer operation 376a5a4af3bSchristos Syntax: <i> src, dst 377a5a4af3bSchristos src = Direct (@), Indirect (*) 378a5a4af3bSchristos dst = Register (R) 379a5a4af3bSchristos Instr: 1/1 - LDII, C4x: SIGI 380a5a4af3bSchristos */ 381a5a4af3bSchristos #define A6_CLASS_INSN(name, opcode, level) \ 382a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,R", level }, \ 383a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,R", level } 384a5a4af3bSchristos 385a5a4af3bSchristos /* A7: Limited 2-operand integer store operation 386a5a4af3bSchristos Syntax: <i> src, dst 387a5a4af3bSchristos src = Register (R) 388a5a4af3bSchristos dst = Direct (@), Indirect (*) 389a5a4af3bSchristos Instr: 2/0 - STI, STII 390a5a4af3bSchristos */ 391a5a4af3bSchristos #define A7_CLASS_INSN(name, opcode, level) \ 392a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "R,@", level }, \ 393a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "R,*", level } 394a5a4af3bSchristos 395a5a4af3bSchristos /* AY: General 2-operand signed address load operation 396a5a4af3bSchristos Syntax: <i> src, dst 397a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Signed immediate (S) 398a5a4af3bSchristos dst = Address register - ARx, IRx, DP, BK, SP (Y) 399a5a4af3bSchristos Instr: 0/1 - C4x: LDA 400a5a4af3bSchristos Note: Q and Y should *never* be the same register 401a5a4af3bSchristos */ 402a5a4af3bSchristos #define AY_CLASS_INSN(name, opcode, level) \ 403a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q,Y", level }, \ 404a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,Y", level }, \ 405a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,Y", level }, \ 406a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "S,Y", level } 407a5a4af3bSchristos 408a5a4af3bSchristos /* B: General 2-operand float operation 409a5a4af3bSchristos Syntax: <i> src, dst 410a5a4af3bSchristos src = Register 0-11 (q), Direct (@), Indirect (*), Float immediate (F) 411a5a4af3bSchristos dst = Register 0-11 (r) 412a5a4af3bSchristos Instr: 12/2 - ABSF, ADDF, CMPF, LDE, LDF, LDM, MPYF, NEGF, NORM, RND, 413a5a4af3bSchristos SUBF, SUBRF, C4x: RSQRF, TOIEEE 414a5a4af3bSchristos */ 415a5a4af3bSchristos #define B_CLASS_INSN(name, opcode, level) \ 416a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "q;r", level }, \ 417a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,r", level }, \ 418a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,r", level }, \ 419a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "F,r", level } 420a5a4af3bSchristos 421a5a4af3bSchristos /* BA: General 2-operand integer to float operation 422a5a4af3bSchristos Syntax: <i> src, dst 423a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Float immediate (F) 424a5a4af3bSchristos dst = Register 0-11 (r) 425a5a4af3bSchristos Instr: 0/1 - C4x: CRCPF 426a5a4af3bSchristos */ 427a5a4af3bSchristos #define BA_CLASS_INSN(name, opcode, level) \ 428a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q;r", level }, \ 429a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,r", level }, \ 430a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,r", level }, \ 431a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "F,r", level } 432a5a4af3bSchristos 433a5a4af3bSchristos /* BB: General 2-operand conditional float operation 434a5a4af3bSchristos Syntax: <i>c src, dst 435a5a4af3bSchristos c = Condition 436a5a4af3bSchristos src = Register 0-11 (q), Direct (@), Indirect (*), Float immediate (F) 437a5a4af3bSchristos dst = Register 0-11 (r) 438a5a4af3bSchristos Instr: 1/0 - LDFc 439a5a4af3bSchristos */ 440a5a4af3bSchristos #define BB_CLASS_INSN(name, opcode, level) \ 441a5a4af3bSchristos { name, opcode|0x40000000, 0xf0600000, "q;r", level }, \ 442a5a4af3bSchristos { name, opcode|0x40200000, 0xf0600000, "@,r", level }, \ 443a5a4af3bSchristos { name, opcode|0x40400000, 0xf0600000, "*,r", level }, \ 444a5a4af3bSchristos { name, opcode|0x40600000, 0xf0600000, "F,r", level } 445a5a4af3bSchristos 446a5a4af3bSchristos /* BI: General 2-operand integer to float operation (yet different to BA) 447a5a4af3bSchristos Syntax: <i> src, dst 448a5a4af3bSchristos src = Register (Q), Direct (@), Indirect (*), Signed immediate (S) 449a5a4af3bSchristos dst = Register 0-11 (r) 450a5a4af3bSchristos Instr: 1/0 - FLOAT 451a5a4af3bSchristos */ 452a5a4af3bSchristos #define BI_CLASS_INSN(name, opcode, level) \ 453a5a4af3bSchristos { name, opcode|0x00000000, 0xffe00000, "Q;r", level }, \ 454a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,r", level }, \ 455a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,r", level }, \ 456a5a4af3bSchristos { name, opcode|0x00600000, 0xffe00000, "S,r", level } 457a5a4af3bSchristos 458a5a4af3bSchristos /* B6: Limited 2-operand float operation 459a5a4af3bSchristos Syntax: <i> src, dst 460a5a4af3bSchristos src = Direct (@), Indirect (*) 461a5a4af3bSchristos dst = Register 0-11 (r) 462a5a4af3bSchristos Instr: 1/1 - LDFI, C4x: FRIEEE 463a5a4af3bSchristos */ 464a5a4af3bSchristos #define B6_CLASS_INSN(name, opcode, level) \ 465a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "@,r", level }, \ 466a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "*,r", level } 467a5a4af3bSchristos 468a5a4af3bSchristos /* B7: Limited 2-operand float store operation 469a5a4af3bSchristos Syntax: <i> src, dst 470a5a4af3bSchristos src = Register 0-11 (r) 471a5a4af3bSchristos dst = Direct (@), Indirect (*) 472a5a4af3bSchristos Instr: 2/0 - STF, STFI 473a5a4af3bSchristos */ 474a5a4af3bSchristos #define B7_CLASS_INSN(name, opcode, level) \ 475a5a4af3bSchristos { name, opcode|0x00200000, 0xffe00000, "r,@", level }, \ 476a5a4af3bSchristos { name, opcode|0x00400000, 0xffe00000, "r,*", level } 477a5a4af3bSchristos 478a5a4af3bSchristos /* D: Decrement and brach operations 479a5a4af3bSchristos Syntax: <i>c ARn, dst 480a5a4af3bSchristos c = condition 481a5a4af3bSchristos ARn = AR register 0-7 (A) 482a5a4af3bSchristos dst = Register (Q), PC-relative (P) 483a5a4af3bSchristos Instr: 2/0 - DBc, DBcD 484a5a4af3bSchristos Alias: <name1> <name2> 485a5a4af3bSchristos */ 486a5a4af3bSchristos #define D_CLASS_INSN(name1, name2, opcode, level) \ 487a5a4af3bSchristos { name1, opcode|0x00000000, 0xfe200000, "A,Q", level }, \ 488a5a4af3bSchristos { name1, opcode|0x02000000, 0xfe200000, "A,P", level }, \ 489a5a4af3bSchristos { name2, opcode|0x00000000, 0xfe200000, "A,Q", level }, \ 490a5a4af3bSchristos { name2, opcode|0x02000000, 0xfe200000, "A,P", level } 491a5a4af3bSchristos 492a5a4af3bSchristos /* I: General branch operations 493a5a4af3bSchristos Syntax: <i> dst 494a5a4af3bSchristos dst = Address (B) 495a5a4af3bSchristos Instr: 3/1 - BR, BRD, CALL, C4x: LAJ 496a5a4af3bSchristos */ 497a5a4af3bSchristos 498a5a4af3bSchristos /* I2: General branch operations (C4x addition) 499a5a4af3bSchristos Syntax: <i> dst 500a5a4af3bSchristos dst = Address (B), C4x: Register (Q) 501a5a4af3bSchristos Instr: 2/0 - RPTB, RPTBD 502a5a4af3bSchristos */ 503a5a4af3bSchristos 504a5a4af3bSchristos /* J: General conditional branch operations 505a5a4af3bSchristos Syntax: <i>c dst 506a5a4af3bSchristos c = Condition 507a5a4af3bSchristos dst = Register (Q), PC-relative (P) 508a5a4af3bSchristos Instr: 2/3 - Bc, BcD, C4x: BcAF, BcAT, LAJc 509a5a4af3bSchristos Alias: <name1> <name2> 510a5a4af3bSchristos */ 511a5a4af3bSchristos #define J_CLASS_INSN(name1, name2, opcode, level) \ 512a5a4af3bSchristos { name1, opcode|0x00000000, 0xffe00000, "Q", level }, \ 513a5a4af3bSchristos { name1, opcode|0x02000000, 0xffe00000, "P", level }, \ 514a5a4af3bSchristos { name2, opcode|0x00000000, 0xffe00000, "Q", level }, \ 515a5a4af3bSchristos { name2, opcode|0x02000000, 0xffe00000, "P", level } 516a5a4af3bSchristos 517a5a4af3bSchristos /* JS: General conditional branch operations 518a5a4af3bSchristos Syntax: <i>c dst 519a5a4af3bSchristos c = Condition 520a5a4af3bSchristos dst = Register (Q), PC-relative (P) 521a5a4af3bSchristos Instr: 1/1 - CALLc, C4X: LAJc 522a5a4af3bSchristos */ 523a5a4af3bSchristos 524a5a4af3bSchristos /* LL: Load-load parallell operation 525a5a4af3bSchristos Syntax: <i> src2, dst2 || <i> src1, dst1 526a5a4af3bSchristos src1 = Indirect 0,1,IR0,IR1 (J) 527a5a4af3bSchristos dst1 = Register 0-7 (K) 528a5a4af3bSchristos src2 = Indirect 0,1,IR0,IR1, ENH: Register (i) 529a5a4af3bSchristos dst2 = Register 0-7 (L) 530a5a4af3bSchristos Instr: 2/0 - LDF||LDF, LDI||LDI 531a5a4af3bSchristos Alias: i||i, i1||i2, i2||i1 532a5a4af3bSchristos */ 533a5a4af3bSchristos #define LL_CLASS_INSN(name, opcode, level) \ 534a5a4af3bSchristos { name "_" name , opcode, 0xfe000000, "i;L|J,K", level }, \ 535a5a4af3bSchristos { name "2_" name "1", opcode, 0xfe000000, "i;L|J,K", level }, \ 536a5a4af3bSchristos { name "1_" name "2", opcode, 0xfe000000, "J,K|i;L", level } 537a5a4af3bSchristos 538a5a4af3bSchristos /* LS: Store-store parallell operation 539a5a4af3bSchristos Syntax: <i> src2, dst2 || <i> src1, dst1 540a5a4af3bSchristos src1 = Register 0-7 (H) 541a5a4af3bSchristos dst1 = Indirect 0,1,IR0,IR1 (J) 542a5a4af3bSchristos src2 = Register 0-7 (L) 543a5a4af3bSchristos dst2 = Indirect 0,1,IR0,IR1, ENH: register (i) 544a5a4af3bSchristos Instr: 2/0 - STF||STF, STI||STI 545a5a4af3bSchristos Alias: i||i, i1||i2, i2||i1. 546a5a4af3bSchristos */ 547a5a4af3bSchristos #define LS_CLASS_INSN(name, opcode, level) \ 548a5a4af3bSchristos { name "_" name , opcode, 0xfe000000, "L;i|H,J", level }, \ 549a5a4af3bSchristos { name "2_" name "1", opcode, 0xfe000000, "L;i|H,J", level }, \ 550a5a4af3bSchristos { name "1_" name "2", opcode, 0xfe000000, "H,J|L;i", level } 551a5a4af3bSchristos 552a5a4af3bSchristos /* M: General multiply and add/sub operations 553a5a4af3bSchristos Syntax: <ia> src3,src4,dst1 || <ib> src2,src1,dst2 [00] - Manual 554a5a4af3bSchristos <ia> src3,src1,dst1 || <ib> src2,src4,dst2 [01] - Manual 555a5a4af3bSchristos <ia> src1,src3,dst1 || <ib> src2,src4,dst2 [01] 556a5a4af3bSchristos <ia> src1,src2,dst1 || <ib> src4,src3,dst2 [02] - Manual 557a5a4af3bSchristos <ia> src3,src1,dst1 || <ib> src4,src2,dst2 [03] - Manual 558a5a4af3bSchristos <ia> src1,src3,dst1 || <ib> src4,src2,dst2 [03] 559a5a4af3bSchristos src1 = Register 0-7 (K) 560a5a4af3bSchristos src2 = Register 0-7 (H) 561a5a4af3bSchristos src3 = Indirect 0,1,IR0,IR1, ENH: register (j) 562a5a4af3bSchristos src4 = Indirect 0,1,IR0,IR1, ENH: register (i) 563a5a4af3bSchristos dst1 = Register 0-1 (N) 564a5a4af3bSchristos dst2 = Register 2-3 (M) 565a5a4af3bSchristos Instr: 4/0 - MPYF3||ADDF3, MPYF3||SUBF3, MPYI3||ADDI3, MPYI3||SUBI3 566a5a4af3bSchristos Alias: a||b, a3||n, a||b3, a3||b3, b||a, b3||a, b||a3, b3||a3 567a5a4af3bSchristos */ 568a5a4af3bSchristos #define M_CLASS_INSN(namea, nameb, opcode, level) \ 569a5a4af3bSchristos { namea "_" nameb, opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \ 570a5a4af3bSchristos { namea "_" nameb, opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \ 571a5a4af3bSchristos { namea "_" nameb, opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \ 572a5a4af3bSchristos { namea "_" nameb, opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \ 573a5a4af3bSchristos { namea "_" nameb, opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \ 574a5a4af3bSchristos { namea "_" nameb, opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \ 575a5a4af3bSchristos { namea "3_" nameb, opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \ 576a5a4af3bSchristos { namea "3_" nameb, opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \ 577a5a4af3bSchristos { namea "3_" nameb, opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \ 578a5a4af3bSchristos { namea "3_" nameb, opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \ 579a5a4af3bSchristos { namea "3_" nameb, opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \ 580a5a4af3bSchristos { namea "3_" nameb, opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \ 581a5a4af3bSchristos { namea "_" nameb "3", opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \ 582a5a4af3bSchristos { namea "_" nameb "3", opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \ 583a5a4af3bSchristos { namea "_" nameb "3", opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \ 584a5a4af3bSchristos { namea "_" nameb "3", opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \ 585a5a4af3bSchristos { namea "_" nameb "3", opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \ 586a5a4af3bSchristos { namea "_" nameb "3", opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \ 587a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \ 588a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \ 589a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \ 590a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \ 591a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \ 592a5a4af3bSchristos { namea "3_" nameb "3", opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \ 593a5a4af3bSchristos { nameb "_" namea, opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \ 594a5a4af3bSchristos { nameb "_" namea, opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \ 595a5a4af3bSchristos { nameb "_" namea, opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \ 596a5a4af3bSchristos { nameb "_" namea, opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \ 597a5a4af3bSchristos { nameb "_" namea, opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \ 598a5a4af3bSchristos { nameb "_" namea, opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \ 599a5a4af3bSchristos { nameb "3_" namea, opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \ 600a5a4af3bSchristos { nameb "3_" namea, opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \ 601a5a4af3bSchristos { nameb "3_" namea, opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \ 602a5a4af3bSchristos { nameb "3_" namea, opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \ 603a5a4af3bSchristos { nameb "3_" namea, opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \ 604a5a4af3bSchristos { nameb "3_" namea, opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \ 605a5a4af3bSchristos { nameb "_" namea "3", opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \ 606a5a4af3bSchristos { nameb "_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \ 607a5a4af3bSchristos { nameb "_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \ 608a5a4af3bSchristos { nameb "_" namea "3", opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \ 609a5a4af3bSchristos { nameb "_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \ 610a5a4af3bSchristos { nameb "_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \ 611a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \ 612a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \ 613a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \ 614a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \ 615a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \ 616a5a4af3bSchristos { nameb "3_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level } 617a5a4af3bSchristos 618a5a4af3bSchristos /* P: General 2-operand operation with parallell store 619a5a4af3bSchristos Syntax: <ia> src2, dst1 || <ib> src3, dst2 620a5a4af3bSchristos src2 = Indirect 0,1,IR0,IR1, ENH: register (i) 621a5a4af3bSchristos dst1 = Register 0-7 (L) 622a5a4af3bSchristos src3 = Register 0-7 (H) 623a5a4af3bSchristos dst2 = Indirect 0,1,IR0,IR1 (J) 624a5a4af3bSchristos Instr: 9/2 - ABSF||STF, ABSI||STI, FIX||STI, FLOAT||STF, LDF||STF, 625a5a4af3bSchristos LDI||STI, NEGF||STF, NEGI||STI, NOT||STI, C4x: FRIEEE||STF, 626a5a4af3bSchristos TOIEEE||STF 627a5a4af3bSchristos Alias: a||b, b||a 628a5a4af3bSchristos */ 629a5a4af3bSchristos #define P_CLASS_INSN(namea, nameb, opcode, level) \ 630a5a4af3bSchristos { namea "_" nameb, opcode, 0xfe000000, "i;L|H,J", level }, \ 631a5a4af3bSchristos { nameb "_" namea, opcode, 0xfe000000, "H,J|i;L", level } 632a5a4af3bSchristos 633a5a4af3bSchristos /* Q: General 3-operand operation with parallell store 634a5a4af3bSchristos Syntax: <ia> src1, src2, dst1 || <ib> src3, dst2 635a5a4af3bSchristos src1 = Register 0-7 (K) 636a5a4af3bSchristos src2 = Indirect 0,1,IR0,IR1, ENH: register (i) 637a5a4af3bSchristos dst1 = Register 0-7 (L) 638a5a4af3bSchristos src3 = Register 0-7 (H) 639a5a4af3bSchristos dst2 = Indirect 0,1,IR0,IR1 (J) 640a5a4af3bSchristos Instr: 4/0 - ASH3||STI, LSH3||STI, SUBF3||STF, SUBI3||STI 641a5a4af3bSchristos Alias: a||b, b||a, a3||b, b||a3 642a5a4af3bSchristos */ 643a5a4af3bSchristos #define Q_CLASS_INSN(namea, nameb, opcode, level) \ 644a5a4af3bSchristos { namea "_" nameb , opcode, 0xfe000000, "K,i;L|H,J", level }, \ 645a5a4af3bSchristos { nameb "_" namea , opcode, 0xfe000000, "H,J|K,i;L", level }, \ 646a5a4af3bSchristos { namea "3_" nameb , opcode, 0xfe000000, "K,i;L|H,J", level }, \ 647a5a4af3bSchristos { nameb "_" namea "3", opcode, 0xfe000000, "H,J|K,i;L", level } 648a5a4af3bSchristos 649a5a4af3bSchristos /* QC: General commutative 3-operand operation with parallell store 650a5a4af3bSchristos Syntax: <ia> src2, src1, dst1 || <ib> src3, dst2 651a5a4af3bSchristos <ia> src1, src2, dst1 || <ib> src3, dst2 - Manual 652a5a4af3bSchristos src1 = Register 0-7 (K) 653a5a4af3bSchristos src2 = Indirect 0,1,IR0,IR1, ENH: register (i) 654a5a4af3bSchristos dst1 = Register 0-7 (L) 655a5a4af3bSchristos src3 = Register 0-7 (H) 656a5a4af3bSchristos dst2 = Indirect 0,1,IR0,IR1 (J) 657a5a4af3bSchristos Instr: 7/0 - ADDF3||STF, ADDI3||STI, AND3||STI, MPYF3||STF, MPYI3||STI, 658a5a4af3bSchristos OR3||STI, XOR3||STI 659a5a4af3bSchristos Alias: a||b, b||a, a3||b, b||a3 660a5a4af3bSchristos */ 661a5a4af3bSchristos #define QC_CLASS_INSN(namea, nameb, opcode, level) \ 662a5a4af3bSchristos { namea "_" nameb , opcode, 0xfe000000, "i;K;L|H,J", level }, \ 663a5a4af3bSchristos { namea "_" nameb , opcode, 0xfe000000, "K;i;L|H,J", level }, \ 664a5a4af3bSchristos { nameb "_" namea , opcode, 0xfe000000, "H,J|i;K;L", level }, \ 665a5a4af3bSchristos { nameb "_" namea , opcode, 0xfe000000, "H,J|K;i;L", level }, \ 666a5a4af3bSchristos { namea "3_" nameb , opcode, 0xfe000000, "i;K;L|H,J", level }, \ 667a5a4af3bSchristos { namea "3_" nameb , opcode, 0xfe000000, "K;i;L|H,J", level }, \ 668a5a4af3bSchristos { nameb "_" namea "3", opcode, 0xfe000000, "H,J|i;K;L", level }, \ 669a5a4af3bSchristos { nameb "_" namea "3", opcode, 0xfe000000, "H,J|K;i;L", level } 670a5a4af3bSchristos 671a5a4af3bSchristos /* R: General register integer operation 672a5a4af3bSchristos Syntax: <i> dst 673a5a4af3bSchristos dst = Register (R) 674a5a4af3bSchristos Instr: 6/0 - POP, PUSH, ROL, ROLC, ROR, RORC 675a5a4af3bSchristos */ 676a5a4af3bSchristos #define R_CLASS_INSN(name, opcode, level) \ 677a5a4af3bSchristos { name, opcode, 0xffe0ffff, "R", level } 678a5a4af3bSchristos 679a5a4af3bSchristos /* RF: General register float operation 680a5a4af3bSchristos Syntax: <i> dst 681a5a4af3bSchristos dst = Register 0-11 (r) 682a5a4af3bSchristos Instr: 2/0 - POPF, PUSHF 683a5a4af3bSchristos */ 684a5a4af3bSchristos #define RF_CLASS_INSN(name, opcode, level) \ 685a5a4af3bSchristos { name, opcode, 0xffe0ffff, "r", level } 686a5a4af3bSchristos 687a5a4af3bSchristos /* S: General 3-operand float operation 688a5a4af3bSchristos Syntax: <i> src2, src1, dst 689a5a4af3bSchristos src2 = Register 0-11 (e), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C) 690a5a4af3bSchristos src1 = Register 0-11 (g), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 691a5a4af3bSchristos dst = Register 0-11 (r) 692a5a4af3bSchristos Instr: 1/0 - SUBF3 693a5a4af3bSchristos Alias: i, i3 694a5a4af3bSchristos */ 695a5a4af3bSchristos #define S_CLASS_INSN(name, opcode, level) \ 696a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "e,g;r", level }, \ 697a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "e,J,r", level }, \ 698a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,g;r", level }, \ 699a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J,r", level }, \ 700a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \ 701a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }, \ 702a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "e,g;r", level }, \ 703a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "e,J,r", level }, \ 704a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,g;r", level }, \ 705a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J,r", level }, \ 706a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \ 707a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X } 708a5a4af3bSchristos 709a5a4af3bSchristos /* SC: General commutative 3-operand float operation 710a5a4af3bSchristos Syntax: <i> src2, src1, dst - Manual 711a5a4af3bSchristos <i> src1, src2, dst 712a5a4af3bSchristos src2 = Register 0-11 (e), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C) 713a5a4af3bSchristos src1 = Register 0-11 (g), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 714a5a4af3bSchristos dst = Register 0-11 (r) 715a5a4af3bSchristos Instr: 2/0 - ADDF3, MPYF3 716a5a4af3bSchristos Alias: i, i3 717a5a4af3bSchristos */ 718a5a4af3bSchristos #define SC_CLASS_INSN(name, opcode, level) \ 719a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "e,g;r", level }, \ 720a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "e,J,r", level }, \ 721a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,g;r", level }, \ 722a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J,r", level }, \ 723a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \ 724a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "g,C,r", OP_C4X }, \ 725a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }, \ 726a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "e,g;r", level }, \ 727a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "e,J,r", level }, \ 728a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,g;r", level }, \ 729a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J,r", level }, \ 730a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "g,C,r", OP_C4X }, \ 731a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \ 732a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X } 733a5a4af3bSchristos 734a5a4af3bSchristos /* S2: General 3-operand float operation with 2 args 735a5a4af3bSchristos Syntax: <i> src2, src1 736a5a4af3bSchristos src2 = Register 0-11 (e), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C) 737a5a4af3bSchristos src1 = Register 0-11 (g), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 738a5a4af3bSchristos Instr: 1/0 - CMPF3 739a5a4af3bSchristos Alias: i, i3 740a5a4af3bSchristos */ 741a5a4af3bSchristos #define S2_CLASS_INSN(name, opcode, level) \ 742a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "e,g", level }, \ 743a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "e,J", level }, \ 744a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,g", level }, \ 745a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J", level }, \ 746a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,g", OP_C4X }, \ 747a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \ 748a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "e,g", level }, \ 749a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "e,J", level }, \ 750a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,g", level }, \ 751a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \ 752a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,g", OP_C4X }, \ 753a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X } 754a5a4af3bSchristos 755a5a4af3bSchristos /* T: General 3-operand integer operand 756a5a4af3bSchristos Syntax: <i> src2, src1, dst 757a5a4af3bSchristos src2 = Register (E), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C), Immediate (W) 758a5a4af3bSchristos src1 = Register (G), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 759a5a4af3bSchristos dst = Register (R) 760a5a4af3bSchristos Instr: 5/0 - ANDN3, ASH3, LSH3, SUBB3, SUBI3 761a5a4af3bSchristos Alias: i, i3 762a5a4af3bSchristos */ 763a5a4af3bSchristos #define T_CLASS_INSN(name, opcode, level) \ 764a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "E,G;R", level }, \ 765a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "E,J,R", level }, \ 766a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,G;R", level }, \ 767a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J,R", level }, \ 768a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \ 769a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \ 770a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \ 771a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }, \ 772a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "E,G;R", level }, \ 773a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "E,J,R", level }, \ 774a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,G;R", level }, \ 775a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J,R", level }, \ 776a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \ 777a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \ 778a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \ 779a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X } 780a5a4af3bSchristos 781a5a4af3bSchristos /* TC: General commutative 3-operand integer operation 782a5a4af3bSchristos Syntax: <i> src2, src1, dst 783a5a4af3bSchristos <i> src1, src2, dst 784a5a4af3bSchristos src2 = Register (E), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C), Immediate (W) 785a5a4af3bSchristos src1 = Register (G), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 786a5a4af3bSchristos dst = Register (R) 787a5a4af3bSchristos Instr: 6/2 - ADDC3, ADDI3, AND3, MPYI3, OR3, XOR3, C4x: MPYSHI, MPYUHI 788a5a4af3bSchristos Alias: i, i3 789a5a4af3bSchristos */ 790a5a4af3bSchristos #define TC_CLASS_INSN(name, opcode, level) \ 791a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "E,G;R", level }, \ 792a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "E,J,R", level }, \ 793a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,G;R", level }, \ 794a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J,R", level }, \ 795a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \ 796a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "G,W,R", OP_C4X }, \ 797a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \ 798a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "G,C,R", OP_C4X }, \ 799a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \ 800a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "O,W,R", OP_C4X }, \ 801a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }, \ 802a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "E,G;R", level }, \ 803a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "E,J,R", level }, \ 804a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,G;R", level }, \ 805a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J,R", level }, \ 806a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \ 807a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "G,W,R", OP_C4X }, \ 808a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \ 809a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "G,C,R", OP_C4X }, \ 810a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \ 811a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "O,W,R", OP_C4X }, \ 812a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X } 813a5a4af3bSchristos 814a5a4af3bSchristos /* T2: General 3-operand integer operation with 2 args 815a5a4af3bSchristos Syntax: <i> src2, src1 816a5a4af3bSchristos src2 = Register (E), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C), Immediate (W) 817a5a4af3bSchristos src1 = Register (G), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (O) 818a5a4af3bSchristos Instr: 1/0 - CMPI3 819a5a4af3bSchristos Alias: i, i3 820a5a4af3bSchristos */ 821a5a4af3bSchristos #define T2_CLASS_INSN(name, opcode, level) \ 822a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "E,G", level }, \ 823a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "E,J", level }, \ 824a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,G", level }, \ 825a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J", level }, \ 826a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \ 827a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \ 828a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \ 829a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \ 830a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "E,G", level }, \ 831a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "E,J", level }, \ 832a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,G", level }, \ 833a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \ 834a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \ 835a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \ 836a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \ 837a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X } 838a5a4af3bSchristos 839a5a4af3bSchristos /* T2C: General commutative 3-operand integer operation with 2 args 840a5a4af3bSchristos Syntax: <i> src2, src1 - Manual 841a5a4af3bSchristos <i> src1, src2 842a5a4af3bSchristos src2 = Register (E), Indirect 0,1,IR0,IR1 (I), C4x T2: Indirect (C), Immediate (W) 843a5a4af3bSchristos src1 = Register (G), Indirect 0,1,IR0,IR1 (J), C4x T2: Indirect (0) 844a5a4af3bSchristos Instr: 1/0 - TSTB3 845a5a4af3bSchristos Alias: i, i3 846a5a4af3bSchristos */ 847a5a4af3bSchristos #define T2C_CLASS_INSN(name, opcode, level) \ 848a5a4af3bSchristos { name, opcode|0x20000000, 0xffe00000, "E,G", level }, \ 849a5a4af3bSchristos { name, opcode|0x20200000, 0xffe00000, "E,J", level }, \ 850a5a4af3bSchristos { name, opcode|0x20400000, 0xffe00000, "I,G", level }, \ 851a5a4af3bSchristos { name, opcode|0x20600000, 0xffe00000, "I,J", level }, \ 852a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \ 853a5a4af3bSchristos { name, opcode|0x30000000, 0xffe00000, "G,W", OP_C4X }, \ 854a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \ 855a5a4af3bSchristos { name, opcode|0x30200000, 0xffe00000, "G,C", OP_C4X }, \ 856a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \ 857a5a4af3bSchristos { name, opcode|0x30400000, 0xffe00000, "O,W", OP_C4X }, \ 858a5a4af3bSchristos { name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \ 859a5a4af3bSchristos { name "3", opcode|0x20000000, 0xffe00000, "E,G", level }, \ 860a5a4af3bSchristos { name "3", opcode|0x20200000, 0xffe00000, "E,J", level }, \ 861a5a4af3bSchristos { name "3", opcode|0x20400000, 0xffe00000, "I,G", level }, \ 862a5a4af3bSchristos { name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \ 863a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \ 864a5a4af3bSchristos { name "3", opcode|0x30000000, 0xffe00000, "G,W", OP_C4X }, \ 865a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \ 866a5a4af3bSchristos { name "3", opcode|0x30200000, 0xffe00000, "G,C", OP_C4X }, \ 867a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \ 868a5a4af3bSchristos { name "3", opcode|0x30400000, 0xffe00000, "O,W", OP_C4X }, \ 869a5a4af3bSchristos { name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X } 870a5a4af3bSchristos 871a5a4af3bSchristos /* Z: Misc operations with or without arguments 872a5a4af3bSchristos Syntax: <i> <arg1>,... 873a5a4af3bSchristos Instr: 16 - RETIc, RETSc, SIGI(c3X), SWI, IDLE, IDLE2, RETIcD, 874a5a4af3bSchristos TRAPc, LATc, LDEP, LDEHI, LDEPE, LDPK, STIK, LDP, IACK 875a5a4af3bSchristos */ 876a5a4af3bSchristos 877a5a4af3bSchristos 878a5a4af3bSchristos /* Define tic4x opcodes for assembler and disassembler. */ 879a5a4af3bSchristos static const tic4x_inst_t tic4x_insts[] = 880a5a4af3bSchristos { 881a5a4af3bSchristos /* Put synonyms after the desired forms in table so that they get 882a5a4af3bSchristos overwritten in the lookup table. The disassembler will thus 883a5a4af3bSchristos print the `proper' mnemonics. Note that the disassembler 884a5a4af3bSchristos only decodes the 11 MSBs, so instructions like ldp @0x500 will 885a5a4af3bSchristos be printed as ldiu 5, dp. Note that with parallel instructions, 886a5a4af3bSchristos the second part is executed before the first part, unless 887a5a4af3bSchristos the sti1||sti2 form is used. We also allow sti2||sti1 888a5a4af3bSchristos which is equivalent to the default sti||sti form. 889a5a4af3bSchristos */ 890a5a4af3bSchristos B_CLASS_INSN( "absf", 0x00000000, OP_C3X ), 891a5a4af3bSchristos P_CLASS_INSN( "absf", "stf", 0xc8000000, OP_C3X ), 892a5a4af3bSchristos A_CLASS_INSN( "absi", 0x00800000, OP_C3X ), 893a5a4af3bSchristos P_CLASS_INSN( "absi", "sti", 0xca000000, OP_C3X ), 894a5a4af3bSchristos A_CLASS_INSN( "addc", 0x01000000, OP_C3X ), 895a5a4af3bSchristos TC_CLASS_INSN( "addc", 0x00000000, OP_C3X ), 896a5a4af3bSchristos B_CLASS_INSN( "addf", 0x01800000, OP_C3X ), 897a5a4af3bSchristos SC_CLASS_INSN( "addf", 0x00800000, OP_C3X ), 898a5a4af3bSchristos QC_CLASS_INSN( "addf", "stf", 0xcc000000, OP_C3X ), 899a5a4af3bSchristos A_CLASS_INSN( "addi", 0x02000000, OP_C3X ), 900a5a4af3bSchristos TC_CLASS_INSN( "addi", 0x01000000, OP_C3X ), 901a5a4af3bSchristos QC_CLASS_INSN( "addi", "sti", 0xce000000, OP_C3X ), 902a5a4af3bSchristos AU_CLASS_INSN( "and", 0x02800000, OP_C3X ), 903a5a4af3bSchristos TC_CLASS_INSN( "and", 0x01800000, OP_C3X ), 904a5a4af3bSchristos QC_CLASS_INSN( "and", "sti", 0xd0000000, OP_C3X ), 905a5a4af3bSchristos AU_CLASS_INSN( "andn", 0x03000000, OP_C3X ), 906a5a4af3bSchristos T_CLASS_INSN( "andn", 0x02000000, OP_C3X ), 907a5a4af3bSchristos A_CLASS_INSN( "ash", 0x03800000, OP_C3X ), 908a5a4af3bSchristos T_CLASS_INSN( "ash", 0x02800000, OP_C3X ), 909a5a4af3bSchristos Q_CLASS_INSN( "ash", "sti", 0xd2000000, OP_C3X ), 910a5a4af3bSchristos J_CLASS_INSN( "bB", "b", 0x68000000, OP_C3X ), 911a5a4af3bSchristos J_CLASS_INSN( "bBd", "bd", 0x68200000, OP_C3X ), 912a5a4af3bSchristos J_CLASS_INSN( "bBaf", "baf", 0x68a00000, OP_C4X ), 913a5a4af3bSchristos J_CLASS_INSN( "bBat", "bat", 0x68600000, OP_C4X ), 914a5a4af3bSchristos { "br", 0x60000000, 0xff000000, "B" , OP_C3X }, /* I_CLASS */ 915a5a4af3bSchristos { "brd", 0x61000000, 0xff000000, "B" , OP_C3X }, /* I_CLASS */ 916a5a4af3bSchristos { "call", 0x62000000, 0xff000000, "B" , OP_C3X }, /* I_CLASS */ 917a5a4af3bSchristos { "callB", 0x70000000, 0xffe00000, "Q" , OP_C3X }, /* JS_CLASS */ 918a5a4af3bSchristos { "callB", 0x72000000, 0xffe00000, "P" , OP_C3X }, /* JS_CLASS */ 919a5a4af3bSchristos B_CLASS_INSN( "cmpf", 0x04000000, OP_C3X ), 920a5a4af3bSchristos S2_CLASS_INSN( "cmpf", 0x03000000, OP_C3X ), 921a5a4af3bSchristos A_CLASS_INSN( "cmpi", 0x04800000, OP_C3X ), 922a5a4af3bSchristos T2_CLASS_INSN( "cmpi", 0x03800000, OP_C3X ), 923a5a4af3bSchristos D_CLASS_INSN( "dbB", "db", 0x6c000000, OP_C3X ), 924a5a4af3bSchristos D_CLASS_INSN( "dbBd", "dbd", 0x6c200000, OP_C3X ), 925a5a4af3bSchristos AF_CLASS_INSN( "fix", 0x05000000, OP_C3X ), 926a5a4af3bSchristos P_CLASS_INSN( "fix", "sti", 0xd4000000, OP_C3X ), 927a5a4af3bSchristos BI_CLASS_INSN( "float", 0x05800000, OP_C3X ), 928a5a4af3bSchristos P_CLASS_INSN( "float", "stf", 0xd6000000, OP_C3X ), 929a5a4af3bSchristos B6_CLASS_INSN( "frieee", 0x1c000000, OP_C4X ), 930a5a4af3bSchristos P_CLASS_INSN( "frieee","stf", 0xf2000000, OP_C4X ), 931a5a4af3bSchristos { "iack", 0x1b200000, 0xffe00000, "@" , OP_C3X }, /* Z_CLASS */ 932a5a4af3bSchristos { "iack", 0x1b400000, 0xffe00000, "*" , OP_C3X }, /* Z_CLASS */ 933a5a4af3bSchristos { "idle", 0x06000000, 0xffffffff, "" , OP_C3X }, /* Z_CLASS */ 934a5a4af3bSchristos { "idlez", 0x06000000, 0xffffffff, "" , OP_C3X }, /* Z_CLASS */ 935a5a4af3bSchristos { "idle2", 0x06000001, 0xffffffff, "" , OP_IDLE2 }, /* Z_CLASS */ 936a5a4af3bSchristos { "laj", 0x63000000, 0xff000000, "B" , OP_C4X }, /* I_CLASS */ 937a5a4af3bSchristos { "lajB", 0x70200000, 0xffe00000, "Q" , OP_C4X }, /* JS_CLASS */ 938a5a4af3bSchristos { "lajB", 0x72200000, 0xffe00000, "P" , OP_C4X }, /* JS_CLASS */ 939a5a4af3bSchristos { "latB", 0x74800000, 0xffe00000, "V" , OP_C4X }, /* Z_CLASS */ 940a5a4af3bSchristos A_CLASS_INSN( "lb0", 0xb0000000, OP_C4X ), 941a5a4af3bSchristos A_CLASS_INSN( "lb1", 0xb0800000, OP_C4X ), 942a5a4af3bSchristos A_CLASS_INSN( "lb2", 0xb1000000, OP_C4X ), 943a5a4af3bSchristos A_CLASS_INSN( "lb3", 0xb1800000, OP_C4X ), 944a5a4af3bSchristos AU_CLASS_INSN( "lbu0", 0xb2000000, OP_C4X ), 945a5a4af3bSchristos AU_CLASS_INSN( "lbu1", 0xb2800000, OP_C4X ), 946a5a4af3bSchristos AU_CLASS_INSN( "lbu2", 0xb3000000, OP_C4X ), 947a5a4af3bSchristos AU_CLASS_INSN( "lbu3", 0xb3800000, OP_C4X ), 948a5a4af3bSchristos AY_CLASS_INSN( "lda", 0x1e800000, OP_C4X ), 949a5a4af3bSchristos B_CLASS_INSN( "lde", 0x06800000, OP_C3X ), 950a5a4af3bSchristos { "ldep", 0x76000000, 0xffe00000, "X,R" , OP_C4X }, /* Z_CLASS */ 951a5a4af3bSchristos B_CLASS_INSN( "ldf", 0x07000000, OP_C3X ), 952a5a4af3bSchristos LL_CLASS_INSN( "ldf", 0xc4000000, OP_C3X ), 953a5a4af3bSchristos P_CLASS_INSN( "ldf", "stf", 0xd8000000, OP_C3X ), 954a5a4af3bSchristos BB_CLASS_INSN( "ldfC", 0x00000000, OP_C3X ), 955a5a4af3bSchristos B6_CLASS_INSN( "ldfi", 0x07800000, OP_C3X ), 956a5a4af3bSchristos { "ldhi", 0x1fe00000, 0xffe00000, "U,R" , OP_C4X }, /* Z_CLASS */ 957a5a4af3bSchristos { "ldhi", 0x1fe00000, 0xffe00000, "#,R" , OP_C4X }, /* Z_CLASS */ 958a5a4af3bSchristos A_CLASS_INSN( "ldi", 0x08000000, OP_C3X ), 959a5a4af3bSchristos LL_CLASS_INSN( "ldi", 0xc6000000, OP_C3X ), 960a5a4af3bSchristos P_CLASS_INSN( "ldi", "sti", 0xda000000, OP_C3X ), 961a5a4af3bSchristos AB_CLASS_INSN( "ldiC", 0x10000000, OP_C3X ), 962a5a4af3bSchristos A6_CLASS_INSN( "ldii", 0x08800000, OP_C3X ), 963a5a4af3bSchristos { "ldp", 0x50700000, 0xffff0000, "#" , OP_C3X }, /* Z_CLASS - synonym for ldiu #,dp */ 964a5a4af3bSchristos B_CLASS_INSN( "ldm", 0x09000000, OP_C3X ), 965a5a4af3bSchristos { "ldpe", 0x76800000, 0xffe00000, "Q,Z" , OP_C4X }, /* Z_CLASS */ 966a5a4af3bSchristos { "ldpk", 0x1F700000, 0xffff0000, "#" , OP_C4X }, /* Z_CLASS */ 967a5a4af3bSchristos A_CLASS_INSN( "lh0", 0xba000000, OP_C4X ), 968a5a4af3bSchristos A_CLASS_INSN( "lh1", 0xba800000, OP_C4X ), 969a5a4af3bSchristos AU_CLASS_INSN( "lhu0", 0xbb000000, OP_C4X ), 970a5a4af3bSchristos AU_CLASS_INSN( "lhu1", 0xbb800000, OP_C4X ), 971a5a4af3bSchristos { "lopower", 0x10800001,0xffffffff, "" , OP_LPWR }, /* Z_CLASS */ 972a5a4af3bSchristos A_CLASS_INSN( "lsh", 0x09800000, OP_C3X ), 973a5a4af3bSchristos T_CLASS_INSN( "lsh", 0x04000000, OP_C3X ), 974a5a4af3bSchristos Q_CLASS_INSN( "lsh", "sti", 0xdc000000, OP_C3X ), 975a5a4af3bSchristos A_CLASS_INSN( "lwl0", 0xb4000000, OP_C4X ), 976a5a4af3bSchristos A_CLASS_INSN( "lwl1", 0xb4800000, OP_C4X ), 977a5a4af3bSchristos A_CLASS_INSN( "lwl2", 0xb5000000, OP_C4X ), 978a5a4af3bSchristos A_CLASS_INSN( "lwl3", 0xb5800000, OP_C4X ), 979a5a4af3bSchristos A_CLASS_INSN( "lwr0", 0xb6000000, OP_C4X ), 980a5a4af3bSchristos A_CLASS_INSN( "lwr1", 0xb6800000, OP_C4X ), 981a5a4af3bSchristos A_CLASS_INSN( "lwr2", 0xb7000000, OP_C4X ), 982a5a4af3bSchristos A_CLASS_INSN( "lwr3", 0xb7800000, OP_C4X ), 983a5a4af3bSchristos { "maxspeed",0x10800000,0xffffffff, "" , OP_LPWR }, /* Z_CLASS */ 984a5a4af3bSchristos A_CLASS_INSN( "mb0", 0xb8000000, OP_C4X ), 985a5a4af3bSchristos A_CLASS_INSN( "mb1", 0xb8800000, OP_C4X ), 986a5a4af3bSchristos A_CLASS_INSN( "mb2", 0xb9000000, OP_C4X ), 987a5a4af3bSchristos A_CLASS_INSN( "mb3", 0xb9800000, OP_C4X ), 988a5a4af3bSchristos A_CLASS_INSN( "mh0", 0xbc000000, OP_C4X ), 989a5a4af3bSchristos A_CLASS_INSN( "mh1", 0xbc800000, OP_C4X ), 990a5a4af3bSchristos A_CLASS_INSN( "mh2", 0xbd000000, OP_C4X ), 991a5a4af3bSchristos A_CLASS_INSN( "mh3", 0xbd800000, OP_C4X ), 992a5a4af3bSchristos B_CLASS_INSN( "mpyf", 0x0a000000, OP_C3X ), 993a5a4af3bSchristos SC_CLASS_INSN( "mpyf", 0x04800000, OP_C3X ), 994a5a4af3bSchristos M_CLASS_INSN( "mpyf", "addf", 0x80000000, OP_C3X ), 995a5a4af3bSchristos QC_CLASS_INSN( "mpyf", "stf", 0xde000000, OP_C3X ), 996a5a4af3bSchristos M_CLASS_INSN( "mpyf", "subf", 0x84000000, OP_C3X ), 997a5a4af3bSchristos A_CLASS_INSN( "mpyi", 0x0a800000, OP_C3X ), 998a5a4af3bSchristos TC_CLASS_INSN( "mpyi", 0x05000000, OP_C3X ), 999a5a4af3bSchristos M_CLASS_INSN( "mpyi", "addi", 0x88000000, OP_C3X ), 1000a5a4af3bSchristos QC_CLASS_INSN( "mpyi", "sti", 0xe0000000, OP_C3X ), 1001a5a4af3bSchristos M_CLASS_INSN( "mpyi", "subi", 0x8c000000, OP_C3X ), 1002a5a4af3bSchristos A_CLASS_INSN( "mpyshi", 0x1d800000, OP_C4X ), 1003a5a4af3bSchristos TC_CLASS_INSN( "mpyshi", 0x28800000, OP_C4X ), 1004a5a4af3bSchristos A_CLASS_INSN( "mpyuhi", 0x1e000000, OP_C4X ), 1005a5a4af3bSchristos TC_CLASS_INSN( "mpyuhi", 0x29000000, OP_C4X ), 1006a5a4af3bSchristos A_CLASS_INSN( "negb", 0x0b000000, OP_C3X ), 1007a5a4af3bSchristos B_CLASS_INSN( "negf", 0x0b800000, OP_C3X ), 1008a5a4af3bSchristos P_CLASS_INSN( "negf", "stf", 0xe2000000, OP_C3X ), 1009a5a4af3bSchristos A_CLASS_INSN( "negi", 0x0c000000, OP_C3X ), 1010a5a4af3bSchristos P_CLASS_INSN( "negi", "sti", 0xe4000000, OP_C3X ), 1011a5a4af3bSchristos A2_CLASS_INSN( "nop", 0x0c800000, OP_C3X ), 1012a5a4af3bSchristos B_CLASS_INSN( "norm", 0x0d000000, OP_C3X ), 1013a5a4af3bSchristos AU_CLASS_INSN( "not", 0x0d800000, OP_C3X ), 1014a5a4af3bSchristos P_CLASS_INSN( "not", "sti", 0xe6000000, OP_C3X ), 1015a5a4af3bSchristos AU_CLASS_INSN( "or", 0x10000000, OP_C3X ), 1016a5a4af3bSchristos TC_CLASS_INSN( "or", 0x05800000, OP_C3X ), 1017a5a4af3bSchristos QC_CLASS_INSN( "or", "sti", 0xe8000000, OP_C3X ), 1018a5a4af3bSchristos R_CLASS_INSN( "pop", 0x0e200000, OP_C3X ), 1019a5a4af3bSchristos RF_CLASS_INSN( "popf", 0x0ea00000, OP_C3X ), 1020a5a4af3bSchristos R_CLASS_INSN( "push", 0x0f200000, OP_C3X ), 1021a5a4af3bSchristos RF_CLASS_INSN( "pushf", 0x0fa00000, OP_C3X ), 1022a5a4af3bSchristos BA_CLASS_INSN( "rcpf", 0x1d000000, OP_C4X ), 1023a5a4af3bSchristos { "retiB", 0x78000000, 0xffe00000, "" , OP_C3X }, /* Z_CLASS */ 1024a5a4af3bSchristos { "reti", 0x78000000, 0xffe00000, "" , OP_C3X }, /* Z_CLASS - Alias for retiu */ 1025a5a4af3bSchristos { "retiBd", 0x78200000, 0xffe00000, "" , OP_C4X }, /* Z_CLASS */ 1026a5a4af3bSchristos { "retid", 0x78200000, 0xffe00000, "" , OP_C4X }, /* Z_CLASS - Alias for retiud */ 1027a5a4af3bSchristos { "retsB", 0x78800000, 0xffe00000, "" , OP_C3X }, /* Z_CLASS */ 1028a5a4af3bSchristos { "rets", 0x78800000, 0xffe00000, "" , OP_C3X }, /* Z_CLASS - Alias for retsu */ 1029a5a4af3bSchristos B_CLASS_INSN( "rnd", 0x11000000, OP_C3X ), 1030a5a4af3bSchristos R_CLASS_INSN( "rol", 0x11e00001, OP_C3X ), 1031a5a4af3bSchristos R_CLASS_INSN( "rolc", 0x12600001, OP_C3X ), 1032a5a4af3bSchristos R_CLASS_INSN( "ror", 0x12e0ffff, OP_C3X ), 1033a5a4af3bSchristos R_CLASS_INSN( "rorc", 0x1360ffff, OP_C3X ), 1034a5a4af3bSchristos { "rptb", 0x64000000, 0xff000000, "B" , OP_C3X }, /* I2_CLASS */ 1035a5a4af3bSchristos { "rptb", 0x79000000, 0xff000000, "Q" , OP_C4X }, /* I2_CLASS */ 1036a5a4af3bSchristos { "rptbd", 0x65000000, 0xff000000, "B" , OP_C4X }, /* I2_CLASS */ 1037a5a4af3bSchristos { "rptbd", 0x79800000, 0xff000000, "Q" , OP_C4X }, /* I2_CLASS */ 1038a5a4af3bSchristos A3_CLASS_INSN( "rpts", 0x139b0000, OP_C3X ), 1039a5a4af3bSchristos B_CLASS_INSN( "rsqrf", 0x1c800000, OP_C4X ), 1040a5a4af3bSchristos { "sigi", 0x16000000, 0xffe00000, "" , OP_C3X }, /* Z_CLASS */ 1041a5a4af3bSchristos A6_CLASS_INSN( "sigi", 0x16000000, OP_C4X ), 1042a5a4af3bSchristos B7_CLASS_INSN( "stf", 0x14000000, OP_C3X ), 1043a5a4af3bSchristos LS_CLASS_INSN( "stf", 0xc0000000, OP_C3X ), 1044a5a4af3bSchristos B7_CLASS_INSN( "stfi", 0x14800000, OP_C3X ), 1045a5a4af3bSchristos A7_CLASS_INSN( "sti", 0x15000000, OP_C3X ), 1046a5a4af3bSchristos { "sti", 0x15000000, 0xffe00000, "T,@" , OP_C4X }, /* Class A7 - Alias for stik */ 1047a5a4af3bSchristos { "sti", 0x15600000, 0xffe00000, "T,*" , OP_C4X }, /* Class A7 */ 1048a5a4af3bSchristos LS_CLASS_INSN( "sti", 0xc2000000, OP_C3X ), 1049a5a4af3bSchristos A7_CLASS_INSN( "stii", 0x15800000, OP_C3X ), 1050a5a4af3bSchristos { "stik", 0x15000000, 0xffe00000, "T,@" , OP_C4X }, /* Z_CLASS */ 1051a5a4af3bSchristos { "stik", 0x15600000, 0xffe00000, "T,*" , OP_C4X }, /* Z_CLASS */ 1052a5a4af3bSchristos A_CLASS_INSN( "subb", 0x16800000, OP_C3X ), 1053a5a4af3bSchristos T_CLASS_INSN( "subb", 0x06000000, OP_C3X ), 1054a5a4af3bSchristos A_CLASS_INSN( "subc", 0x17000000, OP_C3X ), 1055a5a4af3bSchristos B_CLASS_INSN( "subf", 0x17800000, OP_C3X ), 1056a5a4af3bSchristos S_CLASS_INSN( "subf", 0x06800000, OP_C3X ), 1057a5a4af3bSchristos Q_CLASS_INSN( "subf", "stf", 0xea000000, OP_C3X ), 1058a5a4af3bSchristos A_CLASS_INSN( "subi", 0x18000000, OP_C3X ), 1059a5a4af3bSchristos T_CLASS_INSN( "subi", 0x07000000, OP_C3X ), 1060a5a4af3bSchristos Q_CLASS_INSN( "subi", "sti", 0xec000000, OP_C3X ), 1061a5a4af3bSchristos A_CLASS_INSN( "subrb", 0x18800000, OP_C3X ), 1062a5a4af3bSchristos B_CLASS_INSN( "subrf", 0x19000000, OP_C3X ), 1063a5a4af3bSchristos A_CLASS_INSN( "subri", 0x19800000, OP_C3X ), 1064a5a4af3bSchristos { "swi", 0x66000000, 0xffffffff, "" , OP_C3X }, /* Z_CLASS */ 1065a5a4af3bSchristos B_CLASS_INSN( "toieee", 0x1b800000, OP_C4X ), 1066a5a4af3bSchristos P_CLASS_INSN( "toieee","stf", 0xf0000000, OP_C4X ), 1067a5a4af3bSchristos { "trapB", 0x74000000, 0xffe00000, "V" , OP_C3X }, /* Z_CLASS */ 1068a5a4af3bSchristos { "trap", 0x74000000, 0xffe00000, "V" , OP_C3X }, /* Z_CLASS - Alias for trapu */ 1069a5a4af3bSchristos AU_CLASS_INSN( "tstb", 0x1a000000, OP_C3X ), 1070a5a4af3bSchristos T2C_CLASS_INSN("tstb", 0x07800000, OP_C3X ), 1071a5a4af3bSchristos AU_CLASS_INSN( "xor", 0x1a800000, OP_C3X ), 1072a5a4af3bSchristos TC_CLASS_INSN( "xor", 0x08000000, OP_C3X ), 1073a5a4af3bSchristos QC_CLASS_INSN( "xor", "sti", 0xee000000, OP_C3X ), 1074a5a4af3bSchristos 1075a5a4af3bSchristos /* Dummy entry, not included in tic4x_num_insts. This 1076a5a4af3bSchristos lets code examine entry i + 1 without checking 1077a5a4af3bSchristos if we've run off the end of the table. */ 1078a5a4af3bSchristos { "", 0x0, 0x00, "", 0 } 1079a5a4af3bSchristos }; 1080a5a4af3bSchristos 1081a5a4af3bSchristos const unsigned int tic4x_num_insts = (((sizeof tic4x_insts) / (sizeof tic4x_insts[0])) - 1); 1082