aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-mips.c20
2 files changed, 25 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2daf90f..c2ea1d9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2002-02-08 Chris Demetriou <cgd@broadcom.com>
+
+ * config/tc-mips.c (IS_SEXT_32BIT_NUM): New macro to
+ determine if a number is a sign-extended 32-bit number.
+ (load_register): Use IS_SEXT_32BIT_NUM.
+ (macro): Check if load/store macro handling is using a
+ constant 32-bit address on 64-bit address systems, and if
+ so optimize the generation of that address.
+
2002-02-08 Richard Henderson <rth@redhat.com>
* config/tc-alpha.c (alpha_force_relocation): Don't assert that
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 0da9b8b..d64d4eb 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3353,6 +3353,11 @@ check_absolute_expr (ip, ex)
? 1 \
: 0)
+/* Is the given value a sign-extended 32-bit value? */
+#define IS_SEXT_32BIT_NUM(x) \
+ (((x) &~ (offsetT) 0x7fffffff) == 0 \
+ || (((x) &~ (offsetT) 0x7fffffff) == ~ (offsetT) 0x7fffffff))
+
/* load_register()
* This routine generates the least number of instructions neccessary to load
* an absolute expression value into a register.
@@ -3392,9 +3397,7 @@ load_register (counter, reg, ep, dbl)
(int) BFD_RELOC_LO16);
return;
}
- else if ((((ep->X_add_number &~ (offsetT) 0x7fffffff) == 0
- || ((ep->X_add_number &~ (offsetT) 0x7fffffff)
- == ~ (offsetT) 0x7fffffff))
+ else if ((IS_SEXT_32BIT_NUM (ep->X_add_number)
&& (! dbl
|| ! ep->X_unsigned
|| sizeof (ep->X_add_number) > 4
@@ -5544,8 +5547,17 @@ macro (ip)
dsll $tempreg,16
daddu $tempreg,$tempreg,$breg
<op> $treg,<sym>($tempreg) (BFD_RELOC_LO16)
+
+ If we have 64-bit addresses, as an optimization, for
+ addresses which are 32-bit constants (e.g. kseg0/kseg1
+ addresses) we fall back to the 32-bit address generation
+ mechanism since it is more efficient. This code should
+ probably attempt to generate 64-bit constants more
+ efficiently in general.
*/
- if (HAVE_64BIT_ADDRESSES)
+ if (HAVE_64BIT_ADDRESSES
+ && !(offset_expr.X_op == O_constant
+ && IS_SEXT_32BIT_NUM (offset_expr.X_add_number)))
{
p = NULL;