From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Richard Sandiford <rdsandiford@googlemail.com>
Cc: Catherine Moore <clm@codesourcery.com>, binutils@sourceware.org
Subject: [PATCH 04/20] MIPS/GAS: Spell out 0 referring to $0 as ZERO
Date: Thu, 02 Dec 2010 19:18:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.10.1012012308500.14129@tp.orcam.me.uk> (raw)
Hi,
Here is a (supposedly) exhaustive change to macro() that makes $0
register references in macro_build() and move_register() calls to be
spelled as ZERO for better clarity and difference to places where an
immediate value of 0 is referred to. I have not changed other places,
typically pieces of code like:
treg = 0;
or:
if (sreg == 0)
whose reference to $0 is obvious.
2010-12-02 Maciej W. Rozycki <macro@codesourcery.com>
gas/
* config/tc-mips.c (macro): Replace 0 with ZERO in macro_build
and move_register calls referring to $0.
OK to apply?
Maciej
binutils-gas-mips-zero.diff
Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c 2010-12-01 21:05:49.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c 2010-12-01 21:05:49.000000000 +0000
@@ -4960,7 +4960,7 @@ macro (struct mips_cl_insn *ip)
beq_i:
if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0)
{
- macro_build (&offset_expr, s, "s,t,p", sreg, 0);
+ macro_build (&offset_expr, s, "s,t,p", sreg, ZERO);
break;
}
used_at = 1;
@@ -4983,7 +4983,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
macro_build (NULL, "slt", "d,v,t", AT, sreg, treg);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BGTL_I:
@@ -5007,7 +5007,7 @@ macro (struct mips_cl_insn *ip)
if (! likely)
macro_build (NULL, "nop", "", 0);
else
- macro_build (&offset_expr, "bnel", "s,t,p", 0, 0);
+ macro_build (&offset_expr, "bnel", "s,t,p", ZERO, ZERO);
break;
}
if (imm_expr.X_op != O_constant)
@@ -5049,7 +5049,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
set_at (sreg, 0);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BGEUL:
@@ -5060,12 +5060,12 @@ macro (struct mips_cl_insn *ip)
if (sreg == 0)
{
macro_build (&offset_expr, likely ? "beql" : "beq",
- "s,t,p", 0, treg);
+ "s,t,p", ZERO, treg);
break;
}
used_at = 1;
macro_build (NULL, "sltu", "d,v,t", AT, sreg, treg);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BGTUL_I:
@@ -5089,12 +5089,12 @@ macro (struct mips_cl_insn *ip)
if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
{
macro_build (&offset_expr, likely ? "bnel" : "bne",
- "s,t,p", sreg, 0);
+ "s,t,p", sreg, ZERO);
break;
}
used_at = 1;
set_at (sreg, 1);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BGTL:
@@ -5112,7 +5112,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
macro_build (NULL, "slt", "d,v,t", AT, treg, sreg);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_BGTUL:
@@ -5121,14 +5121,14 @@ macro (struct mips_cl_insn *ip)
if (treg == 0)
{
macro_build (&offset_expr, likely ? "bnel" : "bne",
- "s,t,p", sreg, 0);
+ "s,t,p", sreg, ZERO);
break;
}
if (sreg == 0)
goto do_false;
used_at = 1;
macro_build (NULL, "sltu", "d,v,t", AT, treg, sreg);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_BLEL:
@@ -5146,7 +5146,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
macro_build (NULL, "slt", "d,v,t", AT, treg, sreg);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BLEL_I:
@@ -5184,7 +5184,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
set_at (sreg, 0);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_BLEUL:
@@ -5193,14 +5193,14 @@ macro (struct mips_cl_insn *ip)
if (treg == 0)
{
macro_build (&offset_expr, likely ? "beql" : "beq",
- "s,t,p", sreg, 0);
+ "s,t,p", sreg, ZERO);
break;
}
if (sreg == 0)
goto do_true;
used_at = 1;
macro_build (NULL, "sltu", "d,v,t", AT, treg, sreg);
- macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, ZERO);
break;
case M_BLEUL_I:
@@ -5224,12 +5224,12 @@ macro (struct mips_cl_insn *ip)
if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
{
macro_build (&offset_expr, likely ? "beql" : "beq",
- "s,t,p", sreg, 0);
+ "s,t,p", sreg, ZERO);
break;
}
used_at = 1;
set_at (sreg, 1);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_BLTL:
@@ -5247,7 +5247,7 @@ macro (struct mips_cl_insn *ip)
}
used_at = 1;
macro_build (NULL, "slt", "d,v,t", AT, sreg, treg);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_BLTUL:
@@ -5258,12 +5258,12 @@ macro (struct mips_cl_insn *ip)
if (sreg == 0)
{
macro_build (&offset_expr, likely ? "bnel" : "bne",
- "s,t,p", 0, treg);
+ "s,t,p", ZERO, treg);
break;
}
used_at = 1;
macro_build (NULL, "sltu", "d,v,t", AT, sreg, treg);
- macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0);
+ macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, ZERO);
break;
case M_DEXT:
@@ -5375,7 +5375,7 @@ macro (struct mips_cl_insn *ip)
{
as_warn (_("Divide by zero."));
if (mips_trap)
- macro_build (NULL, "teq", "s,t,q", 0, 0, 7);
+ macro_build (NULL, "teq", "s,t,q", ZERO, ZERO, 7);
else
macro_build (NULL, "break", "c", 7);
break;
@@ -5384,13 +5384,13 @@ macro (struct mips_cl_insn *ip)
start_noreorder ();
if (mips_trap)
{
- macro_build (NULL, "teq", "s,t,q", treg, 0, 7);
+ macro_build (NULL, "teq", "s,t,q", treg, ZERO, 7);
macro_build (NULL, dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
}
else
{
expr1.X_add_number = 8;
- macro_build (&expr1, "bne", "s,t,p", treg, 0);
+ macro_build (&expr1, "bne", "s,t,p", treg, ZERO);
macro_build (NULL, dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
macro_build (NULL, "break", "c", 7);
}
@@ -5472,7 +5472,7 @@ macro (struct mips_cl_insn *ip)
{
as_warn (_("Divide by zero."));
if (mips_trap)
- macro_build (NULL, "teq", "s,t,q", 0, 0, 7);
+ macro_build (NULL, "teq", "s,t,q", ZERO, ZERO, 7);
else
macro_build (NULL, "break", "c", 7);
break;
@@ -5482,7 +5482,7 @@ macro (struct mips_cl_insn *ip)
if (strcmp (s2, "mflo") == 0)
move_register (dreg, sreg);
else
- move_register (dreg, 0);
+ move_register (dreg, ZERO);
break;
}
if (imm_expr.X_op == O_constant
@@ -5494,7 +5494,7 @@ macro (struct mips_cl_insn *ip)
macro_build (NULL, dbl ? "dneg" : "neg", "d,w", dreg, sreg);
}
else
- move_register (dreg, 0);
+ move_register (dreg, ZERO);
break;
}
@@ -5523,7 +5523,7 @@ macro (struct mips_cl_insn *ip)
start_noreorder ();
if (mips_trap)
{
- macro_build (NULL, "teq", "s,t,q", treg, 0, 7);
+ macro_build (NULL, "teq", "s,t,q", treg, ZERO, 7);
macro_build (NULL, s, "z,s,t", sreg, treg);
/* We want to close the noreorder block as soon as possible, so
that later insns are available for delay slot filling. */
@@ -5532,7 +5532,7 @@ macro (struct mips_cl_insn *ip)
else
{
expr1.X_add_number = 8;
- macro_build (&expr1, "bne", "s,t,p", treg, 0);
+ macro_build (&expr1, "bne", "s,t,p", treg, ZERO);
macro_build (NULL, s, "z,s,t", sreg, treg);
/* We want to close the noreorder block as soon as possible, so
@@ -7476,11 +7476,11 @@ macro (struct mips_cl_insn *ip)
macro_build (NULL, "mfhi", "d", AT);
macro_build (NULL, "mflo", "d", dreg);
if (mips_trap)
- macro_build (NULL, "tne", "s,t,q", AT, 0, 6);
+ macro_build (NULL, "tne", "s,t,q", AT, ZERO, 6);
else
{
expr1.X_add_number = 8;
- macro_build (&expr1, "beq", "s,t,p", AT, 0);
+ macro_build (&expr1, "beq", "s,t,p", AT, ZERO);
macro_build (NULL, "nop", "", 0);
macro_build (NULL, "break", "c", 6);
}
@@ -7504,7 +7504,7 @@ macro (struct mips_cl_insn *ip)
break;
}
used_at = 1;
- macro_build (NULL, "dsubu", "d,v,t", AT, 0, treg);
+ macro_build (NULL, "dsubu", "d,v,t", AT, ZERO, treg);
macro_build (NULL, "dsrlv", "d,t,s", AT, sreg, AT);
macro_build (NULL, "dsllv", "d,t,s", dreg, sreg, treg);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
@@ -7527,7 +7527,7 @@ macro (struct mips_cl_insn *ip)
break;
}
used_at = 1;
- macro_build (NULL, "subu", "d,v,t", AT, 0, treg);
+ macro_build (NULL, "subu", "d,v,t", AT, ZERO, treg);
macro_build (NULL, "srlv", "d,t,s", AT, sreg, AT);
macro_build (NULL, "sllv", "d,t,s", dreg, sreg, treg);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
@@ -7597,7 +7597,7 @@ macro (struct mips_cl_insn *ip)
break;
}
used_at = 1;
- macro_build (NULL, "dsubu", "d,v,t", AT, 0, treg);
+ macro_build (NULL, "dsubu", "d,v,t", AT, ZERO, treg);
macro_build (NULL, "dsllv", "d,t,s", AT, sreg, AT);
macro_build (NULL, "dsrlv", "d,t,s", dreg, sreg, treg);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
@@ -7610,7 +7610,7 @@ macro (struct mips_cl_insn *ip)
break;
}
used_at = 1;
- macro_build (NULL, "subu", "d,v,t", AT, 0, treg);
+ macro_build (NULL, "subu", "d,v,t", AT, ZERO, treg);
macro_build (NULL, "sllv", "d,t,s", AT, sreg, AT);
macro_build (NULL, "srlv", "d,t,s", dreg, sreg, treg);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
next reply other threads:[~2010-12-02 19:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 19:18 Maciej W. Rozycki [this message]
2010-12-02 19:19 ` Paul Koning
2010-12-02 23:57 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.10.1012012308500.14129@tp.orcam.me.uk \
--to=macro@codesourcery.com \
--cc=binutils@sourceware.org \
--cc=clm@codesourcery.com \
--cc=rdsandiford@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).