OSDN Git Service

2002-02-08 Chris Demetriou <cgd@broadcom.com>
authorChris Demetriou <cgd@broadcom.com>
Fri, 8 Feb 2002 22:25:36 +0000 (22:25 +0000)
committerChris Demetriou <cgd@broadcom.com>
Fri, 8 Feb 2002 22:25:36 +0000 (22:25 +0000)
        * 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.

gas/ChangeLog
gas/config/tc-mips.c

index 2daf90f..c2ea1d9 100644 (file)
@@ -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
index 0da9b8b..d64d4eb 100644 (file)
@@ -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;