[PATCH] MIPS gas: Fix macro expansions for .set noat
Maciej W. Rozycki
macro@linux-mips.org
Thu Feb 17 00:25:00 GMT 2005
On Wed, 16 Feb 2005, Thiemo Seufer wrote:
> @@ -5762,11 +5761,19 @@ macro (struct mips_cl_insn *ip)
> case M_LWU_AB:
> s = "lwu";
> ld:
> - if (breg == treg || coproc || lr)
> + /* XXX Why don't we try to use AT for all expansions? */
Because we don't have to and it helps in cases like:
.set noat
ld k0,foo
> + if (!mips_opts.noat && (breg == treg || coproc || lr))
> {
> tempreg = AT;
> used_at = 1;
> }
> + else if (breg == treg
> + && (offset_expr.X_op != O_constant
> + || (offset_expr.X_add_number > 0x7fff
> + || offset_expr.X_add_number < -0x8000)))
> + {
> + as_bad(_("load expansion needs $at register"));
> + }
> else
> {
> tempreg = treg;
This looks broken -- you can only use treg as a scratch pad if it's a
GPR.
> @@ -5840,8 +5847,23 @@ macro (struct mips_cl_insn *ip)
> case M_SDR_AB:
> s = "sdr";
> st:
> - tempreg = AT;
> - used_at = 1;
> + if (!mips_opts.noat)
> + {
> + tempreg = AT;
> + used_at = 1;
> + }
> + else if (breg == treg
> + && (offset_expr.X_op != O_constant
> + || (offset_expr.X_add_number > 0x7fff
> + || offset_expr.X_add_number < -0x8000)))
> + {
> + as_bad(_("store expansion needs $at register"));
> + }
> + else
> + {
> + tempreg = treg;
> + used_at = 0;
> + }
> ld_st:
> /* Itbl support may require additional care here. */
> if (mask == M_LWC1_AB
This is yet more broken -- treg can never be used, because it contains
the value to be stored! And of course it's not expected to get trashed
anyway.
Maciej
More information about the Binutils
mailing list