summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 13:41:38 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 13:41:38 +0000
commit2a33161dade1a9b493ed07265861620dc3c82c94 (patch)
tree739d354e74f2c75e38b0fcff7be1faa168423800 /gcc
parent88eaee2d9e837474fca5895d712c4958305ca3f5 (diff)
downloadgcc-2a33161dade1a9b493ed07265861620dc3c82c94.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107602 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/fp-bit.c17
-rw-r--r--gcc/config/fp-bit.h2
3 files changed, 16 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aaed30c8290..2320e10de95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/fp-bit.c b/gcc/config/fp-bit.c
index ccf927e8c3b..cf943daed91 100644
--- a/gcc/config/fp-bit.c
+++ b/gcc/config/fp-bit.c
@@ -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;
diff --git a/gcc/config/fp-bit.h b/gcc/config/fp-bit.h
index 3f7a0dfb315..78d850b5d03 100644
--- a/gcc/config/fp-bit.h
+++ b/gcc/config/fp-bit.h
@@ -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