xref: /openbmc/linux/arch/mips/include/uapi/asm/inst.h (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
290e8cacdSRalf Baechle /*
390e8cacdSRalf Baechle  * Format of an instruction in memory.
490e8cacdSRalf Baechle  *
590e8cacdSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
690e8cacdSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
790e8cacdSRalf Baechle  * for more details.
890e8cacdSRalf Baechle  *
990e8cacdSRalf Baechle  * Copyright (C) 1996, 2000 by Ralf Baechle
1090e8cacdSRalf Baechle  * Copyright (C) 2006 by Thiemo Seufer
112aa9fd06SSteven J. Hill  * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
12aa1af47fSLeonid Yegoshin  * Copyright (C) 2014 Imagination Technologies Ltd.
1390e8cacdSRalf Baechle  */
1490e8cacdSRalf Baechle #ifndef _UAPI_ASM_INST_H
1590e8cacdSRalf Baechle #define _UAPI_ASM_INST_H
1690e8cacdSRalf Baechle 
1764a17a0fSRalf Baechle #include <asm/bitfield.h>
1864a17a0fSRalf Baechle 
1990e8cacdSRalf Baechle /*
2090e8cacdSRalf Baechle  * Major opcodes; before MIPS IV cop1x was called cop3.
2190e8cacdSRalf Baechle  */
2290e8cacdSRalf Baechle enum major_op {
2390e8cacdSRalf Baechle 	spec_op, bcond_op, j_op, jal_op,
2490e8cacdSRalf Baechle 	beq_op, bne_op, blez_op, bgtz_op,
251b492600SPaul Burton 	addi_op, pop10_op = addi_op, addiu_op, slti_op, sltiu_op,
2690e8cacdSRalf Baechle 	andi_op, ori_op, xori_op, lui_op,
2790e8cacdSRalf Baechle 	cop0_op, cop1_op, cop2_op, cop1x_op,
2890e8cacdSRalf Baechle 	beql_op, bnel_op, blezl_op, bgtzl_op,
291b492600SPaul Burton 	daddi_op, pop30_op = daddi_op, daddiu_op, ldl_op, ldr_op,
306701ca2dSLeonid Yegoshin 	spec2_op, jalx_op, mdmx_op, msa_op = mdmx_op, spec3_op,
3190e8cacdSRalf Baechle 	lb_op, lh_op, lwl_op, lw_op,
3290e8cacdSRalf Baechle 	lbu_op, lhu_op, lwr_op, lwu_op,
3390e8cacdSRalf Baechle 	sb_op, sh_op, swl_op, sw_op,
3490e8cacdSRalf Baechle 	sdl_op, sdr_op, swr_op, cache_op,
358467ca01SMarkos Chandras 	ll_op, lwc1_op, lwc2_op, bc6_op = lwc2_op, pref_op,
361c66b79bSPaul Burton 	lld_op, ldc1_op, ldc2_op, pop66_op = ldc2_op, ld_op,
3784fef630SMarkos Chandras 	sc_op, swc1_op, swc2_op, balc6_op = swc2_op, major_3b_op,
381c66b79bSPaul Burton 	scd_op, sdc1_op, sdc2_op, pop76_op = sdc2_op, sd_op
3990e8cacdSRalf Baechle };
4090e8cacdSRalf Baechle 
4190e8cacdSRalf Baechle /*
4290e8cacdSRalf Baechle  * func field of spec opcode.
4390e8cacdSRalf Baechle  */
4490e8cacdSRalf Baechle enum spec_op {
4590e8cacdSRalf Baechle 	sll_op, movc_op, srl_op, sra_op,
4690e8cacdSRalf Baechle 	sllv_op, pmon_op, srlv_op, srav_op,
4790e8cacdSRalf Baechle 	jr_op, jalr_op, movz_op, movn_op,
4890e8cacdSRalf Baechle 	syscall_op, break_op, spim_op, sync_op,
4990e8cacdSRalf Baechle 	mfhi_op, mthi_op, mflo_op, mtlo_op,
5090e8cacdSRalf Baechle 	dsllv_op, spec2_unused_op, dsrlv_op, dsrav_op,
5190e8cacdSRalf Baechle 	mult_op, multu_op, div_op, divu_op,
5290e8cacdSRalf Baechle 	dmult_op, dmultu_op, ddiv_op, ddivu_op,
5390e8cacdSRalf Baechle 	add_op, addu_op, sub_op, subu_op,
5490e8cacdSRalf Baechle 	and_op, or_op, xor_op, nor_op,
5590e8cacdSRalf Baechle 	spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
5690e8cacdSRalf Baechle 	dadd_op, daddu_op, dsub_op, dsubu_op,
5790e8cacdSRalf Baechle 	tge_op, tgeu_op, tlt_op, tltu_op,
580d1d17b9SHassan Naveed 	teq_op, seleqz_op, tne_op, selnez_op,
590d1d17b9SHassan Naveed 	dsll_op, spec5_unused_op, dsrl_op, dsra_op,
600d1d17b9SHassan Naveed 	dsll32_op, spec6_unused_op, dsrl32_op, dsra32_op
6190e8cacdSRalf Baechle };
6290e8cacdSRalf Baechle 
6390e8cacdSRalf Baechle /*
6490e8cacdSRalf Baechle  * func field of spec2 opcode.
6590e8cacdSRalf Baechle  */
6690e8cacdSRalf Baechle enum spec2_op {
6790e8cacdSRalf Baechle 	madd_op, maddu_op, mul_op, spec2_3_unused_op,
6890e8cacdSRalf Baechle 	msub_op, msubu_op, /* more unused ops */
6990e8cacdSRalf Baechle 	clz_op = 0x20, clo_op,
7090e8cacdSRalf Baechle 	dclz_op = 0x24, dclo_op,
7190e8cacdSRalf Baechle 	sdbpp_op = 0x3f
7290e8cacdSRalf Baechle };
7390e8cacdSRalf Baechle 
7490e8cacdSRalf Baechle /*
7590e8cacdSRalf Baechle  * func field of spec3 opcode.
7690e8cacdSRalf Baechle  */
7790e8cacdSRalf Baechle enum spec3_op {
7890e8cacdSRalf Baechle 	ext_op, dextm_op, dextu_op, dext_op,
7990e8cacdSRalf Baechle 	ins_op, dinsm_op, dinsu_op, dins_op,
806f5bb424SPaul Burton 	yield_op  = 0x09, lx_op     = 0x0a,
816f5bb424SPaul Burton 	lwle_op   = 0x19, lwre_op   = 0x1a,
826f5bb424SPaul Burton 	cachee_op = 0x1b, sbe_op    = 0x1c,
836f5bb424SPaul Burton 	she_op    = 0x1d, sce_op    = 0x1e,
846f5bb424SPaul Burton 	swe_op    = 0x1f, bshfl_op  = 0x20,
856f5bb424SPaul Burton 	swle_op   = 0x21, swre_op   = 0x22,
866f5bb424SPaul Burton 	prefe_op  = 0x23, dbshfl_op = 0x24,
87a168b8f1SLeonid Yegoshin 	cache6_op = 0x25, sc6_op    = 0x26,
88a168b8f1SLeonid Yegoshin 	scd6_op   = 0x27, lbue_op   = 0x28,
89a168b8f1SLeonid Yegoshin 	lhue_op   = 0x29, lbe_op    = 0x2c,
90a168b8f1SLeonid Yegoshin 	lhe_op    = 0x2d, lle_op    = 0x2e,
91a168b8f1SLeonid Yegoshin 	lwe_op    = 0x2f, pref6_op  = 0x35,
92a168b8f1SLeonid Yegoshin 	ll6_op    = 0x36, lld6_op   = 0x37,
936f5bb424SPaul Burton 	rdhwr_op  = 0x3b
9490e8cacdSRalf Baechle };
9590e8cacdSRalf Baechle 
9690e8cacdSRalf Baechle /*
976f63405cSJames Hogan  * Bits 10-6 minor opcode for r6 spec mult/div encodings
986f63405cSJames Hogan  */
996f63405cSJames Hogan enum mult_op {
1006f63405cSJames Hogan 	mult_mult_op = 0x0,
1016f63405cSJames Hogan 	mult_mul_op = 0x2,
1026f63405cSJames Hogan 	mult_muh_op = 0x3,
1036f63405cSJames Hogan };
1046f63405cSJames Hogan enum multu_op {
1056f63405cSJames Hogan 	multu_multu_op = 0x0,
1066f63405cSJames Hogan 	multu_mulu_op = 0x2,
1076f63405cSJames Hogan 	multu_muhu_op = 0x3,
1086f63405cSJames Hogan };
1096f63405cSJames Hogan enum div_op {
1106f63405cSJames Hogan 	div_div_op = 0x0,
1116f63405cSJames Hogan 	div_div6_op = 0x2,
1126f63405cSJames Hogan 	div_mod_op = 0x3,
1136f63405cSJames Hogan };
1146f63405cSJames Hogan enum divu_op {
1156f63405cSJames Hogan 	divu_divu_op = 0x0,
1166f63405cSJames Hogan 	divu_divu6_op = 0x2,
1176f63405cSJames Hogan 	divu_modu_op = 0x3,
1186f63405cSJames Hogan };
1196f63405cSJames Hogan enum dmult_op {
1206f63405cSJames Hogan 	dmult_dmult_op = 0x0,
1216f63405cSJames Hogan 	dmult_dmul_op = 0x2,
1226f63405cSJames Hogan 	dmult_dmuh_op = 0x3,
1236f63405cSJames Hogan };
1246f63405cSJames Hogan enum dmultu_op {
1256f63405cSJames Hogan 	dmultu_dmultu_op = 0x0,
1266f63405cSJames Hogan 	dmultu_dmulu_op = 0x2,
1276f63405cSJames Hogan 	dmultu_dmuhu_op = 0x3,
1286f63405cSJames Hogan };
1296f63405cSJames Hogan enum ddiv_op {
1306f63405cSJames Hogan 	ddiv_ddiv_op = 0x0,
1316f63405cSJames Hogan 	ddiv_ddiv6_op = 0x2,
1326f63405cSJames Hogan 	ddiv_dmod_op = 0x3,
1336f63405cSJames Hogan };
1346f63405cSJames Hogan enum ddivu_op {
1356f63405cSJames Hogan 	ddivu_ddivu_op = 0x0,
1366f63405cSJames Hogan 	ddivu_ddivu6_op = 0x2,
1376f63405cSJames Hogan 	ddivu_dmodu_op = 0x3,
1386f63405cSJames Hogan };
1396f63405cSJames Hogan 
1406f63405cSJames Hogan /*
14190e8cacdSRalf Baechle  * rt field of bcond opcodes.
14290e8cacdSRalf Baechle  */
14390e8cacdSRalf Baechle enum rt_op {
14490e8cacdSRalf Baechle 	bltz_op, bgez_op, bltzl_op, bgezl_op,
14590e8cacdSRalf Baechle 	spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
14690e8cacdSRalf Baechle 	tgei_op, tgeiu_op, tlti_op, tltiu_op,
14790e8cacdSRalf Baechle 	teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
14890e8cacdSRalf Baechle 	bltzal_op, bgezal_op, bltzall_op, bgezall_op,
14990e8cacdSRalf Baechle 	rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
15090e8cacdSRalf Baechle 	rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
151258f3a2eSJames Hogan 	bposge32_op, rt_op_0x1d, rt_op_0x1e, synci_op
15290e8cacdSRalf Baechle };
15390e8cacdSRalf Baechle 
15490e8cacdSRalf Baechle /*
15590e8cacdSRalf Baechle  * rs field of cop opcodes.
15690e8cacdSRalf Baechle  */
15790e8cacdSRalf Baechle enum cop_op {
15890e8cacdSRalf Baechle 	mfc_op	      = 0x00, dmfc_op	    = 0x01,
159e2965cd0SSteven J. Hill 	cfc_op	      = 0x02, mfhc0_op	    = 0x02,
160e2965cd0SSteven J. Hill 	mfhc_op       = 0x03, mtc_op	    = 0x04,
161e2965cd0SSteven J. Hill 	dmtc_op	      = 0x05, ctc_op	    = 0x06,
162e2965cd0SSteven J. Hill 	mthc0_op      = 0x06, mthc_op	    = 0x07,
163c8a34581SMarkos Chandras 	bc_op	      = 0x08, bc1eqz_op     = 0x09,
164b2c59635SJames Hogan 	mfmc0_op      = 0x0b, bc1nez_op     = 0x0d,
165b2c59635SJames Hogan 	wrpgpr_op     = 0x0e, cop_op	    = 0x10,
16690e8cacdSRalf Baechle 	copm_op	      = 0x18
16790e8cacdSRalf Baechle };
16890e8cacdSRalf Baechle 
16990e8cacdSRalf Baechle /*
17090e8cacdSRalf Baechle  * rt field of cop.bc_op opcodes
17190e8cacdSRalf Baechle  */
17290e8cacdSRalf Baechle enum bcop_op {
17390e8cacdSRalf Baechle 	bcf_op, bct_op, bcfl_op, bctl_op
17490e8cacdSRalf Baechle };
17590e8cacdSRalf Baechle 
17690e8cacdSRalf Baechle /*
17790e8cacdSRalf Baechle  * func field of cop0 coi opcodes.
17890e8cacdSRalf Baechle  */
17990e8cacdSRalf Baechle enum cop0_coi_func {
18090e8cacdSRalf Baechle 	tlbr_op	      = 0x01, tlbwi_op	    = 0x02,
18190e8cacdSRalf Baechle 	tlbwr_op      = 0x06, tlbp_op	    = 0x08,
182b0a3eae2SPaul Burton 	rfe_op	      = 0x10, eret_op	    = 0x18,
183955d8dc3SJames Hogan 	wait_op       = 0x20, hypcall_op    = 0x28
18490e8cacdSRalf Baechle };
18590e8cacdSRalf Baechle 
18690e8cacdSRalf Baechle /*
18790e8cacdSRalf Baechle  * func field of cop0 com opcodes.
18890e8cacdSRalf Baechle  */
18990e8cacdSRalf Baechle enum cop0_com_func {
19090e8cacdSRalf Baechle 	tlbr1_op      = 0x01, tlbw_op	    = 0x02,
19190e8cacdSRalf Baechle 	tlbp1_op      = 0x08, dctr_op	    = 0x09,
19290e8cacdSRalf Baechle 	dctw_op	      = 0x0a
19390e8cacdSRalf Baechle };
19490e8cacdSRalf Baechle 
19590e8cacdSRalf Baechle /*
19690e8cacdSRalf Baechle  * fmt field of cop1 opcodes.
19790e8cacdSRalf Baechle  */
19890e8cacdSRalf Baechle enum cop1_fmt {
19990e8cacdSRalf Baechle 	s_fmt, d_fmt, e_fmt, q_fmt,
20090e8cacdSRalf Baechle 	w_fmt, l_fmt
20190e8cacdSRalf Baechle };
20290e8cacdSRalf Baechle 
20390e8cacdSRalf Baechle /*
20490e8cacdSRalf Baechle  * func field of cop1 instructions using d, s or w format.
20590e8cacdSRalf Baechle  */
20690e8cacdSRalf Baechle enum cop1_sdw_func {
20790e8cacdSRalf Baechle 	fadd_op	     =	0x00, fsub_op	   =  0x01,
20890e8cacdSRalf Baechle 	fmul_op	     =	0x02, fdiv_op	   =  0x03,
20990e8cacdSRalf Baechle 	fsqrt_op     =	0x04, fabs_op	   =  0x05,
21090e8cacdSRalf Baechle 	fmov_op	     =	0x06, fneg_op	   =  0x07,
21190e8cacdSRalf Baechle 	froundl_op   =	0x08, ftruncl_op   =  0x09,
21290e8cacdSRalf Baechle 	fceill_op    =	0x0a, ffloorl_op   =  0x0b,
21390e8cacdSRalf Baechle 	fround_op    =	0x0c, ftrunc_op	   =  0x0d,
21490e8cacdSRalf Baechle 	fceil_op     =	0x0e, ffloor_op	   =  0x0f,
215b6d5c4edSPaul Burton 	fsel_op      =  0x10,
21690e8cacdSRalf Baechle 	fmovc_op     =	0x11, fmovz_op	   =  0x12,
217107d3400SMarkos Chandras 	fmovn_op     =	0x13, fseleqz_op   =  0x14,
218107d3400SMarkos Chandras 	frecip_op    =  0x15, frsqrt_op    =  0x16,
219107d3400SMarkos Chandras 	fselnez_op   =  0x17, fmaddf_op    =  0x18,
220107d3400SMarkos Chandras 	fmsubf_op    =  0x19, frint_op     =  0x1a,
221107d3400SMarkos Chandras 	fclass_op    =  0x1b, fmin_op      =  0x1c,
222107d3400SMarkos Chandras 	fmina_op     =  0x1d, fmax_op      =  0x1e,
223107d3400SMarkos Chandras 	fmaxa_op     =  0x1f, fcvts_op     =  0x20,
22490e8cacdSRalf Baechle 	fcvtd_op     =	0x21, fcvte_op	   =  0x22,
22590e8cacdSRalf Baechle 	fcvtw_op     =	0x24, fcvtl_op	   =  0x25,
22690e8cacdSRalf Baechle 	fcmp_op	     =	0x30
22790e8cacdSRalf Baechle };
22890e8cacdSRalf Baechle 
22990e8cacdSRalf Baechle /*
23090e8cacdSRalf Baechle  * func field of cop1x opcodes (MIPS IV).
23190e8cacdSRalf Baechle  */
23290e8cacdSRalf Baechle enum cop1x_func {
23390e8cacdSRalf Baechle 	lwxc1_op     =	0x00, ldxc1_op	   =  0x01,
23451061b88SDeng-Cheng Zhu 	swxc1_op     =  0x08, sdxc1_op	   =  0x09,
23551061b88SDeng-Cheng Zhu 	pfetch_op    =	0x0f, madd_s_op	   =  0x20,
23690e8cacdSRalf Baechle 	madd_d_op    =	0x21, madd_e_op	   =  0x22,
23790e8cacdSRalf Baechle 	msub_s_op    =	0x28, msub_d_op	   =  0x29,
23890e8cacdSRalf Baechle 	msub_e_op    =	0x2a, nmadd_s_op   =  0x30,
23990e8cacdSRalf Baechle 	nmadd_d_op   =	0x31, nmadd_e_op   =  0x32,
24090e8cacdSRalf Baechle 	nmsub_s_op   =	0x38, nmsub_d_op   =  0x39,
24190e8cacdSRalf Baechle 	nmsub_e_op   =	0x3a
24290e8cacdSRalf Baechle };
24390e8cacdSRalf Baechle 
24490e8cacdSRalf Baechle /*
24590e8cacdSRalf Baechle  * func field for mad opcodes (MIPS IV).
24690e8cacdSRalf Baechle  */
24790e8cacdSRalf Baechle enum mad_func {
24890e8cacdSRalf Baechle 	madd_fp_op	= 0x08, msub_fp_op	= 0x0a,
24990e8cacdSRalf Baechle 	nmadd_fp_op	= 0x0c, nmsub_fp_op	= 0x0e
25090e8cacdSRalf Baechle };
25190e8cacdSRalf Baechle 
25290e8cacdSRalf Baechle /*
253380cd582SHuacai Chen  * func field for page table walker (Loongson-3).
254380cd582SHuacai Chen  */
255380cd582SHuacai Chen enum ptw_func {
256380cd582SHuacai Chen 	lwdir_op = 0x00,
257380cd582SHuacai Chen 	lwpte_op = 0x01,
258380cd582SHuacai Chen 	lddir_op = 0x02,
259380cd582SHuacai Chen 	ldpte_op = 0x03,
260380cd582SHuacai Chen };
261380cd582SHuacai Chen 
262380cd582SHuacai Chen /*
26390e8cacdSRalf Baechle  * func field for special3 lx opcodes (Cavium Octeon).
26490e8cacdSRalf Baechle  */
26590e8cacdSRalf Baechle enum lx_func {
26690e8cacdSRalf Baechle 	lwx_op	= 0x00,
26790e8cacdSRalf Baechle 	lhx_op	= 0x04,
26890e8cacdSRalf Baechle 	lbux_op = 0x06,
26990e8cacdSRalf Baechle 	ldx_op	= 0x08,
27090e8cacdSRalf Baechle 	lwux_op = 0x10,
27190e8cacdSRalf Baechle 	lhux_op = 0x14,
27290e8cacdSRalf Baechle 	lbx_op	= 0x16,
27390e8cacdSRalf Baechle };
27490e8cacdSRalf Baechle 
27590e8cacdSRalf Baechle /*
276*6673c276SSiarhei Volkau  * func field for special2 MXU opcodes (Ingenic XBurst MXU).
277*6673c276SSiarhei Volkau  */
278*6673c276SSiarhei Volkau enum mxu_func {
279*6673c276SSiarhei Volkau 	/* TODO, other MXU funcs */
280*6673c276SSiarhei Volkau 	mxu_lx_op = 0x28,
281*6673c276SSiarhei Volkau };
282*6673c276SSiarhei Volkau 
283*6673c276SSiarhei Volkau /*
284*6673c276SSiarhei Volkau  * op field for special2 MXU LX opcodes (Ingenic XBurst MXU).
285*6673c276SSiarhei Volkau  */
286*6673c276SSiarhei Volkau enum lx_ingenic_func {
287*6673c276SSiarhei Volkau 	mxu_lxb_op,
288*6673c276SSiarhei Volkau 	mxu_lxh_op,
289*6673c276SSiarhei Volkau 	/* reserved */
290*6673c276SSiarhei Volkau 	mxu_lxw_op = 3,
291*6673c276SSiarhei Volkau 	mxu_lxbu_op,
292*6673c276SSiarhei Volkau 	mxu_lxhu_op,
293*6673c276SSiarhei Volkau 	/* more reserved */
294*6673c276SSiarhei Volkau };
295*6673c276SSiarhei Volkau 
296*6673c276SSiarhei Volkau /*
297ab9e4fa0SMarkos Chandras  * BSHFL opcodes
298ab9e4fa0SMarkos Chandras  */
299ab9e4fa0SMarkos Chandras enum bshfl_func {
300ab9e4fa0SMarkos Chandras 	wsbh_op = 0x2,
301ab9e4fa0SMarkos Chandras 	seb_op  = 0x10,
302ab9e4fa0SMarkos Chandras 	seh_op  = 0x18,
303ab9e4fa0SMarkos Chandras };
304ab9e4fa0SMarkos Chandras 
305ab9e4fa0SMarkos Chandras /*
3061f22d599SDavid Daney  * DBSHFL opcodes
3071f22d599SDavid Daney  */
3081f22d599SDavid Daney enum dbshfl_func {
3091f22d599SDavid Daney 	dsbh_op = 0x2,
3101f22d599SDavid Daney 	dshd_op = 0x5,
3111f22d599SDavid Daney };
3121f22d599SDavid Daney 
3131f22d599SDavid Daney /*
31459e3559fSJames Hogan  * MSA minor opcodes.
31559e3559fSJames Hogan  */
31659e3559fSJames Hogan enum msa_func {
31759e3559fSJames Hogan 	msa_elm_op = 0x19,
31859e3559fSJames Hogan };
31959e3559fSJames Hogan 
32059e3559fSJames Hogan /*
32159e3559fSJames Hogan  * MSA ELM opcodes.
32259e3559fSJames Hogan  */
32359e3559fSJames Hogan enum msa_elm {
32459e3559fSJames Hogan 	msa_ctc_op = 0x3e,
32559e3559fSJames Hogan 	msa_cfc_op = 0x7e,
32659e3559fSJames Hogan };
32759e3559fSJames Hogan 
32859e3559fSJames Hogan /*
3296701ca2dSLeonid Yegoshin  * func field for MSA MI10 format.
3306701ca2dSLeonid Yegoshin  */
3316701ca2dSLeonid Yegoshin enum msa_mi10_func {
3326701ca2dSLeonid Yegoshin 	msa_ld_op = 8,
3336701ca2dSLeonid Yegoshin 	msa_st_op = 9,
3346701ca2dSLeonid Yegoshin };
3356701ca2dSLeonid Yegoshin 
3366701ca2dSLeonid Yegoshin /*
3376701ca2dSLeonid Yegoshin  * MSA 2 bit format fields.
3386701ca2dSLeonid Yegoshin  */
3396701ca2dSLeonid Yegoshin enum msa_2b_fmt {
3406701ca2dSLeonid Yegoshin 	msa_fmt_b = 0,
3416701ca2dSLeonid Yegoshin 	msa_fmt_h = 1,
3426701ca2dSLeonid Yegoshin 	msa_fmt_w = 2,
3436701ca2dSLeonid Yegoshin 	msa_fmt_d = 3,
3446701ca2dSLeonid Yegoshin };
3456701ca2dSLeonid Yegoshin 
3466701ca2dSLeonid Yegoshin /*
3472aa9fd06SSteven J. Hill  * (microMIPS) Major opcodes.
3482aa9fd06SSteven J. Hill  */
3492aa9fd06SSteven J. Hill enum mm_major_op {
3502aa9fd06SSteven J. Hill 	mm_pool32a_op, mm_pool16a_op, mm_lbu16_op, mm_move16_op,
3512aa9fd06SSteven J. Hill 	mm_addi32_op, mm_lbu32_op, mm_sb32_op, mm_lb32_op,
3522aa9fd06SSteven J. Hill 	mm_pool32b_op, mm_pool16b_op, mm_lhu16_op, mm_andi16_op,
3532aa9fd06SSteven J. Hill 	mm_addiu32_op, mm_lhu32_op, mm_sh32_op, mm_lh32_op,
3542aa9fd06SSteven J. Hill 	mm_pool32i_op, mm_pool16c_op, mm_lwsp16_op, mm_pool16d_op,
35559e3559fSJames Hogan 	mm_ori32_op, mm_pool32f_op, mm_pool32s_op, mm_reserved2_op,
3562aa9fd06SSteven J. Hill 	mm_pool32c_op, mm_lwgp16_op, mm_lw16_op, mm_pool16e_op,
3572aa9fd06SSteven J. Hill 	mm_xori32_op, mm_jals32_op, mm_addiupc_op, mm_reserved3_op,
3582aa9fd06SSteven J. Hill 	mm_reserved4_op, mm_pool16f_op, mm_sb16_op, mm_beqz16_op,
3592aa9fd06SSteven J. Hill 	mm_slti32_op, mm_beq32_op, mm_swc132_op, mm_lwc132_op,
3602aa9fd06SSteven J. Hill 	mm_reserved5_op, mm_reserved6_op, mm_sh16_op, mm_bnez16_op,
3612aa9fd06SSteven J. Hill 	mm_sltiu32_op, mm_bne32_op, mm_sdc132_op, mm_ldc132_op,
3622aa9fd06SSteven J. Hill 	mm_reserved7_op, mm_reserved8_op, mm_swsp16_op, mm_b16_op,
3632aa9fd06SSteven J. Hill 	mm_andi32_op, mm_j32_op, mm_sd32_op, mm_ld32_op,
3642aa9fd06SSteven J. Hill 	mm_reserved11_op, mm_reserved12_op, mm_sw16_op, mm_li16_op,
3652aa9fd06SSteven J. Hill 	mm_jalx32_op, mm_jal32_op, mm_sw32_op, mm_lw32_op,
3662aa9fd06SSteven J. Hill };
3672aa9fd06SSteven J. Hill 
3682aa9fd06SSteven J. Hill /*
3692aa9fd06SSteven J. Hill  * (microMIPS) POOL32I minor opcodes.
3702aa9fd06SSteven J. Hill  */
3712aa9fd06SSteven J. Hill enum mm_32i_minor_op {
3722aa9fd06SSteven J. Hill 	mm_bltz_op, mm_bltzal_op, mm_bgez_op, mm_bgezal_op,
3732aa9fd06SSteven J. Hill 	mm_blez_op, mm_bnezc_op, mm_bgtz_op, mm_beqzc_op,
3742aa9fd06SSteven J. Hill 	mm_tlti_op, mm_tgei_op, mm_tltiu_op, mm_tgeiu_op,
3752aa9fd06SSteven J. Hill 	mm_tnei_op, mm_lui_op, mm_teqi_op, mm_reserved13_op,
3762aa9fd06SSteven J. Hill 	mm_synci_op, mm_bltzals_op, mm_reserved14_op, mm_bgezals_op,
3772aa9fd06SSteven J. Hill 	mm_bc2f_op, mm_bc2t_op, mm_reserved15_op, mm_reserved16_op,
3782aa9fd06SSteven J. Hill 	mm_reserved17_op, mm_reserved18_op, mm_bposge64_op, mm_bposge32_op,
3792aa9fd06SSteven J. Hill 	mm_bc1f_op, mm_bc1t_op, mm_reserved19_op, mm_reserved20_op,
3802aa9fd06SSteven J. Hill 	mm_bc1any2f_op, mm_bc1any2t_op, mm_bc1any4f_op, mm_bc1any4t_op,
3812aa9fd06SSteven J. Hill };
3822aa9fd06SSteven J. Hill 
3832aa9fd06SSteven J. Hill /*
3842aa9fd06SSteven J. Hill  * (microMIPS) POOL32A minor opcodes.
3852aa9fd06SSteven J. Hill  */
3862aa9fd06SSteven J. Hill enum mm_32a_minor_op {
3872aa9fd06SSteven J. Hill 	mm_sll32_op = 0x000,
3882aa9fd06SSteven J. Hill 	mm_ins_op = 0x00c,
389bef581baSMarkos Chandras 	mm_sllv32_op = 0x010,
3902aa9fd06SSteven J. Hill 	mm_ext_op = 0x02c,
3912aa9fd06SSteven J. Hill 	mm_pool32axf_op = 0x03c,
3922aa9fd06SSteven J. Hill 	mm_srl32_op = 0x040,
39317f6c83fSJiong Wang 	mm_srlv32_op = 0x050,
3942aa9fd06SSteven J. Hill 	mm_sra_op = 0x080,
395ee94b90cSJiong Wang 	mm_srav_op = 0x090,
3962aa9fd06SSteven J. Hill 	mm_rotr_op = 0x0c0,
3972aa9fd06SSteven J. Hill 	mm_lwxs_op = 0x118,
3982aa9fd06SSteven J. Hill 	mm_addu32_op = 0x150,
3992aa9fd06SSteven J. Hill 	mm_subu32_op = 0x1d0,
400ab9e4fa0SMarkos Chandras 	mm_wsbh_op = 0x1ec,
401a8e897adSMarkos Chandras 	mm_mul_op = 0x210,
4022aa9fd06SSteven J. Hill 	mm_and_op = 0x250,
4032aa9fd06SSteven J. Hill 	mm_or32_op = 0x290,
4042aa9fd06SSteven J. Hill 	mm_xor32_op = 0x310,
4057682f9e8SMarkos Chandras 	mm_slt_op = 0x350,
406e8ef868bSMarkos Chandras 	mm_sltu_op = 0x390,
4072aa9fd06SSteven J. Hill };
4082aa9fd06SSteven J. Hill 
4092aa9fd06SSteven J. Hill /*
4102aa9fd06SSteven J. Hill  * (microMIPS) POOL32B functions.
4112aa9fd06SSteven J. Hill  */
4122aa9fd06SSteven J. Hill enum mm_32b_func {
4132aa9fd06SSteven J. Hill 	mm_lwc2_func = 0x0,
4142aa9fd06SSteven J. Hill 	mm_lwp_func = 0x1,
4152aa9fd06SSteven J. Hill 	mm_ldc2_func = 0x2,
4162aa9fd06SSteven J. Hill 	mm_ldp_func = 0x4,
4172aa9fd06SSteven J. Hill 	mm_lwm32_func = 0x5,
4182aa9fd06SSteven J. Hill 	mm_cache_func = 0x6,
4192aa9fd06SSteven J. Hill 	mm_ldm_func = 0x7,
4202aa9fd06SSteven J. Hill 	mm_swc2_func = 0x8,
4212aa9fd06SSteven J. Hill 	mm_swp_func = 0x9,
4222aa9fd06SSteven J. Hill 	mm_sdc2_func = 0xa,
4232aa9fd06SSteven J. Hill 	mm_sdp_func = 0xc,
4242aa9fd06SSteven J. Hill 	mm_swm32_func = 0xd,
4252aa9fd06SSteven J. Hill 	mm_sdm_func = 0xf,
4262aa9fd06SSteven J. Hill };
4272aa9fd06SSteven J. Hill 
4282aa9fd06SSteven J. Hill /*
4292aa9fd06SSteven J. Hill  * (microMIPS) POOL32C functions.
4302aa9fd06SSteven J. Hill  */
4312aa9fd06SSteven J. Hill enum mm_32c_func {
4322aa9fd06SSteven J. Hill 	mm_pref_func = 0x2,
4332aa9fd06SSteven J. Hill 	mm_ll_func = 0x3,
4342aa9fd06SSteven J. Hill 	mm_swr_func = 0x9,
4352aa9fd06SSteven J. Hill 	mm_sc_func = 0xb,
4362aa9fd06SSteven J. Hill 	mm_lwu_func = 0xe,
4372aa9fd06SSteven J. Hill };
4382aa9fd06SSteven J. Hill 
4392aa9fd06SSteven J. Hill /*
4402aa9fd06SSteven J. Hill  * (microMIPS) POOL32AXF minor opcodes.
4412aa9fd06SSteven J. Hill  */
4422aa9fd06SSteven J. Hill enum mm_32axf_minor_op {
4432aa9fd06SSteven J. Hill 	mm_mfc0_op = 0x003,
4442aa9fd06SSteven J. Hill 	mm_mtc0_op = 0x00b,
4452aa9fd06SSteven J. Hill 	mm_tlbp_op = 0x00d,
446f3ec7a23SMarkos Chandras 	mm_mfhi32_op = 0x035,
4472aa9fd06SSteven J. Hill 	mm_jalr_op = 0x03c,
4482aa9fd06SSteven J. Hill 	mm_tlbr_op = 0x04d,
44916d21a81SMarkos Chandras 	mm_mflo32_op = 0x075,
4502aa9fd06SSteven J. Hill 	mm_jalrhb_op = 0x07c,
4512aa9fd06SSteven J. Hill 	mm_tlbwi_op = 0x08d,
4529f730a60SJames Hogan 	mm_mthi32_op = 0x0b5,
4532aa9fd06SSteven J. Hill 	mm_tlbwr_op = 0x0cd,
4549f730a60SJames Hogan 	mm_mtlo32_op = 0x0f5,
45561c64cf9SJames Hogan 	mm_di_op = 0x11d,
4562aa9fd06SSteven J. Hill 	mm_jalrs_op = 0x13c,
4572aa9fd06SSteven J. Hill 	mm_jalrshb_op = 0x17c,
4587ed82ad1SPaul Burton 	mm_sync_op = 0x1ad,
4592aa9fd06SSteven J. Hill 	mm_syscall_op = 0x22d,
460f263839aSPaul Burton 	mm_wait_op = 0x24d,
4612aa9fd06SSteven J. Hill 	mm_eret_op = 0x3cd,
4624c12a854SMarkos Chandras 	mm_divu_op = 0x5dc,
4632aa9fd06SSteven J. Hill };
4642aa9fd06SSteven J. Hill 
4652aa9fd06SSteven J. Hill /*
4662aa9fd06SSteven J. Hill  * (microMIPS) POOL32F minor opcodes.
4672aa9fd06SSteven J. Hill  */
4682aa9fd06SSteven J. Hill enum mm_32f_minor_op {
4692aa9fd06SSteven J. Hill 	mm_32f_00_op = 0x00,
4702aa9fd06SSteven J. Hill 	mm_32f_01_op = 0x01,
4712aa9fd06SSteven J. Hill 	mm_32f_02_op = 0x02,
4722aa9fd06SSteven J. Hill 	mm_32f_10_op = 0x08,
4732aa9fd06SSteven J. Hill 	mm_32f_11_op = 0x09,
4742aa9fd06SSteven J. Hill 	mm_32f_12_op = 0x0a,
4752aa9fd06SSteven J. Hill 	mm_32f_20_op = 0x10,
4762aa9fd06SSteven J. Hill 	mm_32f_30_op = 0x18,
4772aa9fd06SSteven J. Hill 	mm_32f_40_op = 0x20,
4782aa9fd06SSteven J. Hill 	mm_32f_41_op = 0x21,
4792aa9fd06SSteven J. Hill 	mm_32f_42_op = 0x22,
4802aa9fd06SSteven J. Hill 	mm_32f_50_op = 0x28,
4812aa9fd06SSteven J. Hill 	mm_32f_51_op = 0x29,
4822aa9fd06SSteven J. Hill 	mm_32f_52_op = 0x2a,
4832aa9fd06SSteven J. Hill 	mm_32f_60_op = 0x30,
4842aa9fd06SSteven J. Hill 	mm_32f_70_op = 0x38,
4852aa9fd06SSteven J. Hill 	mm_32f_73_op = 0x3b,
4862aa9fd06SSteven J. Hill 	mm_32f_74_op = 0x3c,
4872aa9fd06SSteven J. Hill };
4882aa9fd06SSteven J. Hill 
4892aa9fd06SSteven J. Hill /*
4902aa9fd06SSteven J. Hill  * (microMIPS) POOL32F secondary minor opcodes.
4912aa9fd06SSteven J. Hill  */
4922aa9fd06SSteven J. Hill enum mm_32f_10_minor_op {
4932aa9fd06SSteven J. Hill 	mm_lwxc1_op = 0x1,
4942aa9fd06SSteven J. Hill 	mm_swxc1_op,
4952aa9fd06SSteven J. Hill 	mm_ldxc1_op,
4962aa9fd06SSteven J. Hill 	mm_sdxc1_op,
4972aa9fd06SSteven J. Hill 	mm_luxc1_op,
4982aa9fd06SSteven J. Hill 	mm_suxc1_op,
4992aa9fd06SSteven J. Hill };
5002aa9fd06SSteven J. Hill 
5012aa9fd06SSteven J. Hill enum mm_32f_func {
5022aa9fd06SSteven J. Hill 	mm_lwxc1_func = 0x048,
5032aa9fd06SSteven J. Hill 	mm_swxc1_func = 0x088,
5042aa9fd06SSteven J. Hill 	mm_ldxc1_func = 0x0c8,
5052aa9fd06SSteven J. Hill 	mm_sdxc1_func = 0x108,
5062aa9fd06SSteven J. Hill };
5072aa9fd06SSteven J. Hill 
5082aa9fd06SSteven J. Hill /*
5092aa9fd06SSteven J. Hill  * (microMIPS) POOL32F secondary minor opcodes.
5102aa9fd06SSteven J. Hill  */
5112aa9fd06SSteven J. Hill enum mm_32f_40_minor_op {
5122aa9fd06SSteven J. Hill 	mm_fmovf_op,
5132aa9fd06SSteven J. Hill 	mm_fmovt_op,
5142aa9fd06SSteven J. Hill };
5152aa9fd06SSteven J. Hill 
5162aa9fd06SSteven J. Hill /*
5172aa9fd06SSteven J. Hill  * (microMIPS) POOL32F secondary minor opcodes.
5182aa9fd06SSteven J. Hill  */
5192aa9fd06SSteven J. Hill enum mm_32f_60_minor_op {
5202aa9fd06SSteven J. Hill 	mm_fadd_op,
5212aa9fd06SSteven J. Hill 	mm_fsub_op,
5222aa9fd06SSteven J. Hill 	mm_fmul_op,
5232aa9fd06SSteven J. Hill 	mm_fdiv_op,
5242aa9fd06SSteven J. Hill };
5252aa9fd06SSteven J. Hill 
5262aa9fd06SSteven J. Hill /*
5272aa9fd06SSteven J. Hill  * (microMIPS) POOL32F secondary minor opcodes.
5282aa9fd06SSteven J. Hill  */
5292aa9fd06SSteven J. Hill enum mm_32f_70_minor_op {
5302aa9fd06SSteven J. Hill 	mm_fmovn_op,
5312aa9fd06SSteven J. Hill 	mm_fmovz_op,
5322aa9fd06SSteven J. Hill };
5332aa9fd06SSteven J. Hill 
5342aa9fd06SSteven J. Hill /*
5352aa9fd06SSteven J. Hill  * (microMIPS) POOL32FXF secondary minor opcodes for POOL32F.
5362aa9fd06SSteven J. Hill  */
5372aa9fd06SSteven J. Hill enum mm_32f_73_minor_op {
5382aa9fd06SSteven J. Hill 	mm_fmov0_op = 0x01,
5392aa9fd06SSteven J. Hill 	mm_fcvtl_op = 0x04,
5402aa9fd06SSteven J. Hill 	mm_movf0_op = 0x05,
5412aa9fd06SSteven J. Hill 	mm_frsqrt_op = 0x08,
5422aa9fd06SSteven J. Hill 	mm_ffloorl_op = 0x0c,
5432aa9fd06SSteven J. Hill 	mm_fabs0_op = 0x0d,
5442aa9fd06SSteven J. Hill 	mm_fcvtw_op = 0x24,
5452aa9fd06SSteven J. Hill 	mm_movt0_op = 0x25,
5462aa9fd06SSteven J. Hill 	mm_fsqrt_op = 0x28,
5472aa9fd06SSteven J. Hill 	mm_ffloorw_op = 0x2c,
5482aa9fd06SSteven J. Hill 	mm_fneg0_op = 0x2d,
5492aa9fd06SSteven J. Hill 	mm_cfc1_op = 0x40,
5502aa9fd06SSteven J. Hill 	mm_frecip_op = 0x48,
5512aa9fd06SSteven J. Hill 	mm_fceill_op = 0x4c,
5522aa9fd06SSteven J. Hill 	mm_fcvtd0_op = 0x4d,
5532aa9fd06SSteven J. Hill 	mm_ctc1_op = 0x60,
5542aa9fd06SSteven J. Hill 	mm_fceilw_op = 0x6c,
5552aa9fd06SSteven J. Hill 	mm_fcvts0_op = 0x6d,
5562aa9fd06SSteven J. Hill 	mm_mfc1_op = 0x80,
5572aa9fd06SSteven J. Hill 	mm_fmov1_op = 0x81,
5582aa9fd06SSteven J. Hill 	mm_movf1_op = 0x85,
5592aa9fd06SSteven J. Hill 	mm_ftruncl_op = 0x8c,
5602aa9fd06SSteven J. Hill 	mm_fabs1_op = 0x8d,
5612aa9fd06SSteven J. Hill 	mm_mtc1_op = 0xa0,
5622aa9fd06SSteven J. Hill 	mm_movt1_op = 0xa5,
5632aa9fd06SSteven J. Hill 	mm_ftruncw_op = 0xac,
5642aa9fd06SSteven J. Hill 	mm_fneg1_op = 0xad,
5659355e59cSSteven J. Hill 	mm_mfhc1_op = 0xc0,
5662aa9fd06SSteven J. Hill 	mm_froundl_op = 0xcc,
5672aa9fd06SSteven J. Hill 	mm_fcvtd1_op = 0xcd,
5689355e59cSSteven J. Hill 	mm_mthc1_op = 0xe0,
5692aa9fd06SSteven J. Hill 	mm_froundw_op = 0xec,
5702aa9fd06SSteven J. Hill 	mm_fcvts1_op = 0xed,
5712aa9fd06SSteven J. Hill };
5722aa9fd06SSteven J. Hill 
5732aa9fd06SSteven J. Hill /*
57459e3559fSJames Hogan  * (microMIPS) POOL32S minor opcodes.
57559e3559fSJames Hogan  */
57659e3559fSJames Hogan enum mm_32s_minor_op {
57759e3559fSJames Hogan 	mm_32s_elm_op = 0x16,
57859e3559fSJames Hogan };
57959e3559fSJames Hogan 
58059e3559fSJames Hogan /*
5812aa9fd06SSteven J. Hill  * (microMIPS) POOL16C minor opcodes.
5822aa9fd06SSteven J. Hill  */
5832aa9fd06SSteven J. Hill enum mm_16c_minor_op {
5842aa9fd06SSteven J. Hill 	mm_lwm16_op = 0x04,
5852aa9fd06SSteven J. Hill 	mm_swm16_op = 0x05,
586dfb033f0STony Wu 	mm_jr16_op = 0x0c,
587dfb033f0STony Wu 	mm_jrc_op = 0x0d,
588dfb033f0STony Wu 	mm_jalr16_op = 0x0e,
589dfb033f0STony Wu 	mm_jalrs16_op = 0x0f,
590dfb033f0STony Wu 	mm_jraddiusp_op = 0x18,
5912aa9fd06SSteven J. Hill };
5922aa9fd06SSteven J. Hill 
5932aa9fd06SSteven J. Hill /*
5942aa9fd06SSteven J. Hill  * (microMIPS) POOL16D minor opcodes.
5952aa9fd06SSteven J. Hill  */
5962aa9fd06SSteven J. Hill enum mm_16d_minor_op {
5972aa9fd06SSteven J. Hill 	mm_addius5_func,
5982aa9fd06SSteven J. Hill 	mm_addiusp_func,
5992aa9fd06SSteven J. Hill };
6002aa9fd06SSteven J. Hill 
6012aa9fd06SSteven J. Hill /*
602cd574704SSteven J. Hill  * (MIPS16e) opcodes.
603cd574704SSteven J. Hill  */
604cd574704SSteven J. Hill enum MIPS16e_ops {
605cd574704SSteven J. Hill 	MIPS16e_jal_op = 003,
606cd574704SSteven J. Hill 	MIPS16e_ld_op = 007,
607cd574704SSteven J. Hill 	MIPS16e_i8_op = 014,
608cd574704SSteven J. Hill 	MIPS16e_sd_op = 017,
609cd574704SSteven J. Hill 	MIPS16e_lb_op = 020,
610cd574704SSteven J. Hill 	MIPS16e_lh_op = 021,
611cd574704SSteven J. Hill 	MIPS16e_lwsp_op = 022,
612cd574704SSteven J. Hill 	MIPS16e_lw_op = 023,
613cd574704SSteven J. Hill 	MIPS16e_lbu_op = 024,
614cd574704SSteven J. Hill 	MIPS16e_lhu_op = 025,
615cd574704SSteven J. Hill 	MIPS16e_lwpc_op = 026,
616cd574704SSteven J. Hill 	MIPS16e_lwu_op = 027,
617cd574704SSteven J. Hill 	MIPS16e_sb_op = 030,
618cd574704SSteven J. Hill 	MIPS16e_sh_op = 031,
619cd574704SSteven J. Hill 	MIPS16e_swsp_op = 032,
620cd574704SSteven J. Hill 	MIPS16e_sw_op = 033,
621cd574704SSteven J. Hill 	MIPS16e_rr_op = 035,
622cd574704SSteven J. Hill 	MIPS16e_extend_op = 036,
623cd574704SSteven J. Hill 	MIPS16e_i64_op = 037,
624cd574704SSteven J. Hill };
625cd574704SSteven J. Hill 
626cd574704SSteven J. Hill enum MIPS16e_i64_func {
627cd574704SSteven J. Hill 	MIPS16e_ldsp_func,
628cd574704SSteven J. Hill 	MIPS16e_sdsp_func,
629cd574704SSteven J. Hill 	MIPS16e_sdrasp_func,
630cd574704SSteven J. Hill 	MIPS16e_dadjsp_func,
631cd574704SSteven J. Hill 	MIPS16e_ldpc_func,
632cd574704SSteven J. Hill };
633cd574704SSteven J. Hill 
634cd574704SSteven J. Hill enum MIPS16e_rr_func {
635cd574704SSteven J. Hill 	MIPS16e_jr_func,
636cd574704SSteven J. Hill };
637cd574704SSteven J. Hill 
638cd574704SSteven J. Hill enum MIPS6e_i8_func {
639cd574704SSteven J. Hill 	MIPS16e_swrasp_func = 02,
640cd574704SSteven J. Hill };
641cd574704SSteven J. Hill 
642cd574704SSteven J. Hill /*
64329e28003SMaciej W. Rozycki  * (microMIPS) NOP instruction.
644102cedc3SLeonid Yegoshin  */
645102cedc3SLeonid Yegoshin #define MM_NOP16	0x0c00
646102cedc3SLeonid Yegoshin 
64785dfaf08SRalf Baechle struct j_format {
6488471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */
6498471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int target : 26,
65085dfaf08SRalf Baechle 	;))
65185dfaf08SRalf Baechle };
65285dfaf08SRalf Baechle 
65385dfaf08SRalf Baechle struct i_format {			/* signed immediate format */
6548471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
6558471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
6568471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
6578471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 16,
65885dfaf08SRalf Baechle 	;))))
65985dfaf08SRalf Baechle };
66085dfaf08SRalf Baechle 
66185dfaf08SRalf Baechle struct u_format {			/* unsigned immediate format */
6628471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
6638471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
6648471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
6658471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int uimmediate : 16,
66685dfaf08SRalf Baechle 	;))))
66785dfaf08SRalf Baechle };
66885dfaf08SRalf Baechle 
66985dfaf08SRalf Baechle struct c_format {			/* Cache (>= R6000) format */
6708471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
6718471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
6728471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int c_op : 3,
6738471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int cache : 2,
6748471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int simmediate : 16,
67585dfaf08SRalf Baechle 	;)))))
67685dfaf08SRalf Baechle };
67785dfaf08SRalf Baechle 
67885dfaf08SRalf Baechle struct r_format {			/* Register format */
6798471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
6808471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
6818471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
6828471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rd : 5,
6838471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int re : 5,
6848471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
68585dfaf08SRalf Baechle 	;))))))
68685dfaf08SRalf Baechle };
68785dfaf08SRalf Baechle 
688258f3a2eSJames Hogan struct c0r_format {			/* C0 register format */
689258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int opcode : 6,
690258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rs : 5,
691258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rt : 5,
692258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rd : 5,
693258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int z: 8,
694258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int sel : 3,
695258f3a2eSJames Hogan 	;))))))
696258f3a2eSJames Hogan };
697258f3a2eSJames Hogan 
698258f3a2eSJames Hogan struct mfmc0_format {			/* MFMC0 register format */
699258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int opcode : 6,
700258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rs : 5,
701258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rt : 5,
702258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int rd : 5,
703258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int re : 5,
704258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int sc : 1,
705258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int : 2,
706258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int sel : 3,
707258f3a2eSJames Hogan 	;))))))))
708258f3a2eSJames Hogan };
709258f3a2eSJames Hogan 
710258f3a2eSJames Hogan struct co_format {			/* C0 CO format */
711258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int opcode : 6,
712258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int co : 1,
713258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int code : 19,
714258f3a2eSJames Hogan 	__BITFIELD_FIELD(unsigned int func : 6,
715258f3a2eSJames Hogan 	;))))
716258f3a2eSJames Hogan };
717258f3a2eSJames Hogan 
71885dfaf08SRalf Baechle struct p_format {		/* Performance counter format (R10000) */
7198471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7208471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
7218471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
7228471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rd : 5,
7238471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int re : 5,
7248471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
72585dfaf08SRalf Baechle 	;))))))
72685dfaf08SRalf Baechle };
72785dfaf08SRalf Baechle 
72885dfaf08SRalf Baechle struct f_format {			/* FPU register format */
7298471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7308471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 1,
7318471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 4,
7328471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
7338471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rd : 5,
7348471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int re : 5,
7358471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
73685dfaf08SRalf Baechle 	;)))))))
73785dfaf08SRalf Baechle };
73885dfaf08SRalf Baechle 
73985dfaf08SRalf Baechle struct ma_format {		/* FPU multiply and add format (MIPS IV) */
7408471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7418471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fr : 5,
7428471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
7438471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
7448471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
7458471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 4,
7468471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 2,
74785dfaf08SRalf Baechle 	;)))))))
74885dfaf08SRalf Baechle };
74985dfaf08SRalf Baechle 
75085dfaf08SRalf Baechle struct b_format {			/* BREAK and SYSCALL */
7518471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7528471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int code : 20,
7538471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
75485dfaf08SRalf Baechle 	;)))
75585dfaf08SRalf Baechle };
75685dfaf08SRalf Baechle 
7578fba1e58SRalf Baechle struct ps_format {			/* MIPS-3D / paired single format */
7588471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7598471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
7608471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
7618471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
7628471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
7638471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
7648fba1e58SRalf Baechle 	;))))))
7658fba1e58SRalf Baechle };
7668fba1e58SRalf Baechle 
7678fba1e58SRalf Baechle struct v_format {				/* MDMX vector format */
7688471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
7698471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int sel : 4,
7708471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 1,
7718471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int vt : 5,
7728471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int vs : 5,
7738471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int vd : 5,
7748471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
7758fba1e58SRalf Baechle 	;)))))))
7768fba1e58SRalf Baechle };
7778fba1e58SRalf Baechle 
7786701ca2dSLeonid Yegoshin struct msa_mi10_format {		/* MSA MI10 */
7796701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(unsigned int opcode : 6,
7806701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(signed int s10 : 10,
7816701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(unsigned int rs : 5,
7826701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(unsigned int wd : 5,
7836701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(unsigned int func : 4,
7846701ca2dSLeonid Yegoshin 	__BITFIELD_FIELD(unsigned int df : 2,
7856701ca2dSLeonid Yegoshin 	;))))))
7866701ca2dSLeonid Yegoshin };
7876701ca2dSLeonid Yegoshin 
7883f88ec63SMiodrag Dinic struct dsp_format {		/* SPEC3 DSP format instructions */
7893f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int opcode : 6,
7903f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int base : 5,
7913f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int index : 5,
7923f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int rd : 5,
7933f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int op : 5,
7943f88ec63SMiodrag Dinic 	__BITFIELD_FIELD(unsigned int func : 6,
7953f88ec63SMiodrag Dinic 	;))))))
7963f88ec63SMiodrag Dinic };
7973f88ec63SMiodrag Dinic 
798*6673c276SSiarhei Volkau struct mxu_lx_format {		/* SPEC2 MXU LX format instructions */
799*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int opcode : 6,
800*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int rs : 5,
801*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int rt : 5,
802*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int rd : 5,
803*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int strd : 2,
804*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int op : 3,
805*6673c276SSiarhei Volkau 	__BITFIELD_FIELD(unsigned int func : 6,
806*6673c276SSiarhei Volkau 	;)))))))
807*6673c276SSiarhei Volkau };
808*6673c276SSiarhei Volkau 
809aa1af47fSLeonid Yegoshin struct spec3_format {   /* SPEC3 */
8108471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode:6,
8118471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs:5,
8128471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt:5,
8138471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate:9,
8148471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func:7,
815aa1af47fSLeonid Yegoshin 	;)))))
816aa1af47fSLeonid Yegoshin };
817aa1af47fSLeonid Yegoshin 
8182aa9fd06SSteven J. Hill /*
8192aa9fd06SSteven J. Hill  * microMIPS instruction formats (32-bit length)
8202aa9fd06SSteven J. Hill  *
8212aa9fd06SSteven J. Hill  * NOTE:
8222aa9fd06SSteven J. Hill  *	Parenthesis denote whether the format is a microMIPS instruction or
8232aa9fd06SSteven J. Hill  *	if it is MIPS32 instruction re-encoded for use in the microMIPS ASE.
8242aa9fd06SSteven J. Hill  */
8252aa9fd06SSteven J. Hill struct fb_format {		/* FPU branch format (MIPS32) */
8268471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8278471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int bc : 5,
8288471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int cc : 3,
8298471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int flag : 2,
8308471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 16,
8312aa9fd06SSteven J. Hill 	;)))))
8322aa9fd06SSteven J. Hill };
8332aa9fd06SSteven J. Hill 
8342aa9fd06SSteven J. Hill struct fp0_format {		/* FPU multiply and add format (MIPS32) */
8358471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8368471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 5,
8378471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
8388471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8398471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
8408471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8412aa9fd06SSteven J. Hill 	;))))))
8422aa9fd06SSteven J. Hill };
8432aa9fd06SSteven J. Hill 
84429e28003SMaciej W. Rozycki struct mm_fp0_format {		/* FPU multiply and add format (microMIPS) */
8458471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8468471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
8478471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8488471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
8498471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 3,
8508471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 2,
8518471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8522aa9fd06SSteven J. Hill 	;)))))))
8532aa9fd06SSteven J. Hill };
8542aa9fd06SSteven J. Hill 
8552aa9fd06SSteven J. Hill struct fp1_format {		/* FPU mfc1 and cfc1 format (MIPS32) */
8568471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8578471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 5,
8588471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
8598471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8608471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
8618471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8622aa9fd06SSteven J. Hill 	;))))))
8632aa9fd06SSteven J. Hill };
8642aa9fd06SSteven J. Hill 
8652aa9fd06SSteven J. Hill struct mm_fp1_format {		/* FPU mfc1 and cfc1 format (microMIPS) */
8668471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8678471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
8688471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8698471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 2,
8708471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 8,
8718471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8722aa9fd06SSteven J. Hill 	;))))))
8732aa9fd06SSteven J. Hill };
8742aa9fd06SSteven J. Hill 
8752aa9fd06SSteven J. Hill struct mm_fp2_format {		/* FPU movt and movf format (microMIPS) */
8768471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8778471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
8788471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8798471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int cc : 3,
8808471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int zero : 2,
8818471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 2,
8828471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 3,
8838471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8842aa9fd06SSteven J. Hill 	;))))))))
8852aa9fd06SSteven J. Hill };
8862aa9fd06SSteven J. Hill 
8872aa9fd06SSteven J. Hill struct mm_fp3_format {		/* FPU abs and neg format (microMIPS) */
8888471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8898471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
8908471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
8918471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 3,
8928471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 7,
8938471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
8942aa9fd06SSteven J. Hill 	;))))))
8952aa9fd06SSteven J. Hill };
8962aa9fd06SSteven J. Hill 
8972aa9fd06SSteven J. Hill struct mm_fp4_format {		/* FPU c.cond format (microMIPS) */
8988471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
8998471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
9008471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
9018471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int cc : 3,
9028471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fmt : 3,
9038471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int cond : 4,
9048471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
9052aa9fd06SSteven J. Hill 	;)))))))
9062aa9fd06SSteven J. Hill };
9072aa9fd06SSteven J. Hill 
9082aa9fd06SSteven J. Hill struct mm_fp5_format {		/* FPU lwxc1 and swxc1 format (microMIPS) */
9098471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9108471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int index : 5,
9118471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int base : 5,
9128471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
9138471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int op : 5,
9148471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
9152aa9fd06SSteven J. Hill 	;))))))
9162aa9fd06SSteven J. Hill };
9172aa9fd06SSteven J. Hill 
9182aa9fd06SSteven J. Hill struct fp6_format {		/* FPU madd and msub format (MIPS IV) */
9198471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9208471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fr : 5,
9218471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
9228471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
9238471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
9248471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
9252aa9fd06SSteven J. Hill 	;))))))
9262aa9fd06SSteven J. Hill };
9272aa9fd06SSteven J. Hill 
9282aa9fd06SSteven J. Hill struct mm_fp6_format {		/* FPU madd and msub format (microMIPS) */
9298471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9308471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ft : 5,
9318471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fs : 5,
9328471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fd : 5,
9338471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int fr : 5,
9348471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 6,
9352aa9fd06SSteven J. Hill 	;))))))
9362aa9fd06SSteven J. Hill };
9372aa9fd06SSteven J. Hill 
9382aa9fd06SSteven J. Hill struct mm_i_format {		/* Immediate format (microMIPS) */
9398471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9408471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
9418471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 5,
9428471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 16,
9432aa9fd06SSteven J. Hill 	;))))
9442aa9fd06SSteven J. Hill };
9452aa9fd06SSteven J. Hill 
9462aa9fd06SSteven J. Hill struct mm_m_format {		/* Multi-word load/store format (microMIPS) */
9478471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9488471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rd : 5,
9498471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int base : 5,
9508471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 4,
9518471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 12,
9522aa9fd06SSteven J. Hill 	;)))))
9532aa9fd06SSteven J. Hill };
9542aa9fd06SSteven J. Hill 
9552aa9fd06SSteven J. Hill struct mm_x_format {		/* Scaled indexed load format (microMIPS) */
9568471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9578471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int index : 5,
9588471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int base : 5,
9598471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rd : 5,
9608471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 11,
9612aa9fd06SSteven J. Hill 	;)))))
9622aa9fd06SSteven J. Hill };
9632aa9fd06SSteven J. Hill 
96469a1e6cbSMaciej W. Rozycki struct mm_a_format {		/* ADDIUPC format (microMIPS) */
96569a1e6cbSMaciej W. Rozycki 	__BITFIELD_FIELD(unsigned int opcode : 6,
96669a1e6cbSMaciej W. Rozycki 	__BITFIELD_FIELD(unsigned int rs : 3,
96769a1e6cbSMaciej W. Rozycki 	__BITFIELD_FIELD(signed int simmediate : 23,
96869a1e6cbSMaciej W. Rozycki 	;)))
96969a1e6cbSMaciej W. Rozycki };
97069a1e6cbSMaciej W. Rozycki 
9712aa9fd06SSteven J. Hill /*
9722aa9fd06SSteven J. Hill  * microMIPS instruction formats (16-bit length)
9732aa9fd06SSteven J. Hill  */
9742aa9fd06SSteven J. Hill struct mm_b0_format {		/* Unconditional branch format (microMIPS) */
9758471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9768471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 10,
9778471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
9782aa9fd06SSteven J. Hill 	;)))
9792aa9fd06SSteven J. Hill };
9802aa9fd06SSteven J. Hill 
9812aa9fd06SSteven J. Hill struct mm_b1_format {		/* Conditional branch format (microMIPS) */
9828471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9838471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rs : 3,
9848471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 7,
9858471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
9862aa9fd06SSteven J. Hill 	;))))
9872aa9fd06SSteven J. Hill };
9882aa9fd06SSteven J. Hill 
9892aa9fd06SSteven J. Hill struct mm16_m_format {		/* Multi-word load/store format */
9908471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
9918471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 4,
9928471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rlist : 2,
9938471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 4,
9948471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
9952aa9fd06SSteven J. Hill 	;)))))
9962aa9fd06SSteven J. Hill };
9972aa9fd06SSteven J. Hill 
9982aa9fd06SSteven J. Hill struct mm16_rb_format {		/* Signed immediate format */
9998471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
10008471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 3,
10018471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int base : 3,
10028471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 4,
10038471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
10042aa9fd06SSteven J. Hill 	;)))))
10052aa9fd06SSteven J. Hill };
10062aa9fd06SSteven J. Hill 
10072aa9fd06SSteven J. Hill struct mm16_r3_format {		/* Load from global pointer format */
10088471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
10098471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 3,
10108471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int simmediate : 7,
10118471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
10122aa9fd06SSteven J. Hill 	;))))
10132aa9fd06SSteven J. Hill };
10142aa9fd06SSteven J. Hill 
10152aa9fd06SSteven J. Hill struct mm16_r5_format {		/* Load/store from stack pointer format */
10168471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 6,
10178471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rt : 5,
1018cea8cd49SMatt Redfearn 	__BITFIELD_FIELD(unsigned int imm : 5,
10198471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
10202aa9fd06SSteven J. Hill 	;))))
10212aa9fd06SSteven J. Hill };
10222aa9fd06SSteven J. Hill 
1023cd574704SSteven J. Hill /*
1024f83e4f98SHuacai Chen  * Loongson-3 overridden COP2 instruction formats (32-bit length)
1025f83e4f98SHuacai Chen  */
1026f83e4f98SHuacai Chen struct loongson3_lswc2_format {	/* Loongson-3 overridden lwc2/swc2 Load/Store format */
1027f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int opcode : 6,
1028f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int base : 5,
1029f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int rt : 5,
1030f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int fr : 1,
1031f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int offset : 9,
1032f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int ls : 1,
1033f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int rq : 5,
1034f83e4f98SHuacai Chen 	;)))))))
1035f83e4f98SHuacai Chen };
1036f83e4f98SHuacai Chen 
1037f83e4f98SHuacai Chen struct loongson3_lsdc2_format {	/* Loongson-3 overridden ldc2/sdc2 Load/Store format */
1038f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int opcode : 6,
1039f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int base : 5,
1040f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int rt : 5,
1041f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int index : 5,
1042f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int offset : 8,
1043f83e4f98SHuacai Chen 	__BITFIELD_FIELD(unsigned int opcode1 : 3,
1044f83e4f98SHuacai Chen 	;))))))
1045f83e4f98SHuacai Chen };
1046f83e4f98SHuacai Chen 
10477f2a83f1SHuacai Chen struct loongson3_lscsr_format {	/* Loongson-3 CPUCFG&CSR read/write format */
10487f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int opcode : 6,
10497f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int rs : 5,
10507f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int fr : 5,
10517f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int rd : 5,
10527f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int fd : 5,
10537f2a83f1SHuacai Chen 	__BITFIELD_FIELD(unsigned int func : 6,
10547f2a83f1SHuacai Chen 	;))))))
10557f2a83f1SHuacai Chen };
10567f2a83f1SHuacai Chen 
1057f83e4f98SHuacai Chen /*
1058cd574704SSteven J. Hill  * MIPS16e instruction formats (16-bit length)
1059cd574704SSteven J. Hill  */
1060cd574704SSteven J. Hill struct m16e_rr {
10618471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
10628471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rx : 3,
10638471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int nd : 1,
10648471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int l : 1,
10658471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ra : 1,
10668471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 5,
1067cd574704SSteven J. Hill 	;))))))
1068cd574704SSteven J. Hill };
1069cd574704SSteven J. Hill 
1070cd574704SSteven J. Hill struct m16e_jal {
10718471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
10728471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int x : 1,
10738471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm20_16 : 5,
10748471ac1bSRalf Baechle 	__BITFIELD_FIELD(signed int imm25_21 : 5,
1075cd574704SSteven J. Hill 	;))))
1076cd574704SSteven J. Hill };
1077cd574704SSteven J. Hill 
1078cd574704SSteven J. Hill struct m16e_i64 {
10798471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
10808471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 3,
10818471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 8,
1082cd574704SSteven J. Hill 	;)))
1083cd574704SSteven J. Hill };
1084cd574704SSteven J. Hill 
1085cd574704SSteven J. Hill struct m16e_ri64 {
10868471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
10878471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 3,
10888471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ry : 3,
10898471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 5,
1090cd574704SSteven J. Hill 	;))))
1091cd574704SSteven J. Hill };
1092cd574704SSteven J. Hill 
1093cd574704SSteven J. Hill struct m16e_ri {
10948471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
10958471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rx : 3,
10968471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 8,
1097cd574704SSteven J. Hill 	;)))
1098cd574704SSteven J. Hill };
1099cd574704SSteven J. Hill 
1100cd574704SSteven J. Hill struct m16e_rri {
11018471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
11028471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int rx : 3,
11038471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int ry : 3,
11048471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 5,
1105cd574704SSteven J. Hill 	;))))
1106cd574704SSteven J. Hill };
1107cd574704SSteven J. Hill 
1108cd574704SSteven J. Hill struct m16e_i8 {
11098471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int opcode : 5,
11108471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int func : 3,
11118471ac1bSRalf Baechle 	__BITFIELD_FIELD(unsigned int imm : 8,
1112cd574704SSteven J. Hill 	;)))
1113cd574704SSteven J. Hill };
1114cd574704SSteven J. Hill 
111590e8cacdSRalf Baechle union mips_instruction {
111690e8cacdSRalf Baechle 	unsigned int word;
111790e8cacdSRalf Baechle 	unsigned short halfword[2];
111890e8cacdSRalf Baechle 	unsigned char byte[4];
111990e8cacdSRalf Baechle 	struct j_format j_format;
112090e8cacdSRalf Baechle 	struct i_format i_format;
112190e8cacdSRalf Baechle 	struct u_format u_format;
112290e8cacdSRalf Baechle 	struct c_format c_format;
112390e8cacdSRalf Baechle 	struct r_format r_format;
1124258f3a2eSJames Hogan 	struct c0r_format c0r_format;
1125258f3a2eSJames Hogan 	struct mfmc0_format mfmc0_format;
1126258f3a2eSJames Hogan 	struct co_format co_format;
112790e8cacdSRalf Baechle 	struct p_format p_format;
112890e8cacdSRalf Baechle 	struct f_format f_format;
112990e8cacdSRalf Baechle 	struct ma_format ma_format;
11306701ca2dSLeonid Yegoshin 	struct msa_mi10_format msa_mi10_format;
113190e8cacdSRalf Baechle 	struct b_format b_format;
11328fba1e58SRalf Baechle 	struct ps_format ps_format;
11338fba1e58SRalf Baechle 	struct v_format v_format;
11343f88ec63SMiodrag Dinic 	struct dsp_format dsp_format;
1135aa1af47fSLeonid Yegoshin 	struct spec3_format spec3_format;
11362aa9fd06SSteven J. Hill 	struct fb_format fb_format;
11372aa9fd06SSteven J. Hill 	struct fp0_format fp0_format;
11382aa9fd06SSteven J. Hill 	struct mm_fp0_format mm_fp0_format;
11392aa9fd06SSteven J. Hill 	struct fp1_format fp1_format;
11402aa9fd06SSteven J. Hill 	struct mm_fp1_format mm_fp1_format;
11412aa9fd06SSteven J. Hill 	struct mm_fp2_format mm_fp2_format;
11422aa9fd06SSteven J. Hill 	struct mm_fp3_format mm_fp3_format;
11432aa9fd06SSteven J. Hill 	struct mm_fp4_format mm_fp4_format;
11442aa9fd06SSteven J. Hill 	struct mm_fp5_format mm_fp5_format;
11452aa9fd06SSteven J. Hill 	struct fp6_format fp6_format;
11462aa9fd06SSteven J. Hill 	struct mm_fp6_format mm_fp6_format;
11472aa9fd06SSteven J. Hill 	struct mm_i_format mm_i_format;
11482aa9fd06SSteven J. Hill 	struct mm_m_format mm_m_format;
11492aa9fd06SSteven J. Hill 	struct mm_x_format mm_x_format;
115069a1e6cbSMaciej W. Rozycki 	struct mm_a_format mm_a_format;
11512aa9fd06SSteven J. Hill 	struct mm_b0_format mm_b0_format;
11522aa9fd06SSteven J. Hill 	struct mm_b1_format mm_b1_format;
11532aa9fd06SSteven J. Hill 	struct mm16_m_format mm16_m_format ;
11542aa9fd06SSteven J. Hill 	struct mm16_rb_format mm16_rb_format;
11552aa9fd06SSteven J. Hill 	struct mm16_r3_format mm16_r3_format;
11562aa9fd06SSteven J. Hill 	struct mm16_r5_format mm16_r5_format;
1157f83e4f98SHuacai Chen 	struct loongson3_lswc2_format loongson3_lswc2_format;
1158f83e4f98SHuacai Chen 	struct loongson3_lsdc2_format loongson3_lsdc2_format;
11597f2a83f1SHuacai Chen 	struct loongson3_lscsr_format loongson3_lscsr_format;
1160*6673c276SSiarhei Volkau 	struct mxu_lx_format mxu_lx_format;
116190e8cacdSRalf Baechle };
116290e8cacdSRalf Baechle 
1163cd574704SSteven J. Hill union mips16e_instruction {
1164cd574704SSteven J. Hill 	unsigned int full : 16;
1165cd574704SSteven J. Hill 	struct m16e_rr rr;
1166cd574704SSteven J. Hill 	struct m16e_jal jal;
1167cd574704SSteven J. Hill 	struct m16e_i64 i64;
1168cd574704SSteven J. Hill 	struct m16e_ri64 ri64;
1169cd574704SSteven J. Hill 	struct m16e_ri ri;
1170cd574704SSteven J. Hill 	struct m16e_rri rri;
1171cd574704SSteven J. Hill 	struct m16e_i8 i8;
1172cd574704SSteven J. Hill };
1173cd574704SSteven J. Hill 
117490e8cacdSRalf Baechle #endif /* _UAPI_ASM_INST_H */
1175