From 842f8b2a1e0780823528556046919173a9a8db57 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 9 Dec 2010 23:33:24 +0000 Subject: gas/ * config/tc-mips.c (macro) : Don't load a zero into an auxiliary register when using a signed 16-bit constant offset. gas/testsuite/ * gas/mips/ldstla-32.d: Update according to a 16-bit constant offset optimization. * gas/mips/ldstla-32-mips3.d: Likewise. * gas/mips/ldstla-32-shared.d: Likewise. * gas/mips/ldstla-32-mips3-shared.d: Likewise. --- gas/config/tc-mips.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'gas/config') diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index b664585..eb1ba2e 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -6565,14 +6565,19 @@ macro (struct mips_cl_insn *ip) is in non PIC code. */ if (offset_expr.X_op == O_constant) { - expr1.X_add_number = ((offset_expr.X_add_number + 0x8000) - & ~(bfd_vma) 0xffff); + expr1.X_add_number = offset_expr.X_add_number; normalize_address_expr (&expr1); - load_register (tempreg, &expr1, HAVE_64BIT_ADDRESSES); - if (breg != 0) - macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", - tempreg, tempreg, breg); - macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, tempreg); + if (!IS_SEXT_16BIT_NUM (expr1.X_add_number)) + { + expr1.X_add_number = ((expr1.X_add_number + 0x8000) + & ~(bfd_vma) 0xffff); + load_register (tempreg, &expr1, HAVE_64BIT_ADDRESSES); + if (breg != 0) + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", + tempreg, tempreg, breg); + breg = tempreg; + } + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, breg); } else if (mips_pic == NO_PIC) { -- cgit v1.1