* config/tc-mips.c (INSERT_BITS, EXTRACT_BITS, INSERT_OPERAND)

(EXTRACT_OPERAND, MIPS16_INSERT_OPERAND, MIPS16_EXTRACT_OPERAND): New.
	(insn_uses_reg, reg_needs_delay, append_insn, macro_build)
	(mips16_macro_build, macro_build_lui, mips16_macro, mips_ip)
	(mips16_ip): Use the new macros instead of explicit masks and shifts.
This commit is contained in:
Richard Sandiford
2005-03-09 09:15:35 +00:00
parent a38419a54c
commit bf12938eac
2 changed files with 176 additions and 203 deletions

View File

@ -1,3 +1,11 @@
2005-03-09 Richard Sandiford <rsandifo@redhat.com>
* config/tc-mips.c (INSERT_BITS, EXTRACT_BITS, INSERT_OPERAND)
(EXTRACT_OPERAND, MIPS16_INSERT_OPERAND, MIPS16_EXTRACT_OPERAND): New.
(insn_uses_reg, reg_needs_delay, append_insn, macro_build)
(mips16_macro_build, macro_build_lui, mips16_macro, mips_ip)
(mips16_ip): Use the new macros instead of explicit masks and shifts.
2005-03-09 Richard Sandiford <rsandifo@redhat.com> 2005-03-09 Richard Sandiford <rsandifo@redhat.com>
* config/tc-mips.c (mips_cl_insn): Replace the valid_p, delay_slot_p * config/tc-mips.c (mips_cl_insn): Replace the valid_p, delay_slot_p

View File

@ -824,6 +824,36 @@ static int mips_relax_branch;
(((x) &~ (offsetT) 0x7fff) == 0 \ (((x) &~ (offsetT) 0x7fff) == 0 \
|| (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff)) || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff))
/* Replace bits MASK << SHIFT of STRUCT with the equivalent bits in
VALUE << SHIFT. VALUE is evaluated exactly once. */
#define INSERT_BITS(STRUCT, VALUE, MASK, SHIFT) \
(STRUCT) = (((STRUCT) & ~((MASK) << (SHIFT))) \
| (((VALUE) & (MASK)) << (SHIFT)))
/* Extract bits MASK << SHIFT from STRUCT and shift them right
SHIFT places. */
#define EXTRACT_BITS(STRUCT, MASK, SHIFT) \
(((STRUCT) >> (SHIFT)) & (MASK))
/* Change INSN's opcode so that the operand given by FIELD has value VALUE.
INSN is a mips_cl_insn structure and VALUE is evaluated exactly once.
include/opcode/mips.h specifies operand fields using the macros
OP_MASK_<FIELD> and OP_SH_<FIELD>. The MIPS16 equivalents start
with "MIPS16OP" instead of "OP". */
#define INSERT_OPERAND(FIELD, INSN, VALUE) \
INSERT_BITS ((INSN).insn_opcode, VALUE, OP_MASK_##FIELD, OP_SH_##FIELD)
#define MIPS16_INSERT_OPERAND(FIELD, INSN, VALUE) \
INSERT_BITS ((INSN).insn_opcode, VALUE, \
MIPS16OP_MASK_##FIELD, MIPS16OP_SH_##FIELD)
/* Extract the operand given by FIELD from mips_cl_insn INSN. */
#define EXTRACT_OPERAND(FIELD, INSN) \
EXTRACT_BITS ((INSN).insn_opcode, OP_MASK_##FIELD, OP_SH_##FIELD)
#define MIPS16_EXTRACT_OPERAND(FIELD, INSN) \
EXTRACT_BITS ((INSN).insn_opcode, \
MIPS16OP_MASK_##FIELD, \
MIPS16OP_SH_##FIELD)
/* Global variables used when generating relaxable macros. See the /* Global variables used when generating relaxable macros. See the
comment above RELAX_ENCODE for more details about how relaxation comment above RELAX_ENCODE for more details about how relaxation
@ -1463,38 +1493,33 @@ insn_uses_reg (struct mips_cl_insn *ip, unsigned int reg,
because there is no instruction that sets both $f0 and $f1 because there is no instruction that sets both $f0 and $f1
and requires a delay. */ and requires a delay. */
if ((ip->insn_mo->pinfo & INSN_READ_FPR_S) if ((ip->insn_mo->pinfo & INSN_READ_FPR_S)
&& ((((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) &~(unsigned)1) && ((EXTRACT_OPERAND (FS, *ip) & ~(unsigned) 1)
== (reg &~ (unsigned) 1))) == (reg &~ (unsigned) 1)))
return 1; return 1;
if ((ip->insn_mo->pinfo & INSN_READ_FPR_T) if ((ip->insn_mo->pinfo & INSN_READ_FPR_T)
&& ((((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) &~(unsigned)1) && ((EXTRACT_OPERAND (FT, *ip) & ~(unsigned) 1)
== (reg &~ (unsigned) 1))) == (reg &~ (unsigned) 1)))
return 1; return 1;
} }
else if (! mips_opts.mips16) else if (! mips_opts.mips16)
{ {
if ((ip->insn_mo->pinfo & INSN_READ_GPR_S) if ((ip->insn_mo->pinfo & INSN_READ_GPR_S)
&& ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS) == reg) && EXTRACT_OPERAND (RS, *ip) == reg)
return 1; return 1;
if ((ip->insn_mo->pinfo & INSN_READ_GPR_T) if ((ip->insn_mo->pinfo & INSN_READ_GPR_T)
&& ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT) == reg) && EXTRACT_OPERAND (RT, *ip) == reg)
return 1; return 1;
} }
else else
{ {
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X)
&& (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RX) && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, *ip)] == reg)
& MIPS16OP_MASK_RX)]
== reg))
return 1; return 1;
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y)
&& (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RY) && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RY, *ip)] == reg)
& MIPS16OP_MASK_RY)]
== reg))
return 1; return 1;
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z)
&& (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) && (mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (MOVE32Z, *ip)]
& MIPS16OP_MASK_MOVE32Z)]
== reg)) == reg))
return 1; return 1;
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG)
@ -1504,8 +1529,7 @@ insn_uses_reg (struct mips_cl_insn *ip, unsigned int reg,
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA)
return 1; return 1;
if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X) if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X)
&& ((ip->insn_opcode >> MIPS16OP_SH_REGR32) && MIPS16_EXTRACT_OPERAND (REGR32, *ip) == reg)
& MIPS16OP_MASK_REGR32) == reg)
return 1; return 1;
} }
@ -1531,7 +1555,7 @@ reg_needs_delay (unsigned int reg)
delay the use of general register rt for one instruction. */ delay the use of general register rt for one instruction. */
/* Itbl support may require additional care here. */ /* Itbl support may require additional care here. */
know (prev_pinfo & INSN_WRITE_GPR_T); know (prev_pinfo & INSN_WRITE_GPR_T);
if (reg == ((history[0].insn_opcode >> OP_SH_RT) & OP_MASK_RT)) if (reg == EXTRACT_OPERAND (RT, history[0]))
return 1; return 1;
} }
@ -1680,9 +1704,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
/* Itbl support may require additional care here. */ /* Itbl support may require additional care here. */
know (prev_pinfo & INSN_WRITE_GPR_T); know (prev_pinfo & INSN_WRITE_GPR_T);
if (mips_optimize == 0 if (mips_optimize == 0
|| insn_uses_reg (ip, || insn_uses_reg (ip, EXTRACT_OPERAND (RT, history[0]),
((history[0].insn_opcode >> OP_SH_RT)
& OP_MASK_RT),
MIPS_GR_REG)) MIPS_GR_REG))
++nops; ++nops;
} }
@ -1709,18 +1731,14 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
if (prev_pinfo & INSN_WRITE_FPR_T) if (prev_pinfo & INSN_WRITE_FPR_T)
{ {
if (mips_optimize == 0 if (mips_optimize == 0
|| insn_uses_reg (ip, || insn_uses_reg (ip, EXTRACT_OPERAND (FT, history[0]),
((history[0].insn_opcode >> OP_SH_FT)
& OP_MASK_FT),
MIPS_FP_REG)) MIPS_FP_REG))
++nops; ++nops;
} }
else if (prev_pinfo & INSN_WRITE_FPR_S) else if (prev_pinfo & INSN_WRITE_FPR_S)
{ {
if (mips_optimize == 0 if (mips_optimize == 0
|| insn_uses_reg (ip, || insn_uses_reg (ip, EXTRACT_OPERAND (FS, history[0]),
((history[0].insn_opcode >> OP_SH_FS)
& OP_MASK_FS),
MIPS_FP_REG)) MIPS_FP_REG))
++nops; ++nops;
} }
@ -1763,8 +1781,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
else if (mips_7000_hilo_fix else if (mips_7000_hilo_fix
&& MF_HILO_INSN (prev_pinfo) && MF_HILO_INSN (prev_pinfo)
&& insn_uses_reg (ip, ((history[0].insn_opcode >> OP_SH_RD) && insn_uses_reg (ip, EXTRACT_OPERAND (RD, history[0]),
& OP_MASK_RD),
MIPS_GR_REG)) MIPS_GR_REG))
{ {
nops += 2; nops += 2;
@ -1777,8 +1794,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
else if (mips_7000_hilo_fix else if (mips_7000_hilo_fix
&& MF_HILO_INSN (history[1].insn_opcode) && MF_HILO_INSN (history[1].insn_opcode)
&& insn_uses_reg (ip, ((history[1].insn_opcode >> OP_SH_RD) && insn_uses_reg (ip, EXTRACT_OPERAND (RD, history[1]),
& OP_MASK_RD),
MIPS_GR_REG)) MIPS_GR_REG))
{ {
@ -2281,21 +2297,21 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
if (! mips_opts.mips16) if (! mips_opts.mips16)
{ {
if (pinfo & INSN_WRITE_GPR_D) if (pinfo & INSN_WRITE_GPR_D)
mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD); mips_gprmask |= 1 << EXTRACT_OPERAND (RD, *ip);
if ((pinfo & (INSN_WRITE_GPR_T | INSN_READ_GPR_T)) != 0) if ((pinfo & (INSN_WRITE_GPR_T | INSN_READ_GPR_T)) != 0)
mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT); mips_gprmask |= 1 << EXTRACT_OPERAND (RT, *ip);
if (pinfo & INSN_READ_GPR_S) if (pinfo & INSN_READ_GPR_S)
mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS); mips_gprmask |= 1 << EXTRACT_OPERAND (RS, *ip);
if (pinfo & INSN_WRITE_GPR_31) if (pinfo & INSN_WRITE_GPR_31)
mips_gprmask |= 1 << RA; mips_gprmask |= 1 << RA;
if (pinfo & INSN_WRITE_FPR_D) if (pinfo & INSN_WRITE_FPR_D)
mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FD) & OP_MASK_FD); mips_cprmask[1] |= 1 << EXTRACT_OPERAND (FD, *ip);
if ((pinfo & (INSN_WRITE_FPR_S | INSN_READ_FPR_S)) != 0) if ((pinfo & (INSN_WRITE_FPR_S | INSN_READ_FPR_S)) != 0)
mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS); mips_cprmask[1] |= 1 << EXTRACT_OPERAND (FS, *ip);
if ((pinfo & (INSN_WRITE_FPR_T | INSN_READ_FPR_T)) != 0) if ((pinfo & (INSN_WRITE_FPR_T | INSN_READ_FPR_T)) != 0)
mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT); mips_cprmask[1] |= 1 << EXTRACT_OPERAND (FT, *ip);
if ((pinfo & INSN_READ_FPR_R) != 0) if ((pinfo & INSN_READ_FPR_R) != 0)
mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FR) & OP_MASK_FR); mips_cprmask[1] |= 1 << EXTRACT_OPERAND (FR, *ip);
if (pinfo & INSN_COP) if (pinfo & INSN_COP)
{ {
/* We don't keep enough information to sort these cases out. /* We don't keep enough information to sort these cases out.
@ -2309,14 +2325,11 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
else else
{ {
if (pinfo & (MIPS16_INSN_WRITE_X | MIPS16_INSN_READ_X)) if (pinfo & (MIPS16_INSN_WRITE_X | MIPS16_INSN_READ_X))
mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RX) mips_gprmask |= 1 << MIPS16_EXTRACT_OPERAND (RX, *ip);
& MIPS16OP_MASK_RX);
if (pinfo & (MIPS16_INSN_WRITE_Y | MIPS16_INSN_READ_Y)) if (pinfo & (MIPS16_INSN_WRITE_Y | MIPS16_INSN_READ_Y))
mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RY) mips_gprmask |= 1 << MIPS16_EXTRACT_OPERAND (RY, *ip);
& MIPS16OP_MASK_RY);
if (pinfo & MIPS16_INSN_WRITE_Z) if (pinfo & MIPS16_INSN_WRITE_Z)
mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RZ) mips_gprmask |= 1 << MIPS16_EXTRACT_OPERAND (RZ, *ip);
& MIPS16OP_MASK_RZ);
if (pinfo & (MIPS16_INSN_WRITE_T | MIPS16_INSN_READ_T)) if (pinfo & (MIPS16_INSN_WRITE_T | MIPS16_INSN_READ_T))
mips_gprmask |= 1 << TREG; mips_gprmask |= 1 << TREG;
if (pinfo & (MIPS16_INSN_WRITE_SP | MIPS16_INSN_READ_SP)) if (pinfo & (MIPS16_INSN_WRITE_SP | MIPS16_INSN_READ_SP))
@ -2326,11 +2339,9 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
if (pinfo & MIPS16_INSN_WRITE_GPR_Y) if (pinfo & MIPS16_INSN_WRITE_GPR_Y)
mips_gprmask |= 1 << MIPS16OP_EXTRACT_REG32R (ip->insn_opcode); mips_gprmask |= 1 << MIPS16OP_EXTRACT_REG32R (ip->insn_opcode);
if (pinfo & MIPS16_INSN_READ_Z) if (pinfo & MIPS16_INSN_READ_Z)
mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) mips_gprmask |= 1 << MIPS16_EXTRACT_OPERAND (MOVE32Z, *ip);
& MIPS16OP_MASK_MOVE32Z);
if (pinfo & MIPS16_INSN_READ_GPR_X) if (pinfo & MIPS16_INSN_READ_GPR_X)
mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_REGR32) mips_gprmask |= 1 << MIPS16_EXTRACT_OPERAND (REGR32, *ip);
& MIPS16OP_MASK_REGR32);
} }
if (mips_relax.sequence != 2 && !mips_opts.noreorder) if (mips_relax.sequence != 2 && !mips_opts.noreorder)
@ -2424,35 +2435,25 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
instruction sets, we can not swap. */ instruction sets, we can not swap. */
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (prev_pinfo & INSN_WRITE_GPR_T) && (prev_pinfo & INSN_WRITE_GPR_T)
&& insn_uses_reg (ip, && insn_uses_reg (ip, EXTRACT_OPERAND (RT, history[0]),
((history[0].insn_opcode >> OP_SH_RT)
& OP_MASK_RT),
MIPS_GR_REG)) MIPS_GR_REG))
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (prev_pinfo & INSN_WRITE_GPR_D) && (prev_pinfo & INSN_WRITE_GPR_D)
&& insn_uses_reg (ip, && insn_uses_reg (ip, EXTRACT_OPERAND (RD, history[0]),
((history[0].insn_opcode >> OP_SH_RD)
& OP_MASK_RD),
MIPS_GR_REG)) MIPS_GR_REG))
|| (mips_opts.mips16 || (mips_opts.mips16
&& (((prev_pinfo & MIPS16_INSN_WRITE_X) && (((prev_pinfo & MIPS16_INSN_WRITE_X)
&& insn_uses_reg (ip, && (insn_uses_reg
((history[0].insn_opcode (ip, MIPS16_EXTRACT_OPERAND (RX, history[0]),
>> MIPS16OP_SH_RX) MIPS16_REG)))
& MIPS16OP_MASK_RX),
MIPS16_REG))
|| ((prev_pinfo & MIPS16_INSN_WRITE_Y) || ((prev_pinfo & MIPS16_INSN_WRITE_Y)
&& insn_uses_reg (ip, && (insn_uses_reg
((history[0].insn_opcode (ip, MIPS16_EXTRACT_OPERAND (RY, history[0]),
>> MIPS16OP_SH_RY) MIPS16_REG)))
& MIPS16OP_MASK_RY),
MIPS16_REG))
|| ((prev_pinfo & MIPS16_INSN_WRITE_Z) || ((prev_pinfo & MIPS16_INSN_WRITE_Z)
&& insn_uses_reg (ip, && (insn_uses_reg
((history[0].insn_opcode (ip, MIPS16_EXTRACT_OPERAND (RZ, history[0]),
>> MIPS16OP_SH_RZ) MIPS16_REG)))
& MIPS16OP_MASK_RZ),
MIPS16_REG))
|| ((prev_pinfo & MIPS16_INSN_WRITE_T) || ((prev_pinfo & MIPS16_INSN_WRITE_T)
&& insn_uses_reg (ip, TREG, MIPS_GR_REG)) && insn_uses_reg (ip, TREG, MIPS_GR_REG))
|| ((prev_pinfo & MIPS16_INSN_WRITE_31) || ((prev_pinfo & MIPS16_INSN_WRITE_31)
@ -2468,21 +2469,17 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (prev_pinfo & INSN_WRITE_GPR_T) && (prev_pinfo & INSN_WRITE_GPR_T)
&& (((pinfo & INSN_WRITE_GPR_D) && (((pinfo & INSN_WRITE_GPR_D)
&& (((history[0].insn_opcode >> OP_SH_RT) & OP_MASK_RT) && (EXTRACT_OPERAND (RT, history[0])
== ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD))) == EXTRACT_OPERAND (RD, *ip)))
|| ((pinfo & INSN_WRITE_GPR_31) || ((pinfo & INSN_WRITE_GPR_31)
&& (((history[0].insn_opcode >> OP_SH_RT) && EXTRACT_OPERAND (RT, history[0]) == RA)))
& OP_MASK_RT)
== RA))))
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (prev_pinfo & INSN_WRITE_GPR_D) && (prev_pinfo & INSN_WRITE_GPR_D)
&& (((pinfo & INSN_WRITE_GPR_D) && (((pinfo & INSN_WRITE_GPR_D)
&& (((history[0].insn_opcode >> OP_SH_RD) & OP_MASK_RD) && (EXTRACT_OPERAND (RD, history[0])
== ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD))) == EXTRACT_OPERAND (RD, *ip)))
|| ((pinfo & INSN_WRITE_GPR_31) || ((pinfo & INSN_WRITE_GPR_31)
&& (((history[0].insn_opcode >> OP_SH_RD) && EXTRACT_OPERAND (RD, history[0]) == RA)))
& OP_MASK_RD)
== RA))))
|| (mips_opts.mips16 || (mips_opts.mips16
&& (pinfo & MIPS16_INSN_WRITE_31) && (pinfo & MIPS16_INSN_WRITE_31)
&& ((prev_pinfo & MIPS16_INSN_WRITE_31) && ((prev_pinfo & MIPS16_INSN_WRITE_31)
@ -2495,8 +2492,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (pinfo & INSN_WRITE_GPR_D) && (pinfo & INSN_WRITE_GPR_D)
&& insn_uses_reg (&history[0], && insn_uses_reg (&history[0],
((ip->insn_opcode >> OP_SH_RD) EXTRACT_OPERAND (RD, *ip),
& OP_MASK_RD),
MIPS_GR_REG)) MIPS_GR_REG))
|| (! mips_opts.mips16 || (! mips_opts.mips16
&& (pinfo & INSN_WRITE_GPR_31) && (pinfo & INSN_WRITE_GPR_31)
@ -2514,9 +2510,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
|| ((history[1].insn_mo->pinfo || ((history[1].insn_mo->pinfo
& INSN_LOAD_MEMORY_DELAY) & INSN_LOAD_MEMORY_DELAY)
&& ! gpr_interlocks)) && ! gpr_interlocks))
&& insn_uses_reg (ip, && insn_uses_reg (ip, EXTRACT_OPERAND (RT, history[1]),
((history[1].insn_opcode >> OP_SH_RT)
& OP_MASK_RT),
MIPS_GR_REG)) MIPS_GR_REG))
/* If one instruction sets a condition code and the /* If one instruction sets a condition code and the
other one uses a condition code, we can not swap. */ other one uses a condition code, we can not swap. */
@ -3060,8 +3054,7 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
{ {
case 'A': case 'A':
case 'E': case 'E':
insn.insn_opcode |= (va_arg (args, int) INSERT_OPERAND (SHAMT, insn, va_arg (args, int));
& OP_MASK_SHAMT) << OP_SH_SHAMT;
continue; continue;
case 'B': case 'B':
@ -3070,8 +3063,7 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
in MSB form. (When handling the instruction in the in MSB form. (When handling the instruction in the
non-macro case, these arguments are sizes from which non-macro case, these arguments are sizes from which
MSB values must be calculated.) */ MSB values must be calculated.) */
insn.insn_opcode |= (va_arg (args, int) INSERT_OPERAND (INSMSB, insn, va_arg (args, int));
& OP_MASK_INSMSB) << OP_SH_INSMSB;
continue; continue;
case 'C': case 'C':
@ -3081,8 +3073,7 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
in MSBD form. (When handling the instruction in the in MSBD form. (When handling the instruction in the
non-macro case, these arguments are sizes from which non-macro case, these arguments are sizes from which
MSBD values must be calculated.) */ MSBD values must be calculated.) */
insn.insn_opcode |= (va_arg (args, int) INSERT_OPERAND (EXTMSBD, insn, va_arg (args, int));
& OP_MASK_EXTMSBD) << OP_SH_EXTMSBD;
continue; continue;
default: default:
@ -3093,66 +3084,66 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
case 't': case 't':
case 'w': case 'w':
case 'E': case 'E':
insn.insn_opcode |= va_arg (args, int) << OP_SH_RT; INSERT_OPERAND (RT, insn, va_arg (args, int));
continue; continue;
case 'c': case 'c':
insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE; INSERT_OPERAND (CODE, insn, va_arg (args, int));
continue; continue;
case 'T': case 'T':
case 'W': case 'W':
insn.insn_opcode |= va_arg (args, int) << OP_SH_FT; INSERT_OPERAND (FT, insn, va_arg (args, int));
continue; continue;
case 'd': case 'd':
case 'G': case 'G':
case 'K': case 'K':
insn.insn_opcode |= va_arg (args, int) << OP_SH_RD; INSERT_OPERAND (RD, insn, va_arg (args, int));
continue; continue;
case 'U': case 'U':
{ {
int tmp = va_arg (args, int); int tmp = va_arg (args, int);
insn.insn_opcode |= tmp << OP_SH_RT; INSERT_OPERAND (RT, insn, tmp);
insn.insn_opcode |= tmp << OP_SH_RD; INSERT_OPERAND (RD, insn, tmp);
continue; continue;
} }
case 'V': case 'V':
case 'S': case 'S':
insn.insn_opcode |= va_arg (args, int) << OP_SH_FS; INSERT_OPERAND (FS, insn, va_arg (args, int));
continue; continue;
case 'z': case 'z':
continue; continue;
case '<': case '<':
insn.insn_opcode |= va_arg (args, int) << OP_SH_SHAMT; INSERT_OPERAND (SHAMT, insn, va_arg (args, int));
continue; continue;
case 'D': case 'D':
insn.insn_opcode |= va_arg (args, int) << OP_SH_FD; INSERT_OPERAND (FD, insn, va_arg (args, int));
continue; continue;
case 'B': case 'B':
insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE20; INSERT_OPERAND (CODE20, insn, va_arg (args, int));
continue; continue;
case 'J': case 'J':
insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE19; INSERT_OPERAND (CODE19, insn, va_arg (args, int));
continue; continue;
case 'q': case 'q':
insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE2; INSERT_OPERAND (CODE2, insn, va_arg (args, int));
continue; continue;
case 'b': case 'b':
case 's': case 's':
case 'r': case 'r':
case 'v': case 'v':
insn.insn_opcode |= va_arg (args, int) << OP_SH_RS; INSERT_OPERAND (RS, insn, va_arg (args, int));
continue; continue;
case 'i': case 'i':
@ -3264,20 +3255,20 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
case 'y': case 'y':
case 'w': case 'w':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RY; MIPS16_INSERT_OPERAND (RY, insn, va_arg (args, int));
continue; continue;
case 'x': case 'x':
case 'v': case 'v':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RX; MIPS16_INSERT_OPERAND (RX, insn, va_arg (args, int));
continue; continue;
case 'z': case 'z':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RZ; MIPS16_INSERT_OPERAND (RZ, insn, va_arg (args, int));
continue; continue;
case 'Z': case 'Z':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_MOVE32Z; MIPS16_INSERT_OPERAND (MOVE32Z, insn, va_arg (args, int));
continue; continue;
case '0': case '0':
@ -3287,7 +3278,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
continue; continue;
case 'X': case 'X':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_REGR32; MIPS16_INSERT_OPERAND (REGR32, insn, va_arg (args, int));
continue; continue;
case 'Y': case 'Y':
@ -3333,7 +3324,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
continue; continue;
case '6': case '6':
insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_IMM6; MIPS16_INSERT_OPERAND (IMM6, insn, va_arg (args, int));
continue; continue;
} }
@ -3408,7 +3399,8 @@ macro_build_lui (expressionS *ep, int regnum)
assert (strcmp (name, insn.insn_mo->name) == 0); assert (strcmp (name, insn.insn_mo->name) == 0);
assert (strcmp (fmt, insn.insn_mo->args) == 0); assert (strcmp (fmt, insn.insn_mo->args) == 0);
insn.insn_opcode = insn.insn_mo->match | (regnum << OP_SH_RT); insn.insn_opcode = insn.insn_mo->match;
INSERT_OPERAND (RT, insn, regnum);
if (*r == BFD_RELOC_UNUSED) if (*r == BFD_RELOC_UNUSED)
{ {
insn.insn_opcode |= high_expr.X_add_number; insn.insn_opcode |= high_expr.X_add_number;
@ -7574,9 +7566,9 @@ mips16_macro (struct mips_cl_insn *ip)
mask = ip->insn_mo->mask; mask = ip->insn_mo->mask;
xreg = (ip->insn_opcode >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX; xreg = MIPS16_EXTRACT_OPERAND (RX, *ip);
yreg = (ip->insn_opcode >> MIPS16OP_SH_RY) & MIPS16OP_MASK_RY; yreg = MIPS16_EXTRACT_OPERAND (RY, *ip);
zreg = (ip->insn_opcode >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ; zreg = MIPS16_EXTRACT_OPERAND (RZ, *ip);
expr1.X_op = O_constant; expr1.X_op = O_constant;
expr1.X_op_symbol = NULL; expr1.X_op_symbol = NULL;
@ -8050,19 +8042,19 @@ mips_ip (char *str, struct mips_cl_insn *ip)
{ {
case 'r': case 'r':
case 'v': case 'v':
ip->insn_opcode |= lastregno << OP_SH_RS; INSERT_OPERAND (RS, *ip, lastregno);
continue; continue;
case 'w': case 'w':
ip->insn_opcode |= lastregno << OP_SH_RT; INSERT_OPERAND (RT, *ip, lastregno);
continue; continue;
case 'W': case 'W':
ip->insn_opcode |= lastregno << OP_SH_FT; INSERT_OPERAND (FT, *ip, lastregno);
continue; continue;
case 'V': case 'V':
ip->insn_opcode |= lastregno << OP_SH_FS; INSERT_OPERAND (FS, *ip, lastregno);
continue; continue;
} }
break; break;
@ -8107,8 +8099,7 @@ do_lsb:
imm_expr.X_add_number = limlo; imm_expr.X_add_number = limlo;
} }
lastpos = imm_expr.X_add_number; lastpos = imm_expr.X_add_number;
ip->insn_opcode |= (imm_expr.X_add_number INSERT_OPERAND (SHAMT, *ip, imm_expr.X_add_number);
& OP_MASK_SHAMT) << OP_SH_SHAMT;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8139,8 +8130,8 @@ do_msb:
(unsigned long) lastpos); (unsigned long) lastpos);
imm_expr.X_add_number = limlo - lastpos; imm_expr.X_add_number = limlo - lastpos;
} }
ip->insn_opcode |= ((lastpos + imm_expr.X_add_number - 1) INSERT_OPERAND (INSMSB, *ip,
& OP_MASK_INSMSB) << OP_SH_INSMSB; lastpos + imm_expr.X_add_number - 1);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8175,8 +8166,7 @@ do_msbd:
(unsigned long) lastpos); (unsigned long) lastpos);
imm_expr.X_add_number = limlo - lastpos; imm_expr.X_add_number = limlo - lastpos;
} }
ip->insn_opcode |= ((imm_expr.X_add_number - 1) INSERT_OPERAND (EXTMSBD, *ip, imm_expr.X_add_number - 1);
& OP_MASK_EXTMSBD) << OP_SH_EXTMSBD;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8213,12 +8203,9 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 31) if ((unsigned long) imm_expr.X_add_number > 31)
{
as_warn (_("Improper shift amount (%lu)"), as_warn (_("Improper shift amount (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_SHAMT; INSERT_OPERAND (SHAMT, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_SHAMT;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8229,7 +8216,7 @@ do_msbd:
if ((unsigned long) imm_expr.X_add_number < 32 if ((unsigned long) imm_expr.X_add_number < 32
|| (unsigned long) imm_expr.X_add_number > 63) || (unsigned long) imm_expr.X_add_number > 63)
break; break;
ip->insn_opcode |= (imm_expr.X_add_number - 32) << OP_SH_SHAMT; INSERT_OPERAND (SHAMT, *ip, imm_expr.X_add_number - 32);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8239,16 +8226,13 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 31) if ((unsigned long) imm_expr.X_add_number > 31)
{
as_warn (_("Invalid value for `%s' (%lu)"), as_warn (_("Invalid value for `%s' (%lu)"),
ip->insn_mo->name, ip->insn_mo->name,
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= 0x1f;
}
if (*args == 'k') if (*args == 'k')
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CACHE; INSERT_OPERAND (CACHE, *ip, imm_expr.X_add_number);
else else
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_PREFX; INSERT_OPERAND (PREFX, *ip, imm_expr.X_add_number);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8257,12 +8241,9 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 1023) if ((unsigned long) imm_expr.X_add_number > 1023)
{
as_warn (_("Illegal break code (%lu)"), as_warn (_("Illegal break code (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_CODE; INSERT_OPERAND (CODE, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8271,12 +8252,9 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 1023) if ((unsigned long) imm_expr.X_add_number > 1023)
{
as_warn (_("Illegal lower break code (%lu)"), as_warn (_("Illegal lower break code (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_CODE2; INSERT_OPERAND (CODE2, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE2;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8287,7 +8265,7 @@ do_msbd:
if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE20) if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE20)
as_warn (_("Illegal 20-bit code (%lu)"), as_warn (_("Illegal 20-bit code (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE20; INSERT_OPERAND (CODE20, *ip, imm_expr.X_add_number);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8312,7 +8290,7 @@ do_msbd:
if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE19) if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE19)
as_warn (_("Illegal 19-bit code (%lu)"), as_warn (_("Illegal 19-bit code (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE19; INSERT_OPERAND (CODE19, *ip, imm_expr.X_add_number);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8321,12 +8299,9 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if (imm_expr.X_add_number != 0 && imm_expr.X_add_number != 1) if (imm_expr.X_add_number != 0 && imm_expr.X_add_number != 1)
{
as_warn (_("Invalid performance register (%lu)"), as_warn (_("Invalid performance register (%lu)"),
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_PERFREG; INSERT_OPERAND (PERFREG, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= (imm_expr.X_add_number << OP_SH_PERFREG);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8463,21 +8438,21 @@ do_msbd:
case 's': case 's':
case 'v': case 'v':
case 'b': case 'b':
ip->insn_opcode |= regno << OP_SH_RS; INSERT_OPERAND (RS, *ip, regno);
break; break;
case 'd': case 'd':
case 'G': case 'G':
case 'K': case 'K':
ip->insn_opcode |= regno << OP_SH_RD; INSERT_OPERAND (RD, *ip, regno);
break; break;
case 'U': case 'U':
ip->insn_opcode |= regno << OP_SH_RD; INSERT_OPERAND (RD, *ip, regno);
ip->insn_opcode |= regno << OP_SH_RT; INSERT_OPERAND (RT, *ip, regno);
break; break;
case 'w': case 'w':
case 't': case 't':
case 'E': case 'E':
ip->insn_opcode |= regno << OP_SH_RT; INSERT_OPERAND (RT, *ip, regno);
break; break;
case 'x': case 'x':
/* This case exists because on the r3000 trunc /* This case exists because on the r3000 trunc
@ -8508,10 +8483,10 @@ do_msbd:
{ {
case 'r': case 'r':
case 'v': case 'v':
ip->insn_opcode |= lastregno << OP_SH_RS; INSERT_OPERAND (RS, *ip, lastregno);
continue; continue;
case 'w': case 'w':
ip->insn_opcode |= lastregno << OP_SH_RT; INSERT_OPERAND (RT, *ip, lastregno);
continue; continue;
} }
break; break;
@ -8520,12 +8495,9 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > OP_MASK_ALN) if ((unsigned long) imm_expr.X_add_number > OP_MASK_ALN)
{
as_warn ("Improper align amount (%ld), using low bits", as_warn ("Improper align amount (%ld), using low bits",
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_ALN; INSERT_OPERAND (ALN, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_ALN;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8537,17 +8509,13 @@ do_msbd:
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > OP_MASK_FT) if ((unsigned long) imm_expr.X_add_number > OP_MASK_FT)
{
as_warn (_("Invalid MDMX Immediate (%ld)"), as_warn (_("Invalid MDMX Immediate (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_FT; INSERT_OPERAND (FT, *ip, imm_expr.X_add_number);
}
imm_expr.X_add_number &= OP_MASK_FT;
if (ip->insn_opcode & (OP_MASK_VSEL << OP_SH_VSEL)) if (ip->insn_opcode & (OP_MASK_VSEL << OP_SH_VSEL))
ip->insn_opcode |= MDMX_FMTSEL_IMM_QH << OP_SH_VSEL; ip->insn_opcode |= MDMX_FMTSEL_IMM_QH << OP_SH_VSEL;
else else
ip->insn_opcode |= MDMX_FMTSEL_IMM_OB << OP_SH_VSEL; ip->insn_opcode |= MDMX_FMTSEL_IMM_OB << OP_SH_VSEL;
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_FT;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -8610,12 +8578,12 @@ do_msbd:
{ {
case 'D': case 'D':
case 'X': case 'X':
ip->insn_opcode |= regno << OP_SH_FD; INSERT_OPERAND (FD, *ip, regno);
break; break;
case 'V': case 'V':
case 'S': case 'S':
case 'Y': case 'Y':
ip->insn_opcode |= regno << OP_SH_FS; INSERT_OPERAND (FS, *ip, regno);
break; break;
case 'Q': case 'Q':
/* This is like 'Z', but also needs to fix the MDMX /* This is like 'Z', but also needs to fix the MDMX
@ -8655,10 +8623,10 @@ do_msbd:
case 'W': case 'W':
case 'T': case 'T':
case 'Z': case 'Z':
ip->insn_opcode |= regno << OP_SH_FT; INSERT_OPERAND (FT, *ip, regno);
break; break;
case 'R': case 'R':
ip->insn_opcode |= regno << OP_SH_FR; INSERT_OPERAND (FR, *ip, regno);
break; break;
} }
lastregno = regno; lastregno = regno;
@ -8668,10 +8636,10 @@ do_msbd:
switch (*args++) switch (*args++)
{ {
case 'V': case 'V':
ip->insn_opcode |= lastregno << OP_SH_FS; INSERT_OPERAND (FS, *ip, lastregno);
continue; continue;
case 'W': case 'W':
ip->insn_opcode |= lastregno << OP_SH_FT; INSERT_OPERAND (FT, *ip, lastregno);
continue; continue;
} }
break; break;
@ -9001,9 +8969,9 @@ do_msbd:
as_warn(_("Condition code register should be 0 or 4 for %s, was %d"), as_warn(_("Condition code register should be 0 or 4 for %s, was %d"),
str, regno); str, regno);
if (*args == 'N') if (*args == 'N')
ip->insn_opcode |= regno << OP_SH_BCC; INSERT_OPERAND (BCC, *ip, regno);
else else
ip->insn_opcode |= regno << OP_SH_CCC; INSERT_OPERAND (CCC, *ip, regno);
continue; continue;
case 'H': case 'H':
@ -9041,7 +9009,7 @@ do_msbd:
imm_expr.X_add_number = 0; imm_expr.X_add_number = 0;
} }
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_VECBYTE; INSERT_OPERAND (VECBYTE, *ip, imm_expr.X_add_number);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -9058,7 +9026,7 @@ do_msbd:
imm_expr.X_add_number = 0; imm_expr.X_add_number = 0;
} }
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_VECALIGN; INSERT_OPERAND (VECALIGN, *ip, imm_expr.X_add_number);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -9234,10 +9202,10 @@ mips16_ip (char *str, struct mips_cl_insn *ip)
switch (*++args) switch (*++args)
{ {
case 'v': case 'v':
ip->insn_opcode |= lastregno << MIPS16OP_SH_RX; MIPS16_INSERT_OPERAND (RX, *ip, lastregno);
continue; continue;
case 'w': case 'w':
ip->insn_opcode |= lastregno << MIPS16OP_SH_RY; MIPS16_INSERT_OPERAND (RY, *ip, lastregno);
continue; continue;
} }
break; break;
@ -9253,9 +9221,9 @@ mips16_ip (char *str, struct mips_cl_insn *ip)
if (s[0] != '$') if (s[0] != '$')
{ {
if (c == 'v') if (c == 'v')
ip->insn_opcode |= lastregno << MIPS16OP_SH_RX; MIPS16_INSERT_OPERAND (RX, *ip, lastregno);
else else
ip->insn_opcode |= lastregno << MIPS16OP_SH_RY; MIPS16_INSERT_OPERAND (RY, *ip, lastregno);
++args; ++args;
continue; continue;
} }
@ -9390,27 +9358,27 @@ mips16_ip (char *str, struct mips_cl_insn *ip)
{ {
case 'x': case 'x':
case 'v': case 'v':
ip->insn_opcode |= regno << MIPS16OP_SH_RX; MIPS16_INSERT_OPERAND (RX, *ip, regno);
break; break;
case 'y': case 'y':
case 'w': case 'w':
ip->insn_opcode |= regno << MIPS16OP_SH_RY; MIPS16_INSERT_OPERAND (RY, *ip, regno);
break; break;
case 'z': case 'z':
ip->insn_opcode |= regno << MIPS16OP_SH_RZ; MIPS16_INSERT_OPERAND (RZ, *ip, regno);
break; break;
case 'Z': case 'Z':
ip->insn_opcode |= regno << MIPS16OP_SH_MOVE32Z; MIPS16_INSERT_OPERAND (MOVE32Z, *ip, regno);
case '0': case '0':
case 'S': case 'S':
case 'R': case 'R':
break; break;
case 'X': case 'X':
ip->insn_opcode |= regno << MIPS16OP_SH_REGR32; MIPS16_INSERT_OPERAND (REGR32, *ip, regno);
break; break;
case 'Y': case 'Y':
regno = ((regno & 7) << 2) | ((regno & 0x18) >> 3); regno = ((regno & 7) << 2) | ((regno & 0x18) >> 3);
ip->insn_opcode |= regno << MIPS16OP_SH_REG32R; MIPS16_INSERT_OPERAND (REG32R, *ip, regno);
break; break;
default: default:
internalError (); internalError ();
@ -9512,13 +9480,10 @@ mips16_ip (char *str, struct mips_cl_insn *ip)
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 63) if ((unsigned long) imm_expr.X_add_number > 63)
{
as_warn (_("Invalid value for `%s' (%lu)"), as_warn (_("Invalid value for `%s' (%lu)"),
ip->insn_mo->name, ip->insn_mo->name,
(unsigned long) imm_expr.X_add_number); (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= 0x3f; MIPS16_INSERT_OPERAND (IMM6, *ip, imm_expr.X_add_number);
}
ip->insn_opcode |= imm_expr.X_add_number << MIPS16OP_SH_IMM6;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;