* config/floatunsisf.c, config/floatunsidf.c,
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Nov 2005 01:40:01 +0000 (01:40 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Nov 2005 01:40:01 +0000 (01:40 +0000)
config/floatunsixf.c, config/floatunsitf.c: New files.
* config/ia64/t-hpux: Add floatunsitf.c.
* config/ia64/ia64.c (ia64_init_libfuncs): Use
_U_Qfcnvxuf_dbl_to_quad for unsigned DImode-to-TFmode conversion.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107558 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/floatunsidf.c [new file with mode: 0644]
gcc/config/floatunsisf.c [new file with mode: 0644]
gcc/config/floatunsitf.c [new file with mode: 0644]
gcc/config/floatunsixf.c [new file with mode: 0644]
gcc/config/ia64/ia64.c
gcc/config/ia64/t-hpux

index 0ee870d..b654b62 100644 (file)
@@ -1,3 +1,11 @@
+2005-11-27  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * config/floatunsisf.c, config/floatunsidf.c,
+       config/floatunsixf.c, config/floatunsitf.c: New files.
+       * config/ia64/t-hpux: Add floatunsitf.c.
+       * config/ia64/ia64.c (ia64_init_libfuncs): Use
+       _U_Qfcnvxuf_dbl_to_quad for unsigned DImode-to-TFmode conversion.
+
 2005-11-26  Richard Henderson  <rth@redhat.com>
 
        * c-lex.c (pragma_lex): Rename from c_lex.
diff --git a/gcc/config/floatunsidf.c b/gcc/config/floatunsidf.c
new file mode 100644 (file)
index 0000000..ff28112
--- /dev/null
@@ -0,0 +1,15 @@
+/* Public domain.  */
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef float DFtype __attribute__ ((mode (DF)));
+
+DFtype
+__floatunsidf (USItype u)
+{
+  SItype s = (SItype) u;
+  DFtype r = (DFtype) s;
+  if (s < 0)
+    r += (DFtype)2.0 * (DFtype) ((USItype) 1
+                                << (sizeof (USItype) * __CHAR_BIT__ - 1));
+  return r;
+}
diff --git a/gcc/config/floatunsisf.c b/gcc/config/floatunsisf.c
new file mode 100644 (file)
index 0000000..11d4aa7
--- /dev/null
@@ -0,0 +1,18 @@
+/* Public domain.  */
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef float SFtype __attribute__ ((mode (SF)));
+
+SFtype
+__floatunsisf (USItype u)
+{
+  SItype s = (SItype) u;
+  if (s < 0)
+    {
+      /* As in expand_float, compute (u & 1) | (u >> 1) to ensure
+        correct rounding if a nonzero bit is shifted out.  */
+      return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1));
+    }
+  else
+    return (SFtype) s;
+}
diff --git a/gcc/config/floatunsitf.c b/gcc/config/floatunsitf.c
new file mode 100644 (file)
index 0000000..955d676
--- /dev/null
@@ -0,0 +1,15 @@
+/* Public domain.  */
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef float TFtype __attribute__ ((mode (TF)));
+
+TFtype
+__floatunsitf (USItype u)
+{
+  SItype s = (SItype) u;
+  TFtype r = (TFtype) s;
+  if (s < 0)
+    r += (TFtype)2.0 * (TFtype) ((USItype) 1
+                                << (sizeof (USItype) * __CHAR_BIT__ - 1));
+  return r;
+}
diff --git a/gcc/config/floatunsixf.c b/gcc/config/floatunsixf.c
new file mode 100644 (file)
index 0000000..5251168
--- /dev/null
@@ -0,0 +1,15 @@
+/* Public domain.  */
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef float XFtype __attribute__ ((mode (XF)));
+
+XFtype
+__floatunsixf (USItype u)
+{
+  SItype s = (SItype) u;
+  XFtype r = (XFtype) s;
+  if (s < 0)
+    r += (XFtype)2.0 * (XFtype) ((USItype) 1
+                                << (sizeof (USItype) * __CHAR_BIT__ - 1));
+  return r;
+}
index b11583d..7267625 100644 (file)
@@ -8437,6 +8437,9 @@ ia64_init_libfuncs (void)
 
   set_conv_libfunc (sfloat_optab, TFmode, SImode, "_U_Qfcnvxf_sgl_to_quad");
   set_conv_libfunc (sfloat_optab, TFmode, DImode, "_U_Qfcnvxf_dbl_to_quad");
+  /* HP-UX 11.23 libc does not have a function for unsigned
+     SImode-to-TFmode conversion.  */
+  set_conv_libfunc (ufloat_optab, TFmode, DImode, "_U_Qfcnvxuf_dbl_to_quad");
 }
 
 /* Rename all the TFmode libfuncs using the HPUX conventions.  */
index 2897739..7d294d1 100644 (file)
@@ -9,7 +9,7 @@ MULTILIB_MATCHES =
 
 # Support routines for HP-UX 128 bit floats.
 
-LIB2FUNCS_EXTRA=quadlib.c
+LIB2FUNCS_EXTRA=quadlib.c $(srcdir)/config/floatunsitf.c
 
 quadlib.c: $(srcdir)/config/ia64/quadlib.c
        cat $(srcdir)/config/ia64/quadlib.c > quadlib.c