Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sys/arch/m68k/fpe pullup 1.1->1.2 (briggs): fix FPE



details:   https://anonhg.NetBSD.org/src/rev/578939bf721a
branches:  netbsd-1-4
changeset: 468796:578939bf721a
user:      perry <perry%NetBSD.org@localhost>
date:      Mon Jun 21 15:17:36 1999 +0000

description:
pullup 1.1->1.2 (briggs): fix FPE

diffstat:

 sys/arch/m68k/fpe/fpu_arith.h |  105 +++++++++++++++++++++++++----------------
 1 files changed, 63 insertions(+), 42 deletions(-)

diffs (123 lines):

diff -r d504d9ec451f -r 578939bf721a sys/arch/m68k/fpe/fpu_arith.h
--- a/sys/arch/m68k/fpe/fpu_arith.h     Mon Jun 21 15:17:22 1999 +0000
+++ b/sys/arch/m68k/fpe/fpu_arith.h     Mon Jun 21 15:17:36 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_arith.h,v 1.1 1995/11/03 04:46:59 briggs Exp $ */
+/*     $NetBSD: fpu_arith.h,v 1.1.24.1 1999/06/21 15:17:36 perry Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -58,46 +58,7 @@
  * for example.
  */
 
-#ifdef sparc
-
-/* set up for extended-precision arithemtic */
-#define        FPU_DECL_CARRY
-
-/*
- * We have three kinds of add:
- *     add with carry:                                   r = x + y + c
- *     add (ignoring current carry) and set carry:     c'r = x + y + 0
- *     add with carry and set carry:                   c'r = x + y + c
- * The macros use `C' for `use carry' and `S' for `set carry'.
- * Note that the state of the carry is undefined after ADDC and SUBC,
- * so if all you have for these is `add with carry and set carry',
- * that is OK.
- *
- * The same goes for subtract, except that we compute x - y - c.
- *
- * Finally, we have a way to get the carry into a `regular' variable,
- * or set it from a value.  SET_CARRY turns 0 into no-carry, nonzero
- * into carry; GET_CARRY sets its argument to 0 or 1.
- */
-#define        FPU_ADDC(r, x, y) \
-       asm volatile("addx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define        FPU_ADDS(r, x, y) \
-       asm volatile("addcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define        FPU_ADDCS(r, x, y) \
-       asm volatile("addxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define        FPU_SUBC(r, x, y) \
-       asm volatile("subx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define        FPU_SUBS(r, x, y) \
-       asm volatile("subcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define        FPU_SUBCS(r, x, y) \
-       asm volatile("subxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-
-#define        FPU_GET_CARRY(r) asm volatile("addx %%g0,%%g0,%0" : "=r"(r))
-#define        FPU_SET_CARRY(v) asm volatile("addcc %0,-1,%%g0" : : "r"(v))
-
-#define        FPU_SHL1_BY_ADD /* shift left 1 faster by ADDC than (a<<1)|(b>>31) */
-
-#else /* non sparc */
+#ifndef FPE_USE_ASM
 
 /* set up for extended-precision arithemtic */
 #define        FPU_DECL_CARRY quad_t fpu_carry, fpu_tmp;
@@ -150,4 +111,64 @@
 #define        FPU_GET_CARRY(r) (r) = (!!fpu_carry)
 #define        FPU_SET_CARRY(v) fpu_carry = ((v) != 0)
 
-#endif
+#else
+
+/* set up for extended-precision arithemtic */
+#define        FPU_DECL_CARRY register int fpu_tmp;
+
+/*
+ * We have three kinds of add:
+ *     add with carry:                                   r = x + y + c
+ *     add (ignoring current carry) and set carry:     c'r = x + y + 0
+ *     add with carry and set carry:                   c'r = x + y + c
+ * The macros use `C' for `use carry' and `S' for `set carry'.
+ * Note that the state of the carry is undefined after ADDC and SUBC,
+ * so if all you have for these is `add with carry and set carry',
+ * that is OK.
+ *
+ * The same goes for subtract, except that we compute x - y - c.
+ *
+ * Finally, we have a way to get the carry into a `regular' variable,
+ * or set it from a value.  SET_CARRY turns 0 into no-carry, nonzero
+ * into carry; GET_CARRY sets its argument to 0 or 1.
+ */
+#define        FPU_ADDC(r, x, y)                                               \
+       {                                                               \
+               asm volatile("movel %1,%0" : "=d"(fpu_tmp) : "g"(x));   \
+               asm volatile("addxl %1,%0" : "=d"(fpu_tmp) : "d"(y));   \
+               asm volatile("movel %1,%0" : "=g"(r) : "r"(fpu_tmp));   \
+       }
+#define        FPU_ADDS(r, x, y)                                               \
+       {                                                               \
+               asm volatile("movel %1,%0" : "=d"(fpu_tmp) : "g"(x));   \
+               asm volatile("addl %1,%0" : "=d"(fpu_tmp) : "g"(y));    \
+               asm volatile("movel %1,%0" : "=g"(r) : "r"(fpu_tmp));   \
+       }
+#define        FPU_ADDCS(r, x, y) FPU_ADDC(r, x, y)
+
+#define        FPU_SUBC(r, x, y)                                               \
+       {                                                               \
+               asm volatile("movel %1,%0" : "=d"(fpu_tmp) : "g"(x));   \
+               asm volatile("subxl %1,%0" : "=d"(fpu_tmp) : "d"(y));   \
+               asm volatile("movel %1,%0" : "=g"(r) : "r"(fpu_tmp));   \
+       }
+#define        FPU_SUBS(r, x, y)                                               \
+       {                                                               \
+               asm volatile("movel %1,%0" : "=d"(fpu_tmp) : "g"(x));   \
+               asm volatile("subl %1,%0" : "=d"(fpu_tmp) : "g"(y));    \
+               asm volatile("movel %1,%0" : "=g"(r) : "r"(fpu_tmp));   \
+       }
+#define        FPU_SUBCS(r, x, y) FPU_SUBC(r, x, y)
+
+#define        FPU_GET_CARRY(r)                                \
+       {                                               \
+               asm volatile("moveq #0,%0" : "=d"(r));  \
+               asm volatile("addxl %0,%0" : "+d"(r));  \
+       }
+#define        FPU_SET_CARRY(v)                                                \
+       {                                                               \
+               asm volatile("moveq #0,%0" : "=d"(fpu_tmp));            \
+               asm volatile("subl %1,%0" : "=d"(fpu_tmp) : "g"(v));    \
+       }
+
+#endif /* FPE_USE_ASM */



Home | Main Index | Thread Index | Old Index