1a2e2270fSchristos /* TILE-Gx opcode information. 2a2e2270fSchristos * 3*aab831ceSchristos * Copyright (C) 2011-2024 Free Software Foundation, Inc. 4a2e2270fSchristos * 5a2e2270fSchristos * This program is free software; you can redistribute it and/or modify 6a2e2270fSchristos * it under the terms of the GNU General Public License as published by 7a2e2270fSchristos * the Free Software Foundation; either version 3 of the License, or 8a2e2270fSchristos * (at your option) any later version. 9a2e2270fSchristos * 10a2e2270fSchristos * This program is distributed in the hope that it will be useful, 11a2e2270fSchristos * but WITHOUT ANY WARRANTY; without even the implied warranty of 12a2e2270fSchristos * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13a2e2270fSchristos * GNU General Public License for more details. 14a2e2270fSchristos * 15a2e2270fSchristos * You should have received a copy of the GNU General Public License 16a2e2270fSchristos * along with this program; if not, write to the Free Software 17a2e2270fSchristos * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 18a2e2270fSchristos * MA 02110-1301, USA. 19a2e2270fSchristos */ 20a2e2270fSchristos 21a2e2270fSchristos #ifndef opcode_tile_h 22a2e2270fSchristos #define opcode_tile_h 23a2e2270fSchristos 24212397c6Schristos #ifdef __cplusplus 25212397c6Schristos extern "C" { 26212397c6Schristos #endif 27212397c6Schristos 28a2e2270fSchristos typedef unsigned long long tilegx_bundle_bits; 29a2e2270fSchristos 30a2e2270fSchristos 31a2e2270fSchristos enum 32a2e2270fSchristos { 33a2e2270fSchristos TILEGX_MAX_OPERANDS = 4 /* bfexts */ 34a2e2270fSchristos }; 35a2e2270fSchristos 36a2e2270fSchristos typedef enum 37a2e2270fSchristos { 38a2e2270fSchristos TILEGX_OPC_BPT, 39a2e2270fSchristos TILEGX_OPC_INFO, 40a2e2270fSchristos TILEGX_OPC_INFOL, 41a2e2270fSchristos TILEGX_OPC_LD4S_TLS, 42a2e2270fSchristos TILEGX_OPC_LD_TLS, 43a2e2270fSchristos TILEGX_OPC_MOVE, 44a2e2270fSchristos TILEGX_OPC_MOVEI, 45a2e2270fSchristos TILEGX_OPC_MOVELI, 46a2e2270fSchristos TILEGX_OPC_PREFETCH, 47a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L1, 48a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L1_FAULT, 49a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L2, 50a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L2_FAULT, 51a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L3, 52a2e2270fSchristos TILEGX_OPC_PREFETCH_ADD_L3_FAULT, 53a2e2270fSchristos TILEGX_OPC_PREFETCH_L1, 54a2e2270fSchristos TILEGX_OPC_PREFETCH_L1_FAULT, 55a2e2270fSchristos TILEGX_OPC_PREFETCH_L2, 56a2e2270fSchristos TILEGX_OPC_PREFETCH_L2_FAULT, 57a2e2270fSchristos TILEGX_OPC_PREFETCH_L3, 58a2e2270fSchristos TILEGX_OPC_PREFETCH_L3_FAULT, 59a2e2270fSchristos TILEGX_OPC_RAISE, 60a2e2270fSchristos TILEGX_OPC_ADD, 61a2e2270fSchristos TILEGX_OPC_ADDI, 62a2e2270fSchristos TILEGX_OPC_ADDLI, 63a2e2270fSchristos TILEGX_OPC_ADDX, 64a2e2270fSchristos TILEGX_OPC_ADDXI, 65a2e2270fSchristos TILEGX_OPC_ADDXLI, 66a2e2270fSchristos TILEGX_OPC_ADDXSC, 67a2e2270fSchristos TILEGX_OPC_AND, 68a2e2270fSchristos TILEGX_OPC_ANDI, 69a2e2270fSchristos TILEGX_OPC_BEQZ, 70a2e2270fSchristos TILEGX_OPC_BEQZT, 71a2e2270fSchristos TILEGX_OPC_BFEXTS, 72a2e2270fSchristos TILEGX_OPC_BFEXTU, 73a2e2270fSchristos TILEGX_OPC_BFINS, 74a2e2270fSchristos TILEGX_OPC_BGEZ, 75a2e2270fSchristos TILEGX_OPC_BGEZT, 76a2e2270fSchristos TILEGX_OPC_BGTZ, 77a2e2270fSchristos TILEGX_OPC_BGTZT, 78a2e2270fSchristos TILEGX_OPC_BLBC, 79a2e2270fSchristos TILEGX_OPC_BLBCT, 80a2e2270fSchristos TILEGX_OPC_BLBS, 81a2e2270fSchristos TILEGX_OPC_BLBST, 82a2e2270fSchristos TILEGX_OPC_BLEZ, 83a2e2270fSchristos TILEGX_OPC_BLEZT, 84a2e2270fSchristos TILEGX_OPC_BLTZ, 85a2e2270fSchristos TILEGX_OPC_BLTZT, 86a2e2270fSchristos TILEGX_OPC_BNEZ, 87a2e2270fSchristos TILEGX_OPC_BNEZT, 88a2e2270fSchristos TILEGX_OPC_CLZ, 89a2e2270fSchristos TILEGX_OPC_CMOVEQZ, 90a2e2270fSchristos TILEGX_OPC_CMOVNEZ, 91a2e2270fSchristos TILEGX_OPC_CMPEQ, 92a2e2270fSchristos TILEGX_OPC_CMPEQI, 93a2e2270fSchristos TILEGX_OPC_CMPEXCH, 94a2e2270fSchristos TILEGX_OPC_CMPEXCH4, 95a2e2270fSchristos TILEGX_OPC_CMPLES, 96a2e2270fSchristos TILEGX_OPC_CMPLEU, 97a2e2270fSchristos TILEGX_OPC_CMPLTS, 98a2e2270fSchristos TILEGX_OPC_CMPLTSI, 99a2e2270fSchristos TILEGX_OPC_CMPLTU, 100a2e2270fSchristos TILEGX_OPC_CMPLTUI, 101a2e2270fSchristos TILEGX_OPC_CMPNE, 102a2e2270fSchristos TILEGX_OPC_CMUL, 103a2e2270fSchristos TILEGX_OPC_CMULA, 104a2e2270fSchristos TILEGX_OPC_CMULAF, 105a2e2270fSchristos TILEGX_OPC_CMULF, 106a2e2270fSchristos TILEGX_OPC_CMULFR, 107a2e2270fSchristos TILEGX_OPC_CMULH, 108a2e2270fSchristos TILEGX_OPC_CMULHR, 109a2e2270fSchristos TILEGX_OPC_CRC32_32, 110a2e2270fSchristos TILEGX_OPC_CRC32_8, 111a2e2270fSchristos TILEGX_OPC_CTZ, 112a2e2270fSchristos TILEGX_OPC_DBLALIGN, 113a2e2270fSchristos TILEGX_OPC_DBLALIGN2, 114a2e2270fSchristos TILEGX_OPC_DBLALIGN4, 115a2e2270fSchristos TILEGX_OPC_DBLALIGN6, 116a2e2270fSchristos TILEGX_OPC_DRAIN, 117a2e2270fSchristos TILEGX_OPC_DTLBPR, 118a2e2270fSchristos TILEGX_OPC_EXCH, 119a2e2270fSchristos TILEGX_OPC_EXCH4, 120a2e2270fSchristos TILEGX_OPC_FDOUBLE_ADD_FLAGS, 121a2e2270fSchristos TILEGX_OPC_FDOUBLE_ADDSUB, 122a2e2270fSchristos TILEGX_OPC_FDOUBLE_MUL_FLAGS, 123a2e2270fSchristos TILEGX_OPC_FDOUBLE_PACK1, 124a2e2270fSchristos TILEGX_OPC_FDOUBLE_PACK2, 125a2e2270fSchristos TILEGX_OPC_FDOUBLE_SUB_FLAGS, 126a2e2270fSchristos TILEGX_OPC_FDOUBLE_UNPACK_MAX, 127a2e2270fSchristos TILEGX_OPC_FDOUBLE_UNPACK_MIN, 128a2e2270fSchristos TILEGX_OPC_FETCHADD, 129a2e2270fSchristos TILEGX_OPC_FETCHADD4, 130a2e2270fSchristos TILEGX_OPC_FETCHADDGEZ, 131a2e2270fSchristos TILEGX_OPC_FETCHADDGEZ4, 132a2e2270fSchristos TILEGX_OPC_FETCHAND, 133a2e2270fSchristos TILEGX_OPC_FETCHAND4, 134a2e2270fSchristos TILEGX_OPC_FETCHOR, 135a2e2270fSchristos TILEGX_OPC_FETCHOR4, 136a2e2270fSchristos TILEGX_OPC_FINV, 137a2e2270fSchristos TILEGX_OPC_FLUSH, 138a2e2270fSchristos TILEGX_OPC_FLUSHWB, 139a2e2270fSchristos TILEGX_OPC_FNOP, 140a2e2270fSchristos TILEGX_OPC_FSINGLE_ADD1, 141a2e2270fSchristos TILEGX_OPC_FSINGLE_ADDSUB2, 142a2e2270fSchristos TILEGX_OPC_FSINGLE_MUL1, 143a2e2270fSchristos TILEGX_OPC_FSINGLE_MUL2, 144a2e2270fSchristos TILEGX_OPC_FSINGLE_PACK1, 145a2e2270fSchristos TILEGX_OPC_FSINGLE_PACK2, 146a2e2270fSchristos TILEGX_OPC_FSINGLE_SUB1, 147a2e2270fSchristos TILEGX_OPC_ICOH, 148a2e2270fSchristos TILEGX_OPC_ILL, 149a2e2270fSchristos TILEGX_OPC_INV, 150a2e2270fSchristos TILEGX_OPC_IRET, 151a2e2270fSchristos TILEGX_OPC_J, 152a2e2270fSchristos TILEGX_OPC_JAL, 153a2e2270fSchristos TILEGX_OPC_JALR, 154a2e2270fSchristos TILEGX_OPC_JALRP, 155a2e2270fSchristos TILEGX_OPC_JR, 156a2e2270fSchristos TILEGX_OPC_JRP, 157a2e2270fSchristos TILEGX_OPC_LD, 158a2e2270fSchristos TILEGX_OPC_LD1S, 159a2e2270fSchristos TILEGX_OPC_LD1S_ADD, 160a2e2270fSchristos TILEGX_OPC_LD1U, 161a2e2270fSchristos TILEGX_OPC_LD1U_ADD, 162a2e2270fSchristos TILEGX_OPC_LD2S, 163a2e2270fSchristos TILEGX_OPC_LD2S_ADD, 164a2e2270fSchristos TILEGX_OPC_LD2U, 165a2e2270fSchristos TILEGX_OPC_LD2U_ADD, 166a2e2270fSchristos TILEGX_OPC_LD4S, 167a2e2270fSchristos TILEGX_OPC_LD4S_ADD, 168a2e2270fSchristos TILEGX_OPC_LD4U, 169a2e2270fSchristos TILEGX_OPC_LD4U_ADD, 170a2e2270fSchristos TILEGX_OPC_LD_ADD, 171a2e2270fSchristos TILEGX_OPC_LDNA, 172a2e2270fSchristos TILEGX_OPC_LDNA_ADD, 173a2e2270fSchristos TILEGX_OPC_LDNT, 174a2e2270fSchristos TILEGX_OPC_LDNT1S, 175a2e2270fSchristos TILEGX_OPC_LDNT1S_ADD, 176a2e2270fSchristos TILEGX_OPC_LDNT1U, 177a2e2270fSchristos TILEGX_OPC_LDNT1U_ADD, 178a2e2270fSchristos TILEGX_OPC_LDNT2S, 179a2e2270fSchristos TILEGX_OPC_LDNT2S_ADD, 180a2e2270fSchristos TILEGX_OPC_LDNT2U, 181a2e2270fSchristos TILEGX_OPC_LDNT2U_ADD, 182a2e2270fSchristos TILEGX_OPC_LDNT4S, 183a2e2270fSchristos TILEGX_OPC_LDNT4S_ADD, 184a2e2270fSchristos TILEGX_OPC_LDNT4U, 185a2e2270fSchristos TILEGX_OPC_LDNT4U_ADD, 186a2e2270fSchristos TILEGX_OPC_LDNT_ADD, 187a2e2270fSchristos TILEGX_OPC_LNK, 188a2e2270fSchristos TILEGX_OPC_MF, 189a2e2270fSchristos TILEGX_OPC_MFSPR, 190a2e2270fSchristos TILEGX_OPC_MM, 191a2e2270fSchristos TILEGX_OPC_MNZ, 192a2e2270fSchristos TILEGX_OPC_MTSPR, 193a2e2270fSchristos TILEGX_OPC_MUL_HS_HS, 194a2e2270fSchristos TILEGX_OPC_MUL_HS_HU, 195a2e2270fSchristos TILEGX_OPC_MUL_HS_LS, 196a2e2270fSchristos TILEGX_OPC_MUL_HS_LU, 197a2e2270fSchristos TILEGX_OPC_MUL_HU_HU, 198a2e2270fSchristos TILEGX_OPC_MUL_HU_LS, 199a2e2270fSchristos TILEGX_OPC_MUL_HU_LU, 200a2e2270fSchristos TILEGX_OPC_MUL_LS_LS, 201a2e2270fSchristos TILEGX_OPC_MUL_LS_LU, 202a2e2270fSchristos TILEGX_OPC_MUL_LU_LU, 203a2e2270fSchristos TILEGX_OPC_MULA_HS_HS, 204a2e2270fSchristos TILEGX_OPC_MULA_HS_HU, 205a2e2270fSchristos TILEGX_OPC_MULA_HS_LS, 206a2e2270fSchristos TILEGX_OPC_MULA_HS_LU, 207a2e2270fSchristos TILEGX_OPC_MULA_HU_HU, 208a2e2270fSchristos TILEGX_OPC_MULA_HU_LS, 209a2e2270fSchristos TILEGX_OPC_MULA_HU_LU, 210a2e2270fSchristos TILEGX_OPC_MULA_LS_LS, 211a2e2270fSchristos TILEGX_OPC_MULA_LS_LU, 212a2e2270fSchristos TILEGX_OPC_MULA_LU_LU, 213a2e2270fSchristos TILEGX_OPC_MULAX, 214a2e2270fSchristos TILEGX_OPC_MULX, 215a2e2270fSchristos TILEGX_OPC_MZ, 216a2e2270fSchristos TILEGX_OPC_NAP, 217a2e2270fSchristos TILEGX_OPC_NOP, 218a2e2270fSchristos TILEGX_OPC_NOR, 219a2e2270fSchristos TILEGX_OPC_OR, 220a2e2270fSchristos TILEGX_OPC_ORI, 221a2e2270fSchristos TILEGX_OPC_PCNT, 222a2e2270fSchristos TILEGX_OPC_REVBITS, 223a2e2270fSchristos TILEGX_OPC_REVBYTES, 224a2e2270fSchristos TILEGX_OPC_ROTL, 225a2e2270fSchristos TILEGX_OPC_ROTLI, 226a2e2270fSchristos TILEGX_OPC_SHL, 227a2e2270fSchristos TILEGX_OPC_SHL16INSLI, 228a2e2270fSchristos TILEGX_OPC_SHL1ADD, 229a2e2270fSchristos TILEGX_OPC_SHL1ADDX, 230a2e2270fSchristos TILEGX_OPC_SHL2ADD, 231a2e2270fSchristos TILEGX_OPC_SHL2ADDX, 232a2e2270fSchristos TILEGX_OPC_SHL3ADD, 233a2e2270fSchristos TILEGX_OPC_SHL3ADDX, 234a2e2270fSchristos TILEGX_OPC_SHLI, 235a2e2270fSchristos TILEGX_OPC_SHLX, 236a2e2270fSchristos TILEGX_OPC_SHLXI, 237a2e2270fSchristos TILEGX_OPC_SHRS, 238a2e2270fSchristos TILEGX_OPC_SHRSI, 239a2e2270fSchristos TILEGX_OPC_SHRU, 240a2e2270fSchristos TILEGX_OPC_SHRUI, 241a2e2270fSchristos TILEGX_OPC_SHRUX, 242a2e2270fSchristos TILEGX_OPC_SHRUXI, 243a2e2270fSchristos TILEGX_OPC_SHUFFLEBYTES, 244a2e2270fSchristos TILEGX_OPC_ST, 245a2e2270fSchristos TILEGX_OPC_ST1, 246a2e2270fSchristos TILEGX_OPC_ST1_ADD, 247a2e2270fSchristos TILEGX_OPC_ST2, 248a2e2270fSchristos TILEGX_OPC_ST2_ADD, 249a2e2270fSchristos TILEGX_OPC_ST4, 250a2e2270fSchristos TILEGX_OPC_ST4_ADD, 251a2e2270fSchristos TILEGX_OPC_ST_ADD, 252a2e2270fSchristos TILEGX_OPC_STNT, 253a2e2270fSchristos TILEGX_OPC_STNT1, 254a2e2270fSchristos TILEGX_OPC_STNT1_ADD, 255a2e2270fSchristos TILEGX_OPC_STNT2, 256a2e2270fSchristos TILEGX_OPC_STNT2_ADD, 257a2e2270fSchristos TILEGX_OPC_STNT4, 258a2e2270fSchristos TILEGX_OPC_STNT4_ADD, 259a2e2270fSchristos TILEGX_OPC_STNT_ADD, 260a2e2270fSchristos TILEGX_OPC_SUB, 261a2e2270fSchristos TILEGX_OPC_SUBX, 262a2e2270fSchristos TILEGX_OPC_SUBXSC, 263a2e2270fSchristos TILEGX_OPC_SWINT0, 264a2e2270fSchristos TILEGX_OPC_SWINT1, 265a2e2270fSchristos TILEGX_OPC_SWINT2, 266a2e2270fSchristos TILEGX_OPC_SWINT3, 267a2e2270fSchristos TILEGX_OPC_TBLIDXB0, 268a2e2270fSchristos TILEGX_OPC_TBLIDXB1, 269a2e2270fSchristos TILEGX_OPC_TBLIDXB2, 270a2e2270fSchristos TILEGX_OPC_TBLIDXB3, 271a2e2270fSchristos TILEGX_OPC_V1ADD, 272a2e2270fSchristos TILEGX_OPC_V1ADDI, 273a2e2270fSchristos TILEGX_OPC_V1ADDUC, 274a2e2270fSchristos TILEGX_OPC_V1ADIFFU, 275a2e2270fSchristos TILEGX_OPC_V1AVGU, 276a2e2270fSchristos TILEGX_OPC_V1CMPEQ, 277a2e2270fSchristos TILEGX_OPC_V1CMPEQI, 278a2e2270fSchristos TILEGX_OPC_V1CMPLES, 279a2e2270fSchristos TILEGX_OPC_V1CMPLEU, 280a2e2270fSchristos TILEGX_OPC_V1CMPLTS, 281a2e2270fSchristos TILEGX_OPC_V1CMPLTSI, 282a2e2270fSchristos TILEGX_OPC_V1CMPLTU, 283a2e2270fSchristos TILEGX_OPC_V1CMPLTUI, 284a2e2270fSchristos TILEGX_OPC_V1CMPNE, 285a2e2270fSchristos TILEGX_OPC_V1DDOTPU, 286a2e2270fSchristos TILEGX_OPC_V1DDOTPUA, 287a2e2270fSchristos TILEGX_OPC_V1DDOTPUS, 288a2e2270fSchristos TILEGX_OPC_V1DDOTPUSA, 289a2e2270fSchristos TILEGX_OPC_V1DOTP, 290a2e2270fSchristos TILEGX_OPC_V1DOTPA, 291a2e2270fSchristos TILEGX_OPC_V1DOTPU, 292a2e2270fSchristos TILEGX_OPC_V1DOTPUA, 293a2e2270fSchristos TILEGX_OPC_V1DOTPUS, 294a2e2270fSchristos TILEGX_OPC_V1DOTPUSA, 295a2e2270fSchristos TILEGX_OPC_V1INT_H, 296a2e2270fSchristos TILEGX_OPC_V1INT_L, 297a2e2270fSchristos TILEGX_OPC_V1MAXU, 298a2e2270fSchristos TILEGX_OPC_V1MAXUI, 299a2e2270fSchristos TILEGX_OPC_V1MINU, 300a2e2270fSchristos TILEGX_OPC_V1MINUI, 301a2e2270fSchristos TILEGX_OPC_V1MNZ, 302a2e2270fSchristos TILEGX_OPC_V1MULTU, 303a2e2270fSchristos TILEGX_OPC_V1MULU, 304a2e2270fSchristos TILEGX_OPC_V1MULUS, 305a2e2270fSchristos TILEGX_OPC_V1MZ, 306a2e2270fSchristos TILEGX_OPC_V1SADAU, 307a2e2270fSchristos TILEGX_OPC_V1SADU, 308a2e2270fSchristos TILEGX_OPC_V1SHL, 309a2e2270fSchristos TILEGX_OPC_V1SHLI, 310a2e2270fSchristos TILEGX_OPC_V1SHRS, 311a2e2270fSchristos TILEGX_OPC_V1SHRSI, 312a2e2270fSchristos TILEGX_OPC_V1SHRU, 313a2e2270fSchristos TILEGX_OPC_V1SHRUI, 314a2e2270fSchristos TILEGX_OPC_V1SUB, 315a2e2270fSchristos TILEGX_OPC_V1SUBUC, 316a2e2270fSchristos TILEGX_OPC_V2ADD, 317a2e2270fSchristos TILEGX_OPC_V2ADDI, 318a2e2270fSchristos TILEGX_OPC_V2ADDSC, 319a2e2270fSchristos TILEGX_OPC_V2ADIFFS, 320a2e2270fSchristos TILEGX_OPC_V2AVGS, 321a2e2270fSchristos TILEGX_OPC_V2CMPEQ, 322a2e2270fSchristos TILEGX_OPC_V2CMPEQI, 323a2e2270fSchristos TILEGX_OPC_V2CMPLES, 324a2e2270fSchristos TILEGX_OPC_V2CMPLEU, 325a2e2270fSchristos TILEGX_OPC_V2CMPLTS, 326a2e2270fSchristos TILEGX_OPC_V2CMPLTSI, 327a2e2270fSchristos TILEGX_OPC_V2CMPLTU, 328a2e2270fSchristos TILEGX_OPC_V2CMPLTUI, 329a2e2270fSchristos TILEGX_OPC_V2CMPNE, 330a2e2270fSchristos TILEGX_OPC_V2DOTP, 331a2e2270fSchristos TILEGX_OPC_V2DOTPA, 332a2e2270fSchristos TILEGX_OPC_V2INT_H, 333a2e2270fSchristos TILEGX_OPC_V2INT_L, 334a2e2270fSchristos TILEGX_OPC_V2MAXS, 335a2e2270fSchristos TILEGX_OPC_V2MAXSI, 336a2e2270fSchristos TILEGX_OPC_V2MINS, 337a2e2270fSchristos TILEGX_OPC_V2MINSI, 338a2e2270fSchristos TILEGX_OPC_V2MNZ, 339a2e2270fSchristos TILEGX_OPC_V2MULFSC, 340a2e2270fSchristos TILEGX_OPC_V2MULS, 341a2e2270fSchristos TILEGX_OPC_V2MULTS, 342a2e2270fSchristos TILEGX_OPC_V2MZ, 343a2e2270fSchristos TILEGX_OPC_V2PACKH, 344a2e2270fSchristos TILEGX_OPC_V2PACKL, 345a2e2270fSchristos TILEGX_OPC_V2PACKUC, 346a2e2270fSchristos TILEGX_OPC_V2SADAS, 347a2e2270fSchristos TILEGX_OPC_V2SADAU, 348a2e2270fSchristos TILEGX_OPC_V2SADS, 349a2e2270fSchristos TILEGX_OPC_V2SADU, 350a2e2270fSchristos TILEGX_OPC_V2SHL, 351a2e2270fSchristos TILEGX_OPC_V2SHLI, 352a2e2270fSchristos TILEGX_OPC_V2SHLSC, 353a2e2270fSchristos TILEGX_OPC_V2SHRS, 354a2e2270fSchristos TILEGX_OPC_V2SHRSI, 355a2e2270fSchristos TILEGX_OPC_V2SHRU, 356a2e2270fSchristos TILEGX_OPC_V2SHRUI, 357a2e2270fSchristos TILEGX_OPC_V2SUB, 358a2e2270fSchristos TILEGX_OPC_V2SUBSC, 359a2e2270fSchristos TILEGX_OPC_V4ADD, 360a2e2270fSchristos TILEGX_OPC_V4ADDSC, 361a2e2270fSchristos TILEGX_OPC_V4INT_H, 362a2e2270fSchristos TILEGX_OPC_V4INT_L, 363a2e2270fSchristos TILEGX_OPC_V4PACKSC, 364a2e2270fSchristos TILEGX_OPC_V4SHL, 365a2e2270fSchristos TILEGX_OPC_V4SHLSC, 366a2e2270fSchristos TILEGX_OPC_V4SHRS, 367a2e2270fSchristos TILEGX_OPC_V4SHRU, 368a2e2270fSchristos TILEGX_OPC_V4SUB, 369a2e2270fSchristos TILEGX_OPC_V4SUBSC, 370a2e2270fSchristos TILEGX_OPC_WH64, 371a2e2270fSchristos TILEGX_OPC_XOR, 372a2e2270fSchristos TILEGX_OPC_XORI, 373a2e2270fSchristos TILEGX_OPC_NONE 374a2e2270fSchristos } tilegx_mnemonic; 375a2e2270fSchristos 376a2e2270fSchristos /* 64-bit pattern for a { bpt ; nop } bundle. */ 377a2e2270fSchristos #define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL 378a2e2270fSchristos 379a2e2270fSchristos 380a2e2270fSchristos 381a2e2270fSchristos static __inline unsigned int 382a2e2270fSchristos get_BFEnd_X0(tilegx_bundle_bits num) 383a2e2270fSchristos { 384a2e2270fSchristos const unsigned int n = (unsigned int)num; 385a2e2270fSchristos return (((n >> 12)) & 0x3f); 386a2e2270fSchristos } 387a2e2270fSchristos 388a2e2270fSchristos static __inline unsigned int 389a2e2270fSchristos get_BFOpcodeExtension_X0(tilegx_bundle_bits num) 390a2e2270fSchristos { 391a2e2270fSchristos const unsigned int n = (unsigned int)num; 392a2e2270fSchristos return (((n >> 24)) & 0xf); 393a2e2270fSchristos } 394a2e2270fSchristos 395a2e2270fSchristos static __inline unsigned int 396a2e2270fSchristos get_BFStart_X0(tilegx_bundle_bits num) 397a2e2270fSchristos { 398a2e2270fSchristos const unsigned int n = (unsigned int)num; 399a2e2270fSchristos return (((n >> 18)) & 0x3f); 400a2e2270fSchristos } 401a2e2270fSchristos 402a2e2270fSchristos static __inline unsigned int 403a2e2270fSchristos get_BrOff_X1(tilegx_bundle_bits n) 404a2e2270fSchristos { 405a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x0000003f) | 406a2e2270fSchristos (((unsigned int)(n >> 37)) & 0x0001ffc0); 407a2e2270fSchristos } 408a2e2270fSchristos 409a2e2270fSchristos static __inline unsigned int 410a2e2270fSchristos get_BrType_X1(tilegx_bundle_bits n) 411a2e2270fSchristos { 412a2e2270fSchristos return (((unsigned int)(n >> 54)) & 0x1f); 413a2e2270fSchristos } 414a2e2270fSchristos 415a2e2270fSchristos static __inline unsigned int 416a2e2270fSchristos get_Dest_Imm8_X1(tilegx_bundle_bits n) 417a2e2270fSchristos { 418a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x0000003f) | 419a2e2270fSchristos (((unsigned int)(n >> 43)) & 0x000000c0); 420a2e2270fSchristos } 421a2e2270fSchristos 422a2e2270fSchristos static __inline unsigned int 423a2e2270fSchristos get_Dest_X0(tilegx_bundle_bits num) 424a2e2270fSchristos { 425a2e2270fSchristos const unsigned int n = (unsigned int)num; 426a2e2270fSchristos return (((n >> 0)) & 0x3f); 427a2e2270fSchristos } 428a2e2270fSchristos 429a2e2270fSchristos static __inline unsigned int 430a2e2270fSchristos get_Dest_X1(tilegx_bundle_bits n) 431a2e2270fSchristos { 432a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x3f); 433a2e2270fSchristos } 434a2e2270fSchristos 435a2e2270fSchristos static __inline unsigned int 436a2e2270fSchristos get_Dest_Y0(tilegx_bundle_bits num) 437a2e2270fSchristos { 438a2e2270fSchristos const unsigned int n = (unsigned int)num; 439a2e2270fSchristos return (((n >> 0)) & 0x3f); 440a2e2270fSchristos } 441a2e2270fSchristos 442a2e2270fSchristos static __inline unsigned int 443a2e2270fSchristos get_Dest_Y1(tilegx_bundle_bits n) 444a2e2270fSchristos { 445a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x3f); 446a2e2270fSchristos } 447a2e2270fSchristos 448a2e2270fSchristos static __inline unsigned int 449a2e2270fSchristos get_Imm16_X0(tilegx_bundle_bits num) 450a2e2270fSchristos { 451a2e2270fSchristos const unsigned int n = (unsigned int)num; 452a2e2270fSchristos return (((n >> 12)) & 0xffff); 453a2e2270fSchristos } 454a2e2270fSchristos 455a2e2270fSchristos static __inline unsigned int 456a2e2270fSchristos get_Imm16_X1(tilegx_bundle_bits n) 457a2e2270fSchristos { 458a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0xffff); 459a2e2270fSchristos } 460a2e2270fSchristos 461a2e2270fSchristos static __inline unsigned int 462a2e2270fSchristos get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num) 463a2e2270fSchristos { 464a2e2270fSchristos const unsigned int n = (unsigned int)num; 465a2e2270fSchristos return (((n >> 20)) & 0xff); 466a2e2270fSchristos } 467a2e2270fSchristos 468a2e2270fSchristos static __inline unsigned int 469a2e2270fSchristos get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n) 470a2e2270fSchristos { 471a2e2270fSchristos return (((unsigned int)(n >> 51)) & 0xff); 472a2e2270fSchristos } 473a2e2270fSchristos 474a2e2270fSchristos static __inline unsigned int 475a2e2270fSchristos get_Imm8_X0(tilegx_bundle_bits num) 476a2e2270fSchristos { 477a2e2270fSchristos const unsigned int n = (unsigned int)num; 478a2e2270fSchristos return (((n >> 12)) & 0xff); 479a2e2270fSchristos } 480a2e2270fSchristos 481a2e2270fSchristos static __inline unsigned int 482a2e2270fSchristos get_Imm8_X1(tilegx_bundle_bits n) 483a2e2270fSchristos { 484a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0xff); 485a2e2270fSchristos } 486a2e2270fSchristos 487a2e2270fSchristos static __inline unsigned int 488a2e2270fSchristos get_Imm8_Y0(tilegx_bundle_bits num) 489a2e2270fSchristos { 490a2e2270fSchristos const unsigned int n = (unsigned int)num; 491a2e2270fSchristos return (((n >> 12)) & 0xff); 492a2e2270fSchristos } 493a2e2270fSchristos 494a2e2270fSchristos static __inline unsigned int 495a2e2270fSchristos get_Imm8_Y1(tilegx_bundle_bits n) 496a2e2270fSchristos { 497a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0xff); 498a2e2270fSchristos } 499a2e2270fSchristos 500a2e2270fSchristos static __inline unsigned int 501a2e2270fSchristos get_JumpOff_X1(tilegx_bundle_bits n) 502a2e2270fSchristos { 503a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x7ffffff); 504a2e2270fSchristos } 505a2e2270fSchristos 506a2e2270fSchristos static __inline unsigned int 507a2e2270fSchristos get_JumpOpcodeExtension_X1(tilegx_bundle_bits n) 508a2e2270fSchristos { 509a2e2270fSchristos return (((unsigned int)(n >> 58)) & 0x1); 510a2e2270fSchristos } 511a2e2270fSchristos 512a2e2270fSchristos static __inline unsigned int 513a2e2270fSchristos get_MF_Imm14_X1(tilegx_bundle_bits n) 514a2e2270fSchristos { 515a2e2270fSchristos return (((unsigned int)(n >> 37)) & 0x3fff); 516a2e2270fSchristos } 517a2e2270fSchristos 518a2e2270fSchristos static __inline unsigned int 519a2e2270fSchristos get_MT_Imm14_X1(tilegx_bundle_bits n) 520a2e2270fSchristos { 521a2e2270fSchristos return (((unsigned int)(n >> 31)) & 0x0000003f) | 522a2e2270fSchristos (((unsigned int)(n >> 37)) & 0x00003fc0); 523a2e2270fSchristos } 524a2e2270fSchristos 525a2e2270fSchristos static __inline unsigned int 526a2e2270fSchristos get_Mode(tilegx_bundle_bits n) 527a2e2270fSchristos { 528a2e2270fSchristos return (((unsigned int)(n >> 62)) & 0x3); 529a2e2270fSchristos } 530a2e2270fSchristos 531a2e2270fSchristos static __inline unsigned int 532a2e2270fSchristos get_Opcode_X0(tilegx_bundle_bits num) 533a2e2270fSchristos { 534a2e2270fSchristos const unsigned int n = (unsigned int)num; 535a2e2270fSchristos return (((n >> 28)) & 0x7); 536a2e2270fSchristos } 537a2e2270fSchristos 538a2e2270fSchristos static __inline unsigned int 539a2e2270fSchristos get_Opcode_X1(tilegx_bundle_bits n) 540a2e2270fSchristos { 541a2e2270fSchristos return (((unsigned int)(n >> 59)) & 0x7); 542a2e2270fSchristos } 543a2e2270fSchristos 544a2e2270fSchristos static __inline unsigned int 545a2e2270fSchristos get_Opcode_Y0(tilegx_bundle_bits num) 546a2e2270fSchristos { 547a2e2270fSchristos const unsigned int n = (unsigned int)num; 548a2e2270fSchristos return (((n >> 27)) & 0xf); 549a2e2270fSchristos } 550a2e2270fSchristos 551a2e2270fSchristos static __inline unsigned int 552a2e2270fSchristos get_Opcode_Y1(tilegx_bundle_bits n) 553a2e2270fSchristos { 554a2e2270fSchristos return (((unsigned int)(n >> 58)) & 0xf); 555a2e2270fSchristos } 556a2e2270fSchristos 557a2e2270fSchristos static __inline unsigned int 558a2e2270fSchristos get_Opcode_Y2(tilegx_bundle_bits n) 559a2e2270fSchristos { 560a2e2270fSchristos return (((n >> 26)) & 0x00000001) | 561a2e2270fSchristos (((unsigned int)(n >> 56)) & 0x00000002); 562a2e2270fSchristos } 563a2e2270fSchristos 564a2e2270fSchristos static __inline unsigned int 565a2e2270fSchristos get_RRROpcodeExtension_X0(tilegx_bundle_bits num) 566a2e2270fSchristos { 567a2e2270fSchristos const unsigned int n = (unsigned int)num; 568a2e2270fSchristos return (((n >> 18)) & 0x3ff); 569a2e2270fSchristos } 570a2e2270fSchristos 571a2e2270fSchristos static __inline unsigned int 572a2e2270fSchristos get_RRROpcodeExtension_X1(tilegx_bundle_bits n) 573a2e2270fSchristos { 574a2e2270fSchristos return (((unsigned int)(n >> 49)) & 0x3ff); 575a2e2270fSchristos } 576a2e2270fSchristos 577a2e2270fSchristos static __inline unsigned int 578a2e2270fSchristos get_RRROpcodeExtension_Y0(tilegx_bundle_bits num) 579a2e2270fSchristos { 580a2e2270fSchristos const unsigned int n = (unsigned int)num; 581a2e2270fSchristos return (((n >> 18)) & 0x3); 582a2e2270fSchristos } 583a2e2270fSchristos 584a2e2270fSchristos static __inline unsigned int 585a2e2270fSchristos get_RRROpcodeExtension_Y1(tilegx_bundle_bits n) 586a2e2270fSchristos { 587a2e2270fSchristos return (((unsigned int)(n >> 49)) & 0x3); 588a2e2270fSchristos } 589a2e2270fSchristos 590a2e2270fSchristos static __inline unsigned int 591a2e2270fSchristos get_ShAmt_X0(tilegx_bundle_bits num) 592a2e2270fSchristos { 593a2e2270fSchristos const unsigned int n = (unsigned int)num; 594a2e2270fSchristos return (((n >> 12)) & 0x3f); 595a2e2270fSchristos } 596a2e2270fSchristos 597a2e2270fSchristos static __inline unsigned int 598a2e2270fSchristos get_ShAmt_X1(tilegx_bundle_bits n) 599a2e2270fSchristos { 600a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 601a2e2270fSchristos } 602a2e2270fSchristos 603a2e2270fSchristos static __inline unsigned int 604a2e2270fSchristos get_ShAmt_Y0(tilegx_bundle_bits num) 605a2e2270fSchristos { 606a2e2270fSchristos const unsigned int n = (unsigned int)num; 607a2e2270fSchristos return (((n >> 12)) & 0x3f); 608a2e2270fSchristos } 609a2e2270fSchristos 610a2e2270fSchristos static __inline unsigned int 611a2e2270fSchristos get_ShAmt_Y1(tilegx_bundle_bits n) 612a2e2270fSchristos { 613a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 614a2e2270fSchristos } 615a2e2270fSchristos 616a2e2270fSchristos static __inline unsigned int 617a2e2270fSchristos get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num) 618a2e2270fSchristos { 619a2e2270fSchristos const unsigned int n = (unsigned int)num; 620a2e2270fSchristos return (((n >> 18)) & 0x3ff); 621a2e2270fSchristos } 622a2e2270fSchristos 623a2e2270fSchristos static __inline unsigned int 624a2e2270fSchristos get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n) 625a2e2270fSchristos { 626a2e2270fSchristos return (((unsigned int)(n >> 49)) & 0x3ff); 627a2e2270fSchristos } 628a2e2270fSchristos 629a2e2270fSchristos static __inline unsigned int 630a2e2270fSchristos get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num) 631a2e2270fSchristos { 632a2e2270fSchristos const unsigned int n = (unsigned int)num; 633a2e2270fSchristos return (((n >> 18)) & 0x3); 634a2e2270fSchristos } 635a2e2270fSchristos 636a2e2270fSchristos static __inline unsigned int 637a2e2270fSchristos get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n) 638a2e2270fSchristos { 639a2e2270fSchristos return (((unsigned int)(n >> 49)) & 0x3); 640a2e2270fSchristos } 641a2e2270fSchristos 642a2e2270fSchristos static __inline unsigned int 643a2e2270fSchristos get_SrcA_X0(tilegx_bundle_bits num) 644a2e2270fSchristos { 645a2e2270fSchristos const unsigned int n = (unsigned int)num; 646a2e2270fSchristos return (((n >> 6)) & 0x3f); 647a2e2270fSchristos } 648a2e2270fSchristos 649a2e2270fSchristos static __inline unsigned int 650a2e2270fSchristos get_SrcA_X1(tilegx_bundle_bits n) 651a2e2270fSchristos { 652a2e2270fSchristos return (((unsigned int)(n >> 37)) & 0x3f); 653a2e2270fSchristos } 654a2e2270fSchristos 655a2e2270fSchristos static __inline unsigned int 656a2e2270fSchristos get_SrcA_Y0(tilegx_bundle_bits num) 657a2e2270fSchristos { 658a2e2270fSchristos const unsigned int n = (unsigned int)num; 659a2e2270fSchristos return (((n >> 6)) & 0x3f); 660a2e2270fSchristos } 661a2e2270fSchristos 662a2e2270fSchristos static __inline unsigned int 663a2e2270fSchristos get_SrcA_Y1(tilegx_bundle_bits n) 664a2e2270fSchristos { 665a2e2270fSchristos return (((unsigned int)(n >> 37)) & 0x3f); 666a2e2270fSchristos } 667a2e2270fSchristos 668a2e2270fSchristos static __inline unsigned int 669a2e2270fSchristos get_SrcA_Y2(tilegx_bundle_bits num) 670a2e2270fSchristos { 671a2e2270fSchristos const unsigned int n = (unsigned int)num; 672a2e2270fSchristos return (((n >> 20)) & 0x3f); 673a2e2270fSchristos } 674a2e2270fSchristos 675a2e2270fSchristos static __inline unsigned int 676a2e2270fSchristos get_SrcBDest_Y2(tilegx_bundle_bits n) 677a2e2270fSchristos { 678a2e2270fSchristos return (((unsigned int)(n >> 51)) & 0x3f); 679a2e2270fSchristos } 680a2e2270fSchristos 681a2e2270fSchristos static __inline unsigned int 682a2e2270fSchristos get_SrcB_X0(tilegx_bundle_bits num) 683a2e2270fSchristos { 684a2e2270fSchristos const unsigned int n = (unsigned int)num; 685a2e2270fSchristos return (((n >> 12)) & 0x3f); 686a2e2270fSchristos } 687a2e2270fSchristos 688a2e2270fSchristos static __inline unsigned int 689a2e2270fSchristos get_SrcB_X1(tilegx_bundle_bits n) 690a2e2270fSchristos { 691a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 692a2e2270fSchristos } 693a2e2270fSchristos 694a2e2270fSchristos static __inline unsigned int 695a2e2270fSchristos get_SrcB_Y0(tilegx_bundle_bits num) 696a2e2270fSchristos { 697a2e2270fSchristos const unsigned int n = (unsigned int)num; 698a2e2270fSchristos return (((n >> 12)) & 0x3f); 699a2e2270fSchristos } 700a2e2270fSchristos 701a2e2270fSchristos static __inline unsigned int 702a2e2270fSchristos get_SrcB_Y1(tilegx_bundle_bits n) 703a2e2270fSchristos { 704a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 705a2e2270fSchristos } 706a2e2270fSchristos 707a2e2270fSchristos static __inline unsigned int 708a2e2270fSchristos get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num) 709a2e2270fSchristos { 710a2e2270fSchristos const unsigned int n = (unsigned int)num; 711a2e2270fSchristos return (((n >> 12)) & 0x3f); 712a2e2270fSchristos } 713a2e2270fSchristos 714a2e2270fSchristos static __inline unsigned int 715a2e2270fSchristos get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n) 716a2e2270fSchristos { 717a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 718a2e2270fSchristos } 719a2e2270fSchristos 720a2e2270fSchristos static __inline unsigned int 721a2e2270fSchristos get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num) 722a2e2270fSchristos { 723a2e2270fSchristos const unsigned int n = (unsigned int)num; 724a2e2270fSchristos return (((n >> 12)) & 0x3f); 725a2e2270fSchristos } 726a2e2270fSchristos 727a2e2270fSchristos static __inline unsigned int 728a2e2270fSchristos get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n) 729a2e2270fSchristos { 730a2e2270fSchristos return (((unsigned int)(n >> 43)) & 0x3f); 731a2e2270fSchristos } 732a2e2270fSchristos 733a2e2270fSchristos 734a2e2270fSchristos static __inline int 735a2e2270fSchristos sign_extend(int n, int num_bits) 736a2e2270fSchristos { 737a2e2270fSchristos int shift = (int)(sizeof(int) * 8 - num_bits); 738a2e2270fSchristos return (n << shift) >> shift; 739a2e2270fSchristos } 740a2e2270fSchristos 741a2e2270fSchristos 742a2e2270fSchristos 743a2e2270fSchristos static __inline tilegx_bundle_bits 744a2e2270fSchristos create_BFEnd_X0(int num) 745a2e2270fSchristos { 746a2e2270fSchristos const unsigned int n = (unsigned int)num; 747a2e2270fSchristos return ((n & 0x3f) << 12); 748a2e2270fSchristos } 749a2e2270fSchristos 750a2e2270fSchristos static __inline tilegx_bundle_bits 751a2e2270fSchristos create_BFOpcodeExtension_X0(int num) 752a2e2270fSchristos { 753a2e2270fSchristos const unsigned int n = (unsigned int)num; 754a2e2270fSchristos return ((n & 0xf) << 24); 755a2e2270fSchristos } 756a2e2270fSchristos 757a2e2270fSchristos static __inline tilegx_bundle_bits 758a2e2270fSchristos create_BFStart_X0(int num) 759a2e2270fSchristos { 760a2e2270fSchristos const unsigned int n = (unsigned int)num; 761a2e2270fSchristos return ((n & 0x3f) << 18); 762a2e2270fSchristos } 763a2e2270fSchristos 764a2e2270fSchristos static __inline tilegx_bundle_bits 765a2e2270fSchristos create_BrOff_X1(int num) 766a2e2270fSchristos { 767a2e2270fSchristos const unsigned int n = (unsigned int)num; 768a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | 769a2e2270fSchristos (((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37); 770a2e2270fSchristos } 771a2e2270fSchristos 772a2e2270fSchristos static __inline tilegx_bundle_bits 773a2e2270fSchristos create_BrType_X1(int num) 774a2e2270fSchristos { 775a2e2270fSchristos const unsigned int n = (unsigned int)num; 776a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x1f)) << 54); 777a2e2270fSchristos } 778a2e2270fSchristos 779a2e2270fSchristos static __inline tilegx_bundle_bits 780a2e2270fSchristos create_Dest_Imm8_X1(int num) 781a2e2270fSchristos { 782a2e2270fSchristos const unsigned int n = (unsigned int)num; 783a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | 784a2e2270fSchristos (((tilegx_bundle_bits)(n & 0x000000c0)) << 43); 785a2e2270fSchristos } 786a2e2270fSchristos 787a2e2270fSchristos static __inline tilegx_bundle_bits 788a2e2270fSchristos create_Dest_X0(int num) 789a2e2270fSchristos { 790a2e2270fSchristos const unsigned int n = (unsigned int)num; 791a2e2270fSchristos return ((n & 0x3f) << 0); 792a2e2270fSchristos } 793a2e2270fSchristos 794a2e2270fSchristos static __inline tilegx_bundle_bits 795a2e2270fSchristos create_Dest_X1(int num) 796a2e2270fSchristos { 797a2e2270fSchristos const unsigned int n = (unsigned int)num; 798a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 31); 799a2e2270fSchristos } 800a2e2270fSchristos 801a2e2270fSchristos static __inline tilegx_bundle_bits 802a2e2270fSchristos create_Dest_Y0(int num) 803a2e2270fSchristos { 804a2e2270fSchristos const unsigned int n = (unsigned int)num; 805a2e2270fSchristos return ((n & 0x3f) << 0); 806a2e2270fSchristos } 807a2e2270fSchristos 808a2e2270fSchristos static __inline tilegx_bundle_bits 809a2e2270fSchristos create_Dest_Y1(int num) 810a2e2270fSchristos { 811a2e2270fSchristos const unsigned int n = (unsigned int)num; 812a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 31); 813a2e2270fSchristos } 814a2e2270fSchristos 815a2e2270fSchristos static __inline tilegx_bundle_bits 816a2e2270fSchristos create_Imm16_X0(int num) 817a2e2270fSchristos { 818a2e2270fSchristos const unsigned int n = (unsigned int)num; 819a2e2270fSchristos return ((n & 0xffff) << 12); 820a2e2270fSchristos } 821a2e2270fSchristos 822a2e2270fSchristos static __inline tilegx_bundle_bits 823a2e2270fSchristos create_Imm16_X1(int num) 824a2e2270fSchristos { 825a2e2270fSchristos const unsigned int n = (unsigned int)num; 826a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0xffff)) << 43); 827a2e2270fSchristos } 828a2e2270fSchristos 829a2e2270fSchristos static __inline tilegx_bundle_bits 830a2e2270fSchristos create_Imm8OpcodeExtension_X0(int num) 831a2e2270fSchristos { 832a2e2270fSchristos const unsigned int n = (unsigned int)num; 833a2e2270fSchristos return ((n & 0xff) << 20); 834a2e2270fSchristos } 835a2e2270fSchristos 836a2e2270fSchristos static __inline tilegx_bundle_bits 837a2e2270fSchristos create_Imm8OpcodeExtension_X1(int num) 838a2e2270fSchristos { 839a2e2270fSchristos const unsigned int n = (unsigned int)num; 840a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0xff)) << 51); 841a2e2270fSchristos } 842a2e2270fSchristos 843a2e2270fSchristos static __inline tilegx_bundle_bits 844a2e2270fSchristos create_Imm8_X0(int num) 845a2e2270fSchristos { 846a2e2270fSchristos const unsigned int n = (unsigned int)num; 847a2e2270fSchristos return ((n & 0xff) << 12); 848a2e2270fSchristos } 849a2e2270fSchristos 850a2e2270fSchristos static __inline tilegx_bundle_bits 851a2e2270fSchristos create_Imm8_X1(int num) 852a2e2270fSchristos { 853a2e2270fSchristos const unsigned int n = (unsigned int)num; 854a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0xff)) << 43); 855a2e2270fSchristos } 856a2e2270fSchristos 857a2e2270fSchristos static __inline tilegx_bundle_bits 858a2e2270fSchristos create_Imm8_Y0(int num) 859a2e2270fSchristos { 860a2e2270fSchristos const unsigned int n = (unsigned int)num; 861a2e2270fSchristos return ((n & 0xff) << 12); 862a2e2270fSchristos } 863a2e2270fSchristos 864a2e2270fSchristos static __inline tilegx_bundle_bits 865a2e2270fSchristos create_Imm8_Y1(int num) 866a2e2270fSchristos { 867a2e2270fSchristos const unsigned int n = (unsigned int)num; 868a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0xff)) << 43); 869a2e2270fSchristos } 870a2e2270fSchristos 871a2e2270fSchristos static __inline tilegx_bundle_bits 872a2e2270fSchristos create_JumpOff_X1(int num) 873a2e2270fSchristos { 874a2e2270fSchristos const unsigned int n = (unsigned int)num; 875a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31); 876a2e2270fSchristos } 877a2e2270fSchristos 878a2e2270fSchristos static __inline tilegx_bundle_bits 879a2e2270fSchristos create_JumpOpcodeExtension_X1(int num) 880a2e2270fSchristos { 881a2e2270fSchristos const unsigned int n = (unsigned int)num; 882a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x1)) << 58); 883a2e2270fSchristos } 884a2e2270fSchristos 885a2e2270fSchristos static __inline tilegx_bundle_bits 886a2e2270fSchristos create_MF_Imm14_X1(int num) 887a2e2270fSchristos { 888a2e2270fSchristos const unsigned int n = (unsigned int)num; 889a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3fff)) << 37); 890a2e2270fSchristos } 891a2e2270fSchristos 892a2e2270fSchristos static __inline tilegx_bundle_bits 893a2e2270fSchristos create_MT_Imm14_X1(int num) 894a2e2270fSchristos { 895a2e2270fSchristos const unsigned int n = (unsigned int)num; 896a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | 897a2e2270fSchristos (((tilegx_bundle_bits)(n & 0x00003fc0)) << 37); 898a2e2270fSchristos } 899a2e2270fSchristos 900a2e2270fSchristos static __inline tilegx_bundle_bits 901a2e2270fSchristos create_Mode(int num) 902a2e2270fSchristos { 903a2e2270fSchristos const unsigned int n = (unsigned int)num; 904a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3)) << 62); 905a2e2270fSchristos } 906a2e2270fSchristos 907a2e2270fSchristos static __inline tilegx_bundle_bits 908a2e2270fSchristos create_Opcode_X0(int num) 909a2e2270fSchristos { 910a2e2270fSchristos const unsigned int n = (unsigned int)num; 911a2e2270fSchristos return ((n & 0x7) << 28); 912a2e2270fSchristos } 913a2e2270fSchristos 914a2e2270fSchristos static __inline tilegx_bundle_bits 915a2e2270fSchristos create_Opcode_X1(int num) 916a2e2270fSchristos { 917a2e2270fSchristos const unsigned int n = (unsigned int)num; 918a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x7)) << 59); 919a2e2270fSchristos } 920a2e2270fSchristos 921a2e2270fSchristos static __inline tilegx_bundle_bits 922a2e2270fSchristos create_Opcode_Y0(int num) 923a2e2270fSchristos { 924a2e2270fSchristos const unsigned int n = (unsigned int)num; 925a2e2270fSchristos return ((n & 0xf) << 27); 926a2e2270fSchristos } 927a2e2270fSchristos 928a2e2270fSchristos static __inline tilegx_bundle_bits 929a2e2270fSchristos create_Opcode_Y1(int num) 930a2e2270fSchristos { 931a2e2270fSchristos const unsigned int n = (unsigned int)num; 932a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0xf)) << 58); 933a2e2270fSchristos } 934a2e2270fSchristos 935a2e2270fSchristos static __inline tilegx_bundle_bits 936a2e2270fSchristos create_Opcode_Y2(int num) 937a2e2270fSchristos { 938a2e2270fSchristos const unsigned int n = (unsigned int)num; 939a2e2270fSchristos return ((n & 0x00000001) << 26) | 940a2e2270fSchristos (((tilegx_bundle_bits)(n & 0x00000002)) << 56); 941a2e2270fSchristos } 942a2e2270fSchristos 943a2e2270fSchristos static __inline tilegx_bundle_bits 944a2e2270fSchristos create_RRROpcodeExtension_X0(int num) 945a2e2270fSchristos { 946a2e2270fSchristos const unsigned int n = (unsigned int)num; 947a2e2270fSchristos return ((n & 0x3ff) << 18); 948a2e2270fSchristos } 949a2e2270fSchristos 950a2e2270fSchristos static __inline tilegx_bundle_bits 951a2e2270fSchristos create_RRROpcodeExtension_X1(int num) 952a2e2270fSchristos { 953a2e2270fSchristos const unsigned int n = (unsigned int)num; 954a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3ff)) << 49); 955a2e2270fSchristos } 956a2e2270fSchristos 957a2e2270fSchristos static __inline tilegx_bundle_bits 958a2e2270fSchristos create_RRROpcodeExtension_Y0(int num) 959a2e2270fSchristos { 960a2e2270fSchristos const unsigned int n = (unsigned int)num; 961a2e2270fSchristos return ((n & 0x3) << 18); 962a2e2270fSchristos } 963a2e2270fSchristos 964a2e2270fSchristos static __inline tilegx_bundle_bits 965a2e2270fSchristos create_RRROpcodeExtension_Y1(int num) 966a2e2270fSchristos { 967a2e2270fSchristos const unsigned int n = (unsigned int)num; 968a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3)) << 49); 969a2e2270fSchristos } 970a2e2270fSchristos 971a2e2270fSchristos static __inline tilegx_bundle_bits 972a2e2270fSchristos create_ShAmt_X0(int num) 973a2e2270fSchristos { 974a2e2270fSchristos const unsigned int n = (unsigned int)num; 975a2e2270fSchristos return ((n & 0x3f) << 12); 976a2e2270fSchristos } 977a2e2270fSchristos 978a2e2270fSchristos static __inline tilegx_bundle_bits 979a2e2270fSchristos create_ShAmt_X1(int num) 980a2e2270fSchristos { 981a2e2270fSchristos const unsigned int n = (unsigned int)num; 982a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 983a2e2270fSchristos } 984a2e2270fSchristos 985a2e2270fSchristos static __inline tilegx_bundle_bits 986a2e2270fSchristos create_ShAmt_Y0(int num) 987a2e2270fSchristos { 988a2e2270fSchristos const unsigned int n = (unsigned int)num; 989a2e2270fSchristos return ((n & 0x3f) << 12); 990a2e2270fSchristos } 991a2e2270fSchristos 992a2e2270fSchristos static __inline tilegx_bundle_bits 993a2e2270fSchristos create_ShAmt_Y1(int num) 994a2e2270fSchristos { 995a2e2270fSchristos const unsigned int n = (unsigned int)num; 996a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 997a2e2270fSchristos } 998a2e2270fSchristos 999a2e2270fSchristos static __inline tilegx_bundle_bits 1000a2e2270fSchristos create_ShiftOpcodeExtension_X0(int num) 1001a2e2270fSchristos { 1002a2e2270fSchristos const unsigned int n = (unsigned int)num; 1003a2e2270fSchristos return ((n & 0x3ff) << 18); 1004a2e2270fSchristos } 1005a2e2270fSchristos 1006a2e2270fSchristos static __inline tilegx_bundle_bits 1007a2e2270fSchristos create_ShiftOpcodeExtension_X1(int num) 1008a2e2270fSchristos { 1009a2e2270fSchristos const unsigned int n = (unsigned int)num; 1010a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3ff)) << 49); 1011a2e2270fSchristos } 1012a2e2270fSchristos 1013a2e2270fSchristos static __inline tilegx_bundle_bits 1014a2e2270fSchristos create_ShiftOpcodeExtension_Y0(int num) 1015a2e2270fSchristos { 1016a2e2270fSchristos const unsigned int n = (unsigned int)num; 1017a2e2270fSchristos return ((n & 0x3) << 18); 1018a2e2270fSchristos } 1019a2e2270fSchristos 1020a2e2270fSchristos static __inline tilegx_bundle_bits 1021a2e2270fSchristos create_ShiftOpcodeExtension_Y1(int num) 1022a2e2270fSchristos { 1023a2e2270fSchristos const unsigned int n = (unsigned int)num; 1024a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3)) << 49); 1025a2e2270fSchristos } 1026a2e2270fSchristos 1027a2e2270fSchristos static __inline tilegx_bundle_bits 1028a2e2270fSchristos create_SrcA_X0(int num) 1029a2e2270fSchristos { 1030a2e2270fSchristos const unsigned int n = (unsigned int)num; 1031a2e2270fSchristos return ((n & 0x3f) << 6); 1032a2e2270fSchristos } 1033a2e2270fSchristos 1034a2e2270fSchristos static __inline tilegx_bundle_bits 1035a2e2270fSchristos create_SrcA_X1(int num) 1036a2e2270fSchristos { 1037a2e2270fSchristos const unsigned int n = (unsigned int)num; 1038a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 37); 1039a2e2270fSchristos } 1040a2e2270fSchristos 1041a2e2270fSchristos static __inline tilegx_bundle_bits 1042a2e2270fSchristos create_SrcA_Y0(int num) 1043a2e2270fSchristos { 1044a2e2270fSchristos const unsigned int n = (unsigned int)num; 1045a2e2270fSchristos return ((n & 0x3f) << 6); 1046a2e2270fSchristos } 1047a2e2270fSchristos 1048a2e2270fSchristos static __inline tilegx_bundle_bits 1049a2e2270fSchristos create_SrcA_Y1(int num) 1050a2e2270fSchristos { 1051a2e2270fSchristos const unsigned int n = (unsigned int)num; 1052a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 37); 1053a2e2270fSchristos } 1054a2e2270fSchristos 1055a2e2270fSchristos static __inline tilegx_bundle_bits 1056a2e2270fSchristos create_SrcA_Y2(int num) 1057a2e2270fSchristos { 1058a2e2270fSchristos const unsigned int n = (unsigned int)num; 1059a2e2270fSchristos return ((n & 0x3f) << 20); 1060a2e2270fSchristos } 1061a2e2270fSchristos 1062a2e2270fSchristos static __inline tilegx_bundle_bits 1063a2e2270fSchristos create_SrcBDest_Y2(int num) 1064a2e2270fSchristos { 1065a2e2270fSchristos const unsigned int n = (unsigned int)num; 1066a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 51); 1067a2e2270fSchristos } 1068a2e2270fSchristos 1069a2e2270fSchristos static __inline tilegx_bundle_bits 1070a2e2270fSchristos create_SrcB_X0(int num) 1071a2e2270fSchristos { 1072a2e2270fSchristos const unsigned int n = (unsigned int)num; 1073a2e2270fSchristos return ((n & 0x3f) << 12); 1074a2e2270fSchristos } 1075a2e2270fSchristos 1076a2e2270fSchristos static __inline tilegx_bundle_bits 1077a2e2270fSchristos create_SrcB_X1(int num) 1078a2e2270fSchristos { 1079a2e2270fSchristos const unsigned int n = (unsigned int)num; 1080a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 1081a2e2270fSchristos } 1082a2e2270fSchristos 1083a2e2270fSchristos static __inline tilegx_bundle_bits 1084a2e2270fSchristos create_SrcB_Y0(int num) 1085a2e2270fSchristos { 1086a2e2270fSchristos const unsigned int n = (unsigned int)num; 1087a2e2270fSchristos return ((n & 0x3f) << 12); 1088a2e2270fSchristos } 1089a2e2270fSchristos 1090a2e2270fSchristos static __inline tilegx_bundle_bits 1091a2e2270fSchristos create_SrcB_Y1(int num) 1092a2e2270fSchristos { 1093a2e2270fSchristos const unsigned int n = (unsigned int)num; 1094a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 1095a2e2270fSchristos } 1096a2e2270fSchristos 1097a2e2270fSchristos static __inline tilegx_bundle_bits 1098a2e2270fSchristos create_UnaryOpcodeExtension_X0(int num) 1099a2e2270fSchristos { 1100a2e2270fSchristos const unsigned int n = (unsigned int)num; 1101a2e2270fSchristos return ((n & 0x3f) << 12); 1102a2e2270fSchristos } 1103a2e2270fSchristos 1104a2e2270fSchristos static __inline tilegx_bundle_bits 1105a2e2270fSchristos create_UnaryOpcodeExtension_X1(int num) 1106a2e2270fSchristos { 1107a2e2270fSchristos const unsigned int n = (unsigned int)num; 1108a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 1109a2e2270fSchristos } 1110a2e2270fSchristos 1111a2e2270fSchristos static __inline tilegx_bundle_bits 1112a2e2270fSchristos create_UnaryOpcodeExtension_Y0(int num) 1113a2e2270fSchristos { 1114a2e2270fSchristos const unsigned int n = (unsigned int)num; 1115a2e2270fSchristos return ((n & 0x3f) << 12); 1116a2e2270fSchristos } 1117a2e2270fSchristos 1118a2e2270fSchristos static __inline tilegx_bundle_bits 1119a2e2270fSchristos create_UnaryOpcodeExtension_Y1(int num) 1120a2e2270fSchristos { 1121a2e2270fSchristos const unsigned int n = (unsigned int)num; 1122a2e2270fSchristos return (((tilegx_bundle_bits)(n & 0x3f)) << 43); 1123a2e2270fSchristos } 1124a2e2270fSchristos 1125a2e2270fSchristos 1126a2e2270fSchristos typedef enum 1127a2e2270fSchristos { 1128a2e2270fSchristos TILEGX_PIPELINE_X0, 1129a2e2270fSchristos TILEGX_PIPELINE_X1, 1130a2e2270fSchristos TILEGX_PIPELINE_Y0, 1131a2e2270fSchristos TILEGX_PIPELINE_Y1, 1132a2e2270fSchristos TILEGX_PIPELINE_Y2, 1133ba340e45Schristos TILEGX_NUM_PIPELINE_ENCODINGS = 5, 1134a2e2270fSchristos } tilegx_pipeline; 1135a2e2270fSchristos 1136a2e2270fSchristos #define tilegx_is_x_pipeline(p) ((int)(p) <= (int)TILEGX_PIPELINE_X1) 1137a2e2270fSchristos 1138a2e2270fSchristos typedef enum 1139a2e2270fSchristos { 1140a2e2270fSchristos TILEGX_OP_TYPE_REGISTER, 1141a2e2270fSchristos TILEGX_OP_TYPE_IMMEDIATE, 1142a2e2270fSchristos TILEGX_OP_TYPE_ADDRESS, 1143a2e2270fSchristos TILEGX_OP_TYPE_SPR 1144a2e2270fSchristos } tilegx_operand_type; 1145a2e2270fSchristos 1146a2e2270fSchristos /* These are the bits that determine if a bundle is in the X encoding. */ 1147a2e2270fSchristos #define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62) 1148a2e2270fSchristos 1149a2e2270fSchristos enum 1150a2e2270fSchristos { 1151a2e2270fSchristos /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */ 1152a2e2270fSchristos TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3, 1153a2e2270fSchristos 1154a2e2270fSchristos /* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */ 1155a2e2270fSchristos TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3, 1156a2e2270fSchristos 1157a2e2270fSchristos /* Instructions take this many bytes. */ 1158a2e2270fSchristos TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES, 1159a2e2270fSchristos 1160a2e2270fSchristos /* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */ 1161a2e2270fSchristos TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3, 1162a2e2270fSchristos 1163a2e2270fSchristos /* Bundles should be aligned modulo this number of bytes. */ 1164a2e2270fSchristos TILEGX_BUNDLE_ALIGNMENT_IN_BYTES = 1165a2e2270fSchristos (1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES), 1166a2e2270fSchristos 1167a2e2270fSchristos /* Number of registers (some are magic, such as network I/O). */ 1168a2e2270fSchristos TILEGX_NUM_REGISTERS = 64, 1169a2e2270fSchristos }; 1170a2e2270fSchristos 1171a2e2270fSchristos 1172a2e2270fSchristos struct tilegx_operand 1173a2e2270fSchristos { 1174a2e2270fSchristos /* Is this operand a register, immediate or address? */ 1175a2e2270fSchristos tilegx_operand_type type; 1176a2e2270fSchristos 1177a2e2270fSchristos /* The default relocation type for this operand. */ 1178a2e2270fSchristos signed int default_reloc : 16; 1179a2e2270fSchristos 1180a2e2270fSchristos /* How many bits is this value? (used for range checking) */ 1181a2e2270fSchristos unsigned int num_bits : 5; 1182a2e2270fSchristos 1183a2e2270fSchristos /* Is the value signed? (used for range checking) */ 1184a2e2270fSchristos unsigned int is_signed : 1; 1185a2e2270fSchristos 1186a2e2270fSchristos /* Is this operand a source register? */ 1187a2e2270fSchristos unsigned int is_src_reg : 1; 1188a2e2270fSchristos 1189a2e2270fSchristos /* Is this operand written? (i.e. is it a destination register) */ 1190a2e2270fSchristos unsigned int is_dest_reg : 1; 1191a2e2270fSchristos 1192a2e2270fSchristos /* Is this operand PC-relative? */ 1193a2e2270fSchristos unsigned int is_pc_relative : 1; 1194a2e2270fSchristos 1195a2e2270fSchristos /* By how many bits do we right shift the value before inserting? */ 1196a2e2270fSchristos unsigned int rightshift : 2; 1197a2e2270fSchristos 1198a2e2270fSchristos /* Return the bits for this operand to be ORed into an existing bundle. */ 1199a2e2270fSchristos tilegx_bundle_bits (*insert) (int op); 1200a2e2270fSchristos 1201a2e2270fSchristos /* Extract this operand and return it. */ 1202a2e2270fSchristos unsigned int (*extract) (tilegx_bundle_bits bundle); 1203a2e2270fSchristos }; 1204a2e2270fSchristos 1205a2e2270fSchristos 1206a2e2270fSchristos extern const struct tilegx_operand tilegx_operands[]; 1207a2e2270fSchristos 1208a2e2270fSchristos /* One finite-state machine per pipe for rapid instruction decoding. */ 1209a2e2270fSchristos extern const unsigned short * const 1210a2e2270fSchristos tilegx_bundle_decoder_fsms[TILEGX_NUM_PIPELINE_ENCODINGS]; 1211a2e2270fSchristos 1212a2e2270fSchristos 1213a2e2270fSchristos struct tilegx_opcode 1214a2e2270fSchristos { 1215a2e2270fSchristos /* The opcode mnemonic, e.g. "add" */ 1216a2e2270fSchristos const char *name; 1217a2e2270fSchristos 1218a2e2270fSchristos /* The enum value for this mnemonic. */ 1219a2e2270fSchristos tilegx_mnemonic mnemonic; 1220a2e2270fSchristos 1221a2e2270fSchristos /* A bit mask of which of the five pipes this instruction 1222a2e2270fSchristos is compatible with: 1223a2e2270fSchristos X0 0x01 1224a2e2270fSchristos X1 0x02 1225a2e2270fSchristos Y0 0x04 1226a2e2270fSchristos Y1 0x08 1227a2e2270fSchristos Y2 0x10 */ 1228a2e2270fSchristos unsigned char pipes; 1229a2e2270fSchristos 1230a2e2270fSchristos /* How many operands are there? */ 1231a2e2270fSchristos unsigned char num_operands; 1232a2e2270fSchristos 1233a2e2270fSchristos /* Which register does this write implicitly, or TREG_ZERO if none? */ 1234a2e2270fSchristos unsigned char implicitly_written_register; 1235a2e2270fSchristos 1236a2e2270fSchristos /* Can this be bundled with other instructions (almost always true). */ 1237a2e2270fSchristos unsigned char can_bundle; 1238a2e2270fSchristos 1239a2e2270fSchristos /* The description of the operands. Each of these is an 1240a2e2270fSchristos * index into the tilegx_operands[] table. */ 1241a2e2270fSchristos unsigned char operands[TILEGX_NUM_PIPELINE_ENCODINGS][TILEGX_MAX_OPERANDS]; 1242a2e2270fSchristos 1243a2e2270fSchristos #if !defined(__KERNEL__) && !defined(_LIBC) 1244a2e2270fSchristos /* A mask of which bits have predefined values for each pipeline. 1245a2e2270fSchristos * This is useful for disassembly. */ 1246a2e2270fSchristos tilegx_bundle_bits fixed_bit_masks[TILEGX_NUM_PIPELINE_ENCODINGS]; 1247a2e2270fSchristos 1248a2e2270fSchristos /* For each bit set in fixed_bit_masks, what the value is for this 1249a2e2270fSchristos * instruction. */ 1250a2e2270fSchristos tilegx_bundle_bits fixed_bit_values[TILEGX_NUM_PIPELINE_ENCODINGS]; 1251a2e2270fSchristos #endif 1252a2e2270fSchristos }; 1253a2e2270fSchristos 1254a2e2270fSchristos extern const struct tilegx_opcode tilegx_opcodes[]; 1255a2e2270fSchristos 1256a2e2270fSchristos /* Used for non-textual disassembly into structs. */ 1257a2e2270fSchristos struct tilegx_decoded_instruction 1258a2e2270fSchristos { 1259a2e2270fSchristos const struct tilegx_opcode *opcode; 1260a2e2270fSchristos const struct tilegx_operand *operands[TILEGX_MAX_OPERANDS]; 1261a2e2270fSchristos long long operand_values[TILEGX_MAX_OPERANDS]; 1262a2e2270fSchristos }; 1263a2e2270fSchristos 1264a2e2270fSchristos 1265a2e2270fSchristos /* Disassemble a bundle into a struct for machine processing. */ 1266a2e2270fSchristos extern int parse_insn_tilegx(tilegx_bundle_bits bits, 1267a2e2270fSchristos unsigned long long pc, 1268a2e2270fSchristos struct tilegx_decoded_instruction 1269a2e2270fSchristos decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE]); 1270a2e2270fSchristos 1271a2e2270fSchristos 1272a2e2270fSchristos #if !defined(__KERNEL__) && !defined(_LIBC) 1273a2e2270fSchristos /* Canonical names of all the registers. */ 1274a2e2270fSchristos /* ISSUE: This table lives in "tile-dis.c" */ 1275a2e2270fSchristos extern const char * const tilegx_register_names[]; 1276a2e2270fSchristos 1277a2e2270fSchristos /* Descriptor for a special-purpose register. */ 1278a2e2270fSchristos struct tilegx_spr 1279a2e2270fSchristos { 1280a2e2270fSchristos /* The number */ 1281a2e2270fSchristos int number; 1282a2e2270fSchristos 1283a2e2270fSchristos /* The name */ 1284a2e2270fSchristos const char *name; 1285a2e2270fSchristos }; 1286a2e2270fSchristos 1287a2e2270fSchristos /* List of all the SPRs; ordered by increasing number. */ 1288a2e2270fSchristos extern const struct tilegx_spr tilegx_sprs[]; 1289a2e2270fSchristos 1290a2e2270fSchristos /* Number of special-purpose registers. */ 1291a2e2270fSchristos extern const int tilegx_num_sprs; 1292a2e2270fSchristos 1293a2e2270fSchristos extern const char * 1294a2e2270fSchristos get_tilegx_spr_name (int num); 1295a2e2270fSchristos #endif /* !__KERNEL__ && !_LIBC */ 1296a2e2270fSchristos 1297a2e2270fSchristos /* Make a few "tile_" variables to simply common code between 1298a2e2270fSchristos architectures. */ 1299a2e2270fSchristos 1300a2e2270fSchristos typedef tilegx_bundle_bits tile_bundle_bits; 1301a2e2270fSchristos #define TILE_BUNDLE_SIZE_IN_BYTES TILEGX_BUNDLE_SIZE_IN_BYTES 1302a2e2270fSchristos #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES 1303a2e2270fSchristos #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \ 1304a2e2270fSchristos TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES 1305a2e2270fSchristos 1306212397c6Schristos #ifdef __cplusplus 1307212397c6Schristos } 1308212397c6Schristos #endif 1309212397c6Schristos 1310a2e2270fSchristos #endif /* opcode_tilegx_h */ 1311