about summary refs log tree commit diff
path: root/sysdeps/alpha/soft-fp/local-soft-fp.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-03-06 20:46:23 +0000
committerRichard Henderson <rth@redhat.com>2004-03-06 20:46:23 +0000
commita598e3fc041f38d0c43be55d1664ff7ed0cf405b (patch)
treeda22cbd1cae0cff761823248c1350f7d6ec32177 /sysdeps/alpha/soft-fp/local-soft-fp.h
parent4df8c11d26a29bc3a6116a9125cdfdca3cd517bb (diff)
downloadglibc-a598e3fc041f38d0c43be55d1664ff7ed0cf405b.tar.gz
glibc-a598e3fc041f38d0c43be55d1664ff7ed0cf405b.tar.xz
glibc-a598e3fc041f38d0c43be55d1664ff7ed0cf405b.zip
* soft-fp/quad.h (union _FP_UNION_Q): Add longs structure. * sysdeps/alpha/Implies: Add alpha/soft-fp. * sysdeps/alpha/soft-fp/sfp-machine.h: Rewrite for GEM interface. * sysdeps/alpha/Subdirs, sysdeps/alpha/soft-fp/Makefile, sysdeps/alpha/soft-fp/Versions, sysdeps/alpha/soft-fp/local-soft-fp.h, sysdeps/alpha/soft-fp/ots_add.c, sysdeps/alpha/soft-fp/ots_cmp.c, sysdeps/alpha/soft-fp/ots_cmpe.c, sysdeps/alpha/soft-fp/ots_cvtqux.c, sysdeps/alpha/soft-fp/ots_cvtqx.c, sysdeps/alpha/soft-fp/ots_cvttx.c, sysdeps/alpha/soft-fp/ots_cvtxq.c, sysdeps/alpha/soft-fp/ots_cvtxt.c, sysdeps/alpha/soft-fp/ots_div.c, sysdeps/alpha/soft-fp/ots_mul.c, sysdeps/alpha/soft-fp/ots_nintxq.c, sysdeps/alpha/soft-fp/ots_sub.c: New files.
2004-03-06  Richard Henderson  <rth@redhat.com>

	* soft-fp/quad.h (union _FP_UNION_Q): Add longs structure.
	* sysdeps/alpha/Implies: Add alpha/soft-fp.
	* sysdeps/alpha/soft-fp/sfp-machine.h: Rewrite for GEM interface.
	* sysdeps/alpha/Subdirs, sysdeps/alpha/soft-fp/Makefile,
	sysdeps/alpha/soft-fp/Versions, sysdeps/alpha/soft-fp/local-soft-fp.h,
	sysdeps/alpha/soft-fp/ots_add.c, sysdeps/alpha/soft-fp/ots_cmp.c,
	sysdeps/alpha/soft-fp/ots_cmpe.c, sysdeps/alpha/soft-fp/ots_cvtqux.c,
	sysdeps/alpha/soft-fp/ots_cvtqx.c, sysdeps/alpha/soft-fp/ots_cvttx.c,
	sysdeps/alpha/soft-fp/ots_cvtxq.c, sysdeps/alpha/soft-fp/ots_cvtxt.c,
	sysdeps/alpha/soft-fp/ots_div.c, sysdeps/alpha/soft-fp/ots_mul.c,
	sysdeps/alpha/soft-fp/ots_nintxq.c, sysdeps/alpha/soft-fp/ots_sub.c:
	New files.
Diffstat (limited to 'sysdeps/alpha/soft-fp/local-soft-fp.h')
-rw-r--r--sysdeps/alpha/soft-fp/local-soft-fp.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/sysdeps/alpha/soft-fp/local-soft-fp.h b/sysdeps/alpha/soft-fp/local-soft-fp.h
new file mode 100644
index 0000000000..e93a2ad064
--- /dev/null
+++ b/sysdeps/alpha/soft-fp/local-soft-fp.h
@@ -0,0 +1,44 @@
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad.h>
+
+/* Helpers for the Ots functions which receive long double arguments
+   in two integer registers, and return values in $16+$17.  */
+
+#undef _FP_UNPACK_RAW_2
+#define _FP_UNPACK_RAW_2(fs, X, val)                    \
+  do {                                                  \
+    union _FP_UNION_##fs _flo;				\
+    _flo.longs.a = val##l;				\
+    _flo.longs.b = val##h;				\
+    X##_f0 = _flo.bits.frac0;				\
+    X##_f1 = _flo.bits.frac1;				\
+    X##_e  = _flo.bits.exp;				\
+    X##_s  = _flo.bits.sign;				\
+  } while (0)
+
+#undef _FP_PACK_RAW_2
+#define _FP_PACK_RAW_2(fs, val, X)                      \
+  do {                                                  \
+    union _FP_UNION_##fs _flo;				\
+    _flo.bits.frac0 = X##_f0;				\
+    _flo.bits.frac1 = X##_f1;				\
+    _flo.bits.exp   = X##_e;				\
+    _flo.bits.sign  = X##_s;				\
+    val##l = _flo.longs.a;				\
+    val##h = _flo.longs.b;				\
+  } while (0)
+
+#define FP_DECL_RETURN(X) \
+  long X##l, X##h
+
+/* ??? We don't have a real way to tell the compiler that we're wanting
+   to return values in $16+$17.  Instead use a volatile asm to make sure
+   that the values are live, and just hope that nothing kills the values
+   in between here and the end of the function.  */
+#define FP_RETURN(X)				\
+do {						\
+  register long r16 __asm__("16") = X##l;	\
+  register long r17 __asm__("17") = X##h;	\
+  asm volatile ("" : : "r"(r16), "r"(r17));	\
+} while (0)