soft-fp quad.h patch

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

soft-fp quad.h patch

Joseph Myers
This patch fixes soft-fp's quad.h for the case where two unsigned long
long words are being used but unsigned long is only 32 bits (as in MIPS64
N32).  (This is needed for a separate patch I'll send to libc-ports to
implement sqrtl for MIPS64.  It would probably be safe to change all such
bit-fields to _FP_W_TYPE but only these ones need changing for this
particular use and I haven't tested changing the others.)

2006-06-07  Joseph Myers  <[hidden email]>

        * soft-fp/quad.h (_FP_UNION_Q): Use _FP_W_TYPE for frac
        bit-fields.

Index: soft-fp/quad.h
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/quad.h,v
retrieving revision 1.8
diff -u -r1.8 quad.h
--- soft-fp/quad.h 4 Apr 2006 08:24:47 -0000 1.8
+++ soft-fp/quad.h 7 Jun 2006 11:01:10 -0000
@@ -178,11 +178,11 @@
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign  : 1;
     unsigned exp   : _FP_EXPBITS_Q;
-    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
-    unsigned long frac0 : _FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
 #else
-    unsigned long frac0 : _FP_W_TYPE_SIZE;
-    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
     unsigned exp   : _FP_EXPBITS_Q;
     unsigned sign  : 1;
 #endif

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Ping Re: soft-fp quad.h patch

Joseph Myers
Ping.  Could someone review this patch for bug 2831
<http://sourceware.org/ml/libc-alpha/2006-06/msg00011.html>?  Jakub, you
reviewed the last soft-fp patches to go in.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Ping Re: soft-fp quad.h patch

Jakub Jelinek
On Sun, Mar 18, 2007 at 08:56:15PM +0000, Joseph S. Myers wrote:
> Ping.  Could someone review this patch for bug 2831
> <http://sourceware.org/ml/libc-alpha/2006-06/msg00011.html>?  Jakub, you
> reviewed the last soft-fp patches to go in.

Is there any reason why you want unsigned long long FP_W_TYPE rather than
just unsigned long?

If yes, then your patch is certainly not sufficient:
grep -w long soft-fp/*.h
soft-fp/double.h:    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
soft-fp/double.h:    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
soft-fp/extended.h:      unsigned long pad1 : _FP_W_TYPE_SIZE;
soft-fp/extended.h:      unsigned long pad2 : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
soft-fp/extended.h:      unsigned long sign : 1;
soft-fp/extended.h:      unsigned long exp : _FP_EXPBITS_E;
soft-fp/extended.h:      unsigned long frac1 : _FP_W_TYPE_SIZE;
soft-fp/extended.h:      unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/extended.h:      unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/extended.h:      unsigned long frac1 : _FP_W_TYPE_SIZE;
soft-fp/extended.h:    unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
soft-fp/extended.h:    unsigned long frac : _FP_W_TYPE_SIZE;
soft-fp/extended.h:    unsigned long frac : _FP_W_TYPE_SIZE;
soft-fp/op-2.h:    _e240 = (double)(long)(X##_f0 & 0xffffff);                                   \
soft-fp/op-2.h:    _j240 = (double)(long)(Y##_f0 & 0xffffff);                                   \
soft-fp/op-2.h:    _d240 = (double)(long)((X##_f0 >> 24) & 0xffffff);                           \
soft-fp/op-2.h:    _i240 = (double)(long)((Y##_f0 >> 24) & 0xffffff);                           \
soft-fp/op-2.h:    _c240 = (double)(long)(((X##_f1 << 16) & 0xffffff) | (X##_f0 >> 48));        \
soft-fp/op-2.h:    _h240 = (double)(long)(((Y##_f1 << 16) & 0xffffff) | (Y##_f0 >> 48));        \
soft-fp/op-2.h:    _b240 = (double)(long)((X##_f1 >> 8) & 0xffffff);                            \
soft-fp/op-2.h:    _g240 = (double)(long)((Y##_f1 >> 8) & 0xffffff);                            \
soft-fp/op-2.h:    _a240 = (double)(long)(X##_f1 >> 32);                                        \
soft-fp/op-2.h:    _f240 = (double)(long)(Y##_f1 >> 32);                                        \
soft-fp/op-common.h:    else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long))               \
soft-fp/op-common.h:    else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long long))          \
soft-fp/quad.h:      unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
soft-fp/quad.h:      unsigned long frac2 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac1 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac1 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac2 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:      unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
soft-fp/quad.h:    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
soft-fp/quad.h:    unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:    unsigned long frac0 : _FP_W_TYPE_SIZE;
soft-fp/quad.h:    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;

From this, op-common.h's FP_CLZ is ok, and so is op-2.h, but I believe either all unsigned long
occurrences in extended.h, quad.h, double.h, or at least those for _FP_W_TYPE_SIZE >= 64
should be _FP_W_TYPE, not just those in quad.h.

        Jakub
Reply | Threaded
Open this post in threaded view
|

Re: Ping Re: soft-fp quad.h patch

Joseph Myers
On Mon, 19 Mar 2007, Jakub Jelinek wrote:

> On Sun, Mar 18, 2007 at 08:56:15PM +0000, Joseph S. Myers wrote:
> > Ping.  Could someone review this patch for bug 2831
> > <http://sourceware.org/ml/libc-alpha/2006-06/msg00011.html>?  Jakub, you
> > reviewed the last soft-fp patches to go in.
>
> Is there any reason why you want unsigned long long FP_W_TYPE rather than
> just unsigned long?

Yes, MIPS64 N32 is an ABI using 64-bit registers but 32-bit long, so using
unsigned long long is more efficient.  The aim is to implement sqrtl to
fix bug 2833, which has been blocked (accepted ports patch depending on
unreviewed libc patch) on this soft-fp patch since last June.

> If yes, then your patch is certainly not sufficient:

It suffices for this particular case of allowing sqrtl to work - but as I
said in the bug on 23 June, if you'd prefer a larger patch where all such
bit-fields for all floating-point formats are changed to _FP_W_TYPE,
please let me know, and I'll prepare one.

--
Joseph S. Myers
[hidden email]