diff options
author | Chris Demetriou <cgd@google.com> | 2002-02-08 22:25:36 +0000 |
---|---|---|
committer | Chris Demetriou <cgd@google.com> | 2002-02-08 22:25:36 +0000 |
commit | 6373ee54794c803d6aff85427fdeb4c2d009b900 (patch) | |
tree | 6998449edeec3fe23dc3264707f84fbfa8b61411 | |
parent | f687139811c1f208969069d0aa030b63641b8119 (diff) | |
download | gdb-6373ee54794c803d6aff85427fdeb4c2d009b900.zip gdb-6373ee54794c803d6aff85427fdeb4c2d009b900.tar.gz gdb-6373ee54794c803d6aff85427fdeb4c2d009b900.tar.bz2 |
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.
-rw-r--r-- | gas/ChangeLog | 9 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 20 |
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; |