]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000.c (output_mi_thunk): Don't determine insns for loading delta with num_insns_co...
authorAlan Modra <amodra@bigpond.net.au>
Fri, 23 Aug 2002 01:18:06 +0000 (01:18 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 23 Aug 2002 01:18:06 +0000 (10:48 +0930)
* config/rs6000/rs6000.c (output_mi_thunk): Don't determine insns
for loading delta with num_insns_constant_wide.  Calculate
delta_low, delta_high without using a conditional.

From-SVN: r56525

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index b7464afe12247981cb67928e55a3107a217b3f5c..ac7f67c7990559c3a8b55db3c7954dd5377cec21 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-23  Alan Modra  <amodra@bigpond.net.au>
+
+       * config/rs6000/rs6000.c (output_mi_thunk): Don't determine insns
+       for loading delta with num_insns_constant_wide.  Calculate
+       delta_low, delta_high without using a conditional.
+
 2002-08-22  Jason Merrill  <jason@redhat.com>
 
        * c-common.h (RETURN_STMT_EXPR): Rename from RETURN_EXPR.
index 4becedd80d965975da7e339cb4f0e2587e3debf1..3ea15aae36797d71b5b0adb69f4560d144507c3e 100644 (file)
@@ -11271,23 +11271,22 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
        fprintf (file, "\taddi %s,%s,%d\n", this_reg, this_reg, delta);
     }
 
+  /* 64-bit constants.  If "int" is 32 bits, we'll never hit this abort.  */
+  else if (TARGET_64BIT && (delta < -2147483647 - 1 || delta > 2147483647))
+    abort ();
+
   /* Large constants that can be done by one addis instruction.  */
-  else if ((delta & 0xffff) == 0 && num_insns_constant_wide (delta) == 1)
+  else if ((delta & 0xffff) == 0)
     asm_fprintf (file, "\t{cau|addis} %s,%s,%d\n", this_reg, this_reg,
                 delta >> 16);
 
   /* 32-bit constants that can be done by an add and addis instruction.  */
-  else if (TARGET_32BIT || num_insns_constant_wide (delta) == 1)
+  else
     {
       /* Break into two pieces, propagating the sign bit from the low
         word to the upper word.  */
-      int delta_high = delta >> 16;
-      int delta_low  = delta & 0xffff;
-      if ((delta_low & 0x8000) != 0)
-       {
-         delta_high++;
-         delta_low = (delta_low ^ 0x8000) - 0x8000;    /* sign extend */
-       }
+      int delta_low  = ((delta & 0xffff) ^ 0x8000) - 0x8000;
+      int delta_high = (delta - delta_low) >> 16;
 
       asm_fprintf (file, "\t{cau|addis} %s,%s,%d\n", this_reg, this_reg,
                   delta_high);
@@ -11298,10 +11297,6 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
        fprintf (file, "\taddi %s,%s,%d\n", this_reg, this_reg, delta_low);
     }
 
-  /* 64-bit constants, fixme */
-  else
-    abort ();
-
   /* Get the prefix in front of the names.  */
   switch (DEFAULT_ABI)
     {