This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] powerpc64: fix g++ -msoft-float


On Mon, Jan 13, 2003 at 10:54:34AM -0500, David Edelsohn wrote:
> 	The TImode types and conversions are necessary for
> powerpc64-linux.  We can either ignore soft-float for powerpc64-linux (all
> systems have FPUs) or copy the necessary DImode functions (.__floatdidf,
> .__fixdfdi, and .__fixsfdi) to the versions of dp-bit.c and fp-bit.c
> compiled into libgcc.so.  dp-bit.c and fp-bit.c provide the FP emulation,
> so they should be providing those functions as well, but were punting to
> libgcc2.c because it worked.

David,

I'm still testing, but is this the right approach?  LIB2FUNCS_EXTRA
looks like a more straightforward way to get additional functions into
libgcc.

The new file has functions copied from libgcc2.c.  I assume it will need
the licensing information; should it use the full list of copyright
dates from the original file?

I'm uncomfortable making copies of the functions since they probably
won't get updates that are made to the versions in libgcc2.c.  It would
be nice to just compile these functions directly from libgcc2.c without
defining IN_LIBGCC, but there doesn't seem to be a way to that, and the
existing machinery to build the library is complicated enough as it is.

Janis

Index: config/rs6000/t-linux64
===================================================================
RCS file: /home/janis/gcc_rsync/gcc-cvs/gcc/gcc/config/rs6000/t-linux64,v
retrieving revision 1.3
diff -u -r1.3 t-linux64
--- config/rs6000/t-linux64	5 Apr 2002 04:42:17 -0000	1.3
+++ config/rs6000/t-linux64	13 Jan 2003 22:35:52 -0000
@@ -5,6 +5,9 @@
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \
 			crtsavres.o
 
+# These functions are needed for soft-float on powerpc64-linux.
+LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/ppc64-fp.c
+
 # ld provides these functions as needed.
 crtsavres.S:
 	echo >crtsavres.S
--- /dev/null	2002-11-15 10:19:31.000000000 -0800
+++ config/rs6000/ppc64-fp.c	2003-01-13 16:00:48.000000000 -0800
@@ -0,0 +1,42 @@
+/* These functions are needed for soft-float on powerpc64-linux.
+   They are copied from libgcc2.c, with macros expanded to force
+   use of DItype rather than TItype.  */
+ 
+#if defined(__powerpc64__)
+#include "fp-bit.h"
+
+extern DItype __fixunsdfdi (DFtype);
+extern DItype __fixunssfdi (SFtype);
+extern DFtype __floatdidf (DItype);
+extern DItype __fixdfdi (DFtype);
+extern DItype __fixsfdi (SFtype);
+
+DFtype
+__floatdidf (DItype u)
+{
+  DFtype d;
+
+  d = (SItype) (u >> (sizeof (SItype) * 8));
+  d *= (((UDItype) 1) << ((sizeof (SItype) * 8) / 2));
+  d *= (((UDItype) 1) << ((sizeof (SItype) * 8) / 2));
+  d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
+
+  return d;
+}
+
+DItype
+__fixdfdi (DFtype a)
+{
+  if (a < 0)
+    return - __fixunsdfdi (-a);
+  return __fixunsdfdi (a);
+}
+
+DItype
+__fixsfdi (SFtype a)
+{
+  if (a < 0)
+    return - __fixunssfdi (-a);
+  return __fixunssfdi (a);
+}
+#endif /* __powerpc64__ */


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