cpu-ia64-opc.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /* Copyright (C) 1998-2022 Free Software Foundation, Inc.
  2. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  3. This file is part of BFD, the Binary File Descriptor library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. /* Logically, this code should be part of libopcode but since some of
  17. the operand insertion/extraction functions help bfd to implement
  18. relocations, this code is included as part of cpu-ia64.c. This
  19. avoids circular dependencies between libopcode and libbfd and also
  20. obviates the need for applications to link in libopcode when all
  21. they really want is libbfd.
  22. --davidm Mon Apr 13 22:14:02 1998 */
  23. #include "../opcodes/ia64-opc.h"
  24. #define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
  25. static const char*
  26. ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
  27. ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
  28. {
  29. return "internal error---this shouldn't happen";
  30. }
  31. static const char*
  32. ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
  33. ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
  34. {
  35. return "internal error---this shouldn't happen";
  36. }
  37. static const char*
  38. ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
  39. ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
  40. {
  41. return 0;
  42. }
  43. static const char*
  44. ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
  45. ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
  46. {
  47. return 0;
  48. }
  49. static const char*
  50. ins_reg (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  51. {
  52. if (value >= 1u << self->field[0].bits)
  53. return "register number out of range";
  54. *code |= value << self->field[0].shift;
  55. return 0;
  56. }
  57. static const char*
  58. ext_reg (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  59. {
  60. *valuep = ((code >> self->field[0].shift)
  61. & ((1u << self->field[0].bits) - 1));
  62. return 0;
  63. }
  64. static const char*
  65. ins_immu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  66. {
  67. ia64_insn new_insn = 0;
  68. int i;
  69. for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
  70. {
  71. new_insn |= ((value & ((((ia64_insn) 1) << self->field[i].bits) - 1))
  72. << self->field[i].shift);
  73. value >>= self->field[i].bits;
  74. }
  75. if (value)
  76. return "integer operand out of range";
  77. *code |= new_insn;
  78. return 0;
  79. }
  80. static const char*
  81. ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  82. {
  83. BFD_HOST_U_64_BIT value = 0;
  84. int i, bits = 0, total = 0;
  85. for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
  86. {
  87. bits = self->field[i].bits;
  88. value |= ((code >> self->field[i].shift)
  89. & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
  90. total += bits;
  91. }
  92. *valuep = value;
  93. return 0;
  94. }
  95. static const char*
  96. ins_immu5b (const struct ia64_operand *self, ia64_insn value,
  97. ia64_insn *code)
  98. {
  99. if (value < 32 || value > 63)
  100. return "value must be between 32 and 63";
  101. return ins_immu (self, value - 32, code);
  102. }
  103. static const char*
  104. ext_immu5b (const struct ia64_operand *self, ia64_insn code,
  105. ia64_insn *valuep)
  106. {
  107. const char *result;
  108. result = ext_immu (self, code, valuep);
  109. if (result)
  110. return result;
  111. *valuep = *valuep + 32;
  112. return 0;
  113. }
  114. static const char*
  115. ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  116. {
  117. if (value & 0x7)
  118. return "value not an integer multiple of 8";
  119. return ins_immu (self, value >> 3, code);
  120. }
  121. static const char*
  122. ext_immus8 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  123. {
  124. const char *result;
  125. result = ext_immu (self, code, valuep);
  126. if (result)
  127. return result;
  128. *valuep = *valuep << 3;
  129. return 0;
  130. }
  131. static const char*
  132. ins_imms_scaled (const struct ia64_operand *self, ia64_insn value,
  133. ia64_insn *code, int scale)
  134. {
  135. BFD_HOST_64_BIT svalue = value, sign_bit = 0;
  136. ia64_insn new_insn = 0;
  137. int i;
  138. svalue >>= scale;
  139. for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
  140. {
  141. new_insn |= ((svalue & ((((ia64_insn) 1) << self->field[i].bits) - 1))
  142. << self->field[i].shift);
  143. sign_bit = (svalue >> (self->field[i].bits - 1)) & 1;
  144. svalue >>= self->field[i].bits;
  145. }
  146. if ((!sign_bit && svalue != 0) || (sign_bit && svalue != -1))
  147. return "integer operand out of range";
  148. *code |= new_insn;
  149. return 0;
  150. }
  151. static const char*
  152. ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
  153. ia64_insn *valuep, int scale)
  154. {
  155. int i, bits = 0, total = 0;
  156. BFD_HOST_U_64_BIT val = 0, sign;
  157. for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
  158. {
  159. bits = self->field[i].bits;
  160. val |= ((code >> self->field[i].shift)
  161. & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
  162. total += bits;
  163. }
  164. /* sign extend: */
  165. sign = (BFD_HOST_U_64_BIT) 1 << (total - 1);
  166. val = (val ^ sign) - sign;
  167. *valuep = val << scale;
  168. return 0;
  169. }
  170. static const char*
  171. ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  172. {
  173. return ins_imms_scaled (self, value, code, 0);
  174. }
  175. static const char*
  176. ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  177. {
  178. value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
  179. return ins_imms_scaled (self, value, code, 0);
  180. }
  181. static const char*
  182. ext_imms (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  183. {
  184. return ext_imms_scaled (self, code, valuep, 0);
  185. }
  186. static const char*
  187. ins_immsm1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  188. {
  189. --value;
  190. return ins_imms_scaled (self, value, code, 0);
  191. }
  192. static const char*
  193. ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value,
  194. ia64_insn *code)
  195. {
  196. value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
  197. --value;
  198. return ins_imms_scaled (self, value, code, 0);
  199. }
  200. static const char*
  201. ext_immsm1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  202. {
  203. const char *res = ext_imms_scaled (self, code, valuep, 0);
  204. ++*valuep;
  205. return res;
  206. }
  207. static const char*
  208. ins_imms1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  209. {
  210. return ins_imms_scaled (self, value, code, 1);
  211. }
  212. static const char*
  213. ext_imms1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  214. {
  215. return ext_imms_scaled (self, code, valuep, 1);
  216. }
  217. static const char*
  218. ins_imms4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  219. {
  220. return ins_imms_scaled (self, value, code, 4);
  221. }
  222. static const char*
  223. ext_imms4 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  224. {
  225. return ext_imms_scaled (self, code, valuep, 4);
  226. }
  227. static const char*
  228. ins_imms16 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  229. {
  230. return ins_imms_scaled (self, value, code, 16);
  231. }
  232. static const char*
  233. ext_imms16 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  234. {
  235. return ext_imms_scaled (self, code, valuep, 16);
  236. }
  237. static const char*
  238. ins_cimmu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  239. {
  240. ia64_insn mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
  241. return ins_immu (self, value ^ mask, code);
  242. }
  243. static const char*
  244. ext_cimmu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  245. {
  246. const char *result;
  247. ia64_insn mask;
  248. mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
  249. result = ext_immu (self, code, valuep);
  250. if (!result)
  251. {
  252. mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
  253. *valuep ^= mask;
  254. }
  255. return result;
  256. }
  257. static const char*
  258. ins_cnt (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  259. {
  260. --value;
  261. if (value >= ((BFD_HOST_U_64_BIT) 1) << self->field[0].bits)
  262. return "count out of range";
  263. *code |= value << self->field[0].shift;
  264. return 0;
  265. }
  266. static const char*
  267. ext_cnt (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  268. {
  269. *valuep = ((code >> self->field[0].shift)
  270. & ((((BFD_HOST_U_64_BIT) 1) << self->field[0].bits) - 1)) + 1;
  271. return 0;
  272. }
  273. static const char*
  274. ins_cnt2b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  275. {
  276. --value;
  277. if (value > 2)
  278. return "count must be in range 1..3";
  279. *code |= value << self->field[0].shift;
  280. return 0;
  281. }
  282. static const char*
  283. ext_cnt2b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  284. {
  285. *valuep = ((code >> self->field[0].shift) & 0x3) + 1;
  286. return 0;
  287. }
  288. static const char*
  289. ins_cnt2c (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  290. {
  291. switch (value)
  292. {
  293. case 0: value = 0; break;
  294. case 7: value = 1; break;
  295. case 15: value = 2; break;
  296. case 16: value = 3; break;
  297. default: return "count must be 0, 7, 15, or 16";
  298. }
  299. *code |= value << self->field[0].shift;
  300. return 0;
  301. }
  302. static const char*
  303. ext_cnt2c (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  304. {
  305. ia64_insn value;
  306. value = (code >> self->field[0].shift) & 0x3;
  307. switch (value)
  308. {
  309. case 0: value = 0; break;
  310. case 1: value = 7; break;
  311. case 2: value = 15; break;
  312. case 3: value = 16; break;
  313. }
  314. *valuep = value;
  315. return 0;
  316. }
  317. static const char*
  318. ins_cnt6a (const struct ia64_operand *self, ia64_insn value,
  319. ia64_insn *code)
  320. {
  321. if (value < 1 || value > 64)
  322. return "value must be between 1 and 64";
  323. return ins_immu (self, value - 1, code);
  324. }
  325. static const char*
  326. ext_cnt6a (const struct ia64_operand *self, ia64_insn code,
  327. ia64_insn *valuep)
  328. {
  329. const char *result;
  330. result = ext_immu (self, code, valuep);
  331. if (result)
  332. return result;
  333. *valuep = *valuep + 1;
  334. return 0;
  335. }
  336. static const char*
  337. ins_strd5b (const struct ia64_operand *self, ia64_insn value,
  338. ia64_insn *code)
  339. {
  340. if ( value & 0x3f )
  341. return "value must be a multiple of 64";
  342. return ins_imms_scaled (self, value, code, 6);
  343. }
  344. static const char*
  345. ext_strd5b (const struct ia64_operand *self, ia64_insn code,
  346. ia64_insn *valuep)
  347. {
  348. return ext_imms_scaled (self, code, valuep, 6);
  349. }
  350. static const char*
  351. ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
  352. {
  353. BFD_HOST_64_BIT val = value;
  354. BFD_HOST_U_64_BIT sign = 0;
  355. if (val < 0)
  356. {
  357. sign = 0x4;
  358. value = -value;
  359. }
  360. switch (value)
  361. {
  362. case 1: value = 3; break;
  363. case 4: value = 2; break;
  364. case 8: value = 1; break;
  365. case 16: value = 0; break;
  366. default: return "count must be +/- 1, 4, 8, or 16";
  367. }
  368. *code |= (sign | value) << self->field[0].shift;
  369. return 0;
  370. }
  371. static const char*
  372. ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
  373. {
  374. BFD_HOST_64_BIT val;
  375. int negate;
  376. val = (code >> self->field[0].shift) & 0x7;
  377. negate = val & 0x4;
  378. switch (val & 0x3)
  379. {
  380. case 0: val = 16; break;
  381. case 1: val = 8; break;
  382. case 2: val = 4; break;
  383. case 3: val = 1; break;
  384. }
  385. if (negate)
  386. val = -val;
  387. *valuep = val;
  388. return 0;
  389. }
  390. #define CST IA64_OPND_CLASS_CST
  391. #define REG IA64_OPND_CLASS_REG
  392. #define IND IA64_OPND_CLASS_IND
  393. #define ABS IA64_OPND_CLASS_ABS
  394. #define REL IA64_OPND_CLASS_REL
  395. #define SDEC IA64_OPND_FLAG_DECIMAL_SIGNED
  396. #define UDEC IA64_OPND_FLAG_DECIMAL_UNSIGNED
  397. const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
  398. {
  399. /* constants: */
  400. { CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "<none>" },
  401. { CST, ins_const, ext_const, "ar.csd", {{ 0, 0}}, 0, "ar.csd" },
  402. { CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" },
  403. { CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" },
  404. { CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" },
  405. { CST, ins_const, ext_const, "8", {{ 0, 0}}, 0, "8" },
  406. { CST, ins_const, ext_const, "16", {{ 0, 0}}, 0, "16" },
  407. { CST, ins_const, ext_const, "r0", {{ 0, 0}}, 0, "r0" },
  408. { CST, ins_const, ext_const, "ip", {{ 0, 0}}, 0, "ip" },
  409. { CST, ins_const, ext_const, "pr", {{ 0, 0}}, 0, "pr" },
  410. { CST, ins_const, ext_const, "pr.rot", {{ 0, 0}}, 0, "pr.rot" },
  411. { CST, ins_const, ext_const, "psr", {{ 0, 0}}, 0, "psr" },
  412. { CST, ins_const, ext_const, "psr.l", {{ 0, 0}}, 0, "psr.l" },
  413. { CST, ins_const, ext_const, "psr.um", {{ 0, 0}}, 0, "psr.um" },
  414. /* register operands: */
  415. { REG, ins_reg, ext_reg, "ar", {{ 7, 20}}, 0, /* AR3 */
  416. "an application register" },
  417. { REG, ins_reg, ext_reg, "b", {{ 3, 6}}, 0, /* B1 */
  418. "a branch register" },
  419. { REG, ins_reg, ext_reg, "b", {{ 3, 13}}, 0, /* B2 */
  420. "a branch register"},
  421. { REG, ins_reg, ext_reg, "cr", {{ 7, 20}}, 0, /* CR */
  422. "a control register"},
  423. { REG, ins_reg, ext_reg, "f", {{ 7, 6}}, 0, /* F1 */
  424. "a floating-point register" },
  425. { REG, ins_reg, ext_reg, "f", {{ 7, 13}}, 0, /* F2 */
  426. "a floating-point register" },
  427. { REG, ins_reg, ext_reg, "f", {{ 7, 20}}, 0, /* F3 */
  428. "a floating-point register" },
  429. { REG, ins_reg, ext_reg, "f", {{ 7, 27}}, 0, /* F4 */
  430. "a floating-point register" },
  431. { REG, ins_reg, ext_reg, "p", {{ 6, 6}}, 0, /* P1 */
  432. "a predicate register" },
  433. { REG, ins_reg, ext_reg, "p", {{ 6, 27}}, 0, /* P2 */
  434. "a predicate register" },
  435. { REG, ins_reg, ext_reg, "r", {{ 7, 6}}, 0, /* R1 */
  436. "a general register" },
  437. { REG, ins_reg, ext_reg, "r", {{ 7, 13}}, 0, /* R2 */
  438. "a general register" },
  439. { REG, ins_reg, ext_reg, "r", {{ 7, 20}}, 0, /* R3 */
  440. "a general register" },
  441. { REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
  442. "a general register r0-r3" },
  443. { REG, ins_reg, ext_reg, "dahr", {{ 3, 23}}, 0, /* DAHR */
  444. "a dahr register dahr0-7" },
  445. /* memory operands: */
  446. { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
  447. "a memory address" },
  448. /* indirect operands: */
  449. { IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
  450. "a cpuid register" },
  451. { IND, ins_reg, ext_reg, "dbr", {{7, 20}}, 0, /* DBR_R3 */
  452. "a dbr register" },
  453. { IND, ins_reg, ext_reg, "dtr", {{7, 20}}, 0, /* DTR_R3 */
  454. "a dtr register" },
  455. { IND, ins_reg, ext_reg, "itr", {{7, 20}}, 0, /* ITR_R3 */
  456. "an itr register" },
  457. { IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */
  458. "an ibr register" },
  459. { IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */
  460. "an msr register" },
  461. { IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */
  462. "a pkr register" },
  463. { IND, ins_reg, ext_reg, "pmc", {{7, 20}}, 0, /* PMC_R3 */
  464. "a pmc register" },
  465. { IND, ins_reg, ext_reg, "pmd", {{7, 20}}, 0, /* PMD_R3 */
  466. "a pmd register" },
  467. { IND, ins_reg, ext_reg, "dahr", {{7, 20}}, 0, /* DAHR_R3 */
  468. "a dahr register" },
  469. { IND, ins_reg, ext_reg, "rr", {{7, 20}}, 0, /* RR_R3 */
  470. "an rr register" },
  471. /* immediate operands: */
  472. { ABS, ins_cimmu, ext_cimmu, 0, {{ 5, 20 }}, UDEC, /* CCNT5 */
  473. "a 5-bit count (0-31)" },
  474. { ABS, ins_cnt, ext_cnt, 0, {{ 2, 27 }}, UDEC, /* CNT2a */
  475. "a 2-bit count (1-4)" },
  476. { ABS, ins_cnt2b, ext_cnt2b, 0, {{ 2, 27 }}, UDEC, /* CNT2b */
  477. "a 2-bit count (1-3)" },
  478. { ABS, ins_cnt2c, ext_cnt2c, 0, {{ 2, 30 }}, UDEC, /* CNT2c */
  479. "a count (0, 7, 15, or 16)" },
  480. { ABS, ins_immu, ext_immu, 0, {{ 5, 14}}, UDEC, /* CNT5 */
  481. "a 5-bit count (0-31)" },
  482. { ABS, ins_immu, ext_immu, 0, {{ 6, 27}}, UDEC, /* CNT6 */
  483. "a 6-bit count (0-63)" },
  484. { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 20}}, UDEC, /* CPOS6a */
  485. "a 6-bit bit pos (0-63)" },
  486. { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 14}}, UDEC, /* CPOS6b */
  487. "a 6-bit bit pos (0-63)" },
  488. { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 31}}, UDEC, /* CPOS6c */
  489. "a 6-bit bit pos (0-63)" },
  490. { ABS, ins_imms, ext_imms, 0, {{ 1, 36}}, SDEC, /* IMM1 */
  491. "a 1-bit integer (-1, 0)" },
  492. { ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
  493. "a 2-bit unsigned (0-3)" },
  494. { ABS, ins_immu5b, ext_immu5b, 0, {{ 5, 14}}, UDEC, /* IMMU5b */
  495. "a 5-bit unsigned (32 + (0-31))" },
  496. { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */
  497. "a 7-bit unsigned (0-127)" },
  498. { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */
  499. "a 7-bit unsigned (0-127)" },
  500. { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, UDEC, /* SOF */
  501. "a frame size (register count)" },
  502. { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, UDEC, /* SOL */
  503. "a local register count" },
  504. { ABS, ins_immus8,ext_immus8,0, {{ 4, 27}}, UDEC, /* SOR */
  505. "a rotating register count (integer multiple of 8)" },
  506. { ABS, ins_imms, ext_imms, 0, /* IMM8 */
  507. {{ 7, 13}, { 1, 36}}, SDEC,
  508. "an 8-bit integer (-128-127)" },
  509. { ABS, ins_immsu4, ext_imms, 0, /* IMM8U4 */
  510. {{ 7, 13}, { 1, 36}}, SDEC,
  511. "an 8-bit signed integer for 32-bit unsigned compare (-128-127)" },
  512. { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1 */
  513. {{ 7, 13}, { 1, 36}}, SDEC,
  514. "an 8-bit integer (-127-128)" },
  515. { ABS, ins_immsm1u4, ext_immsm1, 0, /* IMM8M1U4 */
  516. {{ 7, 13}, { 1, 36}}, SDEC,
  517. "an 8-bit integer for 32-bit unsigned compare (-127-(-1),1-128,0x100000000)" },
  518. { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1U8 */
  519. {{ 7, 13}, { 1, 36}}, SDEC,
  520. "an 8-bit integer for 64-bit unsigned compare (-127-(-1),1-128,0x10000000000000000)" },
  521. { ABS, ins_immu, ext_immu, 0, {{ 2, 33}, { 7, 20}}, 0, /* IMMU9 */
  522. "a 9-bit unsigned (0-511)" },
  523. { ABS, ins_imms, ext_imms, 0, /* IMM9a */
  524. {{ 7, 6}, { 1, 27}, { 1, 36}}, SDEC,
  525. "a 9-bit integer (-256-255)" },
  526. { ABS, ins_imms, ext_imms, 0, /* IMM9b */
  527. {{ 7, 13}, { 1, 27}, { 1, 36}}, SDEC,
  528. "a 9-bit integer (-256-255)" },
  529. { ABS, ins_imms, ext_imms, 0, /* IMM14 */
  530. {{ 7, 13}, { 6, 27}, { 1, 36}}, SDEC,
  531. "a 14-bit integer (-8192-8191)" },
  532. { ABS, ins_immu, ext_immu, 0, /* IMMU16 */
  533. {{4, 6}, {11, 12}, { 1, 36}}, UDEC,
  534. "a 16-bit unsigned" },
  535. { ABS, ins_imms1, ext_imms1, 0, /* IMM17 */
  536. {{ 7, 6}, { 8, 24}, { 1, 36}}, 0,
  537. "a 17-bit integer (-65536-65535)" },
  538. { ABS, ins_immu, ext_immu, 0, /* IMMU19 */
  539. {{4, 6}, {14, 12}, { 1, 36}}, UDEC,
  540. "a 19-bit unsigned" },
  541. { ABS, ins_immu, ext_immu, 0, {{20, 6}, { 1, 36}}, 0, /* IMMU21 */
  542. "a 21-bit unsigned" },
  543. { ABS, ins_imms, ext_imms, 0, /* IMM22 */
  544. {{ 7, 13}, { 9, 27}, { 5, 22}, { 1, 36}}, SDEC,
  545. "a 22-bit signed integer" },
  546. { ABS, ins_immu, ext_immu, 0, /* IMMU24 */
  547. {{21, 6}, { 2, 31}, { 1, 36}}, 0,
  548. "a 24-bit unsigned" },
  549. { ABS, ins_imms16,ext_imms16,0, {{27, 6}, { 1, 36}}, 0, /* IMM44 */
  550. "a 44-bit unsigned (least 16 bits ignored/zeroes)" },
  551. { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU62 */
  552. "a 62-bit unsigned" },
  553. { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU64 */
  554. "a 64-bit unsigned" },
  555. { ABS, ins_inc3, ext_inc3, 0, {{ 3, 13}}, SDEC, /* INC3 */
  556. "an increment (+/- 1, 4, 8, or 16)" },
  557. { ABS, ins_cnt, ext_cnt, 0, {{ 4, 27}}, UDEC, /* LEN4 */
  558. "a 4-bit length (1-16)" },
  559. { ABS, ins_cnt, ext_cnt, 0, {{ 6, 27}}, UDEC, /* LEN6 */
  560. "a 6-bit length (1-64)" },
  561. { ABS, ins_immu, ext_immu, 0, {{ 4, 20}}, 0, /* MBTYPE4 */
  562. "a mix type (@rev, @mix, @shuf, @alt, or @brcst)" },
  563. { ABS, ins_immu, ext_immu, 0, {{ 8, 20}}, 0, /* MBTYPE8 */
  564. "an 8-bit mix type" },
  565. { ABS, ins_immu, ext_immu, 0, {{ 6, 14}}, UDEC, /* POS6 */
  566. "a 6-bit bit pos (0-63)" },
  567. { REL, ins_imms4, ext_imms4, 0, {{ 7, 6}, { 2, 33}}, 0, /* TAG13 */
  568. "a branch tag" },
  569. { REL, ins_imms4, ext_imms4, 0, {{ 9, 24}}, 0, /* TAG13b */
  570. "a branch tag" },
  571. { REL, ins_imms4, ext_imms4, 0, {{20, 6}, { 1, 36}}, 0, /* TGT25 */
  572. "a branch target" },
  573. { REL, ins_imms4, ext_imms4, 0, /* TGT25b */
  574. {{ 7, 6}, {13, 20}, { 1, 36}}, 0,
  575. "a branch target" },
  576. { REL, ins_imms4, ext_imms4, 0, {{20, 13}, { 1, 36}}, 0, /* TGT25c */
  577. "a branch target" },
  578. { REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* TGT64 */
  579. "a branch target" },
  580. { ABS, ins_const, ext_const, 0, {{0, 0}}, 0, /* LDXMOV */
  581. "ldxmov target" },
  582. { ABS, ins_cnt6a, ext_cnt6a, 0, {{6, 6}}, UDEC, /* CNT6a */
  583. "lfetch count" },
  584. { ABS, ins_strd5b, ext_strd5b, 0, {{5, 13}}, SDEC, /* STRD5b*/
  585. "lfetch stride" },
  586. };