summaryrefslogtreecommitdiff
path: root/lib/libc/arch/mips/gen/fpsetsticky.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
commitd6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch)
treeece253b876159b39c620e62b6c9b1174642e070e /lib/libc/arch/mips/gen/fpsetsticky.c
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/arch/mips/gen/fpsetsticky.c')
-rw-r--r--lib/libc/arch/mips/gen/fpsetsticky.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/libc/arch/mips/gen/fpsetsticky.c b/lib/libc/arch/mips/gen/fpsetsticky.c
new file mode 100644
index 00000000000..dc778f25b00
--- /dev/null
+++ b/lib/libc/arch/mips/gen/fpsetsticky.c
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+
+fp_except
+fpsetsticky(sticky)
+ fp_except sticky;
+{
+ fp_except old;
+ fp_except new;
+
+ __asm__("cfc1 %0,$31" : "=r" (old));
+
+ new = old;
+ new &= ~(0x1f << 2);
+ new |= ((sticky & 0x1f) << 2);
+
+ __asm__("ctc1 %0,$31" : : "r" (new));
+
+ return (old >> 2) & 0x1f;
+}