* config/tc-mips.c (set_at): Add cast needed for varargs.

(load_register): Likewise.
	(macro): Likewise. Some code reformatting.
	(macro2): Add cast needed for varargs.
	(mips16_macro): Likewise.
This commit is contained in:
Thiemo Seufer
2001-11-12 22:20:44 +00:00
parent c4e7957cc8
commit 2396cfb964
2 changed files with 248 additions and 181 deletions

View File

@@ -1,3 +1,11 @@
2001-11-12 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (set_at): Add cast needed for varargs.
(load_register): Likewise.
(macro): Likewise. Some code reformatting.
(macro2): Add cast needed for varargs.
(mips16_macro): Likewise.
2001-11-12 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2001-11-12 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (md_assemble): Remove superflous casts. * config/tc-mips.c (md_assemble): Remove superflous casts.

View File

@@ -3164,7 +3164,7 @@ set_at (counter, reg, unsignedp)
else else
{ {
load_register (counter, AT, &imm_expr, 0); load_register (counter, AT, &imm_expr, 0);
macro_build ((char *) NULL, counter, NULL, macro_build ((char *) NULL, counter, (expressionS *) NULL,
unsignedp ? "sltu" : "slt", unsignedp ? "sltu" : "slt",
"d,v,t", AT, reg, AT); "d,v,t", AT, reg, AT);
} }
@@ -3412,7 +3412,7 @@ load_register (counter, reg, ep, dbl)
macro_build ((char *) NULL, counter, &tmp, macro_build ((char *) NULL, counter, &tmp,
"ori", "t,r,i", reg, 0, "ori", "t,r,i", reg, 0,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
macro_build ((char *) NULL, counter, NULL, macro_build ((char *) NULL, counter, (expressionS *) NULL,
(shift >= 32) ? "dsll32" : "dsll", (shift >= 32) ? "dsll32" : "dsll",
"d,w,<", reg, reg, "d,w,<", reg, reg,
(shift >= 32) ? shift - 32 : shift); (shift >= 32) ? shift - 32 : shift);
@@ -3467,12 +3467,12 @@ load_register (counter, reg, ep, dbl)
if (bit != 0) if (bit != 0)
{ {
bit += shift; bit += shift;
macro_build ((char *) NULL, counter, NULL, macro_build ((char *) NULL, counter, (expressionS *) NULL,
(bit >= 32) ? "dsll32" : "dsll", (bit >= 32) ? "dsll32" : "dsll",
"d,w,<", reg, reg, "d,w,<", reg, reg,
(bit >= 32) ? bit - 32 : bit); (bit >= 32) ? bit - 32 : bit);
} }
macro_build ((char *) NULL, counter, NULL, macro_build ((char *) NULL, counter, (expressionS *) NULL,
(shift >= 32) ? "dsrl32" : "dsrl", (shift >= 32) ? "dsrl32" : "dsrl",
"d,w,<", reg, reg, "d,w,<", reg, reg,
(shift >= 32) ? shift - 32 : shift); (shift >= 32) ? shift - 32 : shift);
@@ -3491,8 +3491,8 @@ load_register (counter, reg, ep, dbl)
{ {
if (freg != 0) if (freg != 0)
{ {
macro_build ((char *) NULL, counter, NULL, "dsll32", "d,w,<", reg, macro_build ((char *) NULL, counter, (expressionS *) NULL,
freg, 0); "dsll32", "d,w,<", reg, freg, 0);
freg = reg; freg = reg;
} }
} }
@@ -3596,10 +3596,10 @@ load_address (counter, reg, ep, dbl, used_at)
reg, reg, (int) BFD_RELOC_MIPS_HIGHER); reg, reg, (int) BFD_RELOC_MIPS_HIGHER);
macro_build (p, counter, ep, "daddiu", "t,r,j", macro_build (p, counter, ep, "daddiu", "t,r,j",
AT, AT, (int) BFD_RELOC_LO16); AT, AT, (int) BFD_RELOC_LO16);
macro_build (p, counter, NULL, "dsll32", "d,w,<", macro_build (p, counter, (expressionS *) NULL, "dsll32",
reg, reg, 0); "d,w,<", reg, reg, 0);
macro_build (p, counter, NULL, "dadd", "d,v,t", macro_build (p, counter, (expressionS *) NULL, "dadd",
reg, reg, AT); "d,v,t", reg, reg, AT);
*used_at = 1; *used_at = 1;
} }
else else
@@ -3608,12 +3608,12 @@ load_address (counter, reg, ep, dbl, used_at)
reg, (int) BFD_RELOC_MIPS_HIGHEST); reg, (int) BFD_RELOC_MIPS_HIGHEST);
macro_build (p, counter, ep, "daddiu", "t,r,j", macro_build (p, counter, ep, "daddiu", "t,r,j",
reg, reg, (int) BFD_RELOC_MIPS_HIGHER); reg, reg, (int) BFD_RELOC_MIPS_HIGHER);
macro_build (p, counter, NULL, "dsll", "d,w,<", macro_build (p, counter, (expressionS *) NULL, "dsll",
reg, reg, 16); "d,w,<", reg, reg, 16);
macro_build (p, counter, ep, "daddiu", "t,r,j", macro_build (p, counter, ep, "daddiu", "t,r,j",
reg, reg, (int) BFD_RELOC_HI16_S); reg, reg, (int) BFD_RELOC_HI16_S);
macro_build (p, counter, NULL, "dsll", "d,w,<", macro_build (p, counter, (expressionS *) NULL, "dsll",
reg, reg, 16); "d,w,<", reg, reg, 16);
macro_build (p, counter, ep, "daddiu", "t,r,j", macro_build (p, counter, ep, "daddiu", "t,r,j",
reg, reg, (int) BFD_RELOC_LO16); reg, reg, (int) BFD_RELOC_LO16);
} }
@@ -3832,10 +3832,11 @@ macro (ip)
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "bgez", "s,p", sreg); macro_build ((char *) NULL, &icnt, &expr1, "bgez", "s,p", sreg);
if (dreg == sreg) if (dreg == sreg)
macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "",
0);
else else
move_register (&icnt, dreg, sreg); move_register (&icnt, dreg, sreg);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dsub" : "sub", "d,v,t", dreg, 0, sreg); dbl ? "dsub" : "sub", "d,v,t", dreg, 0, sreg);
--mips_opts.noreorder; --mips_opts.noreorder;
@@ -3868,7 +3869,8 @@ macro (ip)
return; return;
} }
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, s2, "d,v,t", treg, sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s2, "d,v,t",
treg, sreg, AT);
break; break;
case M_AND_I: case M_AND_I:
@@ -3898,14 +3900,15 @@ macro (ip)
{ {
macro_build ((char *) NULL, &icnt, &imm_expr, "ori", "t,r,i", macro_build ((char *) NULL, &icnt, &imm_expr, "ori", "t,r,i",
treg, sreg, (int) BFD_RELOC_LO16); treg, sreg, (int) BFD_RELOC_LO16);
macro_build ((char *) NULL, &icnt, NULL, "nor", "d,v,t", macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nor",
treg, treg, 0); "d,v,t", treg, treg, 0);
} }
return; return;
} }
load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS);
macro_build ((char *) NULL, &icnt, NULL, s2, "d,v,t", treg, sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s2, "d,v,t",
treg, sreg, AT);
break; break;
case M_BEQ_I: case M_BEQ_I:
@@ -3938,18 +3941,17 @@ macro (ip)
if (treg == 0) if (treg == 0)
{ {
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "bgezl" : "bgez", likely ? "bgezl" : "bgez", "s,p", sreg);
"s,p", sreg);
return; return;
} }
if (sreg == 0) if (sreg == 0)
{ {
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "blezl" : "blez", likely ? "blezl" : "blez", "s,p", treg);
"s,p", treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t",
AT, sreg, treg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "beql" : "beq", "s,t,p", AT, 0); likely ? "beql" : "beq", "s,t,p", AT, 0);
break; break;
@@ -3977,7 +3979,8 @@ macro (ip)
if (warn_nops) if (warn_nops)
as_warn (_("Branch %s is always false (nop)"), as_warn (_("Branch %s is always false (nop)"),
ip->insn_mo->name); ip->insn_mo->name);
macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop",
"", 0);
} }
else else
{ {
@@ -4044,8 +4047,8 @@ macro (ip)
likely ? "beql" : "beq", "s,t,p", 0, treg); likely ? "beql" : "beq", "s,t,p", 0, treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
treg); "d,v,t", AT, sreg, treg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "beql" : "beq", "s,t,p", AT, 0); likely ? "beql" : "beq", "s,t,p", AT, 0);
break; break;
@@ -4094,7 +4097,8 @@ macro (ip)
likely ? "bltzl" : "bltz", "s,p", treg); likely ? "bltzl" : "bltz", "s,p", treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t",
AT, treg, sreg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "bnel" : "bne", "s,t,p", AT, 0); likely ? "bnel" : "bne", "s,t,p", AT, 0);
break; break;
@@ -4110,8 +4114,8 @@ macro (ip)
} }
if (sreg == 0) if (sreg == 0)
goto do_false; goto do_false;
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
sreg); "d,v,t", AT, treg, sreg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "bnel" : "bne", "s,t,p", AT, 0); likely ? "bnel" : "bne", "s,t,p", AT, 0);
break; break;
@@ -4131,7 +4135,8 @@ macro (ip)
likely ? "bgezl" : "bgez", "s,p", treg); likely ? "bgezl" : "bgez", "s,p", treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t",
AT, treg, sreg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "beql" : "beq", "s,t,p", AT, 0); likely ? "beql" : "beq", "s,t,p", AT, 0);
break; break;
@@ -4187,8 +4192,8 @@ macro (ip)
} }
if (sreg == 0) if (sreg == 0)
goto do_true; goto do_true;
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
sreg); "d,v,t", AT, treg, sreg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "beql" : "beq", "s,t,p", AT, 0); likely ? "beql" : "beq", "s,t,p", AT, 0);
break; break;
@@ -4238,7 +4243,8 @@ macro (ip)
likely ? "bgtzl" : "bgtz", "s,p", treg); likely ? "bgtzl" : "bgtz", "s,p", treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t",
AT, sreg, treg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "bnel" : "bne", "s,t,p", AT, 0); likely ? "bnel" : "bne", "s,t,p", AT, 0);
break; break;
@@ -4254,7 +4260,8 @@ macro (ip)
likely ? "bnel" : "bne", "s,t,p", 0, treg); likely ? "bnel" : "bne", "s,t,p", 0, treg);
return; return;
} }
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
"d,v,t", AT, sreg,
treg); treg);
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr,
likely ? "bnel" : "bne", "s,t,p", AT, 0); likely ? "bnel" : "bne", "s,t,p", AT, 0);
@@ -4274,9 +4281,11 @@ macro (ip)
{ {
as_warn (_("Divide by zero.")); as_warn (_("Divide by zero."));
if (mips_trap) if (mips_trap)
macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", 0, 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "teq",
"s,t", 0, 0);
else else
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 7);
return; return;
} }
@@ -4285,17 +4294,19 @@ macro (ip)
mips_any_noreorder = 1; mips_any_noreorder = 1;
if (mips_trap) if (mips_trap)
{ {
macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", treg, 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "teq",
macro_build ((char *) NULL, &icnt, NULL, "s,t", treg, 0);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "ddiv" : "div", "z,s,t", sreg, treg); dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
} }
else else
{ {
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0); macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "ddiv" : "div", "z,s,t", sreg, treg); dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 7);
} }
expr1.X_add_number = -1; expr1.X_add_number = -1;
macro_build ((char *) NULL, &icnt, &expr1, macro_build ((char *) NULL, &icnt, &expr1,
@@ -4308,8 +4319,8 @@ macro (ip)
expr1.X_add_number = 1; expr1.X_add_number = 1;
macro_build ((char *) NULL, &icnt, &expr1, "daddiu", "t,r,j", AT, 0, macro_build ((char *) NULL, &icnt, &expr1, "daddiu", "t,r,j", AT, 0,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
macro_build ((char *) NULL, &icnt, NULL, "dsll32", "d,w,<", AT, AT, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "dsll32",
31); "d,w,<", AT, AT, 31);
} }
else else
{ {
@@ -4319,7 +4330,8 @@ macro (ip)
} }
if (mips_trap) if (mips_trap)
{ {
macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "teq",
"s,t", sreg, AT);
/* We want to close the noreorder block as soon as possible, so /* We want to close the noreorder block as soon as possible, so
that later insns are available for delay slot filling. */ that later insns are available for delay slot filling. */
--mips_opts.noreorder; --mips_opts.noreorder;
@@ -4328,15 +4340,17 @@ macro (ip)
{ {
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", sreg, AT); macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", sreg, AT);
macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "",
0);
/* We want to close the noreorder block as soon as possible, so /* We want to close the noreorder block as soon as possible, so
that later insns are available for delay slot filling. */ that later insns are available for delay slot filling. */
--mips_opts.noreorder; --mips_opts.noreorder;
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 6);
} }
macro_build ((char *) NULL, &icnt, NULL, s, "d", dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d", dreg);
break; break;
case M_DIV_3I: case M_DIV_3I:
@@ -4379,9 +4393,11 @@ macro (ip)
{ {
as_warn (_("Divide by zero.")); as_warn (_("Divide by zero."));
if (mips_trap) if (mips_trap)
macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", 0, 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "teq",
"s,t", 0, 0);
else else
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 7);
return; return;
} }
if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
@@ -4398,8 +4414,8 @@ macro (ip)
{ {
if (strcmp (s2, "mflo") == 0) if (strcmp (s2, "mflo") == 0)
{ {
macro_build ((char *) NULL, &icnt, NULL, dbl ? "dneg" : "neg", macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
"d,w", dreg, sreg); dbl ? "dneg" : "neg", "d,w", dreg, sreg);
} }
else else
move_register (&icnt, dreg, 0); move_register (&icnt, dreg, 0);
@@ -4407,8 +4423,9 @@ macro (ip)
} }
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, s, "z,s,t", sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "z,s,t",
macro_build ((char *) NULL, &icnt, NULL, s2, "d", dreg); sreg, AT);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s2, "d", dreg);
break; break;
case M_DIVU_3: case M_DIVU_3:
@@ -4432,8 +4449,10 @@ macro (ip)
mips_any_noreorder = 1; mips_any_noreorder = 1;
if (mips_trap) if (mips_trap)
{ {
macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", treg, 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "teq",
macro_build ((char *) NULL, &icnt, NULL, s, "z,s,t", sreg, treg); "s,t", treg, 0);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "z,s,t",
sreg, treg);
/* We want to close the noreorder block as soon as possible, so /* We want to close the noreorder block as soon as possible, so
that later insns are available for delay slot filling. */ that later insns are available for delay slot filling. */
--mips_opts.noreorder; --mips_opts.noreorder;
@@ -4442,14 +4461,16 @@ macro (ip)
{ {
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0); macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0);
macro_build ((char *) NULL, &icnt, NULL, s, "z,s,t", sreg, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "z,s,t",
sreg, treg);
/* We want to close the noreorder block as soon as possible, so /* We want to close the noreorder block as soon as possible, so
that later insns are available for delay slot filling. */ that later insns are available for delay slot filling. */
--mips_opts.noreorder; --mips_opts.noreorder;
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 7);
} }
macro_build ((char *) NULL, &icnt, NULL, s2, "d", dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s2, "d", dreg);
return; return;
case M_DLA_AB: case M_DLA_AB:
@@ -4565,9 +4586,9 @@ macro (ip)
tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER); tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
AT, AT, (int) BFD_RELOC_LO16); AT, AT, (int) BFD_RELOC_LO16);
macro_build (p, &icnt, NULL, "dsll32", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll32",
tempreg, tempreg, 0); "d,w,<", tempreg, tempreg, 0);
macro_build (p, &icnt, NULL, "dadd", "d,v,t", macro_build (p, &icnt, (expressionS *) NULL, "dadd", "d,v,t",
tempreg, tempreg, AT); tempreg, tempreg, AT);
used_at = 1; used_at = 1;
} }
@@ -4577,11 +4598,11 @@ macro (ip)
tempreg, (int) BFD_RELOC_MIPS_HIGHEST); tempreg, (int) BFD_RELOC_MIPS_HIGHEST);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER); tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER);
macro_build (p, &icnt, NULL, "dsll", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll", "d,w,<",
tempreg, tempreg, 16); tempreg, tempreg, 16);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_HI16_S); tempreg, tempreg, (int) BFD_RELOC_HI16_S);
macro_build (p, &icnt, NULL, "dsll", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll", "d,w,<",
tempreg, tempreg, 16); tempreg, tempreg, 16);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_LO16); tempreg, tempreg, (int) BFD_RELOC_LO16);
@@ -4647,8 +4668,7 @@ macro (ip)
frag_grow (32); frag_grow (32);
if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG) if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG)
lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
macro_build ((char *) NULL, &icnt, &offset_expr, macro_build ((char *) NULL, &icnt, &offset_expr, dbl ? "ld" : "lw",
dbl ? "ld" : "lw",
"t,o(b)", tempreg, lw_reloc_type, GP); "t,o(b)", tempreg, lw_reloc_type, GP);
if (expr1.X_add_number == 0) if (expr1.X_add_number == 0)
{ {
@@ -5428,12 +5448,12 @@ macro (ip)
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER); tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER);
if (breg != 0) if (breg != 0)
macro_build (p, &icnt, NULL, "daddu", "d,v,t", macro_build (p, &icnt, (expressionS *) NULL, "daddu",
AT, AT, breg); "d,v,t", AT, AT, breg);
macro_build (p, &icnt, NULL, "dsll32", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll32",
tempreg, tempreg, 0); "d,w,<", tempreg, tempreg, 0);
macro_build (p, &icnt, NULL, "daddu", "d,v,t", macro_build (p, &icnt, (expressionS *) NULL, "daddu",
tempreg, tempreg, AT); "d,v,t", tempreg, tempreg, AT);
macro_build (p, &icnt, &offset_expr, s, macro_build (p, &icnt, &offset_expr, s,
fmt, treg, (int) BFD_RELOC_LO16, tempreg); fmt, treg, (int) BFD_RELOC_LO16, tempreg);
used_at = 1; used_at = 1;
@@ -5444,15 +5464,15 @@ macro (ip)
tempreg, (int) BFD_RELOC_MIPS_HIGHEST); tempreg, (int) BFD_RELOC_MIPS_HIGHEST);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER); tempreg, tempreg, (int) BFD_RELOC_MIPS_HIGHER);
macro_build (p, &icnt, NULL, "dsll", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll",
tempreg, tempreg, 16); "d,w,<", tempreg, tempreg, 16);
macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j",
tempreg, tempreg, (int) BFD_RELOC_HI16_S); tempreg, tempreg, (int) BFD_RELOC_HI16_S);
macro_build (p, &icnt, NULL, "dsll", "d,w,<", macro_build (p, &icnt, (expressionS *) NULL, "dsll",
tempreg, tempreg, 16); "d,w,<", tempreg, tempreg, 16);
if (breg != 0) if (breg != 0)
macro_build (p, &icnt, NULL, "daddu", "d,v,t", macro_build (p, &icnt, (expressionS *) NULL, "daddu",
tempreg, tempreg, breg); "d,v,t", tempreg, tempreg, breg);
macro_build (p, &icnt, &offset_expr, s, macro_build (p, &icnt, &offset_expr, s,
fmt, treg, (int) BFD_RELOC_LO16, tempreg); fmt, treg, (int) BFD_RELOC_LO16, tempreg);
} }
@@ -6401,10 +6421,10 @@ macro2 (ip)
case M_DMUL: case M_DMUL:
dbl = 1; dbl = 1;
case M_MUL: case M_MUL:
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dmultu" : "multu", dbl ? "dmultu" : "multu", "s,t", sreg, treg);
"s,t", sreg, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "d",
macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); dreg);
return; return;
case M_DMUL_I: case M_DMUL_I:
@@ -6414,9 +6434,10 @@ macro2 (ip)
not trying to be that fancy. GCC should do this for us not trying to be that fancy. GCC should do this for us
anyway. */ anyway. */
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dmult" : "mult", "s,t", sreg, AT); dbl ? "dmult" : "mult", "s,t", sreg, AT);
macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "d",
dreg);
break; break;
case M_DMULO_I: case M_DMULO_I:
@@ -6434,23 +6455,29 @@ macro2 (ip)
mips_any_noreorder = 1; mips_any_noreorder = 1;
if (imm) if (imm)
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dmult" : "mult", "s,t", sreg, imm ? AT : treg); dbl ? "dmult" : "mult", "s,t", sreg, imm ? AT : treg);
macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "d",
macro_build ((char *) NULL, &icnt, NULL, dreg);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dsra32" : "sra", "d,w,<", dreg, dreg, 31); dbl ? "dsra32" : "sra", "d,w,<", dreg, dreg, 31);
macro_build ((char *) NULL, &icnt, NULL, "mfhi", "d", AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mfhi", "d",
AT);
if (mips_trap) if (mips_trap)
macro_build ((char *) NULL, &icnt, NULL, "tne", "s,t", dreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "tne", "s,t",
dreg, AT);
else else
{ {
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "beq", "s,t,p", dreg, AT); macro_build ((char *) NULL, &icnt, &expr1, "beq", "s,t,p", dreg,
macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); AT);
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "",
0);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 6);
} }
--mips_opts.noreorder; --mips_opts.noreorder;
macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "d", dreg);
break; break;
case M_DMULOU_I: case M_DMULOU_I:
@@ -6468,57 +6495,70 @@ macro2 (ip)
mips_any_noreorder = 1; mips_any_noreorder = 1;
if (imm) if (imm)
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dmultu" : "multu", dbl ? "dmultu" : "multu",
"s,t", sreg, imm ? AT : treg); "s,t", sreg, imm ? AT : treg);
macro_build ((char *) NULL, &icnt, NULL, "mfhi", "d", AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mfhi", "d",
macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); AT);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "d",
dreg);
if (mips_trap) if (mips_trap)
macro_build ((char *) NULL, &icnt, NULL, "tne", "s,t", AT, 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "tne", "s,t",
AT, 0);
else else
{ {
expr1.X_add_number = 8; expr1.X_add_number = 8;
macro_build ((char *) NULL, &icnt, &expr1, "beq", "s,t,p", AT, 0); macro_build ((char *) NULL, &icnt, &expr1, "beq", "s,t,p", AT, 0);
macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "",
macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); 0);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"c", 6);
} }
--mips_opts.noreorder; --mips_opts.noreorder;
break; break;
case M_ROL: case M_ROL:
macro_build ((char *) NULL, &icnt, NULL, "subu", "d,v,t", AT, 0, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "subu",
macro_build ((char *) NULL, &icnt, NULL, "srlv", "d,t,s", AT, sreg, AT); "d,v,t", AT, 0, treg);
macro_build ((char *) NULL, &icnt, NULL, "sllv", "d,t,s", dreg, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srlv",
treg); "d,t,s", AT, sreg, AT);
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sllv",
"d,t,s", dreg, sreg, treg);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or",
"d,v,t", dreg, dreg, AT);
break; break;
case M_ROL_I: case M_ROL_I:
if (imm_expr.X_op != O_constant) if (imm_expr.X_op != O_constant)
as_bad (_("rotate count too large")); as_bad (_("rotate count too large"));
macro_build ((char *) NULL, &icnt, NULL, "sll", "d,w,<", AT, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sll", "d,w,<",
(int) (imm_expr.X_add_number & 0x1f)); AT, sreg, (int) (imm_expr.X_add_number & 0x1f));
macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", dreg, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srl", "d,w,<",
(int) ((0 - imm_expr.X_add_number) & 0x1f)); dreg, sreg, (int) ((0 - imm_expr.X_add_number) & 0x1f));
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or", "d,v,t",
dreg, dreg, AT);
break; break;
case M_ROR: case M_ROR:
macro_build ((char *) NULL, &icnt, NULL, "subu", "d,v,t", AT, 0, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "subu",
macro_build ((char *) NULL, &icnt, NULL, "sllv", "d,t,s", AT, sreg, AT); "d,v,t", AT, 0, treg);
macro_build ((char *) NULL, &icnt, NULL, "srlv", "d,t,s", dreg, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sllv",
treg); "d,t,s", AT, sreg, AT);
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srlv",
"d,t,s", dreg, sreg, treg);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or",
"d,v,t", dreg, dreg, AT);
break; break;
case M_ROR_I: case M_ROR_I:
if (imm_expr.X_op != O_constant) if (imm_expr.X_op != O_constant)
as_bad (_("rotate count too large")); as_bad (_("rotate count too large"));
macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", AT, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srl", "d,w,<",
(int) (imm_expr.X_add_number & 0x1f)); AT, sreg, (int) (imm_expr.X_add_number & 0x1f));
macro_build ((char *) NULL, &icnt, NULL, "sll", "d,w,<", dreg, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sll", "d,w,<",
(int) ((0 - imm_expr.X_add_number) & 0x1f)); dreg, sreg, (int) ((0 - imm_expr.X_add_number) & 0x1f));
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or", "d,v,t",
dreg, dreg, AT);
break; break;
case M_S_DOB: case M_S_DOB:
@@ -6548,8 +6588,8 @@ macro2 (ip)
sreg, (int) BFD_RELOC_LO16); sreg, (int) BFD_RELOC_LO16);
else else
{ {
macro_build ((char *) NULL, &icnt, NULL, "xor", "d,v,t", dreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor",
sreg, treg); "d,v,t", dreg, sreg, treg);
macro_build ((char *) NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, macro_build ((char *) NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg,
dreg, (int) BFD_RELOC_LO16); dreg, (int) BFD_RELOC_LO16);
} }
@@ -6591,8 +6631,8 @@ macro2 (ip)
else else
{ {
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, "xor", "d,v,t", dreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor",
sreg, AT); "d,v,t", dreg, sreg, AT);
used_at = 1; used_at = 1;
} }
macro_build ((char *) NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, dreg, macro_build ((char *) NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, dreg,
@@ -6607,7 +6647,8 @@ macro2 (ip)
case M_SGEU: case M_SGEU:
s = "sltu"; s = "sltu";
sge: sge:
macro_build ((char *) NULL, &icnt, NULL, s, "d,v,t", dreg, sreg, treg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t",
dreg, sreg, treg);
macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
return; return;
@@ -6626,9 +6667,9 @@ macro2 (ip)
else else
{ {
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
mask == M_SGE_I ? "slt" : "sltu", mask == M_SGE_I ? "slt" : "sltu", "d,v,t", dreg, sreg,
"d,v,t", dreg, sreg, AT); AT);
used_at = 1; used_at = 1;
} }
macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg,
@@ -6643,7 +6684,8 @@ macro2 (ip)
case M_SGTU: case M_SGTU:
s = "sltu"; s = "sltu";
sgt: sgt:
macro_build ((char *) NULL, &icnt, NULL, s, "d,v,t", dreg, treg, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t",
dreg, treg, sreg);
return; return;
case M_SGT_I: /* sreg > I <==> I < sreg */ case M_SGT_I: /* sreg > I <==> I < sreg */
@@ -6653,28 +6695,31 @@ macro2 (ip)
s = "sltu"; s = "sltu";
sgti: sgti:
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, s, "d,v,t", dreg, AT, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t",
dreg, AT, sreg);
break; break;
case M_SLE: /* sreg <= treg <==> treg >= sreg <==> not (treg < sreg) */ case M_SLE: /* sreg <= treg <==> treg >= sreg <==> not (treg < sreg) */
s = "slt"; s = "slt";
goto sle; goto sle;
case M_SLEU: case M_SLEU:
s = "sltu"; s = "sltu";
sle: sle:
macro_build ((char *) NULL, &icnt, NULL, s, "d,v,t", dreg, treg, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t",
dreg, treg, sreg);
macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
return; return;
case M_SLE_I: /* sreg <= I <==> I >= sreg <==> not (I < sreg) */ case M_SLE_I: /* sreg <= I <==> I >= sreg <==> not (I < sreg) */
s = "slt"; s = "slt";
goto slei; goto slei;
case M_SLEU_I: case M_SLEU_I:
s = "sltu"; s = "sltu";
slei: slei:
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, s, "d,v,t", dreg, AT, sreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t",
dreg, AT, sreg);
macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
break; break;
@@ -6689,7 +6734,8 @@ macro2 (ip)
return; return;
} }
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", dreg, sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t",
dreg, sreg, AT);
break; break;
case M_SLTU_I: case M_SLTU_I:
@@ -6702,31 +6748,31 @@ macro2 (ip)
return; return;
} }
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, sreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
AT); "d,v,t", dreg, sreg, AT);
break; break;
case M_SNE: case M_SNE:
if (sreg == 0) if (sreg == 0)
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
treg); "d,v,t", dreg, 0, treg);
else if (treg == 0) else if (treg == 0)
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
sreg); "d,v,t", dreg, 0, sreg);
else else
{ {
macro_build ((char *) NULL, &icnt, NULL, "xor", "d,v,t", dreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor",
sreg, treg); "d,v,t", dreg, sreg, treg);
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
dreg); "d,v,t", dreg, 0, dreg);
} }
return; return;
case M_SNE_I: case M_SNE_I:
if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0)
{ {
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
sreg); "d,v,t", dreg, 0, sreg);
return; return;
} }
if (sreg == 0) if (sreg == 0)
@@ -6759,11 +6805,12 @@ macro2 (ip)
else else
{ {
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, "xor", "d,v,t", dreg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor",
sreg, AT); "d,v,t", dreg, sreg, AT);
used_at = 1; used_at = 1;
} }
macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, dreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu",
"d,v,t", dreg, 0, dreg);
if (used_at) if (used_at)
break; break;
return; return;
@@ -6782,7 +6829,7 @@ macro2 (ip)
return; return;
} }
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dsub" : "sub", "d,v,t", dreg, sreg, AT); dbl ? "dsub" : "sub", "d,v,t", dreg, sreg, AT);
break; break;
@@ -6800,7 +6847,7 @@ macro2 (ip)
return; return;
} }
load_register (&icnt, AT, &imm_expr, dbl); load_register (&icnt, AT, &imm_expr, dbl);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dsubu" : "subu", "d,v,t", dreg, sreg, AT); dbl ? "dsubu" : "subu", "d,v,t", dreg, sreg, AT);
break; break;
@@ -6823,7 +6870,8 @@ macro2 (ip)
s = "tne"; s = "tne";
trap: trap:
load_register (&icnt, AT, &imm_expr, 0); load_register (&icnt, AT, &imm_expr, 0);
macro_build ((char *) NULL, &icnt, NULL, s, "s,t", sreg, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "s,t", sreg,
AT);
break; break;
case M_TRUNCWS: case M_TRUNCWS:
@@ -6839,21 +6887,25 @@ macro2 (ip)
mips_emit_delays (true); mips_emit_delays (true);
++mips_opts.noreorder; ++mips_opts.noreorder;
mips_any_noreorder = 1; mips_any_noreorder = 1;
macro_build ((char *) NULL, &icnt, NULL, "cfc1", "t,G", treg, 31); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "cfc1", "t,G",
macro_build ((char *) NULL, &icnt, NULL, "cfc1", "t,G", treg, 31); treg, 31);
macro_build ((char *) NULL, &icnt, NULL, "nop", ""); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "cfc1", "t,G",
treg, 31);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
expr1.X_add_number = 3; expr1.X_add_number = 3;
macro_build ((char *) NULL, &icnt, &expr1, "ori", "t,r,i", AT, treg, macro_build ((char *) NULL, &icnt, &expr1, "ori", "t,r,i", AT, treg,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
expr1.X_add_number = 2; expr1.X_add_number = 2;
macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", AT, AT, macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", AT, AT,
(int) BFD_RELOC_LO16); (int) BFD_RELOC_LO16);
macro_build ((char *) NULL, &icnt, NULL, "ctc1", "t,G", AT, 31); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "ctc1", "t,G",
macro_build ((char *) NULL, &icnt, NULL, "nop", ""); AT, 31);
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
mask == M_TRUNCWD ? "cvt.w.d" : "cvt.w.s", "D,S", dreg, sreg); mask == M_TRUNCWD ? "cvt.w.d" : "cvt.w.s", "D,S", dreg, sreg);
macro_build ((char *) NULL, &icnt, NULL, "ctc1", "t,G", treg, 31); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "ctc1", "t,G",
macro_build ((char *) NULL, &icnt, NULL, "nop", ""); treg, 31);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
--mips_opts.noreorder; --mips_opts.noreorder;
break; break;
@@ -6876,8 +6928,10 @@ macro2 (ip)
offset_expr.X_add_number += 1; offset_expr.X_add_number += 1;
macro_build ((char *) NULL, &icnt, &offset_expr, "lbu", "t,o(b)", AT, macro_build ((char *) NULL, &icnt, &offset_expr, "lbu", "t,o(b)", AT,
(int) BFD_RELOC_LO16, breg); (int) BFD_RELOC_LO16, breg);
macro_build ((char *) NULL, &icnt, NULL, "sll", "d,w,<", treg, treg, 8); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sll", "d,w,<",
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", treg, treg, AT); treg, treg, 8);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or", "d,v,t",
treg, treg, AT);
break; break;
case M_ULD: case M_ULD:
@@ -6953,10 +7007,10 @@ macro2 (ip)
expr1.X_add_number = 0; expr1.X_add_number = 0;
macro_build ((char *) NULL, &icnt, &expr1, "lbu", "t,o(b)", AT, macro_build ((char *) NULL, &icnt, &expr1, "lbu", "t,o(b)", AT,
(int) BFD_RELOC_LO16, AT); (int) BFD_RELOC_LO16, AT);
macro_build ((char *) NULL, &icnt, NULL, "sll", "d,w,<", treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sll", "d,w,<",
treg, 8); treg, treg, 8);
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or", "d,v,t",
treg, AT); treg, treg, AT);
break; break;
case M_USH: case M_USH:
@@ -6966,7 +7020,8 @@ macro2 (ip)
offset_expr.X_add_number += 1; offset_expr.X_add_number += 1;
macro_build ((char *) NULL, &icnt, &offset_expr, "sb", "t,o(b)", treg, macro_build ((char *) NULL, &icnt, &offset_expr, "sb", "t,o(b)", treg,
(int) BFD_RELOC_LO16, breg); (int) BFD_RELOC_LO16, breg);
macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", AT, treg, 8); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srl", "d,w,<",
AT, treg, 8);
if (target_big_endian) if (target_big_endian)
offset_expr.X_add_number -= 1; offset_expr.X_add_number -= 1;
else else
@@ -7040,8 +7095,8 @@ macro2 (ip)
expr1.X_add_number = 0; expr1.X_add_number = 0;
macro_build ((char *) NULL, &icnt, &expr1, "sb", "t,o(b)", treg, macro_build ((char *) NULL, &icnt, &expr1, "sb", "t,o(b)", treg,
(int) BFD_RELOC_LO16, AT); (int) BFD_RELOC_LO16, AT);
macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "srl", "d,w,<",
treg, 8); treg, treg, 8);
if (! target_big_endian) if (! target_big_endian)
expr1.X_add_number = 1; expr1.X_add_number = 1;
else else
@@ -7054,10 +7109,10 @@ macro2 (ip)
expr1.X_add_number = 1; expr1.X_add_number = 1;
macro_build ((char *) NULL, &icnt, &expr1, "lbu", "t,o(b)", AT, macro_build ((char *) NULL, &icnt, &expr1, "lbu", "t,o(b)", AT,
(int) BFD_RELOC_LO16, AT); (int) BFD_RELOC_LO16, AT);
macro_build ((char *) NULL, &icnt, NULL, "sll", "d,w,<", treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sll", "d,w,<",
treg, 8); treg, treg, 8);
macro_build ((char *) NULL, &icnt, NULL, "or", "d,v,t", treg, macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "or", "d,v,t",
treg, AT); treg, treg, AT);
break; break;
default: default:
@@ -7116,19 +7171,20 @@ mips16_macro (ip)
mips_emit_delays (true); mips_emit_delays (true);
++mips_opts.noreorder; ++mips_opts.noreorder;
mips_any_noreorder = 1; mips_any_noreorder = 1;
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "ddiv" : "div", dbl ? "ddiv" : "div",
"0,x,y", xreg, yreg); "0,x,y", xreg, yreg);
expr1.X_add_number = 2; expr1.X_add_number = 2;
macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg); macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg);
macro_build ((char *) NULL, &icnt, NULL, "break", "6", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break", "6",
7);
/* FIXME: The normal code checks for of -1 / -0x80000000 here, /* FIXME: The normal code checks for of -1 / -0x80000000 here,
since that causes an overflow. We should do that as well, since that causes an overflow. We should do that as well,
but I don't see how to do the comparisons without a temporary but I don't see how to do the comparisons without a temporary
register. */ register. */
--mips_opts.noreorder; --mips_opts.noreorder;
macro_build ((char *) NULL, &icnt, NULL, s, "x", zreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "x", zreg);
break; break;
case M_DIVU_3: case M_DIVU_3:
@@ -7150,20 +7206,23 @@ mips16_macro (ip)
mips_emit_delays (true); mips_emit_delays (true);
++mips_opts.noreorder; ++mips_opts.noreorder;
mips_any_noreorder = 1; mips_any_noreorder = 1;
macro_build ((char *) NULL, &icnt, NULL, s, "0,x,y", xreg, yreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "0,x,y",
xreg, yreg);
expr1.X_add_number = 2; expr1.X_add_number = 2;
macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg); macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg);
macro_build ((char *) NULL, &icnt, NULL, "break", "6", 7); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "break",
"6", 7);
--mips_opts.noreorder; --mips_opts.noreorder;
macro_build ((char *) NULL, &icnt, NULL, s2, "x", zreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s2, "x", zreg);
break; break;
case M_DMUL: case M_DMUL:
dbl = 1; dbl = 1;
case M_MUL: case M_MUL:
macro_build ((char *) NULL, &icnt, NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
dbl ? "dmultu" : "multu", "x,y", xreg, yreg); dbl ? "dmultu" : "multu", "x,y", xreg, yreg);
macro_build ((char *) NULL, &icnt, NULL, "mflo", "x", zreg); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "mflo", "x",
zreg);
return; return;
case M_DSUBU_I: case M_DSUBU_I: