inst.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Format of an instruction in memory.
  4. *
  5. * This file is subject to the terms and conditions of the GNU General Public
  6. * License. See the file "COPYING" in the main directory of this archive
  7. * for more details.
  8. *
  9. * Copyright (C) 1996, 2000 by Ralf Baechle
  10. * Copyright (C) 2006 by Thiemo Seufer
  11. * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
  12. * Copyright (C) 2014 Imagination Technologies Ltd.
  13. */
  14. #ifndef _UAPI_ASM_INST_H
  15. #define _UAPI_ASM_INST_H
  16. #include <asm/bitfield.h>
  17. /*
  18. * Major opcodes; before MIPS IV cop1x was called cop3.
  19. */
  20. enum major_op {
  21. spec_op, bcond_op, j_op, jal_op,
  22. beq_op, bne_op, blez_op, bgtz_op,
  23. addi_op, pop10_op = addi_op, addiu_op, slti_op, sltiu_op,
  24. andi_op, ori_op, xori_op, lui_op,
  25. cop0_op, cop1_op, cop2_op, cop1x_op,
  26. beql_op, bnel_op, blezl_op, bgtzl_op,
  27. daddi_op, pop30_op = daddi_op, daddiu_op, ldl_op, ldr_op,
  28. spec2_op, jalx_op, mdmx_op, msa_op = mdmx_op, spec3_op,
  29. lb_op, lh_op, lwl_op, lw_op,
  30. lbu_op, lhu_op, lwr_op, lwu_op,
  31. sb_op, sh_op, swl_op, sw_op,
  32. sdl_op, sdr_op, swr_op, cache_op,
  33. ll_op, lwc1_op, lwc2_op, bc6_op = lwc2_op, pref_op,
  34. lld_op, ldc1_op, ldc2_op, pop66_op = ldc2_op, ld_op,
  35. sc_op, swc1_op, swc2_op, balc6_op = swc2_op, major_3b_op,
  36. scd_op, sdc1_op, sdc2_op, pop76_op = sdc2_op, sd_op
  37. };
  38. /*
  39. * func field of spec opcode.
  40. */
  41. enum spec_op {
  42. sll_op, movc_op, srl_op, sra_op,
  43. sllv_op, pmon_op, srlv_op, srav_op,
  44. jr_op, jalr_op, movz_op, movn_op,
  45. syscall_op, break_op, spim_op, sync_op,
  46. mfhi_op, mthi_op, mflo_op, mtlo_op,
  47. dsllv_op, spec2_unused_op, dsrlv_op, dsrav_op,
  48. mult_op, multu_op, div_op, divu_op,
  49. dmult_op, dmultu_op, ddiv_op, ddivu_op,
  50. add_op, addu_op, sub_op, subu_op,
  51. and_op, or_op, xor_op, nor_op,
  52. spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
  53. dadd_op, daddu_op, dsub_op, dsubu_op,
  54. tge_op, tgeu_op, tlt_op, tltu_op,
  55. teq_op, seleqz_op, tne_op, selnez_op,
  56. dsll_op, spec5_unused_op, dsrl_op, dsra_op,
  57. dsll32_op, spec6_unused_op, dsrl32_op, dsra32_op
  58. };
  59. /*
  60. * func field of spec2 opcode.
  61. */
  62. enum spec2_op {
  63. madd_op, maddu_op, mul_op, spec2_3_unused_op,
  64. msub_op, msubu_op, /* more unused ops */
  65. clz_op = 0x20, clo_op,
  66. dclz_op = 0x24, dclo_op,
  67. sdbpp_op = 0x3f
  68. };
  69. /*
  70. * func field of spec3 opcode.
  71. */
  72. enum spec3_op {
  73. ext_op, dextm_op, dextu_op, dext_op,
  74. ins_op, dinsm_op, dinsu_op, dins_op,
  75. yield_op = 0x09, lx_op = 0x0a,
  76. lwle_op = 0x19, lwre_op = 0x1a,
  77. cachee_op = 0x1b, sbe_op = 0x1c,
  78. she_op = 0x1d, sce_op = 0x1e,
  79. swe_op = 0x1f, bshfl_op = 0x20,
  80. swle_op = 0x21, swre_op = 0x22,
  81. prefe_op = 0x23, dbshfl_op = 0x24,
  82. cache6_op = 0x25, sc6_op = 0x26,
  83. scd6_op = 0x27, lbue_op = 0x28,
  84. lhue_op = 0x29, lbe_op = 0x2c,
  85. lhe_op = 0x2d, lle_op = 0x2e,
  86. lwe_op = 0x2f, pref6_op = 0x35,
  87. ll6_op = 0x36, lld6_op = 0x37,
  88. rdhwr_op = 0x3b
  89. };
  90. /*
  91. * Bits 10-6 minor opcode for r6 spec mult/div encodings
  92. */
  93. enum mult_op {
  94. mult_mult_op = 0x0,
  95. mult_mul_op = 0x2,
  96. mult_muh_op = 0x3,
  97. };
  98. enum multu_op {
  99. multu_multu_op = 0x0,
  100. multu_mulu_op = 0x2,
  101. multu_muhu_op = 0x3,
  102. };
  103. enum div_op {
  104. div_div_op = 0x0,
  105. div_div6_op = 0x2,
  106. div_mod_op = 0x3,
  107. };
  108. enum divu_op {
  109. divu_divu_op = 0x0,
  110. divu_divu6_op = 0x2,
  111. divu_modu_op = 0x3,
  112. };
  113. enum dmult_op {
  114. dmult_dmult_op = 0x0,
  115. dmult_dmul_op = 0x2,
  116. dmult_dmuh_op = 0x3,
  117. };
  118. enum dmultu_op {
  119. dmultu_dmultu_op = 0x0,
  120. dmultu_dmulu_op = 0x2,
  121. dmultu_dmuhu_op = 0x3,
  122. };
  123. enum ddiv_op {
  124. ddiv_ddiv_op = 0x0,
  125. ddiv_ddiv6_op = 0x2,
  126. ddiv_dmod_op = 0x3,
  127. };
  128. enum ddivu_op {
  129. ddivu_ddivu_op = 0x0,
  130. ddivu_ddivu6_op = 0x2,
  131. ddivu_dmodu_op = 0x3,
  132. };
  133. /*
  134. * rt field of bcond opcodes.
  135. */
  136. enum rt_op {
  137. bltz_op, bgez_op, bltzl_op, bgezl_op,
  138. spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
  139. tgei_op, tgeiu_op, tlti_op, tltiu_op,
  140. teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
  141. bltzal_op, bgezal_op, bltzall_op, bgezall_op,
  142. rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
  143. rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
  144. bposge32_op, rt_op_0x1d, rt_op_0x1e, synci_op
  145. };
  146. /*
  147. * rs field of cop opcodes.
  148. */
  149. enum cop_op {
  150. mfc_op = 0x00, dmfc_op = 0x01,
  151. cfc_op = 0x02, mfhc0_op = 0x02,
  152. mfhc_op = 0x03, mtc_op = 0x04,
  153. dmtc_op = 0x05, ctc_op = 0x06,
  154. mthc0_op = 0x06, mthc_op = 0x07,
  155. bc_op = 0x08, bc1eqz_op = 0x09,
  156. mfmc0_op = 0x0b, bc1nez_op = 0x0d,
  157. wrpgpr_op = 0x0e, cop_op = 0x10,
  158. copm_op = 0x18
  159. };
  160. /*
  161. * rt field of cop.bc_op opcodes
  162. */
  163. enum bcop_op {
  164. bcf_op, bct_op, bcfl_op, bctl_op
  165. };
  166. /*
  167. * func field of cop0 coi opcodes.
  168. */
  169. enum cop0_coi_func {
  170. tlbr_op = 0x01, tlbwi_op = 0x02,
  171. tlbwr_op = 0x06, tlbp_op = 0x08,
  172. rfe_op = 0x10, eret_op = 0x18,
  173. wait_op = 0x20, hypcall_op = 0x28
  174. };
  175. /*
  176. * func field of cop0 com opcodes.
  177. */
  178. enum cop0_com_func {
  179. tlbr1_op = 0x01, tlbw_op = 0x02,
  180. tlbp1_op = 0x08, dctr_op = 0x09,
  181. dctw_op = 0x0a
  182. };
  183. /*
  184. * fmt field of cop1 opcodes.
  185. */
  186. enum cop1_fmt {
  187. s_fmt, d_fmt, e_fmt, q_fmt,
  188. w_fmt, l_fmt
  189. };
  190. /*
  191. * func field of cop1 instructions using d, s or w format.
  192. */
  193. enum cop1_sdw_func {
  194. fadd_op = 0x00, fsub_op = 0x01,
  195. fmul_op = 0x02, fdiv_op = 0x03,
  196. fsqrt_op = 0x04, fabs_op = 0x05,
  197. fmov_op = 0x06, fneg_op = 0x07,
  198. froundl_op = 0x08, ftruncl_op = 0x09,
  199. fceill_op = 0x0a, ffloorl_op = 0x0b,
  200. fround_op = 0x0c, ftrunc_op = 0x0d,
  201. fceil_op = 0x0e, ffloor_op = 0x0f,
  202. fsel_op = 0x10,
  203. fmovc_op = 0x11, fmovz_op = 0x12,
  204. fmovn_op = 0x13, fseleqz_op = 0x14,
  205. frecip_op = 0x15, frsqrt_op = 0x16,
  206. fselnez_op = 0x17, fmaddf_op = 0x18,
  207. fmsubf_op = 0x19, frint_op = 0x1a,
  208. fclass_op = 0x1b, fmin_op = 0x1c,
  209. fmina_op = 0x1d, fmax_op = 0x1e,
  210. fmaxa_op = 0x1f, fcvts_op = 0x20,
  211. fcvtd_op = 0x21, fcvte_op = 0x22,
  212. fcvtw_op = 0x24, fcvtl_op = 0x25,
  213. fcmp_op = 0x30
  214. };
  215. /*
  216. * func field of cop1x opcodes (MIPS IV).
  217. */
  218. enum cop1x_func {
  219. lwxc1_op = 0x00, ldxc1_op = 0x01,
  220. swxc1_op = 0x08, sdxc1_op = 0x09,
  221. pfetch_op = 0x0f, madd_s_op = 0x20,
  222. madd_d_op = 0x21, madd_e_op = 0x22,
  223. msub_s_op = 0x28, msub_d_op = 0x29,
  224. msub_e_op = 0x2a, nmadd_s_op = 0x30,
  225. nmadd_d_op = 0x31, nmadd_e_op = 0x32,
  226. nmsub_s_op = 0x38, nmsub_d_op = 0x39,
  227. nmsub_e_op = 0x3a
  228. };
  229. /*
  230. * func field for mad opcodes (MIPS IV).
  231. */
  232. enum mad_func {
  233. madd_fp_op = 0x08, msub_fp_op = 0x0a,
  234. nmadd_fp_op = 0x0c, nmsub_fp_op = 0x0e
  235. };
  236. /*
  237. * func field for page table walker (Loongson-3).
  238. */
  239. enum ptw_func {
  240. lwdir_op = 0x00,
  241. lwpte_op = 0x01,
  242. lddir_op = 0x02,
  243. ldpte_op = 0x03,
  244. };
  245. /*
  246. * func field for special3 lx opcodes (Cavium Octeon).
  247. */
  248. enum lx_func {
  249. lwx_op = 0x00,
  250. lhx_op = 0x04,
  251. lbux_op = 0x06,
  252. ldx_op = 0x08,
  253. lwux_op = 0x10,
  254. lhux_op = 0x14,
  255. lbx_op = 0x16,
  256. };
  257. /*
  258. * BSHFL opcodes
  259. */
  260. enum bshfl_func {
  261. wsbh_op = 0x2,
  262. seb_op = 0x10,
  263. seh_op = 0x18,
  264. };
  265. /*
  266. * DBSHFL opcodes
  267. */
  268. enum dbshfl_func {
  269. dsbh_op = 0x2,
  270. dshd_op = 0x5,
  271. };
  272. /*
  273. * MSA minor opcodes.
  274. */
  275. enum msa_func {
  276. msa_elm_op = 0x19,
  277. };
  278. /*
  279. * MSA ELM opcodes.
  280. */
  281. enum msa_elm {
  282. msa_ctc_op = 0x3e,
  283. msa_cfc_op = 0x7e,
  284. };
  285. /*
  286. * func field for MSA MI10 format.
  287. */
  288. enum msa_mi10_func {
  289. msa_ld_op = 8,
  290. msa_st_op = 9,
  291. };
  292. /*
  293. * MSA 2 bit format fields.
  294. */
  295. enum msa_2b_fmt {
  296. msa_fmt_b = 0,
  297. msa_fmt_h = 1,
  298. msa_fmt_w = 2,
  299. msa_fmt_d = 3,
  300. };
  301. /*
  302. * (microMIPS) Major opcodes.
  303. */
  304. enum mm_major_op {
  305. mm_pool32a_op, mm_pool16a_op, mm_lbu16_op, mm_move16_op,
  306. mm_addi32_op, mm_lbu32_op, mm_sb32_op, mm_lb32_op,
  307. mm_pool32b_op, mm_pool16b_op, mm_lhu16_op, mm_andi16_op,
  308. mm_addiu32_op, mm_lhu32_op, mm_sh32_op, mm_lh32_op,
  309. mm_pool32i_op, mm_pool16c_op, mm_lwsp16_op, mm_pool16d_op,
  310. mm_ori32_op, mm_pool32f_op, mm_pool32s_op, mm_reserved2_op,
  311. mm_pool32c_op, mm_lwgp16_op, mm_lw16_op, mm_pool16e_op,
  312. mm_xori32_op, mm_jals32_op, mm_addiupc_op, mm_reserved3_op,
  313. mm_reserved4_op, mm_pool16f_op, mm_sb16_op, mm_beqz16_op,
  314. mm_slti32_op, mm_beq32_op, mm_swc132_op, mm_lwc132_op,
  315. mm_reserved5_op, mm_reserved6_op, mm_sh16_op, mm_bnez16_op,
  316. mm_sltiu32_op, mm_bne32_op, mm_sdc132_op, mm_ldc132_op,
  317. mm_reserved7_op, mm_reserved8_op, mm_swsp16_op, mm_b16_op,
  318. mm_andi32_op, mm_j32_op, mm_sd32_op, mm_ld32_op,
  319. mm_reserved11_op, mm_reserved12_op, mm_sw16_op, mm_li16_op,
  320. mm_jalx32_op, mm_jal32_op, mm_sw32_op, mm_lw32_op,
  321. };
  322. /*
  323. * (microMIPS) POOL32I minor opcodes.
  324. */
  325. enum mm_32i_minor_op {
  326. mm_bltz_op, mm_bltzal_op, mm_bgez_op, mm_bgezal_op,
  327. mm_blez_op, mm_bnezc_op, mm_bgtz_op, mm_beqzc_op,
  328. mm_tlti_op, mm_tgei_op, mm_tltiu_op, mm_tgeiu_op,
  329. mm_tnei_op, mm_lui_op, mm_teqi_op, mm_reserved13_op,
  330. mm_synci_op, mm_bltzals_op, mm_reserved14_op, mm_bgezals_op,
  331. mm_bc2f_op, mm_bc2t_op, mm_reserved15_op, mm_reserved16_op,
  332. mm_reserved17_op, mm_reserved18_op, mm_bposge64_op, mm_bposge32_op,
  333. mm_bc1f_op, mm_bc1t_op, mm_reserved19_op, mm_reserved20_op,
  334. mm_bc1any2f_op, mm_bc1any2t_op, mm_bc1any4f_op, mm_bc1any4t_op,
  335. };
  336. /*
  337. * (microMIPS) POOL32A minor opcodes.
  338. */
  339. enum mm_32a_minor_op {
  340. mm_sll32_op = 0x000,
  341. mm_ins_op = 0x00c,
  342. mm_sllv32_op = 0x010,
  343. mm_ext_op = 0x02c,
  344. mm_pool32axf_op = 0x03c,
  345. mm_srl32_op = 0x040,
  346. mm_srlv32_op = 0x050,
  347. mm_sra_op = 0x080,
  348. mm_srav_op = 0x090,
  349. mm_rotr_op = 0x0c0,
  350. mm_lwxs_op = 0x118,
  351. mm_addu32_op = 0x150,
  352. mm_subu32_op = 0x1d0,
  353. mm_wsbh_op = 0x1ec,
  354. mm_mul_op = 0x210,
  355. mm_and_op = 0x250,
  356. mm_or32_op = 0x290,
  357. mm_xor32_op = 0x310,
  358. mm_slt_op = 0x350,
  359. mm_sltu_op = 0x390,
  360. };
  361. /*
  362. * (microMIPS) POOL32B functions.
  363. */
  364. enum mm_32b_func {
  365. mm_lwc2_func = 0x0,
  366. mm_lwp_func = 0x1,
  367. mm_ldc2_func = 0x2,
  368. mm_ldp_func = 0x4,
  369. mm_lwm32_func = 0x5,
  370. mm_cache_func = 0x6,
  371. mm_ldm_func = 0x7,
  372. mm_swc2_func = 0x8,
  373. mm_swp_func = 0x9,
  374. mm_sdc2_func = 0xa,
  375. mm_sdp_func = 0xc,
  376. mm_swm32_func = 0xd,
  377. mm_sdm_func = 0xf,
  378. };
  379. /*
  380. * (microMIPS) POOL32C functions.
  381. */
  382. enum mm_32c_func {
  383. mm_pref_func = 0x2,
  384. mm_ll_func = 0x3,
  385. mm_swr_func = 0x9,
  386. mm_sc_func = 0xb,
  387. mm_lwu_func = 0xe,
  388. };
  389. /*
  390. * (microMIPS) POOL32AXF minor opcodes.
  391. */
  392. enum mm_32axf_minor_op {
  393. mm_mfc0_op = 0x003,
  394. mm_mtc0_op = 0x00b,
  395. mm_tlbp_op = 0x00d,
  396. mm_mfhi32_op = 0x035,
  397. mm_jalr_op = 0x03c,
  398. mm_tlbr_op = 0x04d,
  399. mm_mflo32_op = 0x075,
  400. mm_jalrhb_op = 0x07c,
  401. mm_tlbwi_op = 0x08d,
  402. mm_mthi32_op = 0x0b5,
  403. mm_tlbwr_op = 0x0cd,
  404. mm_mtlo32_op = 0x0f5,
  405. mm_di_op = 0x11d,
  406. mm_jalrs_op = 0x13c,
  407. mm_jalrshb_op = 0x17c,
  408. mm_sync_op = 0x1ad,
  409. mm_syscall_op = 0x22d,
  410. mm_wait_op = 0x24d,
  411. mm_eret_op = 0x3cd,
  412. mm_divu_op = 0x5dc,
  413. };
  414. /*
  415. * (microMIPS) POOL32F minor opcodes.
  416. */
  417. enum mm_32f_minor_op {
  418. mm_32f_00_op = 0x00,
  419. mm_32f_01_op = 0x01,
  420. mm_32f_02_op = 0x02,
  421. mm_32f_10_op = 0x08,
  422. mm_32f_11_op = 0x09,
  423. mm_32f_12_op = 0x0a,
  424. mm_32f_20_op = 0x10,
  425. mm_32f_30_op = 0x18,
  426. mm_32f_40_op = 0x20,
  427. mm_32f_41_op = 0x21,
  428. mm_32f_42_op = 0x22,
  429. mm_32f_50_op = 0x28,
  430. mm_32f_51_op = 0x29,
  431. mm_32f_52_op = 0x2a,
  432. mm_32f_60_op = 0x30,
  433. mm_32f_70_op = 0x38,
  434. mm_32f_73_op = 0x3b,
  435. mm_32f_74_op = 0x3c,
  436. };
  437. /*
  438. * (microMIPS) POOL32F secondary minor opcodes.
  439. */
  440. enum mm_32f_10_minor_op {
  441. mm_lwxc1_op = 0x1,
  442. mm_swxc1_op,
  443. mm_ldxc1_op,
  444. mm_sdxc1_op,
  445. mm_luxc1_op,
  446. mm_suxc1_op,
  447. };
  448. enum mm_32f_func {
  449. mm_lwxc1_func = 0x048,
  450. mm_swxc1_func = 0x088,
  451. mm_ldxc1_func = 0x0c8,
  452. mm_sdxc1_func = 0x108,
  453. };
  454. /*
  455. * (microMIPS) POOL32F secondary minor opcodes.
  456. */
  457. enum mm_32f_40_minor_op {
  458. mm_fmovf_op,
  459. mm_fmovt_op,
  460. };
  461. /*
  462. * (microMIPS) POOL32F secondary minor opcodes.
  463. */
  464. enum mm_32f_60_minor_op {
  465. mm_fadd_op,
  466. mm_fsub_op,
  467. mm_fmul_op,
  468. mm_fdiv_op,
  469. };
  470. /*
  471. * (microMIPS) POOL32F secondary minor opcodes.
  472. */
  473. enum mm_32f_70_minor_op {
  474. mm_fmovn_op,
  475. mm_fmovz_op,
  476. };
  477. /*
  478. * (microMIPS) POOL32FXF secondary minor opcodes for POOL32F.
  479. */
  480. enum mm_32f_73_minor_op {
  481. mm_fmov0_op = 0x01,
  482. mm_fcvtl_op = 0x04,
  483. mm_movf0_op = 0x05,
  484. mm_frsqrt_op = 0x08,
  485. mm_ffloorl_op = 0x0c,
  486. mm_fabs0_op = 0x0d,
  487. mm_fcvtw_op = 0x24,
  488. mm_movt0_op = 0x25,
  489. mm_fsqrt_op = 0x28,
  490. mm_ffloorw_op = 0x2c,
  491. mm_fneg0_op = 0x2d,
  492. mm_cfc1_op = 0x40,
  493. mm_frecip_op = 0x48,
  494. mm_fceill_op = 0x4c,
  495. mm_fcvtd0_op = 0x4d,
  496. mm_ctc1_op = 0x60,
  497. mm_fceilw_op = 0x6c,
  498. mm_fcvts0_op = 0x6d,
  499. mm_mfc1_op = 0x80,
  500. mm_fmov1_op = 0x81,
  501. mm_movf1_op = 0x85,
  502. mm_ftruncl_op = 0x8c,
  503. mm_fabs1_op = 0x8d,
  504. mm_mtc1_op = 0xa0,
  505. mm_movt1_op = 0xa5,
  506. mm_ftruncw_op = 0xac,
  507. mm_fneg1_op = 0xad,
  508. mm_mfhc1_op = 0xc0,
  509. mm_froundl_op = 0xcc,
  510. mm_fcvtd1_op = 0xcd,
  511. mm_mthc1_op = 0xe0,
  512. mm_froundw_op = 0xec,
  513. mm_fcvts1_op = 0xed,
  514. };
  515. /*
  516. * (microMIPS) POOL32S minor opcodes.
  517. */
  518. enum mm_32s_minor_op {
  519. mm_32s_elm_op = 0x16,
  520. };
  521. /*
  522. * (microMIPS) POOL16C minor opcodes.
  523. */
  524. enum mm_16c_minor_op {
  525. mm_lwm16_op = 0x04,
  526. mm_swm16_op = 0x05,
  527. mm_jr16_op = 0x0c,
  528. mm_jrc_op = 0x0d,
  529. mm_jalr16_op = 0x0e,
  530. mm_jalrs16_op = 0x0f,
  531. mm_jraddiusp_op = 0x18,
  532. };
  533. /*
  534. * (microMIPS) POOL16D minor opcodes.
  535. */
  536. enum mm_16d_minor_op {
  537. mm_addius5_func,
  538. mm_addiusp_func,
  539. };
  540. /*
  541. * (MIPS16e) opcodes.
  542. */
  543. enum MIPS16e_ops {
  544. MIPS16e_jal_op = 003,
  545. MIPS16e_ld_op = 007,
  546. MIPS16e_i8_op = 014,
  547. MIPS16e_sd_op = 017,
  548. MIPS16e_lb_op = 020,
  549. MIPS16e_lh_op = 021,
  550. MIPS16e_lwsp_op = 022,
  551. MIPS16e_lw_op = 023,
  552. MIPS16e_lbu_op = 024,
  553. MIPS16e_lhu_op = 025,
  554. MIPS16e_lwpc_op = 026,
  555. MIPS16e_lwu_op = 027,
  556. MIPS16e_sb_op = 030,
  557. MIPS16e_sh_op = 031,
  558. MIPS16e_swsp_op = 032,
  559. MIPS16e_sw_op = 033,
  560. MIPS16e_rr_op = 035,
  561. MIPS16e_extend_op = 036,
  562. MIPS16e_i64_op = 037,
  563. };
  564. enum MIPS16e_i64_func {
  565. MIPS16e_ldsp_func,
  566. MIPS16e_sdsp_func,
  567. MIPS16e_sdrasp_func,
  568. MIPS16e_dadjsp_func,
  569. MIPS16e_ldpc_func,
  570. };
  571. enum MIPS16e_rr_func {
  572. MIPS16e_jr_func,
  573. };
  574. enum MIPS6e_i8_func {
  575. MIPS16e_swrasp_func = 02,
  576. };
  577. /*
  578. * (microMIPS) NOP instruction.
  579. */
  580. #define MM_NOP16 0x0c00
  581. struct j_format {
  582. __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */
  583. __BITFIELD_FIELD(unsigned int target : 26,
  584. ;))
  585. };
  586. struct i_format { /* signed immediate format */
  587. __BITFIELD_FIELD(unsigned int opcode : 6,
  588. __BITFIELD_FIELD(unsigned int rs : 5,
  589. __BITFIELD_FIELD(unsigned int rt : 5,
  590. __BITFIELD_FIELD(signed int simmediate : 16,
  591. ;))))
  592. };
  593. struct u_format { /* unsigned immediate format */
  594. __BITFIELD_FIELD(unsigned int opcode : 6,
  595. __BITFIELD_FIELD(unsigned int rs : 5,
  596. __BITFIELD_FIELD(unsigned int rt : 5,
  597. __BITFIELD_FIELD(unsigned int uimmediate : 16,
  598. ;))))
  599. };
  600. struct c_format { /* Cache (>= R6000) format */
  601. __BITFIELD_FIELD(unsigned int opcode : 6,
  602. __BITFIELD_FIELD(unsigned int rs : 5,
  603. __BITFIELD_FIELD(unsigned int c_op : 3,
  604. __BITFIELD_FIELD(unsigned int cache : 2,
  605. __BITFIELD_FIELD(unsigned int simmediate : 16,
  606. ;)))))
  607. };
  608. struct r_format { /* Register format */
  609. __BITFIELD_FIELD(unsigned int opcode : 6,
  610. __BITFIELD_FIELD(unsigned int rs : 5,
  611. __BITFIELD_FIELD(unsigned int rt : 5,
  612. __BITFIELD_FIELD(unsigned int rd : 5,
  613. __BITFIELD_FIELD(unsigned int re : 5,
  614. __BITFIELD_FIELD(unsigned int func : 6,
  615. ;))))))
  616. };
  617. struct c0r_format { /* C0 register format */
  618. __BITFIELD_FIELD(unsigned int opcode : 6,
  619. __BITFIELD_FIELD(unsigned int rs : 5,
  620. __BITFIELD_FIELD(unsigned int rt : 5,
  621. __BITFIELD_FIELD(unsigned int rd : 5,
  622. __BITFIELD_FIELD(unsigned int z: 8,
  623. __BITFIELD_FIELD(unsigned int sel : 3,
  624. ;))))))
  625. };
  626. struct mfmc0_format { /* MFMC0 register format */
  627. __BITFIELD_FIELD(unsigned int opcode : 6,
  628. __BITFIELD_FIELD(unsigned int rs : 5,
  629. __BITFIELD_FIELD(unsigned int rt : 5,
  630. __BITFIELD_FIELD(unsigned int rd : 5,
  631. __BITFIELD_FIELD(unsigned int re : 5,
  632. __BITFIELD_FIELD(unsigned int sc : 1,
  633. __BITFIELD_FIELD(unsigned int : 2,
  634. __BITFIELD_FIELD(unsigned int sel : 3,
  635. ;))))))))
  636. };
  637. struct co_format { /* C0 CO format */
  638. __BITFIELD_FIELD(unsigned int opcode : 6,
  639. __BITFIELD_FIELD(unsigned int co : 1,
  640. __BITFIELD_FIELD(unsigned int code : 19,
  641. __BITFIELD_FIELD(unsigned int func : 6,
  642. ;))))
  643. };
  644. struct p_format { /* Performance counter format (R10000) */
  645. __BITFIELD_FIELD(unsigned int opcode : 6,
  646. __BITFIELD_FIELD(unsigned int rs : 5,
  647. __BITFIELD_FIELD(unsigned int rt : 5,
  648. __BITFIELD_FIELD(unsigned int rd : 5,
  649. __BITFIELD_FIELD(unsigned int re : 5,
  650. __BITFIELD_FIELD(unsigned int func : 6,
  651. ;))))))
  652. };
  653. struct f_format { /* FPU register format */
  654. __BITFIELD_FIELD(unsigned int opcode : 6,
  655. __BITFIELD_FIELD(unsigned int : 1,
  656. __BITFIELD_FIELD(unsigned int fmt : 4,
  657. __BITFIELD_FIELD(unsigned int rt : 5,
  658. __BITFIELD_FIELD(unsigned int rd : 5,
  659. __BITFIELD_FIELD(unsigned int re : 5,
  660. __BITFIELD_FIELD(unsigned int func : 6,
  661. ;)))))))
  662. };
  663. struct ma_format { /* FPU multiply and add format (MIPS IV) */
  664. __BITFIELD_FIELD(unsigned int opcode : 6,
  665. __BITFIELD_FIELD(unsigned int fr : 5,
  666. __BITFIELD_FIELD(unsigned int ft : 5,
  667. __BITFIELD_FIELD(unsigned int fs : 5,
  668. __BITFIELD_FIELD(unsigned int fd : 5,
  669. __BITFIELD_FIELD(unsigned int func : 4,
  670. __BITFIELD_FIELD(unsigned int fmt : 2,
  671. ;)))))))
  672. };
  673. struct b_format { /* BREAK and SYSCALL */
  674. __BITFIELD_FIELD(unsigned int opcode : 6,
  675. __BITFIELD_FIELD(unsigned int code : 20,
  676. __BITFIELD_FIELD(unsigned int func : 6,
  677. ;)))
  678. };
  679. struct ps_format { /* MIPS-3D / paired single format */
  680. __BITFIELD_FIELD(unsigned int opcode : 6,
  681. __BITFIELD_FIELD(unsigned int rs : 5,
  682. __BITFIELD_FIELD(unsigned int ft : 5,
  683. __BITFIELD_FIELD(unsigned int fs : 5,
  684. __BITFIELD_FIELD(unsigned int fd : 5,
  685. __BITFIELD_FIELD(unsigned int func : 6,
  686. ;))))))
  687. };
  688. struct v_format { /* MDMX vector format */
  689. __BITFIELD_FIELD(unsigned int opcode : 6,
  690. __BITFIELD_FIELD(unsigned int sel : 4,
  691. __BITFIELD_FIELD(unsigned int fmt : 1,
  692. __BITFIELD_FIELD(unsigned int vt : 5,
  693. __BITFIELD_FIELD(unsigned int vs : 5,
  694. __BITFIELD_FIELD(unsigned int vd : 5,
  695. __BITFIELD_FIELD(unsigned int func : 6,
  696. ;)))))))
  697. };
  698. struct msa_mi10_format { /* MSA MI10 */
  699. __BITFIELD_FIELD(unsigned int opcode : 6,
  700. __BITFIELD_FIELD(signed int s10 : 10,
  701. __BITFIELD_FIELD(unsigned int rs : 5,
  702. __BITFIELD_FIELD(unsigned int wd : 5,
  703. __BITFIELD_FIELD(unsigned int func : 4,
  704. __BITFIELD_FIELD(unsigned int df : 2,
  705. ;))))))
  706. };
  707. struct dsp_format { /* SPEC3 DSP format instructions */
  708. __BITFIELD_FIELD(unsigned int opcode : 6,
  709. __BITFIELD_FIELD(unsigned int base : 5,
  710. __BITFIELD_FIELD(unsigned int index : 5,
  711. __BITFIELD_FIELD(unsigned int rd : 5,
  712. __BITFIELD_FIELD(unsigned int op : 5,
  713. __BITFIELD_FIELD(unsigned int func : 6,
  714. ;))))))
  715. };
  716. struct spec3_format { /* SPEC3 */
  717. __BITFIELD_FIELD(unsigned int opcode:6,
  718. __BITFIELD_FIELD(unsigned int rs:5,
  719. __BITFIELD_FIELD(unsigned int rt:5,
  720. __BITFIELD_FIELD(signed int simmediate:9,
  721. __BITFIELD_FIELD(unsigned int func:7,
  722. ;)))))
  723. };
  724. /*
  725. * microMIPS instruction formats (32-bit length)
  726. *
  727. * NOTE:
  728. * Parenthesis denote whether the format is a microMIPS instruction or
  729. * if it is MIPS32 instruction re-encoded for use in the microMIPS ASE.
  730. */
  731. struct fb_format { /* FPU branch format (MIPS32) */
  732. __BITFIELD_FIELD(unsigned int opcode : 6,
  733. __BITFIELD_FIELD(unsigned int bc : 5,
  734. __BITFIELD_FIELD(unsigned int cc : 3,
  735. __BITFIELD_FIELD(unsigned int flag : 2,
  736. __BITFIELD_FIELD(signed int simmediate : 16,
  737. ;)))))
  738. };
  739. struct fp0_format { /* FPU multiply and add format (MIPS32) */
  740. __BITFIELD_FIELD(unsigned int opcode : 6,
  741. __BITFIELD_FIELD(unsigned int fmt : 5,
  742. __BITFIELD_FIELD(unsigned int ft : 5,
  743. __BITFIELD_FIELD(unsigned int fs : 5,
  744. __BITFIELD_FIELD(unsigned int fd : 5,
  745. __BITFIELD_FIELD(unsigned int func : 6,
  746. ;))))))
  747. };
  748. struct mm_fp0_format { /* FPU multiply and add format (microMIPS) */
  749. __BITFIELD_FIELD(unsigned int opcode : 6,
  750. __BITFIELD_FIELD(unsigned int ft : 5,
  751. __BITFIELD_FIELD(unsigned int fs : 5,
  752. __BITFIELD_FIELD(unsigned int fd : 5,
  753. __BITFIELD_FIELD(unsigned int fmt : 3,
  754. __BITFIELD_FIELD(unsigned int op : 2,
  755. __BITFIELD_FIELD(unsigned int func : 6,
  756. ;)))))))
  757. };
  758. struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */
  759. __BITFIELD_FIELD(unsigned int opcode : 6,
  760. __BITFIELD_FIELD(unsigned int op : 5,
  761. __BITFIELD_FIELD(unsigned int rt : 5,
  762. __BITFIELD_FIELD(unsigned int fs : 5,
  763. __BITFIELD_FIELD(unsigned int fd : 5,
  764. __BITFIELD_FIELD(unsigned int func : 6,
  765. ;))))))
  766. };
  767. struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */
  768. __BITFIELD_FIELD(unsigned int opcode : 6,
  769. __BITFIELD_FIELD(unsigned int rt : 5,
  770. __BITFIELD_FIELD(unsigned int fs : 5,
  771. __BITFIELD_FIELD(unsigned int fmt : 2,
  772. __BITFIELD_FIELD(unsigned int op : 8,
  773. __BITFIELD_FIELD(unsigned int func : 6,
  774. ;))))))
  775. };
  776. struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */
  777. __BITFIELD_FIELD(unsigned int opcode : 6,
  778. __BITFIELD_FIELD(unsigned int fd : 5,
  779. __BITFIELD_FIELD(unsigned int fs : 5,
  780. __BITFIELD_FIELD(unsigned int cc : 3,
  781. __BITFIELD_FIELD(unsigned int zero : 2,
  782. __BITFIELD_FIELD(unsigned int fmt : 2,
  783. __BITFIELD_FIELD(unsigned int op : 3,
  784. __BITFIELD_FIELD(unsigned int func : 6,
  785. ;))))))))
  786. };
  787. struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */
  788. __BITFIELD_FIELD(unsigned int opcode : 6,
  789. __BITFIELD_FIELD(unsigned int rt : 5,
  790. __BITFIELD_FIELD(unsigned int fs : 5,
  791. __BITFIELD_FIELD(unsigned int fmt : 3,
  792. __BITFIELD_FIELD(unsigned int op : 7,
  793. __BITFIELD_FIELD(unsigned int func : 6,
  794. ;))))))
  795. };
  796. struct mm_fp4_format { /* FPU c.cond format (microMIPS) */
  797. __BITFIELD_FIELD(unsigned int opcode : 6,
  798. __BITFIELD_FIELD(unsigned int rt : 5,
  799. __BITFIELD_FIELD(unsigned int fs : 5,
  800. __BITFIELD_FIELD(unsigned int cc : 3,
  801. __BITFIELD_FIELD(unsigned int fmt : 3,
  802. __BITFIELD_FIELD(unsigned int cond : 4,
  803. __BITFIELD_FIELD(unsigned int func : 6,
  804. ;)))))))
  805. };
  806. struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */
  807. __BITFIELD_FIELD(unsigned int opcode : 6,
  808. __BITFIELD_FIELD(unsigned int index : 5,
  809. __BITFIELD_FIELD(unsigned int base : 5,
  810. __BITFIELD_FIELD(unsigned int fd : 5,
  811. __BITFIELD_FIELD(unsigned int op : 5,
  812. __BITFIELD_FIELD(unsigned int func : 6,
  813. ;))))))
  814. };
  815. struct fp6_format { /* FPU madd and msub format (MIPS IV) */
  816. __BITFIELD_FIELD(unsigned int opcode : 6,
  817. __BITFIELD_FIELD(unsigned int fr : 5,
  818. __BITFIELD_FIELD(unsigned int ft : 5,
  819. __BITFIELD_FIELD(unsigned int fs : 5,
  820. __BITFIELD_FIELD(unsigned int fd : 5,
  821. __BITFIELD_FIELD(unsigned int func : 6,
  822. ;))))))
  823. };
  824. struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */
  825. __BITFIELD_FIELD(unsigned int opcode : 6,
  826. __BITFIELD_FIELD(unsigned int ft : 5,
  827. __BITFIELD_FIELD(unsigned int fs : 5,
  828. __BITFIELD_FIELD(unsigned int fd : 5,
  829. __BITFIELD_FIELD(unsigned int fr : 5,
  830. __BITFIELD_FIELD(unsigned int func : 6,
  831. ;))))))
  832. };
  833. struct mm_i_format { /* Immediate format (microMIPS) */
  834. __BITFIELD_FIELD(unsigned int opcode : 6,
  835. __BITFIELD_FIELD(unsigned int rt : 5,
  836. __BITFIELD_FIELD(unsigned int rs : 5,
  837. __BITFIELD_FIELD(signed int simmediate : 16,
  838. ;))))
  839. };
  840. struct mm_m_format { /* Multi-word load/store format (microMIPS) */
  841. __BITFIELD_FIELD(unsigned int opcode : 6,
  842. __BITFIELD_FIELD(unsigned int rd : 5,
  843. __BITFIELD_FIELD(unsigned int base : 5,
  844. __BITFIELD_FIELD(unsigned int func : 4,
  845. __BITFIELD_FIELD(signed int simmediate : 12,
  846. ;)))))
  847. };
  848. struct mm_x_format { /* Scaled indexed load format (microMIPS) */
  849. __BITFIELD_FIELD(unsigned int opcode : 6,
  850. __BITFIELD_FIELD(unsigned int index : 5,
  851. __BITFIELD_FIELD(unsigned int base : 5,
  852. __BITFIELD_FIELD(unsigned int rd : 5,
  853. __BITFIELD_FIELD(unsigned int func : 11,
  854. ;)))))
  855. };
  856. struct mm_a_format { /* ADDIUPC format (microMIPS) */
  857. __BITFIELD_FIELD(unsigned int opcode : 6,
  858. __BITFIELD_FIELD(unsigned int rs : 3,
  859. __BITFIELD_FIELD(signed int simmediate : 23,
  860. ;)))
  861. };
  862. /*
  863. * microMIPS instruction formats (16-bit length)
  864. */
  865. struct mm_b0_format { /* Unconditional branch format (microMIPS) */
  866. __BITFIELD_FIELD(unsigned int opcode : 6,
  867. __BITFIELD_FIELD(signed int simmediate : 10,
  868. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  869. ;)))
  870. };
  871. struct mm_b1_format { /* Conditional branch format (microMIPS) */
  872. __BITFIELD_FIELD(unsigned int opcode : 6,
  873. __BITFIELD_FIELD(unsigned int rs : 3,
  874. __BITFIELD_FIELD(signed int simmediate : 7,
  875. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  876. ;))))
  877. };
  878. struct mm16_m_format { /* Multi-word load/store format */
  879. __BITFIELD_FIELD(unsigned int opcode : 6,
  880. __BITFIELD_FIELD(unsigned int func : 4,
  881. __BITFIELD_FIELD(unsigned int rlist : 2,
  882. __BITFIELD_FIELD(unsigned int imm : 4,
  883. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  884. ;)))))
  885. };
  886. struct mm16_rb_format { /* Signed immediate format */
  887. __BITFIELD_FIELD(unsigned int opcode : 6,
  888. __BITFIELD_FIELD(unsigned int rt : 3,
  889. __BITFIELD_FIELD(unsigned int base : 3,
  890. __BITFIELD_FIELD(signed int simmediate : 4,
  891. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  892. ;)))))
  893. };
  894. struct mm16_r3_format { /* Load from global pointer format */
  895. __BITFIELD_FIELD(unsigned int opcode : 6,
  896. __BITFIELD_FIELD(unsigned int rt : 3,
  897. __BITFIELD_FIELD(signed int simmediate : 7,
  898. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  899. ;))))
  900. };
  901. struct mm16_r5_format { /* Load/store from stack pointer format */
  902. __BITFIELD_FIELD(unsigned int opcode : 6,
  903. __BITFIELD_FIELD(unsigned int rt : 5,
  904. __BITFIELD_FIELD(unsigned int imm : 5,
  905. __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
  906. ;))))
  907. };
  908. /*
  909. * Loongson-3 overridden COP2 instruction formats (32-bit length)
  910. */
  911. struct loongson3_lswc2_format { /* Loongson-3 overridden lwc2/swc2 Load/Store format */
  912. __BITFIELD_FIELD(unsigned int opcode : 6,
  913. __BITFIELD_FIELD(unsigned int base : 5,
  914. __BITFIELD_FIELD(unsigned int rt : 5,
  915. __BITFIELD_FIELD(unsigned int fr : 1,
  916. __BITFIELD_FIELD(unsigned int offset : 9,
  917. __BITFIELD_FIELD(unsigned int ls : 1,
  918. __BITFIELD_FIELD(unsigned int rq : 5,
  919. ;)))))))
  920. };
  921. struct loongson3_lsdc2_format { /* Loongson-3 overridden ldc2/sdc2 Load/Store format */
  922. __BITFIELD_FIELD(unsigned int opcode : 6,
  923. __BITFIELD_FIELD(unsigned int base : 5,
  924. __BITFIELD_FIELD(unsigned int rt : 5,
  925. __BITFIELD_FIELD(unsigned int index : 5,
  926. __BITFIELD_FIELD(unsigned int offset : 8,
  927. __BITFIELD_FIELD(unsigned int opcode1 : 3,
  928. ;))))))
  929. };
  930. struct loongson3_lscsr_format { /* Loongson-3 CPUCFG&CSR read/write format */
  931. __BITFIELD_FIELD(unsigned int opcode : 6,
  932. __BITFIELD_FIELD(unsigned int rs : 5,
  933. __BITFIELD_FIELD(unsigned int fr : 5,
  934. __BITFIELD_FIELD(unsigned int rd : 5,
  935. __BITFIELD_FIELD(unsigned int fd : 5,
  936. __BITFIELD_FIELD(unsigned int func : 6,
  937. ;))))))
  938. };
  939. /*
  940. * MIPS16e instruction formats (16-bit length)
  941. */
  942. struct m16e_rr {
  943. __BITFIELD_FIELD(unsigned int opcode : 5,
  944. __BITFIELD_FIELD(unsigned int rx : 3,
  945. __BITFIELD_FIELD(unsigned int nd : 1,
  946. __BITFIELD_FIELD(unsigned int l : 1,
  947. __BITFIELD_FIELD(unsigned int ra : 1,
  948. __BITFIELD_FIELD(unsigned int func : 5,
  949. ;))))))
  950. };
  951. struct m16e_jal {
  952. __BITFIELD_FIELD(unsigned int opcode : 5,
  953. __BITFIELD_FIELD(unsigned int x : 1,
  954. __BITFIELD_FIELD(unsigned int imm20_16 : 5,
  955. __BITFIELD_FIELD(signed int imm25_21 : 5,
  956. ;))))
  957. };
  958. struct m16e_i64 {
  959. __BITFIELD_FIELD(unsigned int opcode : 5,
  960. __BITFIELD_FIELD(unsigned int func : 3,
  961. __BITFIELD_FIELD(unsigned int imm : 8,
  962. ;)))
  963. };
  964. struct m16e_ri64 {
  965. __BITFIELD_FIELD(unsigned int opcode : 5,
  966. __BITFIELD_FIELD(unsigned int func : 3,
  967. __BITFIELD_FIELD(unsigned int ry : 3,
  968. __BITFIELD_FIELD(unsigned int imm : 5,
  969. ;))))
  970. };
  971. struct m16e_ri {
  972. __BITFIELD_FIELD(unsigned int opcode : 5,
  973. __BITFIELD_FIELD(unsigned int rx : 3,
  974. __BITFIELD_FIELD(unsigned int imm : 8,
  975. ;)))
  976. };
  977. struct m16e_rri {
  978. __BITFIELD_FIELD(unsigned int opcode : 5,
  979. __BITFIELD_FIELD(unsigned int rx : 3,
  980. __BITFIELD_FIELD(unsigned int ry : 3,
  981. __BITFIELD_FIELD(unsigned int imm : 5,
  982. ;))))
  983. };
  984. struct m16e_i8 {
  985. __BITFIELD_FIELD(unsigned int opcode : 5,
  986. __BITFIELD_FIELD(unsigned int func : 3,
  987. __BITFIELD_FIELD(unsigned int imm : 8,
  988. ;)))
  989. };
  990. union mips_instruction {
  991. unsigned int word;
  992. unsigned short halfword[2];
  993. unsigned char byte[4];
  994. struct j_format j_format;
  995. struct i_format i_format;
  996. struct u_format u_format;
  997. struct c_format c_format;
  998. struct r_format r_format;
  999. struct c0r_format c0r_format;
  1000. struct mfmc0_format mfmc0_format;
  1001. struct co_format co_format;
  1002. struct p_format p_format;
  1003. struct f_format f_format;
  1004. struct ma_format ma_format;
  1005. struct msa_mi10_format msa_mi10_format;
  1006. struct b_format b_format;
  1007. struct ps_format ps_format;
  1008. struct v_format v_format;
  1009. struct dsp_format dsp_format;
  1010. struct spec3_format spec3_format;
  1011. struct fb_format fb_format;
  1012. struct fp0_format fp0_format;
  1013. struct mm_fp0_format mm_fp0_format;
  1014. struct fp1_format fp1_format;
  1015. struct mm_fp1_format mm_fp1_format;
  1016. struct mm_fp2_format mm_fp2_format;
  1017. struct mm_fp3_format mm_fp3_format;
  1018. struct mm_fp4_format mm_fp4_format;
  1019. struct mm_fp5_format mm_fp5_format;
  1020. struct fp6_format fp6_format;
  1021. struct mm_fp6_format mm_fp6_format;
  1022. struct mm_i_format mm_i_format;
  1023. struct mm_m_format mm_m_format;
  1024. struct mm_x_format mm_x_format;
  1025. struct mm_a_format mm_a_format;
  1026. struct mm_b0_format mm_b0_format;
  1027. struct mm_b1_format mm_b1_format;
  1028. struct mm16_m_format mm16_m_format ;
  1029. struct mm16_rb_format mm16_rb_format;
  1030. struct mm16_r3_format mm16_r3_format;
  1031. struct mm16_r5_format mm16_r5_format;
  1032. struct loongson3_lswc2_format loongson3_lswc2_format;
  1033. struct loongson3_lsdc2_format loongson3_lsdc2_format;
  1034. struct loongson3_lscsr_format loongson3_lscsr_format;
  1035. };
  1036. union mips16e_instruction {
  1037. unsigned int full : 16;
  1038. struct m16e_rr rr;
  1039. struct m16e_jal jal;
  1040. struct m16e_i64 i64;
  1041. struct m16e_ri64 ri64;
  1042. struct m16e_ri ri;
  1043. struct m16e_rri rri;
  1044. struct m16e_i8 i8;
  1045. };
  1046. #endif /* _UAPI_ASM_INST_H */