This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: soft-fp


On Wed, Dec 29, 1999 at 10:10:43AM -0800, Ulrich Drepper wrote:
> Hi,
> 
> I've finally added the soft-fp stuff Jakub sent me quite some time
> ago.  It not of use for x86 or m68k, but probably for all the others.
> Especially SPARC64 where the 128bit FP format can be/is implement
> using these functions.
> 
> I've never really tested this stuff since none of my machines is using
> them.  So, send mail to Jakub and rth (or for PPC to Geoff who at
> least look at this code and nodded at some point in time).

Thanks.
Here are small fixes which came up during the meantime:

2000-01-03  Jakub Jelinek  <jakub@redhat.com>

	* op-1.h: Fix division for machines using not normalizing version of
	udiv_qrnnd in longlong.h.
	* sysdeps/mips/sfp-machine.h: Likewise.
	* sysdeps/mips/mips64/sfp-machine.h: Likewise.
	* sysdeps/sparc/sparc64/sfp-machine.h: Likewise.
	Patch by Eddie C. Dost <ecd@skynet.be>.

	* soft-fp.h (QItype, UQItype): New types used by longlong.h.

--- soft-fp/sysdeps/mips/mips64/sfp-machine.h.jj	Wed Dec 29 19:08:15 1999
+++ soft-fp/sysdeps/mips/mips64/sfp-machine.h	Mon Jan  3 08:47:30 2000
@@ -11,7 +11,7 @@
   _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
 
 #define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_2_udiv(Q,R,X,Y)
 
 #define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
--- soft-fp/sysdeps/mips/sfp-machine.h.jj	Wed Dec 29 19:08:15 1999
+++ soft-fp/sysdeps/mips/sfp-machine.h	Mon Jan  3 08:47:10 2000
@@ -10,7 +10,7 @@
 #define _FP_MUL_MEAT_Q(R,X,Y)				\
   _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
 
-#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_udiv(S,R,X,Y)
+#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(S,R,X,Y)
 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
 
--- soft-fp/sysdeps/sparc/sparc64/sfp-machine.h.jj	Wed Dec 29 19:08:16 1999
+++ soft-fp/sysdeps/sparc/sparc64/sfp-machine.h	Mon Jan  3 08:45:38 2000
@@ -49,7 +49,7 @@ do {								\
 				_FP_MUL_MEAT_RESET_FE)
 
 #define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_2_udiv(Q,R,X,Y)
 
 #define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
--- soft-fp/soft-fp.h.jj	Wed Dec 29 19:08:14 1999
+++ soft-fp/soft-fp.h	Mon Jan  3 08:43:28 2000
@@ -159,8 +159,10 @@ do {						\
 #define UWtype		_FP_W_TYPE
 #define W_TYPE_SIZE	_FP_W_TYPE_SIZE
 
+typedef int QItype __attribute__((mode(QI)));
 typedef int SItype __attribute__((mode(SI)));
 typedef int DItype __attribute__((mode(DI)));
+typedef unsigned int UQItype __attribute__((mode(QI)));
 typedef unsigned int USItype __attribute__((mode(SI)));
 typedef unsigned int UDItype __attribute__((mode(DI)));
 #if _FP_W_TYPE_SIZE == 32
--- soft-fp/op-1.h.jj	Wed Dec 29 19:08:14 1999
+++ soft-fp/op-1.h	Mon Dec 20 09:33:32 1999
@@ -199,25 +199,25 @@
 
 #define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y)				\
   do {									\
-    _FP_W_TYPE _nh, _nl, _q, _r;					\
+    _FP_W_TYPE _nh, _nl, _q, _r, _y;					\
 									\
     /* Normalize Y -- i.e. make the most significant bit set.  */	\
-    Y##_f <<= _FP_WFRACXBITS_##fs - 1;					\
+    _y = Y##_f << _FP_WFRACXBITS_##fs;					\
 									\
     /* Shift X op correspondingly high, that is, up one full word.  */	\
-    if (X##_f <= Y##_f)							\
+    if (X##_f < Y##_f)							\
       {									\
+	R##_e--;							\
 	_nl = 0;							\
 	_nh = X##_f;							\
       }									\
     else								\
       {									\
-	R##_e++;							\
-	_nl = X##_f << (_FP_W_TYPE_SIZE-1);				\
+	_nl = X##_f << (_FP_W_TYPE_SIZE - 1);				\
 	_nh = X##_f >> 1;						\
       }									\
     									\
-    udiv_qrnnd(_q, _r, _nh, _nl, Y##_f);				\
+    udiv_qrnnd(_q, _r, _nh, _nl, _y);					\
     R##_f = _q | (_r != 0);						\
   } while (0)
 


Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.35 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]