]> gcc.gnu.org Git - gcc.git/commitdiff
fp-bit.h (LSHIFT): Take shift count parameter.
authorJoseph Myers <joseph@codesourcery.com>
Mon, 28 Nov 2005 13:41:38 +0000 (13:41 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Mon, 28 Nov 2005 13:41:38 +0000 (13:41 +0000)
* config/fp-bit.h (LSHIFT): Take shift count parameter.
* config/fp-bit.c (_fpadd_parts): Shift in one go instead of one
bit at a time.

From-SVN: r107602

gcc/ChangeLog
gcc/config/fp-bit.c
gcc/config/fp-bit.h

index aaed30c82903a780e1cfeaf2905ef8d9c4abd64e..2320e10de95965a5cd98cdb7dfce1f1ed1ce7ce7 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-28  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * config/fp-bit.h (LSHIFT): Take shift count parameter.
+       * config/fp-bit.c (_fpadd_parts): Shift in one go instead of one
+       bit at a time.
+
 2005-11-28  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/bfin.c (bfin_secondary_reload): Renamed from
index ccf927e8c3bc667980f7f208d50f5dd7417d6081..cf943daed91c5ebdb3124e5382cd6ca7cc5d3b2c 100644 (file)
@@ -649,6 +649,7 @@ _fpadd_parts (fp_number_type * a,
      they're the same */
   {
     int diff;
+    int sdiff;
 
     a_normal_exp = a->normal_exp;
     b_normal_exp = b->normal_exp;
@@ -656,21 +657,21 @@ _fpadd_parts (fp_number_type * a,
     b_fraction = b->fraction.ll;
 
     diff = a_normal_exp - b_normal_exp;
+    sdiff = diff;
 
     if (diff < 0)
       diff = -diff;
     if (diff < FRAC_NBITS)
       {
-       /* ??? This does shifts one bit at a time.  Optimize.  */
-       while (a_normal_exp > b_normal_exp)
+       if (sdiff > 0)
          {
-           b_normal_exp++;
-           LSHIFT (b_fraction);
+           b_normal_exp += diff;
+           LSHIFT (b_fraction, diff);
          }
-       while (b_normal_exp > a_normal_exp)
+       else if (sdiff < 0)
          {
-           a_normal_exp++;
-           LSHIFT (a_fraction);
+           a_normal_exp += diff;
+           LSHIFT (a_fraction, diff);
          }
       }
     else
@@ -731,7 +732,7 @@ _fpadd_parts (fp_number_type * a,
 
   if (tmp->fraction.ll >= IMPLICIT_2)
     {
-      LSHIFT (tmp->fraction.ll);
+      LSHIFT (tmp->fraction.ll, 1);
       tmp->normal_exp++;
     }
   return tmp;
index 3f7a0dfb3156fd9b1ec9f1bd4168830fe5236354..78d850b5d0374a4d80dbe1e1737c0cd11a292758 100644 (file)
@@ -318,7 +318,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
 #endif
 
 /* Preserve the sticky-bit when shifting fractions to the right.  */
-#define LSHIFT(a) { a = (a & 1) | (a >> 1); }
+#define LSHIFT(a, s) { a = (a >> s) | !!(a & (((fractype) 1 << s) - 1)); }
 
 /* numeric parameters */
 /* F_D_BITOFF is the number of bits offset between the MSB of the mantissa
This page took 0.075908 seconds and 5 git commands to generate.