Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1292/?format=api
{ "id": 1292, "url": "http://patchwork.ozlabs.org/api/patches/1292/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1222268456-22541-1-git-send-email-galak@kernel.crashing.org/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<1222268456-22541-1-git-send-email-galak@kernel.crashing.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1222268456-22541-1-git-send-email-galak@kernel.crashing.org/", "date": "2008-09-24T15:00:56", "name": "[v2] powerpc/math-emu: Use kernel generic math-emu code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "a5ba8b7b26dfcd9b640e363e88bb5ba500d944b3", "submitter": { "id": 5, "url": "http://patchwork.ozlabs.org/api/people/5/?format=api", "name": "Kumar Gala", "email": "galak@kernel.crashing.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1222268456-22541-1-git-send-email-galak@kernel.crashing.org/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/1292/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1292/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Received": [ "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id E827FDE2EC\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 25 Sep 2008 01:01:27 +1000 (EST)", "from gate.crashing.org (gate.crashing.org [63.228.1.57])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client did not present a certificate)\n\tby ozlabs.org (Postfix) with ESMTPS id E4CCEDDF4A\n\tfor <linuxppc-dev@ozlabs.org>; Thu, 25 Sep 2008 01:01:00 +1000 (EST)", "from localhost (localhost.localdomain [127.0.0.1])\n\tby gate.crashing.org (8.14.1/8.13.8) with ESMTP id m8OF0uIA002015\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 24 Sep 2008 10:00:57 -0500" ], "From": "Kumar Gala <galak@kernel.crashing.org>", "To": "linuxppc-dev@ozlabs.org", "Subject": "[PATCH v2] powerpc/math-emu: Use kernel generic math-emu code", "Date": "Wed, 24 Sep 2008 10:00:56 -0500", "Message-Id": "<1222268456-22541-1-git-send-email-galak@kernel.crashing.org>", "X-Mailer": "git-send-email 1.5.5.1", "X-BeenThere": "linuxppc-dev@ozlabs.org", "X-Mailman-Version": "2.1.11", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>", "List-Unsubscribe": "<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://ozlabs.org/pipermail/linuxppc-dev>", "List-Post": "<mailto:linuxppc-dev@ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@ozlabs.org?subject=help>", "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org" }, "content": "The math emulation code is centered around a set of generic macros that\nprovide the core of the emulation that are shared by the various\narchitectures and other projects (like glibc). Each arch implements its\nown sfp-machine.h to specific various arch specific details.\n\nFor historic reasons that are now lost the powerpc math-emu code had\nits own version of the common headers. This moves us to using the\nkernel generic version and thus getting fixes when those are updated.\n\nAlso cleaned up exception/error reporting from the FP emulation functions.\n\nSigned-off-by: Kumar Gala <galak@kernel.crashing.org>\n---\n\nWith a better commit message, no code changes.\n\n- k\n\n .../{math-emu => include/asm}/sfp-machine.h | 114 ++--\n arch/powerpc/math-emu/Makefile | 7 +-\n arch/powerpc/math-emu/double.h | 129 ----\n arch/powerpc/math-emu/fadd.c | 17 +-\n arch/powerpc/math-emu/fadds.c | 20 +-\n arch/powerpc/math-emu/fcmpo.c | 10 +-\n arch/powerpc/math-emu/fcmpu.c | 10 +-\n arch/powerpc/math-emu/fctiw.c | 8 +-\n arch/powerpc/math-emu/fctiwz.c | 8 +-\n arch/powerpc/math-emu/fdiv.c | 14 +-\n arch/powerpc/math-emu/fdivs.c | 16 +-\n arch/powerpc/math-emu/fmadd.c | 16 +-\n arch/powerpc/math-emu/fmadds.c | 18 +-\n arch/powerpc/math-emu/fmsub.c | 16 +-\n arch/powerpc/math-emu/fmsubs.c | 18 +-\n arch/powerpc/math-emu/fmul.c | 14 +-\n arch/powerpc/math-emu/fmuls.c | 16 +-\n arch/powerpc/math-emu/fnmadd.c | 16 +-\n arch/powerpc/math-emu/fnmadds.c | 18 +-\n arch/powerpc/math-emu/fnmsub.c | 16 +-\n arch/powerpc/math-emu/fnmsubs.c | 18 +-\n arch/powerpc/math-emu/frsp.c | 14 +-\n arch/powerpc/math-emu/fsel.c | 8 +-\n arch/powerpc/math-emu/fsqrt.c | 12 +-\n arch/powerpc/math-emu/fsqrts.c | 14 +-\n arch/powerpc/math-emu/fsub.c | 14 +-\n arch/powerpc/math-emu/fsubs.c | 16 +-\n arch/powerpc/math-emu/lfd.c | 4 +-\n arch/powerpc/math-emu/lfs.c | 19 +-\n arch/powerpc/math-emu/math.c | 8 +-\n arch/powerpc/math-emu/mcrfs.c | 3 +-\n arch/powerpc/math-emu/mffs.c | 3 +-\n arch/powerpc/math-emu/mtfsb0.c | 3 +-\n arch/powerpc/math-emu/mtfsb1.c | 3 +-\n arch/powerpc/math-emu/mtfsf.c | 20 +-\n arch/powerpc/math-emu/mtfsfi.c | 3 +-\n arch/powerpc/math-emu/op-1.h | 245 -------\n arch/powerpc/math-emu/op-2.h | 434 ------------\n arch/powerpc/math-emu/op-4.h | 317 ---------\n arch/powerpc/math-emu/op-common.h | 688 --------------------\n arch/powerpc/math-emu/single.h | 66 --\n arch/powerpc/math-emu/soft-fp.h | 104 ---\n arch/powerpc/math-emu/stfs.c | 19 +-\n arch/powerpc/math-emu/types.c | 51 --\n arch/powerpc/math-emu/udivmodti4.c | 2 +-\n 45 files changed, 323 insertions(+), 2266 deletions(-)\n rename arch/powerpc/{math-emu => include/asm}/sfp-machine.h (83%)\n delete mode 100644 arch/powerpc/math-emu/double.h\n delete mode 100644 arch/powerpc/math-emu/op-1.h\n delete mode 100644 arch/powerpc/math-emu/op-2.h\n delete mode 100644 arch/powerpc/math-emu/op-4.h\n delete mode 100644 arch/powerpc/math-emu/op-common.h\n delete mode 100644 arch/powerpc/math-emu/single.h\n delete mode 100644 arch/powerpc/math-emu/soft-fp.h\n delete mode 100644 arch/powerpc/math-emu/types.c", "diff": "diff --git a/arch/powerpc/math-emu/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h\nsimilarity index 83%\nrename from arch/powerpc/math-emu/sfp-machine.h\nrename to arch/powerpc/include/asm/sfp-machine.h\nindex 4b17d83..ced34f1 100644\n--- a/arch/powerpc/math-emu/sfp-machine.h\n+++ b/arch/powerpc/include/asm/sfp-machine.h\n@@ -79,27 +79,44 @@\n * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y)\n */\n \n-#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(S,R,X,Y,umul_ppmm)\n-#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(D,R,X,Y,umul_ppmm)\n+#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)\n+#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)\n \n-#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)\n-#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y)\n+#define _FP_DIV_MEAT_S(R,X,Y)\t_FP_DIV_MEAT_1_udiv(S,R,X,Y)\n+#define _FP_DIV_MEAT_D(R,X,Y)\t_FP_DIV_MEAT_2_udiv(D,R,X,Y)\n \n /* These macros define what NaN looks like. They're supposed to expand to\n * a comma-separated set of 32bit unsigned ints that encode NaN.\n */\n-#define _FP_NANFRAC_S\t\t_FP_QNANBIT_S\n-#define _FP_NANFRAC_D\t\t_FP_QNANBIT_D, 0\n-#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0\n+#define _FP_NANFRAC_S\t\t((_FP_QNANBIT_S << 1) - 1)\n+#define _FP_NANFRAC_D\t\t((_FP_QNANBIT_D << 1) - 1), -1\n+#define _FP_NANFRAC_Q\t\t((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1\n+#define _FP_NANSIGN_S\t\t0\n+#define _FP_NANSIGN_D\t\t0\n+#define _FP_NANSIGN_Q\t\t0\n \n #define _FP_KEEPNANFRACP 1\n \n+/* Exception flags. We use the bit positions of the appropriate bits\n+ in the FPSCR, which also correspond to the FE_* bits. This makes\n+ everything easier ;-). */\n+#define FP_EX_INVALID (1 << (31 - 2))\n+#define FP_EX_INVALID_SNAN\tEFLAG_VXSNAN\n+#define FP_EX_INVALID_ISI\tEFLAG_VXISI\n+#define FP_EX_INVALID_IDI\tEFLAG_VXIDI\n+#define FP_EX_INVALID_ZDZ\tEFLAG_VXZDZ\n+#define FP_EX_INVALID_IMZ\tEFLAG_VXIMZ\n+#define FP_EX_OVERFLOW (1 << (31 - 3))\n+#define FP_EX_UNDERFLOW (1 << (31 - 4))\n+#define FP_EX_DIVZERO (1 << (31 - 5))\n+#define FP_EX_INEXACT (1 << (31 - 6))\n+\n /* This macro appears to be called when both X and Y are NaNs, and\n * has to choose one and copy it to R. i386 goes for the larger of the\n * two, sparc64 just picks Y. I don't understand this at all so I'll\n * go with sparc64 because it's shorter :-> -- PMM\n */\n-#define _FP_CHOOSENAN(fs, wc, R, X, Y)\t\t\t\\\n+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)\t\t\\\n do {\t\t\t\t\t\t\t\\\n R##_s = Y##_s;\t\t\t\t\t\\\n _FP_FRAC_COPY_##wc(R,Y);\t\t\t\t\\\n@@ -107,62 +124,6 @@\n } while (0)\n \n \n-extern void fp_unpack_d(long *, unsigned long *, unsigned long *,\n-\t\t\tlong *, long *, void *);\n-extern int fp_pack_d(void *, long, unsigned long, unsigned long, long, long);\n-extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);\n-\n-#define __FP_UNPACK_RAW_1(fs, X, val)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs *_flo =\t\t\t\\\n- \t(union _FP_UNION_##fs *)val;\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- X##_f = _flo->bits.frac;\t\t\t\t\\\n- X##_e = _flo->bits.exp;\t\t\t\t\\\n- X##_s = _flo->bits.sign;\t\t\t\t\\\n- } while (0)\n-\n-#define __FP_UNPACK_RAW_2(fs, X, val)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs *_flo =\t\t\t\\\n- \t(union _FP_UNION_##fs *)val;\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- X##_f0 = _flo->bits.frac0;\t\t\t\t\\\n- X##_f1 = _flo->bits.frac1;\t\t\t\t\\\n- X##_e = _flo->bits.exp;\t\t\t\t\\\n- X##_s = _flo->bits.sign;\t\t\t\t\\\n- } while (0)\n-\n-#define __FP_UNPACK_S(X,val)\t\t\\\n- do {\t\t\t\t\t\\\n- __FP_UNPACK_RAW_1(S,X,val);\t\t\\\n- _FP_UNPACK_CANONICAL(S,1,X);\t\\\n- } while (0)\n-\n-#define __FP_UNPACK_D(X,val)\t\t\\\n-\tfp_unpack_d(&X##_s, &X##_f1, &X##_f0, &X##_e, &X##_c, val)\n-\n-#define __FP_PACK_RAW_1(fs, val, X)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs *_flo =\t\t\t\\\n- \t(union _FP_UNION_##fs *)val;\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- _flo->bits.frac = X##_f;\t\t\t\t\\\n- _flo->bits.exp = X##_e;\t\t\t\t\\\n- _flo->bits.sign = X##_s;\t\t\t\t\\\n- } while (0)\n-\n-#define __FP_PACK_RAW_2(fs, val, X)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs *_flo =\t\t\t\\\n- \t(union _FP_UNION_##fs *)val;\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- _flo->bits.frac0 = X##_f0;\t\t\t\t\\\n- _flo->bits.frac1 = X##_f1;\t\t\t\t\\\n- _flo->bits.exp = X##_e;\t\t\t\t\\\n- _flo->bits.sign = X##_s;\t\t\t\t\\\n- } while (0)\n-\n #include <linux/kernel.h>\n #include <linux/sched.h>\n \n@@ -182,15 +143,30 @@ extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);\n #define __FP_PACK_S(val,X)\t\t\t\\\n ({ int __exc = _FP_PACK_CANONICAL(S,1,X);\t\\\n if(!__exc || !__FPU_TRAP_P(__exc))\t\t\\\n- __FP_PACK_RAW_1(S,val,X);\t\t\\\n+ _FP_PACK_RAW_1_P(S,val,X);\t\t\\\n __exc;\t\t\t\t\t\\\n })\n \n #define __FP_PACK_D(val,X)\t\t\t\\\n-\tfp_pack_d(val, X##_s, X##_f1, X##_f0, X##_e, X##_c)\n-\n-#define __FP_PACK_DS(val,X)\t\t\t\\\n-\tfp_pack_ds(val, X##_s, X##_f1, X##_f0, X##_e, X##_c)\n+ do {\t\t\t\t\t\t\t\t\t\\\n+\t_FP_PACK_CANONICAL(D, 2, X);\t\t\t\t\t\\\n+\tif (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS))\t\\\n+\t\t_FP_PACK_RAW_2_P(D, val, X);\t\t\t\t\\\n+ } while (0)\n+\n+#define __FP_PACK_DS(val,X)\t\t\t\t\t\t\t\\\n+ do {\t\t\t\t\t\t\t\t\t\t\\\n+\t FP_DECL_S(__X);\t\t\t\t\t\t\t\\\n+\t FP_CONV(S, D, 1, 2, __X, X);\t\t\t\t\t\t\\\n+\t _FP_PACK_CANONICAL(S, 1, __X);\t\t\t\t\t\\\n+\t if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) {\t\\\n+\t\t _FP_UNPACK_CANONICAL(S, 1, __X);\t\t\t\t\\\n+\t\t FP_CONV(D, S, 2, 1, X, __X);\t\t\t\t\t\\\n+\t\t _FP_PACK_CANONICAL(D, 2, X);\t\t\t\t\t\\\n+\t\t if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS))\t\\\n+\t\t _FP_PACK_RAW_2_P(D, val, X);\t\t\t\t\t\\\n+\t }\t\t\t\t\t\t\t\t\t\\\n+ } while (0)\n \n /* Obtain the current rounding mode. */\n #define FP_ROUNDMODE\t\t\t\\\ndiff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile\nindex 29bc912..03aa98d 100644\n--- a/arch/powerpc/math-emu/Makefile\n+++ b/arch/powerpc/math-emu/Makefile\n@@ -4,13 +4,14 @@ obj-y\t\t\t\t:= math.o fmr.o lfd.o stfd.o\n obj-$(CONFIG_MATH_EMULATION)\t+= fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \\\n \t\t\t\t\tfctiw.o fctiwz.o fdiv.o fdivs.o \\\n \t\t\t\t\tfmadd.o fmadds.o fmsub.o fmsubs.o \\\n-\t\t\t\t\tfmul.o fmuls.o fnabs.o fneg.o types.o \\\n+\t\t\t\t\tfmul.o fmuls.o fnabs.o fneg.o \\\n \t\t\t\t\tfnmadd.o fnmadds.o fnmsub.o fnmsubs.o \\\n \t\t\t\t\tfres.o frsp.o frsqrte.o fsel.o lfs.o \\\n \t\t\t\t\tfsqrt.o\tfsqrts.o fsub.o fsubs.o \\\n \t\t\t\t\tmcrfs.o mffs.o mtfsb0.o mtfsb1.o \\\n-\t\t\t\t\tmtfsf.o mtfsfi.o stfiwx.o stfs.o \\\n-\t\t\t\t\tudivmodti4.o\n+\t\t\t\t\tmtfsf.o mtfsfi.o stfiwx.o stfs.o\n \n CFLAGS_fabs.o = -fno-builtin-fabs\n CFLAGS_math.o = -fno-builtin-fabs\n+\n+EXTRA_CFLAGS = -I. -Iinclude/math-emu -w\ndiff --git a/arch/powerpc/math-emu/double.h b/arch/powerpc/math-emu/double.h\ndeleted file mode 100644\nindex ffba8b6..0000000\n--- a/arch/powerpc/math-emu/double.h\n+++ /dev/null\n@@ -1,129 +0,0 @@\n-/*\n- * Definitions for IEEE Double Precision\n- */\n-\n-#if _FP_W_TYPE_SIZE < 32\n-#error \"Here's a nickel kid. Go buy yourself a real computer.\"\n-#endif\n-\n-#if _FP_W_TYPE_SIZE < 64\n-#define _FP_FRACTBITS_D\t\t(2 * _FP_W_TYPE_SIZE)\n-#else\n-#define _FP_FRACTBITS_D\t\t_FP_W_TYPE_SIZE\n-#endif\n-\n-#define _FP_FRACBITS_D\t\t53\n-#define _FP_FRACXBITS_D\t\t(_FP_FRACTBITS_D - _FP_FRACBITS_D)\n-#define _FP_WFRACBITS_D\t\t(_FP_WORKBITS + _FP_FRACBITS_D)\n-#define _FP_WFRACXBITS_D\t(_FP_FRACTBITS_D - _FP_WFRACBITS_D)\n-#define _FP_EXPBITS_D\t\t11\n-#define _FP_EXPBIAS_D\t\t1023\n-#define _FP_EXPMAX_D\t\t2047\n-\n-#define _FP_QNANBIT_D\t\t\\\n-\t((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE))\n-#define _FP_IMPLBIT_D\t\t\\\n-\t((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE))\n-#define _FP_OVERFLOW_D\t\t\\\n-\t((_FP_W_TYPE)1 << (_FP_WFRACBITS_D % _FP_W_TYPE_SIZE))\n-\n-#if _FP_W_TYPE_SIZE < 64\n-\n-union _FP_UNION_D\n-{\n- double flt;\n- struct {\n-#if __BYTE_ORDER == __BIG_ENDIAN\n- unsigned sign : 1;\n- unsigned exp : _FP_EXPBITS_D;\n- unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;\n- unsigned frac0 : _FP_W_TYPE_SIZE;\n-#else\n- unsigned frac0 : _FP_W_TYPE_SIZE;\n- unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;\n- unsigned exp : _FP_EXPBITS_D;\n- unsigned sign : 1;\n-#endif\n- } bits __attribute__((packed));\n-};\n-\n-#define FP_DECL_D(X)\t\t_FP_DECL(2,X)\n-#define FP_UNPACK_RAW_D(X,val)\t_FP_UNPACK_RAW_2(D,X,val)\n-#define FP_PACK_RAW_D(val,X)\t_FP_PACK_RAW_2(D,val,X)\n-\n-#define FP_UNPACK_D(X,val)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_UNPACK_RAW_2(D,X,val);\t\t\\\n- _FP_UNPACK_CANONICAL(D,2,X);\t\\\n- } while (0)\n-\n-#define FP_PACK_D(val,X)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_PACK_CANONICAL(D,2,X);\t\t\\\n- _FP_PACK_RAW_2(D,val,X);\t\t\\\n- } while (0)\n-\n-#define FP_NEG_D(R,X)\t\t_FP_NEG(D,2,R,X)\n-#define FP_ADD_D(R,X,Y)\t\t_FP_ADD(D,2,R,X,Y)\n-#define FP_SUB_D(R,X,Y)\t\t_FP_SUB(D,2,R,X,Y)\n-#define FP_MUL_D(R,X,Y)\t\t_FP_MUL(D,2,R,X,Y)\n-#define FP_DIV_D(R,X,Y)\t\t_FP_DIV(D,2,R,X,Y)\n-#define FP_SQRT_D(R,X)\t\t_FP_SQRT(D,2,R,X)\n-\n-#define FP_CMP_D(r,X,Y,un)\t_FP_CMP(D,2,r,X,Y,un)\n-#define FP_CMP_EQ_D(r,X,Y)\t_FP_CMP_EQ(D,2,r,X,Y)\n-\n-#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)\n-#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)\n-\n-#else\n-\n-union _FP_UNION_D\n-{\n- double flt;\n- struct {\n-#if __BYTE_ORDER == __BIG_ENDIAN\n- unsigned sign : 1;\n- unsigned exp : _FP_EXPBITS_D;\n- unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);\n-#else\n- unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);\n- unsigned exp : _FP_EXPBITS_D;\n- unsigned sign : 1;\n-#endif\n- } bits __attribute__((packed));\n-};\n-\n-#define FP_DECL_D(X)\t\t_FP_DECL(1,X)\n-#define FP_UNPACK_RAW_D(X,val)\t_FP_UNPACK_RAW_1(D,X,val)\n-#define FP_PACK_RAW_D(val,X)\t_FP_PACK_RAW_1(D,val,X)\n-\n-#define FP_UNPACK_D(X,val)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_UNPACK_RAW_1(D,X,val);\t\t\\\n- _FP_UNPACK_CANONICAL(D,1,X);\t\\\n- } while (0)\n-\n-#define FP_PACK_D(val,X)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_PACK_CANONICAL(D,1,X);\t\t\\\n- _FP_PACK_RAW_1(D,val,X);\t\t\\\n- } while (0)\n-\n-#define FP_NEG_D(R,X)\t\t_FP_NEG(D,1,R,X)\n-#define FP_ADD_D(R,X,Y)\t\t_FP_ADD(D,1,R,X,Y)\n-#define FP_SUB_D(R,X,Y)\t\t_FP_SUB(D,1,R,X,Y)\n-#define FP_MUL_D(R,X,Y)\t\t_FP_MUL(D,1,R,X,Y)\n-#define FP_DIV_D(R,X,Y)\t\t_FP_DIV(D,1,R,X,Y)\n-#define FP_SQRT_D(R,X)\t\t_FP_SQRT(D,1,R,X)\n-\n-/* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by\n- the target machine. */\n-\n-#define FP_CMP_D(r,X,Y,un)\t_FP_CMP(D,1,r,X,Y,un)\n-#define FP_CMP_EQ_D(r,X,Y)\t_FP_CMP_EQ(D,1,r,X,Y)\n-\n-#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg)\n-#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt)\n-\n-#endif /* W_TYPE_SIZE < 64 */\ndiff --git a/arch/powerpc/math-emu/fadd.c b/arch/powerpc/math-emu/fadd.c\nindex 7befbbf..04d3b4a 100644\n--- a/arch/powerpc/math-emu/fadd.c\n+++ b/arch/powerpc/math-emu/fadd.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fadd(void *frD, void *frA, void *frB)\n@@ -11,28 +12,28 @@ fadd(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n \tprintk(\"B: %ld %lu %lu %ld (%ld)\\n\", B_s, B_f1, B_f0, B_e, B_c);\n #endif\n \n-\tif (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)\n-\t\tret |= EFLAG_VXISI;\n-\n \tFP_ADD_D(R, A, B);\n \n #ifdef DEBUG\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fadds.c b/arch/powerpc/math-emu/fadds.c\nindex 2b346b3..5930f40 100644\n--- a/arch/powerpc/math-emu/fadds.c\n+++ b/arch/powerpc/math-emu/fadds.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fadds(void *frD, void *frA, void *frB)\n@@ -12,28 +13,27 @@ fadds(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n-\tint ret = 0;\n+\tFP_DECL_EX;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n \tprintk(\"B: %ld %lu %lu %ld (%ld)\\n\", B_s, B_f1, B_f0, B_e, B_c);\n #endif\n \n-\tif (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)\n-\t\tret |= EFLAG_VXISI;\n-\n \tFP_ADD_D(R, A, B);\n \n #ifdef DEBUG\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fcmpo.c b/arch/powerpc/math-emu/fcmpo.c\nindex 36d6890..b5dc449 100644\n--- a/arch/powerpc/math-emu/fcmpo.c\n+++ b/arch/powerpc/math-emu/fcmpo.c\n@@ -2,14 +2,16 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fcmpo(u32 *ccr, int crfD, void *frA, void *frB)\n {\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n+\tFP_DECL_EX;\n \tint code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };\n \tlong cmp;\n \tint ret = 0;\n@@ -18,8 +20,8 @@ fcmpo(u32 *ccr, int crfD, void *frA, void *frB)\n \tprintk(\"%s: %p (%08x) %d %p %p\\n\", __func__, ccr, *ccr, crfD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\ndiff --git a/arch/powerpc/math-emu/fcmpu.c b/arch/powerpc/math-emu/fcmpu.c\nindex 53d9389..d4fb1ba 100644\n--- a/arch/powerpc/math-emu/fcmpu.c\n+++ b/arch/powerpc/math-emu/fcmpu.c\n@@ -2,14 +2,16 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fcmpu(u32 *ccr, int crfD, void *frA, void *frB)\n {\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n+\tFP_DECL_EX;\n \tint code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };\n \tlong cmp;\n \n@@ -17,8 +19,8 @@ fcmpu(u32 *ccr, int crfD, void *frA, void *frB)\n \tprintk(\"%s: %p (%08x) %d %p %p\\n\", __func__, ccr, *ccr, crfD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\ndiff --git a/arch/powerpc/math-emu/fctiw.c b/arch/powerpc/math-emu/fctiw.c\nindex fcd7a95..f694440 100644\n--- a/arch/powerpc/math-emu/fctiw.c\n+++ b/arch/powerpc/math-emu/fctiw.c\n@@ -2,16 +2,18 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fctiw(u32 *frD, void *frB)\n {\n \tFP_DECL_D(B);\n+\tFP_DECL_EX;\n \tunsigned int r;\n \n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(B, frB);\n \tFP_TO_INT_D(r, B, 32, 1);\n \tfrD[1] = r;\n \ndiff --git a/arch/powerpc/math-emu/fctiwz.c b/arch/powerpc/math-emu/fctiwz.c\nindex 1514d59..71e782f 100644\n--- a/arch/powerpc/math-emu/fctiwz.c\n+++ b/arch/powerpc/math-emu/fctiwz.c\n@@ -2,13 +2,15 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fctiwz(u32 *frD, void *frB)\n {\n \tFP_DECL_D(B);\n+\tFP_DECL_EX;\n \tu32 fpscr;\n \tunsigned int r;\n \n@@ -16,7 +18,7 @@ fctiwz(u32 *frD, void *frB)\n \t__FPU_FPSCR &= ~(3);\n \t__FPU_FPSCR |= FP_RND_ZERO;\n \n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(B, frB);\n \tFP_TO_INT_D(r, B, 32, 1);\n \tfrD[1] = r;\n \ndiff --git a/arch/powerpc/math-emu/fdiv.c b/arch/powerpc/math-emu/fdiv.c\nindex 18a20fe..2db1509 100644\n--- a/arch/powerpc/math-emu/fdiv.c\n+++ b/arch/powerpc/math-emu/fdiv.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fdiv(void *frD, void *frA, void *frB)\n@@ -11,14 +12,15 @@ fdiv(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -49,5 +51,7 @@ fdiv(void *frD, void *frA, void *frB)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fdivs.c b/arch/powerpc/math-emu/fdivs.c\nindex 24feed6..797f6a9 100644\n--- a/arch/powerpc/math-emu/fdivs.c\n+++ b/arch/powerpc/math-emu/fdivs.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fdivs(void *frD, void *frA, void *frB)\n@@ -12,14 +13,15 @@ fdivs(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -51,5 +53,7 @@ fdivs(void *frD, void *frA, void *frB)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmadd.c b/arch/powerpc/math-emu/fmadd.c\nindex dedb465..925313a 100644\n--- a/arch/powerpc/math-emu/fmadd.c\n+++ b/arch/powerpc/math-emu/fmadd.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fmadd(void *frD, void *frA, void *frB, void *frC)\n@@ -13,15 +14,16 @@ fmadd(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -44,5 +46,7 @@ fmadd(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmadds.c b/arch/powerpc/math-emu/fmadds.c\nindex 6bbb56d..aea80ef 100644\n--- a/arch/powerpc/math-emu/fmadds.c\n+++ b/arch/powerpc/math-emu/fmadds.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fmadds(void *frD, void *frA, void *frB, void *frC)\n@@ -14,15 +15,16 @@ fmadds(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -45,5 +47,7 @@ fmadds(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmsub.c b/arch/powerpc/math-emu/fmsub.c\nindex f311e2c..a644d52 100644\n--- a/arch/powerpc/math-emu/fmsub.c\n+++ b/arch/powerpc/math-emu/fmsub.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fmsub(void *frD, void *frA, void *frB, void *frC)\n@@ -13,15 +14,16 @@ fmsub(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -47,5 +49,7 @@ fmsub(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmsubs.c b/arch/powerpc/math-emu/fmsubs.c\nindex 81a716d..2fdeeb9 100644\n--- a/arch/powerpc/math-emu/fmsubs.c\n+++ b/arch/powerpc/math-emu/fmsubs.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fmsubs(void *frD, void *frA, void *frB, void *frC)\n@@ -14,15 +15,16 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -48,5 +50,7 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmul.c b/arch/powerpc/math-emu/fmul.c\nindex 2f3d327..391fd17 100644\n--- a/arch/powerpc/math-emu/fmul.c\n+++ b/arch/powerpc/math-emu/fmul.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fmul(void *frD, void *frA, void *frB)\n@@ -11,14 +12,15 @@ fmul(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\\n\",\n@@ -38,5 +40,7 @@ fmul(void *frD, void *frA, void *frB)\n \t R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fmuls.c b/arch/powerpc/math-emu/fmuls.c\nindex 962b588..2d3ec5f 100644\n--- a/arch/powerpc/math-emu/fmuls.c\n+++ b/arch/powerpc/math-emu/fmuls.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fmuls(void *frD, void *frA, void *frB)\n@@ -12,14 +13,15 @@ fmuls(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\\n\",\n@@ -39,5 +41,7 @@ fmuls(void *frD, void *frA, void *frB)\n \t R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fnmadd.c b/arch/powerpc/math-emu/fnmadd.c\nindex 8cf7827..2497b86 100644\n--- a/arch/powerpc/math-emu/fnmadd.c\n+++ b/arch/powerpc/math-emu/fnmadd.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fnmadd(void *frD, void *frA, void *frB, void *frC)\n@@ -13,15 +14,16 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -47,5 +49,7 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fnmadds.c b/arch/powerpc/math-emu/fnmadds.c\nindex f1c4f0f..ee9d71e 100644\n--- a/arch/powerpc/math-emu/fnmadds.c\n+++ b/arch/powerpc/math-emu/fnmadds.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fnmadds(void *frD, void *frA, void *frB, void *frC)\n@@ -14,15 +15,16 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -48,5 +50,7 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fnmsub.c b/arch/powerpc/math-emu/fnmsub.c\nindex 98944e6..3885a77 100644\n--- a/arch/powerpc/math-emu/fnmsub.c\n+++ b/arch/powerpc/math-emu/fnmsub.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fnmsub(void *frD, void *frA, void *frB, void *frC)\n@@ -13,15 +14,16 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -50,5 +52,7 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fnmsubs.c b/arch/powerpc/math-emu/fnmsubs.c\nindex b20f4eb..f835dfe 100644\n--- a/arch/powerpc/math-emu/fnmsubs.c\n+++ b/arch/powerpc/math-emu/fnmsubs.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fnmsubs(void *frD, void *frA, void *frB, void *frC)\n@@ -14,15 +15,16 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)\n \tFP_DECL_D(B);\n \tFP_DECL_D(C);\n \tFP_DECL_D(T);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n-\t__FP_UNPACK_D(C, frC);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n+\tFP_UNPACK_DP(C, frC);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -51,5 +53,7 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/frsp.c b/arch/powerpc/math-emu/frsp.c\nindex 724ccbc..ddcc146 100644\n--- a/arch/powerpc/math-emu/frsp.c\n+++ b/arch/powerpc/math-emu/frsp.c\n@@ -2,24 +2,28 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n frsp(void *frD, void *frB)\n {\n \tFP_DECL_D(B);\n+\tFP_DECL_EX;\n \n #ifdef DEBUG\n \tprintk(\"%s: D %p, B %p\\n\", __func__, frD, frB);\n #endif\n \n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"B: %ld %lu %lu %ld (%ld)\\n\", B_s, B_f1, B_f0, B_e, B_c);\n #endif\n \n-\treturn __FP_PACK_DS(frD, B);\n+\t__FP_PACK_DS(frD, B);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fsel.c b/arch/powerpc/math-emu/fsel.c\nindex ecb5f28..1b0c144 100644\n--- a/arch/powerpc/math-emu/fsel.c\n+++ b/arch/powerpc/math-emu/fsel.c\n@@ -2,19 +2,21 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fsel(u32 *frD, void *frA, u32 *frB, u32 *frC)\n {\n \tFP_DECL_D(A);\n+\tFP_DECL_EX;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frA, frB, frC);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n+\tFP_UNPACK_DP(A, frA);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\ndiff --git a/arch/powerpc/math-emu/fsqrt.c b/arch/powerpc/math-emu/fsqrt.c\nindex 38ec2b7..3e90072 100644\n--- a/arch/powerpc/math-emu/fsqrt.c\n+++ b/arch/powerpc/math-emu/fsqrt.c\n@@ -2,21 +2,23 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fsqrt(void *frD, void *frB)\n {\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frB);\n #endif\n \n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"B: %ld %lu %lu %ld (%ld)\\n\", B_s, B_f1, B_f0, B_e, B_c);\n@@ -33,5 +35,7 @@ fsqrt(void *frD, void *frB)\n \tprintk(\"R: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fsqrts.c b/arch/powerpc/math-emu/fsqrts.c\nindex 335263e..2843be9 100644\n--- a/arch/powerpc/math-emu/fsqrts.c\n+++ b/arch/powerpc/math-emu/fsqrts.c\n@@ -2,22 +2,24 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fsqrts(void *frD, void *frB)\n {\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p %p\\n\", __func__, frD, frB);\n #endif\n \n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"B: %ld %lu %lu %ld (%ld)\\n\", B_s, B_f1, B_f0, B_e, B_c);\n@@ -34,5 +36,7 @@ fsqrts(void *frD, void *frB)\n \tprintk(\"R: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fsub.c b/arch/powerpc/math-emu/fsub.c\nindex 208d20f..78b0944 100644\n--- a/arch/powerpc/math-emu/fsub.c\n+++ b/arch/powerpc/math-emu/fsub.c\n@@ -2,8 +2,9 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n \n int\n fsub(void *frD, void *frA, void *frB)\n@@ -11,14 +12,15 @@ fsub(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -37,5 +39,7 @@ fsub(void *frD, void *frA, void *frB)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_D(frD, R));\n+\t__FP_PACK_D(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/fsubs.c b/arch/powerpc/math-emu/fsubs.c\nindex 0e61b80..d3bf908 100644\n--- a/arch/powerpc/math-emu/fsubs.c\n+++ b/arch/powerpc/math-emu/fsubs.c\n@@ -2,9 +2,10 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n fsubs(void *frD, void *frA, void *frB)\n@@ -12,14 +13,15 @@ fsubs(void *frD, void *frA, void *frB)\n \tFP_DECL_D(A);\n \tFP_DECL_D(B);\n \tFP_DECL_D(R);\n+\tFP_DECL_EX;\n \tint ret = 0;\n \n #ifdef DEBUG\n \tprintk(\"%s: %p %p %p\\n\", __func__, frD, frA, frB);\n #endif\n \n-\t__FP_UNPACK_D(A, frA);\n-\t__FP_UNPACK_D(B, frB);\n+\tFP_UNPACK_DP(A, frA);\n+\tFP_UNPACK_DP(B, frB);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -38,5 +40,7 @@ fsubs(void *frD, void *frA, void *frB)\n \tprintk(\"D: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn (ret | __FP_PACK_DS(frD, R));\n+\t__FP_PACK_DS(frD, R);\n+\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/lfd.c b/arch/powerpc/math-emu/lfd.c\nindex 6ec90b5..79ac76d 100644\n--- a/arch/powerpc/math-emu/lfd.c\n+++ b/arch/powerpc/math-emu/lfd.c\n@@ -2,8 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"sfp-machine.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/double.h>\n \n int\n lfd(void *frD, void *ea)\ndiff --git a/arch/powerpc/math-emu/lfs.c b/arch/powerpc/math-emu/lfs.c\nindex 6f18ebe..434ed27 100644\n--- a/arch/powerpc/math-emu/lfs.c\n+++ b/arch/powerpc/math-emu/lfs.c\n@@ -2,15 +2,17 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n lfs(void *frD, void *ea)\n {\n \tFP_DECL_D(R);\n \tFP_DECL_S(A);\n+\tFP_DECL_EX;\n \tfloat f;\n \n #ifdef DEBUG\n@@ -20,7 +22,7 @@ lfs(void *frD, void *ea)\n \tif (copy_from_user(&f, ea, sizeof(float)))\n \t\treturn -EFAULT;\n \n-\t__FP_UNPACK_S(A, &f);\n+\tFP_UNPACK_S(A, f);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %ld (%ld) [%08lx]\\n\", A_s, A_f, A_e, A_c,\n@@ -33,5 +35,12 @@ lfs(void *frD, void *ea)\n \tprintk(\"R: %ld %lu %lu %ld (%ld)\\n\", R_s, R_f1, R_f0, R_e, R_c);\n #endif\n \n-\treturn __FP_PACK_D(frD, R);\n+\tif (R_c == FP_CLS_NAN) {\n+\t\tR_e = _FP_EXPMAX_D;\n+\t\t_FP_PACK_RAW_2_P(D, frD, R);\n+\t} else {\n+\t\t__FP_PACK_D(frD, R);\n+\t}\n+\n+\treturn 0;\n }\ndiff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c\nindex 29e545e..164d559 100644\n--- a/arch/powerpc/math-emu/math.c\n+++ b/arch/powerpc/math-emu/math.c\n@@ -8,8 +8,8 @@\n #include <asm/uaccess.h>\n #include <asm/reg.h>\n \n-#include \"sfp-machine.h\"\n-#include \"double.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/double.h>\n \n #define FLOATFUNC(x)\textern int x(void *, void *, void *, void *)\n \n@@ -168,6 +168,8 @@ record_exception(struct pt_regs *regs, int eflag)\n \t\t\tfpscr |= FPSCR_ZX;\n \t\tif (eflag & EFLAG_INEXACT)\n \t\t\tfpscr |= FPSCR_XX;\n+\t\tif (eflag & EFLAG_INVALID)\n+\t\t\tfpscr |= FPSCR_VX;\n \t\tif (eflag & EFLAG_VXSNAN)\n \t\t\tfpscr |= FPSCR_VXSNAN;\n \t\tif (eflag & EFLAG_VXISI)\n@@ -188,7 +190,7 @@ record_exception(struct pt_regs *regs, int eflag)\n \t\t\tfpscr |= FPSCR_VXCVI;\n \t}\n \n-\tfpscr &= ~(FPSCR_VX);\n+//\tfpscr &= ~(FPSCR_VX);\n \tif (fpscr & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |\n \t\t FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |\n \t\t FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))\ndiff --git a/arch/powerpc/math-emu/mcrfs.c b/arch/powerpc/math-emu/mcrfs.c\nindex 41ba247..e948d57 100644\n--- a/arch/powerpc/math-emu/mcrfs.c\n+++ b/arch/powerpc/math-emu/mcrfs.c\n@@ -2,7 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mcrfs(u32 *ccr, u32 crfD, u32 crfS)\ndiff --git a/arch/powerpc/math-emu/mffs.c b/arch/powerpc/math-emu/mffs.c\nindex b0e2106..5526cf9 100644\n--- a/arch/powerpc/math-emu/mffs.c\n+++ b/arch/powerpc/math-emu/mffs.c\n@@ -2,7 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mffs(u32 *frD)\ndiff --git a/arch/powerpc/math-emu/mtfsb0.c b/arch/powerpc/math-emu/mtfsb0.c\nindex d306235..bc98558 100644\n--- a/arch/powerpc/math-emu/mtfsb0.c\n+++ b/arch/powerpc/math-emu/mtfsb0.c\n@@ -2,7 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mtfsb0(int crbD)\ndiff --git a/arch/powerpc/math-emu/mtfsb1.c b/arch/powerpc/math-emu/mtfsb1.c\nindex 2e94870..fe6ed5a 100644\n--- a/arch/powerpc/math-emu/mtfsb1.c\n+++ b/arch/powerpc/math-emu/mtfsb1.c\n@@ -2,7 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mtfsb1(int crbD)\ndiff --git a/arch/powerpc/math-emu/mtfsf.c b/arch/powerpc/math-emu/mtfsf.c\nindex 48014d8..dbce92e 100644\n--- a/arch/powerpc/math-emu/mtfsf.c\n+++ b/arch/powerpc/math-emu/mtfsf.c\n@@ -2,12 +2,14 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mtfsf(unsigned int FM, u32 *frB)\n {\n \tu32 mask;\n+\tu32 fpscr;\n \n \tif (FM == 0)\n \t\treturn 0;\n@@ -37,6 +39,22 @@ mtfsf(unsigned int FM, u32 *frB)\n \t__FPU_FPSCR &= ~(mask);\n \t__FPU_FPSCR |= (frB[1] & mask);\n \n+\t__FPU_FPSCR &= ~(FPSCR_VX);\n+\tif (__FPU_FPSCR & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |\n+\t\t FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |\n+\t\t FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))\n+\t\t__FPU_FPSCR |= FPSCR_VX;\n+\n+\tfpscr = __FPU_FPSCR;\n+\tfpscr &= ~(FPSCR_FEX);\n+\tif (((fpscr & FPSCR_VX) && (fpscr & FPSCR_VE)) ||\n+\t ((fpscr & FPSCR_OX) && (fpscr & FPSCR_OE)) ||\n+\t ((fpscr & FPSCR_UX) && (fpscr & FPSCR_UE)) ||\n+\t ((fpscr & FPSCR_ZX) && (fpscr & FPSCR_ZE)) ||\n+\t ((fpscr & FPSCR_XX) && (fpscr & FPSCR_XE)))\n+\t\tfpscr |= FPSCR_FEX;\n+\t__FPU_FPSCR = fpscr;\n+\n #ifdef DEBUG\n \tprintk(\"%s: %02x %p: %08lx\\n\", __func__, FM, frB, __FPU_FPSCR);\n #endif\ndiff --git a/arch/powerpc/math-emu/mtfsfi.c b/arch/powerpc/math-emu/mtfsfi.c\nindex 031e200..fd2acc2 100644\n--- a/arch/powerpc/math-emu/mtfsfi.c\n+++ b/arch/powerpc/math-emu/mtfsfi.c\n@@ -2,7 +2,8 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n \n int\n mtfsfi(unsigned int crfD, unsigned int IMM)\ndiff --git a/arch/powerpc/math-emu/op-1.h b/arch/powerpc/math-emu/op-1.h\ndeleted file mode 100644\nindex c92fa95..0000000\n--- a/arch/powerpc/math-emu/op-1.h\n+++ /dev/null\n@@ -1,245 +0,0 @@\n-/*\n- * Basic one-word fraction declaration and manipulation.\n- */\n-\n-#define _FP_FRAC_DECL_1(X)\t_FP_W_TYPE X##_f\n-#define _FP_FRAC_COPY_1(D,S)\t(D##_f = S##_f)\n-#define _FP_FRAC_SET_1(X,I)\t(X##_f = I)\n-#define _FP_FRAC_HIGH_1(X)\t(X##_f)\n-#define _FP_FRAC_LOW_1(X)\t(X##_f)\n-#define _FP_FRAC_WORD_1(X,w)\t(X##_f)\n-\n-#define _FP_FRAC_ADDI_1(X,I)\t(X##_f += I)\n-#define _FP_FRAC_SLL_1(X,N)\t\t\t\\\n- do {\t\t\t\t\t\t\\\n- if (__builtin_constant_p(N) && (N) == 1)\t\\\n- X##_f += X##_f;\t\t\t\t\\\n- else\t\t\t\t\t\\\n- X##_f <<= (N);\t\t\t\t\\\n- } while (0)\n-#define _FP_FRAC_SRL_1(X,N)\t(X##_f >>= N)\n-\n-/* Right shift with sticky-lsb. */\n-#define _FP_FRAC_SRS_1(X,N,sz)\t__FP_FRAC_SRS_1(X##_f, N, sz)\n-\n-#define __FP_FRAC_SRS_1(X,N,sz)\t\t\t\t\t\t\\\n- (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1\t\t\\\n-\t\t ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))\n-\n-#define _FP_FRAC_ADD_1(R,X,Y)\t(R##_f = X##_f + Y##_f)\n-#define _FP_FRAC_SUB_1(R,X,Y)\t(R##_f = X##_f - Y##_f)\n-#define _FP_FRAC_CLZ_1(z, X)\t__FP_CLZ(z, X##_f)\n-\n-/* Predicates */\n-#define _FP_FRAC_NEGP_1(X)\t((_FP_WS_TYPE)X##_f < 0)\n-#define _FP_FRAC_ZEROP_1(X)\t(X##_f == 0)\n-#define _FP_FRAC_OVERP_1(fs,X)\t(X##_f & _FP_OVERFLOW_##fs)\n-#define _FP_FRAC_EQ_1(X, Y)\t(X##_f == Y##_f)\n-#define _FP_FRAC_GE_1(X, Y)\t(X##_f >= Y##_f)\n-#define _FP_FRAC_GT_1(X, Y)\t(X##_f > Y##_f)\n-\n-#define _FP_ZEROFRAC_1\t\t0\n-#define _FP_MINFRAC_1\t\t1\n-\n-/*\n- * Unpack the raw bits of a native fp value. Do not classify or\n- * normalize the data.\n- */\n-\n-#define _FP_UNPACK_RAW_1(fs, X, val)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs _flo; _flo.flt = (val);\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- X##_f = _flo.bits.frac;\t\t\t\t\t\\\n- X##_e = _flo.bits.exp;\t\t\t\t\t\\\n- X##_s = _flo.bits.sign;\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Repack the raw bits of a native fp value.\n- */\n-\n-#define _FP_PACK_RAW_1(fs, val, X)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs _flo;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- _flo.bits.frac = X##_f;\t\t\t\t\t\\\n- _flo.bits.exp = X##_e;\t\t\t\t\t\\\n- _flo.bits.sign = X##_s;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- (val) = _flo.flt;\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Multiplication algorithms:\n- */\n-\n-/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the\n- multiplication immediately. */\n-\n-#define _FP_MUL_MEAT_1_imm(fs, R, X, Y)\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- R##_f = X##_f * Y##_f;\t\t\t\t\t\t\\\n- /* Normalize since we know where the msb of the multiplicands\t\\\n- were (bit B), we know that the msb of the of the product is\t\\\n- at either 2B or 2B-1. */\t\t\t\t\t\\\n- _FP_FRAC_SRS_1(R, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs);\t\\\n- } while (0)\n-\n-/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */\n-\n-#define _FP_MUL_MEAT_1_wide(fs, R, X, Y, doit)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _Z_f0, _Z_f1;\t\t\t\t\t\t\\\n- doit(_Z_f1, _Z_f0, X##_f, Y##_f);\t\t\t\t\t\\\n- /* Normalize since we know where the msb of the multiplicands\t\\\n- were (bit B), we know that the msb of the of the product is\t\\\n- at either 2B or 2B-1. */\t\t\t\t\t\\\n- _FP_FRAC_SRS_2(_Z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs);\t\\\n- R##_f = _Z_f0;\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-/* Finally, a simple widening multiply algorithm. What fun! */\n-\n-#define _FP_MUL_MEAT_1_hard(fs, R, X, Y)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _xh, _xl, _yh, _yl, _z_f0, _z_f1, _a_f0, _a_f1;\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* split the words in half */\t\t\t\t\t\\\n- _xh = X##_f >> (_FP_W_TYPE_SIZE/2);\t\t\t\t\t\\\n- _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1);\t\t\\\n- _yh = Y##_f >> (_FP_W_TYPE_SIZE/2);\t\t\t\t\t\\\n- _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1);\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* multiply the pieces */\t\t\t\t\t\t\\\n- _z_f0 = _xl * _yl;\t\t\t\t\t\t\t\\\n- _a_f0 = _xh * _yl;\t\t\t\t\t\t\t\\\n- _a_f1 = _xl * _yh;\t\t\t\t\t\t\t\\\n- _z_f1 = _xh * _yh;\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* reassemble into two full words */\t\t\t\t\\\n- if ((_a_f0 += _a_f1) < _a_f1)\t\t\t\t\t\\\n- _z_f1 += (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2);\t\t\t\\\n- _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2);\t\t\t\t\\\n- _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2);\t\t\t\t\\\n- _FP_FRAC_ADD_2(_z, _z, _a);\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* normalize */\t\t\t\t\t\t\t\\\n- _FP_FRAC_SRS_2(_z, _FP_WFRACBITS_##fs - 1, 2*_FP_WFRACBITS_##fs);\t\\\n- R##_f = _z_f0;\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Division algorithms:\n- */\n-\n-/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the\n- division immediately. Give this macro either _FP_DIV_HELP_imm for\n- C primitives or _FP_DIV_HELP_ldiv for the ISO function. Which you\n- choose will depend on what the compiler does with divrem4. */\n-\n-#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit)\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _q, _r;\t\t\t\t\t\\\n- X##_f <<= (X##_f < Y##_f\t\t\t\t\\\n-\t ? R##_e--, _FP_WFRACBITS_##fs\t\t\\\n-\t : _FP_WFRACBITS_##fs - 1);\t\t\\\n- doit(_q, _r, X##_f, Y##_f);\t\t\t\t\\\n- R##_f = _q | (_r != 0);\t\t\t\t\\\n- } while (0)\n-\n-/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd\n- that may be useful in this situation. This first is for a primitive\n- that requires normalization, the second for one that does not. Look\n- for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */\n-\n-#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _nh, _nl, _q, _r;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Normalize Y -- i.e. make the most significant bit set. */\t\\\n- Y##_f <<= _FP_WFRACXBITS_##fs - 1;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Shift X op correspondingly high, that is, up one full word. */\t\\\n- if (X##_f <= Y##_f)\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\t_nl = 0;\t\t\t\t\t\t\t\\\n-\t_nh = X##_f;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tR##_e++;\t\t\t\t\t\t\t\\\n-\t_nl = X##_f << (_FP_W_TYPE_SIZE-1);\t\t\t\t\\\n-\t_nh = X##_f >> 1;\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- \t\t\t\t\t\t\t\t\t\\\n- udiv_qrnnd(_q, _r, _nh, _nl, Y##_f);\t\t\t\t\\\n- R##_f = _q | (_r != 0);\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_DIV_MEAT_1_udiv(fs, R, X, Y)\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _nh, _nl, _q, _r;\t\t\t\\\n- if (X##_f < Y##_f)\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\\\n-\tR##_e--;\t\t\t\t\t\\\n-\t_nl = X##_f << _FP_WFRACBITS_##fs;\t\t\\\n-\t_nh = X##_f >> _FP_WFRACXBITS_##fs;\t\t\\\n- }\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\\\n-\t_nl = X##_f << (_FP_WFRACBITS_##fs - 1);\t\\\n-\t_nh = X##_f >> (_FP_WFRACXBITS_##fs + 1);\t\\\n- }\t\t\t\t\t\t\t\\\n- udiv_qrnnd(_q, _r, _nh, _nl, Y##_f);\t\t\\\n- R##_f = _q | (_r != 0);\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Square root algorithms:\n- * We have just one right now, maybe Newton approximation\n- * should be added for those machines where division is fast.\n- */\n-\n-#define _FP_SQRT_MEAT_1(R, S, T, X, q)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- while (q)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\\\n- T##_f = S##_f + q;\t\t\t\t\\\n- if (T##_f <= X##_f)\t\t\t\t\\\n- {\t\t\t\t\t\t\\\n- S##_f = T##_f + q;\t\t\t\t\\\n- X##_f -= T##_f;\t\t\t\t\\\n- R##_f += q;\t\t\t\t\t\\\n- }\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_1(X, 1);\t\t\t\t\\\n- q >>= 1;\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-/*\n- * Assembly/disassembly for converting to/from integral types.\n- * No shifting or overflow handled here.\n- */\n-\n-#define _FP_FRAC_ASSEMBLE_1(r, X, rsize)\t(r = X##_f)\n-#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize)\t(X##_f = r)\n-\n-\n-/*\n- * Convert FP values between word sizes\n- */\n-\n-#define _FP_FRAC_CONV_1_1(dfs, sfs, D, S)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- D##_f = S##_f;\t\t\t\t\t\t\t\\\n- if (_FP_WFRACBITS_##sfs > _FP_WFRACBITS_##dfs)\t\t\t\\\n- _FP_FRAC_SRS_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs),\t\\\n-\t\t _FP_WFRACBITS_##sfs);\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- D##_f <<= _FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs;\t\t\\\n- } while (0)\ndiff --git a/arch/powerpc/math-emu/op-2.h b/arch/powerpc/math-emu/op-2.h\ndeleted file mode 100644\nindex 7d6f17c..0000000\n--- a/arch/powerpc/math-emu/op-2.h\n+++ /dev/null\n@@ -1,434 +0,0 @@\n-/*\n- * Basic two-word fraction declaration and manipulation.\n- */\n-\n-#define _FP_FRAC_DECL_2(X)\t_FP_W_TYPE X##_f0, X##_f1\n-#define _FP_FRAC_COPY_2(D,S)\t(D##_f0 = S##_f0, D##_f1 = S##_f1)\n-#define _FP_FRAC_SET_2(X,I)\t__FP_FRAC_SET_2(X, I)\n-#define _FP_FRAC_HIGH_2(X)\t(X##_f1)\n-#define _FP_FRAC_LOW_2(X)\t(X##_f0)\n-#define _FP_FRAC_WORD_2(X,w)\t(X##_f##w)\n-\n-#define _FP_FRAC_SLL_2(X,N)\t\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- if ((N) < _FP_W_TYPE_SIZE)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n- if (__builtin_constant_p(N) && (N) == 1) \t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n- X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE)(X##_f0)) < 0);\t\\\n- X##_f0 += X##_f0;\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n-\t X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N));\t\\\n-\t X##_f0 <<= (N);\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE);\t\t\t\\\n-\tX##_f0 = 0;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_FRAC_SRL_2(X,N)\t\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- if ((N) < _FP_W_TYPE_SIZE)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N));\t\\\n-\tX##_f1 >>= (N);\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE);\t\t\t\\\n-\tX##_f1 = 0;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-/* Right shift with sticky-lsb. */\n-#define _FP_FRAC_SRS_2(X,N,sz)\t\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- if ((N) < _FP_W_TYPE_SIZE)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) |\t\\\n-\t\t (__builtin_constant_p(N) && (N) == 1\t\t\t\\\n-\t\t ? X##_f0 & 1\t\t\t\t\t\t\\\n-\t\t : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0));\t\\\n-\tX##_f1 >>= (N);\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) |\t\t\t\\\n-\t (((X##_f1 << (2 * _FP_W_TYPE_SIZE - (N))) |\t\t\\\n-\t\t X##_f0) != 0));\t\t\t\t\t\\\n-\tX##_f1 = 0;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_FRAC_ADDI_2(X,I) \\\n- __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)\n-\n-#define _FP_FRAC_ADD_2(R,X,Y) \\\n- __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)\n-\n-#define _FP_FRAC_SUB_2(R,X,Y) \\\n- __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)\n-\n-#define _FP_FRAC_CLZ_2(R,X)\t\\\n- do {\t\t\t\t\\\n- if (X##_f1)\t\t\t\\\n- __FP_CLZ(R,X##_f1);\t\\\n- else \t\t\t\\\n- {\t\t\t\t\\\n- __FP_CLZ(R,X##_f0);\t\\\n- R += _FP_W_TYPE_SIZE;\t\\\n- }\t\t\t\t\\\n- } while(0)\n-\n-/* Predicates */\n-#define _FP_FRAC_NEGP_2(X)\t((_FP_WS_TYPE)X##_f1 < 0)\n-#define _FP_FRAC_ZEROP_2(X)\t((X##_f1 | X##_f0) == 0)\n-#define _FP_FRAC_OVERP_2(fs,X)\t(X##_f1 & _FP_OVERFLOW_##fs)\n-#define _FP_FRAC_EQ_2(X, Y)\t(X##_f1 == Y##_f1 && X##_f0 == Y##_f0)\n-#define _FP_FRAC_GT_2(X, Y)\t\\\n- ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0))\n-#define _FP_FRAC_GE_2(X, Y)\t\\\n- ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 >= Y##_f0))\n-\n-#define _FP_ZEROFRAC_2\t\t0, 0\n-#define _FP_MINFRAC_2\t\t0, 1\n-\n-/*\n- * Internals\n- */\n-\n-#define __FP_FRAC_SET_2(X,I1,I0)\t(X##_f0 = I0, X##_f1 = I1)\n-\n-#define __FP_CLZ_2(R, xh, xl)\t\\\n- do {\t\t\t\t\\\n- if (xh)\t\t\t\\\n- __FP_CLZ(R,xl);\t\t\\\n- else \t\t\t\\\n- {\t\t\t\t\\\n- __FP_CLZ(R,xl);\t\t\\\n- R += _FP_W_TYPE_SIZE;\t\\\n- }\t\t\t\t\\\n- } while(0)\n-\n-#if 0\n-\n-#ifndef __FP_FRAC_ADDI_2\n-#define __FP_FRAC_ADDI_2(xh, xl, i) \\\n- (xh += ((xl += i) < i))\n-#endif\n-#ifndef __FP_FRAC_ADD_2\n-#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \\\n- (rh = xh + yh + ((rl = xl + yl) < xl))\n-#endif\n-#ifndef __FP_FRAC_SUB_2\n-#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \\\n- (rh = xh - yh - ((rl = xl - yl) > xl))\n-#endif\n-\n-#else\n-\n-#undef __FP_FRAC_ADDI_2\n-#define __FP_FRAC_ADDI_2(xh, xl, i)\tadd_ssaaaa(xh, xl, xh, xl, 0, i)\n-#undef __FP_FRAC_ADD_2\n-#define __FP_FRAC_ADD_2\t\t\tadd_ssaaaa\n-#undef __FP_FRAC_SUB_2\n-#define __FP_FRAC_SUB_2\t\t\tsub_ddmmss\n-\n-#endif\n-\n-/*\n- * Unpack the raw bits of a native fp value. Do not classify or\n- * normalize the data.\n- */\n-\n-#define _FP_UNPACK_RAW_2(fs, X, val)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs _flo; _flo.flt = (val);\t\\\n-\t\t\t\t\t\t\t\\\n- X##_f0 = _flo.bits.frac0;\t\t\t\t\\\n- X##_f1 = _flo.bits.frac1;\t\t\t\t\\\n- X##_e = _flo.bits.exp;\t\t\t\t\\\n- X##_s = _flo.bits.sign;\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Repack the raw bits of a native fp value.\n- */\n-\n-#define _FP_PACK_RAW_2(fs, val, X)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- union _FP_UNION_##fs _flo;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- _flo.bits.frac0 = X##_f0;\t\t\t\t\\\n- _flo.bits.frac1 = X##_f1;\t\t\t\t\\\n- _flo.bits.exp = X##_e;\t\t\t\t\\\n- _flo.bits.sign = X##_s;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- (val) = _flo.flt;\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Multiplication algorithms:\n- */\n-\n-/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */\n-\n-#define _FP_MUL_MEAT_2_wide(fs, R, X, Y, doit)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c);\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- doit(_FP_FRAC_WORD_4(_z,1), _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \\\n- doit(_b_f1, _b_f0, X##_f0, Y##_f1);\t\t\t\t\t\\\n- doit(_c_f1, _c_f0, X##_f1, Y##_f0);\t\t\t\t\t\\\n- doit(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), X##_f1, Y##_f1); \\\n-\t\t\t\t\t\t\t\t\t\\\n- __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2),\t\\\n-\t\t _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0),\t\\\n-\t\t 0, _b_f1, _b_f0, 0,\t\t\t\t\t\\\n-\t\t _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2),\t\\\n-\t\t _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0));\t\\\n- __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2),\t\\\n-\t\t _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0),\t\\\n-\t\t 0, _c_f1, _c_f0, 0,\t\t\t\t\t\\\n-\t\t _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2),\t\\\n-\t\t _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0));\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Normalize since we know where the msb of the multiplicands\t\\\n- were (bit B), we know that the msb of the of the product is\t\\\n- at either 2B or 2B-1. */\t\t\t\t\t\\\n- _FP_FRAC_SRS_4(_z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs);\t\\\n- R##_f0 = _FP_FRAC_WORD_4(_z,0);\t\t\t\t\t\\\n- R##_f1 = _FP_FRAC_WORD_4(_z,1);\t\t\t\t\t\\\n- } while (0)\n-\n-/* This next macro appears to be totally broken. Fortunately nowhere\n- * seems to use it :-> The problem is that we define _z[4] but\n- * then use it in _FP_FRAC_SRS_4, which will attempt to access\n- * _z_f[n] which will cause an error. The fix probably involves\n- * declaring it with _FP_FRAC_DECL_4, see previous macro. -- PMM 02/1998\n- */\n-#define _FP_MUL_MEAT_2_gmp(fs, R, X, Y)\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _x[2], _y[2], _z[4];\t\t\t\t\t\\\n- _x[0] = X##_f0; _x[1] = X##_f1;\t\t\t\t\t\\\n- _y[0] = Y##_f0; _y[1] = Y##_f1;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- mpn_mul_n(_z, _x, _y, 2);\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Normalize since we know where the msb of the multiplicands\t\\\n- were (bit B), we know that the msb of the of the product is\t\\\n- at either 2B or 2B-1. */\t\t\t\t\t\\\n- _FP_FRAC_SRS_4(_z, _FP_WFRACBITS##_fs-1, 2*_FP_WFRACBITS_##fs);\t\\\n- R##_f0 = _z[0];\t\t\t\t\t\t\t\\\n- R##_f1 = _z[1];\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Division algorithms:\n- * This seems to be giving me difficulties -- PMM\n- * Look, NetBSD seems to be able to comment algorithms. Can't you?\n- * I've thrown printks at the problem.\n- * This now appears to work, but I still don't really know why.\n- * Also, I don't think the result is properly normalised...\n- */\n-\n-#define _FP_DIV_MEAT_2_udiv_64(fs, R, X, Y)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- extern void _fp_udivmodti4(_FP_W_TYPE q[2], _FP_W_TYPE r[2],\t\\\n-\t\t\t _FP_W_TYPE n1, _FP_W_TYPE n0,\t\t\\\n-\t\t\t _FP_W_TYPE d1, _FP_W_TYPE d0);\t\t\\\n- _FP_W_TYPE _n_f3, _n_f2, _n_f1, _n_f0, _r_f1, _r_f0;\t\t\\\n- _FP_W_TYPE _q_f1, _q_f0, _m_f1, _m_f0;\t\t\t\t\\\n- _FP_W_TYPE _rmem[2], _qmem[2];\t\t\t\t\t\\\n- /* I think this check is to ensure that the result is normalised. \\\n- * Assuming X,Y normalised (ie in [1.0,2.0)) X/Y will be in \\\n- * [0.5,2.0). Furthermore, it will be less than 1.0 iff X < Y. \\\n- * In this case we tweak things. (this is based on comments in \\\n- * the NetBSD FPU emulation code. ) \\\n- * We know X,Y are normalised because we ensure this as part of \\\n- * the unpacking process. -- PMM \\\n- */\t\t\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_GT_2(X, Y))\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-/*\tR##_e++; */\t\t\t\t\t\t\t\\\n-\t_n_f3 = X##_f1 >> 1;\t\t\t\t\t\t\\\n-\t_n_f2 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1;\t\t\\\n-\t_n_f1 = X##_f0 << (_FP_W_TYPE_SIZE - 1);\t\t\t\\\n-\t_n_f0 = 0;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tR##_e--;\t\t\t\t\t\t\t\\\n-\t_n_f3 = X##_f1;\t\t\t\t\t\t\t\\\n-\t_n_f2 = X##_f0;\t\t\t\t\t\t\t\\\n-\t_n_f1 = _n_f0 = 0;\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Normalize, i.e. make the most significant bit of the \t\t\\\n- denominator set. CHANGED: - 1 to nothing -- PMM */\t\t\\\n- _FP_FRAC_SLL_2(Y, _FP_WFRACXBITS_##fs /* -1 */);\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- /* Do the 256/128 bit division given the 128-bit _fp_udivmodtf4 \t\\\n- primitive snagged from libgcc2.c. */\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- _fp_udivmodti4(_qmem, _rmem, _n_f3, _n_f2, 0, Y##_f1);\t\t\\\n- _q_f1 = _qmem[0];\t\t\t\t\t\t\t\\\n- umul_ppmm(_m_f1, _m_f0, _q_f1, Y##_f0);\t\t\t\t\\\n- _r_f1 = _rmem[0];\t\t\t\t\t\t\t\\\n- _r_f0 = _n_f1;\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_GT_2(_m, _r))\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\t_q_f1--;\t\t\t\t\t\t\t\\\n-\t_FP_FRAC_ADD_2(_r, _r, Y);\t\t\t\t\t\\\n-\tif (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r))\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t _q_f1--;\t\t\t\t\t\t\t\\\n-\t _FP_FRAC_ADD_2(_r, _r, Y);\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_SUB_2(_r, _r, _m);\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- _fp_udivmodti4(_qmem, _rmem, _r_f1, _r_f0, 0, Y##_f1);\t\t\\\n- _q_f0 = _qmem[0];\t\t\t\t\t\t\t\\\n- umul_ppmm(_m_f1, _m_f0, _q_f0, Y##_f0);\t\t\t\t\\\n- _r_f1 = _rmem[0];\t\t\t\t\t\t\t\\\n- _r_f0 = _n_f0;\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_GT_2(_m, _r))\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\t_q_f0--;\t\t\t\t\t\t\t\\\n-\t_FP_FRAC_ADD_2(_r, _r, Y);\t\t\t\t\t\\\n-\tif (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r))\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t _q_f0--;\t\t\t\t\t\t\t\\\n-\t _FP_FRAC_ADD_2(_r, _r, Y);\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_SUB_2(_r, _r, _m);\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- R##_f1 = _q_f1;\t\t\t\t\t\t\t\\\n- R##_f0 = _q_f0 | ((_r_f1 | _r_f0) != 0);\t\t\t\t\\\n- /* adjust so answer is normalized again. I'm not sure what the \t\\\n- * final sz param should be. In practice it's never used since \\\n- * N is 1 which is always going to be < _FP_W_TYPE_SIZE...\t\t\\\n- */\t\t\t\t\t\t\t\t\t\\\n- /* _FP_FRAC_SRS_2(R,1,_FP_WFRACBITS_##fs);\t*/\t\t\t\\\n- } while (0)\n-\n-\n-#define _FP_DIV_MEAT_2_gmp(fs, R, X, Y)\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_W_TYPE _x[4], _y[2], _z[4];\t\t\t\t\t\\\n- _y[0] = Y##_f0; _y[1] = Y##_f1;\t\t\t\t\t\\\n- _x[0] = _x[3] = 0;\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_GT_2(X, Y))\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tR##_e++;\t\t\t\t\t\t\t\\\n-\t_x[1] = (X##_f0 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE) |\t\\\n-\t\t X##_f1 >> (_FP_W_TYPE_SIZE -\t\t\t\t\\\n-\t\t\t (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE)));\t\\\n-\t_x[2] = X##_f1 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE);\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\t_x[1] = (X##_f0 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE) |\t\t\\\n-\t\t X##_f1 >> (_FP_W_TYPE_SIZE -\t\t\t\t\\\n-\t\t\t (_FP_WFRACBITS - _FP_W_TYPE_SIZE)));\t\\\n-\t_x[2] = X##_f1 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE);\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- (void) mpn_divrem (_z, 0, _x, 4, _y, 2);\t\t\t\t\\\n- R##_f1 = _z[1];\t\t\t\t\t\t\t\\\n- R##_f0 = _z[0] | ((_x[0] | _x[1]) != 0);\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Square root algorithms:\n- * We have just one right now, maybe Newton approximation\n- * should be added for those machines where division is fast.\n- */\n-\n-#define _FP_SQRT_MEAT_2(R, S, T, X, q)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- while (q)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\\\n- T##_f1 = S##_f1 + q;\t\t\t\t\\\n- if (T##_f1 <= X##_f1)\t\t\t\t\\\n- {\t\t\t\t\t\t\\\n- S##_f1 = T##_f1 + q;\t\t\t\\\n- X##_f1 -= T##_f1;\t\t\t\t\\\n- R##_f1 += q;\t\t\t\t\\\n- }\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_2(X, 1);\t\t\t\t\\\n- q >>= 1;\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\\\n- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1);\t\t\\\n- while (q)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\\\n- T##_f0 = S##_f0 + q;\t\t\t\t\\\n- T##_f1 = S##_f1;\t\t\t\t\\\n- if (T##_f1 < X##_f1 || \t\t\t\t\\\n- (T##_f1 == X##_f1 && T##_f0 < X##_f0))\t\\\n- {\t\t\t\t\t\t\\\n- S##_f0 = T##_f0 + q;\t\t\t\\\n- if (((_FP_WS_TYPE)T##_f0) < 0 &&\t\t\\\n- ((_FP_WS_TYPE)S##_f0) >= 0)\t\t\\\n- S##_f1++;\t\t\t\t\t\\\n- _FP_FRAC_SUB_2(X, X, T);\t\t\t\\\n- R##_f0 += q;\t\t\t\t\\\n- }\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_2(X, 1);\t\t\t\t\\\n- q >>= 1;\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Assembly/disassembly for converting to/from integral types.\n- * No shifting or overflow handled here.\n- */\n-\n-#define _FP_FRAC_ASSEMBLE_2(r, X, rsize)\t\\\n- do {\t\t\t\t\t\t\\\n- if (rsize <= _FP_W_TYPE_SIZE)\t\t\\\n- r = X##_f0;\t\t\t\t\\\n- else\t\t\t\t\t\\\n- {\t\t\t\t\t\t\\\n-\tr = X##_f1;\t\t\t\t\\\n-\tr <<= _FP_W_TYPE_SIZE;\t\t\t\\\n-\tr += X##_f0;\t\t\t\t\\\n- }\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- X##_f0 = r;\t\t\t\t\t\t\t\t\\\n- X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE);\t\\\n- } while (0)\n-\n-/*\n- * Convert FP values between word sizes\n- */\n-\n-#define _FP_FRAC_CONV_1_2(dfs, sfs, D, S)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_SRS_2(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs),\t\\\n-\t\t _FP_WFRACBITS_##sfs);\t\t\t\t\\\n- D##_f = S##_f0;\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_FRAC_CONV_2_1(dfs, sfs, D, S)\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- D##_f0 = S##_f;\t\t\t\t\t\t\t\\\n- D##_f1 = 0;\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_2(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs));\t\\\n- } while (0)\n-\ndiff --git a/arch/powerpc/math-emu/op-4.h b/arch/powerpc/math-emu/op-4.h\ndeleted file mode 100644\nindex c9ae626..0000000\n--- a/arch/powerpc/math-emu/op-4.h\n+++ /dev/null\n@@ -1,317 +0,0 @@\n-/*\n- * Basic four-word fraction declaration and manipulation.\n- *\n- * When adding quadword support for 32 bit machines, we need\n- * to be a little careful as double multiply uses some of these\n- * macros: (in op-2.h)\n- * _FP_MUL_MEAT_2_wide() uses _FP_FRAC_DECL_4, _FP_FRAC_WORD_4,\n- * _FP_FRAC_ADD_4, _FP_FRAC_SRS_4\n- * _FP_MUL_MEAT_2_gmp() uses _FP_FRAC_SRS_4 (and should use\n- * _FP_FRAC_DECL_4: it appears to be broken and is not used\n- * anywhere anyway. )\n- *\n- * I've now fixed all the macros that were here from the sparc64 code.\n- * [*none* of the shift macros were correct!] -- PMM 02/1998\n- *\n- * The only quadword stuff that remains to be coded is:\n- * 1) the conversion to/from ints, which requires\n- * that we check (in op-common.h) that the following do the right thing\n- * for quadwords: _FP_TO_INT(Q,4,r,X,rsz,rsg), _FP_FROM_INT(Q,4,X,r,rs,rt)\n- * 2) multiply, divide and sqrt, which require:\n- * _FP_MUL_MEAT_4_*(R,X,Y), _FP_DIV_MEAT_4_*(R,X,Y), _FP_SQRT_MEAT_4(R,S,T,X,q),\n- * This also needs _FP_MUL_MEAT_Q and _FP_DIV_MEAT_Q to be defined to\n- * some suitable _FP_MUL_MEAT_4_* macros in sfp-machine.h.\n- * [we're free to choose whatever FP_MUL_MEAT_4_* macros we need for\n- * these; they are used nowhere else. ]\n- */\n-\n-#define _FP_FRAC_DECL_4(X)\t_FP_W_TYPE X##_f[4]\n-#define _FP_FRAC_COPY_4(D,S)\t\t\t\\\n- (D##_f[0] = S##_f[0], D##_f[1] = S##_f[1],\t\\\n- D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])\n-/* The _FP_FRAC_SET_n(X,I) macro is intended for use with another\n- * macro such as _FP_ZEROFRAC_n which returns n comma separated values.\n- * The result is that we get an expansion of __FP_FRAC_SET_n(X,I0,I1,I2,I3)\n- * which just assigns the In values to the array X##_f[].\n- * This is why the number of parameters doesn't appear to match\n- * at first glance... -- PMM\n- */\n-#define _FP_FRAC_SET_4(X,I)\t__FP_FRAC_SET_4(X, I)\n-#define _FP_FRAC_HIGH_4(X)\t(X##_f[3])\n-#define _FP_FRAC_LOW_4(X)\t(X##_f[0])\n-#define _FP_FRAC_WORD_4(X,w)\t(X##_f[w])\n-\n-#define _FP_FRAC_SLL_4(X,N)\t\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_I_TYPE _up, _down, _skip, _i;\t\t\t\t\t\\\n- _skip = (N) / _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _up = (N) % _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _down = _FP_W_TYPE_SIZE - _up;\t\t\t\t\t\\\n- for (_i = 3; _i > _skip; --_i)\t\t\t\t\t\\\n- X##_f[_i] = X##_f[_i-_skip] << _up | X##_f[_i-_skip-1] >> _down;\t\\\n-/* bugfixed: was X##_f[_i] <<= _up; -- PMM 02/1998 */ \\\n- X##_f[_i] = X##_f[0] << _up; \t \\\n- for (--_i; _i >= 0; --_i)\t\t\t\t\t\t\\\n- X##_f[_i] = 0;\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-/* This one was broken too */\n-#define _FP_FRAC_SRL_4(X,N)\t\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_I_TYPE _up, _down, _skip, _i;\t\t\t\t\t\\\n- _skip = (N) / _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _down = (N) % _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _up = _FP_W_TYPE_SIZE - _down;\t\t\t\t\t\\\n- for (_i = 0; _i < 3-_skip; ++_i)\t\t\t\t\t\\\n- X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up;\t\\\n- X##_f[_i] = X##_f[3] >> _down;\t\t\t \t\\\n- for (++_i; _i < 4; ++_i)\t\t\t\t\t\t\\\n- X##_f[_i] = 0;\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/* Right shift with sticky-lsb.\n- * What this actually means is that we do a standard right-shift,\n- * but that if any of the bits that fall off the right hand side\n- * were one then we always set the LSbit.\n- */\n-#define _FP_FRAC_SRS_4(X,N,size)\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- _FP_I_TYPE _up, _down, _skip, _i;\t\t\t\t\t\\\n- _FP_W_TYPE _s;\t\t\t\t\t\t\t\\\n- _skip = (N) / _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _down = (N) % _FP_W_TYPE_SIZE;\t\t\t\t\t\\\n- _up = _FP_W_TYPE_SIZE - _down;\t\t\t\t\t\\\n- for (_s = _i = 0; _i < _skip; ++_i)\t\t\t\t\t\\\n- _s |= X##_f[_i];\t\t\t\t\t\t\t\\\n- _s |= X##_f[_i] << _up;\t\t\t\t\t\t\\\n-/* s is now != 0 if we want to set the LSbit */ \\\n- for (_i = 0; _i < 3-_skip; ++_i)\t\t\t\t\t\\\n- X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up;\t\\\n- X##_f[_i] = X##_f[3] >> _down;\t\t\t\t\t\\\n- for (++_i; _i < 4; ++_i)\t\t\t\t\t\t\\\n- X##_f[_i] = 0;\t\t\t\t\t\t\t\\\n- /* don't fix the LSB until the very end when we're sure f[0] is stable */ \\\n- X##_f[0] |= (_s != 0); \\\n- } while (0)\n-\n-#define _FP_FRAC_ADD_4(R,X,Y)\t\t\t\t\t\t\\\n- __FP_FRAC_ADD_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0],\t\t\\\n-\t\t X##_f[3], X##_f[2], X##_f[1], X##_f[0],\t\t\\\n-\t\t Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])\n-\n-#define _FP_FRAC_SUB_4(R,X,Y) \\\n- __FP_FRAC_SUB_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0],\t\t\\\n-\t\t X##_f[3], X##_f[2], X##_f[1], X##_f[0],\t\t\\\n-\t\t Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])\n-\n-#define _FP_FRAC_ADDI_4(X,I) \\\n- __FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)\n-\n-#define _FP_ZEROFRAC_4 0,0,0,0\n-#define _FP_MINFRAC_4 0,0,0,1\n-\n-#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)\n-#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)\n-#define _FP_FRAC_OVERP_4(fs,X) (X##_f[0] & _FP_OVERFLOW_##fs)\n-\n-#define _FP_FRAC_EQ_4(X,Y) \\\n- (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \\\n- && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])\n-\n-#define _FP_FRAC_GT_4(X,Y) \\\n- (X##_f[3] > Y##_f[3] || \\\n- (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \\\n- (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \\\n- (X##_f[1] == Y##_f[1] && X##_f[0] > Y##_f[0]) \\\n- )) \\\n- )) \\\n- )\n-\n-#define _FP_FRAC_GE_4(X,Y) \\\n- (X##_f[3] > Y##_f[3] || \\\n- (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \\\n- (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \\\n- (X##_f[1] == Y##_f[1] && X##_f[0] >= Y##_f[0]) \\\n- )) \\\n- )) \\\n- )\n-\n-\n-#define _FP_FRAC_CLZ_4(R,X) \\\n- do { \\\n- if (X##_f[3]) \\\n- { \\\n- __FP_CLZ(R,X##_f[3]); \\\n- } \\\n- else if (X##_f[2]) \\\n- { \\\n- __FP_CLZ(R,X##_f[2]); \\\n- R += _FP_W_TYPE_SIZE; \\\n- } \\\n- else if (X##_f[1]) \\\n- { \\\n- __FP_CLZ(R,X##_f[2]); \\\n- R += _FP_W_TYPE_SIZE*2; \\\n- } \\\n- else \\\n- { \\\n- __FP_CLZ(R,X##_f[0]); \\\n- R += _FP_W_TYPE_SIZE*3; \\\n- } \\\n- } while(0)\n-\n-\n-#define _FP_UNPACK_RAW_4(fs, X, val) \\\n- do { \\\n- union _FP_UNION_##fs _flo; _flo.flt = (val); \t\\\n- X##_f[0] = _flo.bits.frac0; \\\n- X##_f[1] = _flo.bits.frac1; \\\n- X##_f[2] = _flo.bits.frac2; \\\n- X##_f[3] = _flo.bits.frac3; \\\n- X##_e = _flo.bits.exp; \\\n- X##_s = _flo.bits.sign; \\\n- } while (0)\n-\n-#define _FP_PACK_RAW_4(fs, val, X) \\\n- do { \\\n- union _FP_UNION_##fs _flo;\t\t\t\t\t\\\n- _flo.bits.frac0 = X##_f[0]; \\\n- _flo.bits.frac1 = X##_f[1]; \\\n- _flo.bits.frac2 = X##_f[2]; \\\n- _flo.bits.frac3 = X##_f[3]; \\\n- _flo.bits.exp = X##_e; \\\n- _flo.bits.sign = X##_s; \\\n- (val) = _flo.flt; \t\\\n- } while (0)\n-\n-\n-/*\n- * Internals\n- */\n-\n-#define __FP_FRAC_SET_4(X,I3,I2,I1,I0)\t\t\t\t\t\\\n- (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)\n-\n-#ifndef __FP_FRAC_ADD_4\n-#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0)\t\\\n- do {\t\t\t\t\t\t\t\t\\\n- int _c1, _c2, _c3;\t\t\t\t\t\t\\\n- r0 = x0 + y0;\t\t\t\t\t\t\\\n- _c1 = r0 < x0;\t\t\t\t\t\t\\\n- r1 = x1 + y1;\t\t\t\t\t\t\\\n- _c2 = r1 < x1;\t\t\t\t\t\t\\\n- r1 += _c1;\t\t\t\t\t\t\t\\\n- _c2 |= r1 < _c1;\t\t\t\t\t\t\\\n- r2 = x2 + y2;\t\t\t\t\t\t\\\n- _c3 = r2 < x2;\t\t\t\t\t\t\\\n- r2 += _c2;\t\t\t\t\t\t\t\\\n- _c3 |= r2 < _c2;\t\t\t\t\t\t\\\n- r3 = x3 + y3 + _c3;\t\t\t\t\t\t\\\n- } while (0)\n-#endif\n-\n-#ifndef __FP_FRAC_SUB_4\n-#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0)\t\\\n- do {\t\t\t\t\t\t\t\t\\\n- int _c1, _c2, _c3;\t\t\t\t\t\t\\\n- r0 = x0 - y0;\t\t\t\t\t\t\\\n- _c1 = r0 > x0;\t\t\t\t\t\t\\\n- r1 = x1 - y1;\t\t\t\t\t\t\\\n- _c2 = r1 > x1;\t\t\t\t\t\t\\\n- r1 -= _c1;\t\t\t\t\t\t\t\\\n- _c2 |= r1 > _c1;\t\t\t\t\t\t\\\n- r2 = x2 - y2;\t\t\t\t\t\t\\\n- _c3 = r2 > x2;\t\t\t\t\t\t\\\n- r2 -= _c2;\t\t\t\t\t\t\t\\\n- _c3 |= r2 > _c2;\t\t\t\t\t\t\\\n- r3 = x3 - y3 - _c3;\t\t\t\t\t\t\\\n- } while (0)\n-#endif\n-\n-#ifndef __FP_FRAC_ADDI_4\n-/* I always wanted to be a lisp programmer :-> */\n-#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \\\n- (x3 += ((x2 += ((x1 += ((x0 += i) < x0)) < x1) < x2)))\n-#endif\n-\n-/* Convert FP values between word sizes. This appears to be more\n- * complicated than I'd have expected it to be, so these might be\n- * wrong... These macros are in any case somewhat bogus because they\n- * use information about what various FRAC_n variables look like\n- * internally [eg, that 2 word vars are X_f0 and x_f1]. But so do\n- * the ones in op-2.h and op-1.h.\n- */\n-#define _FP_FRAC_CONV_1_4(dfs, sfs, D, S) \\\n- do { \\\n- _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \\\n- _FP_WFRACBITS_##sfs); \\\n- D##_f = S##_f[0]; \\\n- } while (0)\n-\n-#define _FP_FRAC_CONV_2_4(dfs, sfs, D, S) \\\n- do { \\\n- _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \\\n- _FP_WFRACBITS_##sfs); \\\n- D##_f0 = S##_f[0]; \\\n- D##_f1 = S##_f[1]; \\\n- } while (0)\n-\n-/* Assembly/disassembly for converting to/from integral types.\n- * No shifting or overflow handled here.\n- */\n-/* Put the FP value X into r, which is an integer of size rsize. */\n-#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \\\n- do { \\\n- if (rsize <= _FP_W_TYPE_SIZE) \\\n- r = X##_f[0]; \\\n- else if (rsize <= 2*_FP_W_TYPE_SIZE) \\\n- { \\\n- r = X##_f[1]; \\\n- r <<= _FP_W_TYPE_SIZE; \\\n- r += X##_f[0]; \\\n- } \\\n- else \\\n- { \\\n- /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \\\n- /* and int == 4words as a single case. */ \\\n- r = X##_f[3]; \\\n- r <<= _FP_W_TYPE_SIZE; \\\n- r += X##_f[2]; \\\n- r <<= _FP_W_TYPE_SIZE; \\\n- r += X##_f[1]; \\\n- r <<= _FP_W_TYPE_SIZE; \\\n- r += X##_f[0]; \\\n- } \\\n- } while (0)\n-\n-/* \"No disassemble Number Five!\" */\n-/* move an integer of size rsize into X's fractional part. We rely on\n- * the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid\n- * having to mask the values we store into it.\n- */\n-#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \\\n- do { \\\n- X##_f[0] = r; \\\n- X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \\\n- X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \\\n- X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \\\n- } while (0)\n-\n-#define _FP_FRAC_CONV_4_1(dfs, sfs, D, S) \\\n- do { \\\n- D##_f[0] = S##_f; \\\n- D##_f[1] = D##_f[2] = D##_f[3] = 0; \\\n- _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \\\n- } while (0)\n-\n-#define _FP_FRAC_CONV_4_2(dfs, sfs, D, S) \\\n- do { \\\n- D##_f[0] = S##_f0; \\\n- D##_f[1] = S##_f1; \\\n- D##_f[2] = D##_f[3] = 0; \\\n- _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \\\n- } while (0)\n-\n-/* FIXME! This has to be written */\n-#define _FP_SQRT_MEAT_4(R, S, T, X, q)\ndiff --git a/arch/powerpc/math-emu/op-common.h b/arch/powerpc/math-emu/op-common.h\ndeleted file mode 100644\nindex afb82b6..0000000\n--- a/arch/powerpc/math-emu/op-common.h\n+++ /dev/null\n@@ -1,688 +0,0 @@\n-#define _FP_DECL(wc, X)\t\t\t\\\n- _FP_I_TYPE X##_c, X##_s, X##_e;\t\\\n- _FP_FRAC_DECL_##wc(X)\n-\n-/*\n- * Finish truely unpacking a native fp value by classifying the kind\n- * of fp value and normalizing both the exponent and the fraction.\n- */\n-\n-#define _FP_UNPACK_CANONICAL(fs, wc, X)\t\t\t\t\t\\\n-do {\t\t\t\t\t\t\t\t\t\\\n- switch (X##_e)\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n- default:\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_HIGH_##wc(X) |= _FP_IMPLBIT_##fs;\t\t\t\t\\\n- _FP_FRAC_SLL_##wc(X, _FP_WORKBITS);\t\t\t\t\t\\\n- X##_e -= _FP_EXPBIAS_##fs;\t\t\t\t\t\t\\\n- X##_c = FP_CLS_NORMAL;\t\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- case 0:\t\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_ZEROP_##wc(X))\t\t\t\t\t\t\\\n- X##_c = FP_CLS_ZERO;\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\t/* a denormalized number */\t\t\t\t\t\\\n-\t_FP_I_TYPE _shift;\t\t\t\t\t\t\\\n-\t_FP_FRAC_CLZ_##wc(_shift, X);\t\t\t\t\t\\\n-\t_shift -= _FP_FRACXBITS_##fs;\t\t\t\t\t\\\n-\t_FP_FRAC_SLL_##wc(X, (_shift+_FP_WORKBITS));\t\t\t\\\n-\tX##_e -= _FP_EXPBIAS_##fs - 1 + _shift;\t\t\t\t\\\n-\tX##_c = FP_CLS_NORMAL;\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n- case _FP_EXPMAX_##fs:\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_ZEROP_##wc(X))\t\t\t\t\t\t\\\n- X##_c = FP_CLS_INF;\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- /* we don't differentiate between signaling and quiet nans */\t\\\n- X##_c = FP_CLS_NAN;\t\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n-} while (0)\n-\n-\n-/*\n- * Before packing the bits back into the native fp result, take care\n- * of such mundane things as rounding and overflow. Also, for some\n- * kinds of fp values, the original parts may not have been fully\n- * extracted -- but that is ok, we can regenerate them now.\n- */\n-\n-#define _FP_PACK_CANONICAL(fs, wc, X)\t\t\t\t\\\n-({int __ret = 0;\t\t\t\t\t\t\\\n- switch (X##_c)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n- case FP_CLS_NORMAL:\t\t\t\t\t\t\\\n- X##_e += _FP_EXPBIAS_##fs;\t\t\t\t\t\\\n- if (X##_e > 0)\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n-\t__ret |= _FP_ROUND(wc, X);\t\t\t\t\\\n-\tif (_FP_FRAC_OVERP_##wc(fs, X))\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t _FP_FRAC_SRL_##wc(X, (_FP_WORKBITS+1));\t\t\\\n-\t X##_e++;\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\\\n-\telse\t\t\t\t\t\t\t\\\n-\t _FP_FRAC_SRL_##wc(X, _FP_WORKBITS);\t\t\t\\\n-\tif (X##_e >= _FP_EXPMAX_##fs)\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t /* overflow to infinity */\t\t\t\t\\\n-\t X##_e = _FP_EXPMAX_##fs;\t\t\t\t\\\n-\t _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\\\n- __ret |= EFLAG_OVERFLOW;\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n-\t/* we've got a denormalized number */\t\t\t\\\n-\tX##_e = -X##_e + 1;\t\t\t\t\t\\\n-\tif (X##_e <= _FP_WFRACBITS_##fs)\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs);\t\\\n-\t _FP_FRAC_SLL_##wc(X, 1);\t\t\t\t\\\n-\t if (_FP_FRAC_OVERP_##wc(fs, X))\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t X##_e = 1;\t\t\t\t\t\\\n-\t _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\\\n-\t }\t\t\t\t\t\t\t\\\n-\t else\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t\tX##_e = 0;\t\t\t\t\t\\\n-\t\t_FP_FRAC_SRL_##wc(X, _FP_WORKBITS+1);\t\t\\\n- __ret |= EFLAG_UNDERFLOW;\t\t\t\\\n-\t }\t\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\\\n-\telse\t\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\\\n-\t /* underflow to zero */\t\t\t\t\\\n-\t X##_e = 0;\t\t\t\t\t\t\\\n-\t _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\\\n- __ret |= EFLAG_UNDERFLOW;\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- case FP_CLS_ZERO:\t\t\t\t\t\t\\\n- X##_e = 0;\t\t\t\t\t\t\t\\\n- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\t\\\n- break;\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- case FP_CLS_INF:\t\t\t\t\t\t\\\n- X##_e = _FP_EXPMAX_##fs;\t\t\t\t\t\\\n- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\t\\\n- break;\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\\\n- case FP_CLS_NAN:\t\t\t\t\t\t\\\n- X##_e = _FP_EXPMAX_##fs;\t\t\t\t\t\\\n- if (!_FP_KEEPNANFRACP)\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n-\t_FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs);\t\t\t\\\n-\tX##_s = 0;\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\\\n- _FP_FRAC_HIGH_##wc(X) |= _FP_QNANBIT_##fs;\t\t\\\n- break;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- __ret;\t\t\t\t\t\t\t\\\n-})\n-\n-\n-/*\n- * Main addition routine. The input values should be cooked.\n- */\n-\n-#define _FP_ADD(fs, wc, R, X, Y)\t\t\t\t\t \\\n-do {\t\t\t\t\t\t\t\t\t \\\n- switch (_FP_CLS_COMBINE(X##_c, Y##_c))\t\t\t\t \\\n- {\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL):\t\t\t \\\n- {\t\t\t\t\t\t\t\t\t \\\n- /* shift the smaller number so that its exponent matches the larger */ \\\n- _FP_I_TYPE diff = X##_e - Y##_e;\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- if (diff < 0)\t\t\t\t\t\t\t \\\n-\t{\t\t\t\t\t\t\t\t \\\n-\t diff = -diff;\t\t\t\t\t\t\t \\\n-\t if (diff <= _FP_WFRACBITS_##fs)\t\t\t\t \\\n-\t _FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs);\t\t \\\n-\t else if (!_FP_FRAC_ZEROP_##wc(X))\t\t\t\t \\\n-\t _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc);\t\t\t \\\n-\t else\t\t\t\t\t\t\t\t \\\n-\t _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\t \\\n-\t R##_e = Y##_e;\t\t\t\t\t\t \\\n-\t}\t\t\t\t\t\t\t\t \\\n- else\t\t\t\t\t\t\t\t \\\n-\t{\t\t\t\t\t\t\t\t \\\n-\t if (diff > 0)\t\t\t\t\t\t\t \\\n-\t {\t\t\t\t\t\t\t\t \\\n-\t if (diff <= _FP_WFRACBITS_##fs)\t\t\t\t \\\n-\t _FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs);\t\t \\\n-\t else if (!_FP_FRAC_ZEROP_##wc(Y))\t\t\t\t \\\n-\t _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc);\t\t\t \\\n-\t else\t\t\t\t\t\t\t \\\n-\t _FP_FRAC_SET_##wc(Y, _FP_ZEROFRAC_##wc);\t\t \\\n-\t }\t\t\t\t\t\t\t\t \\\n-\t R##_e = X##_e;\t\t\t\t\t\t \\\n-\t}\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- R##_c = FP_CLS_NORMAL;\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- if (X##_s == Y##_s)\t\t\t\t\t\t \\\n-\t{\t\t\t\t\t\t\t\t \\\n-\t R##_s = X##_s;\t\t\t\t\t\t \\\n-\t _FP_FRAC_ADD_##wc(R, X, Y);\t\t\t\t\t \\\n-\t if (_FP_FRAC_OVERP_##wc(fs, R))\t\t\t\t \\\n-\t {\t\t\t\t\t\t\t\t \\\n-\t _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs);\t\t \\\n-\t R##_e++;\t\t\t\t\t\t\t \\\n-\t }\t\t\t\t\t\t\t\t \\\n-\t}\t\t\t\t\t\t\t\t \\\n- else\t\t\t\t\t\t\t\t \\\n-\t{\t\t\t\t\t\t\t\t \\\n-\t R##_s = X##_s;\t\t\t\t\t\t \\\n-\t _FP_FRAC_SUB_##wc(R, X, Y);\t\t\t\t\t \\\n-\t if (_FP_FRAC_ZEROP_##wc(R))\t\t\t\t\t \\\n-\t {\t\t\t\t\t\t\t\t \\\n-\t /* return an exact zero */\t\t\t\t \\\n-\t if (FP_ROUNDMODE == FP_RND_MINF)\t\t\t\t \\\n-\t\tR##_s |= Y##_s;\t\t\t\t\t\t \\\n-\t else\t\t\t\t\t\t\t \\\n-\t\tR##_s &= Y##_s;\t\t\t\t\t\t \\\n-\t R##_c = FP_CLS_ZERO;\t\t\t\t\t \\\n-\t }\t\t\t\t\t\t\t\t \\\n-\t else\t\t\t\t\t\t\t\t \\\n-\t {\t\t\t\t\t\t\t\t \\\n-\t if (_FP_FRAC_NEGP_##wc(R))\t\t\t\t \\\n-\t\t{\t\t\t\t\t\t\t \\\n-\t\t _FP_FRAC_SUB_##wc(R, Y, X);\t\t\t\t \\\n-\t\t R##_s = Y##_s;\t\t\t\t\t \\\n-\t\t}\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n-\t /* renormalize after subtraction */\t\t\t \\\n-\t _FP_FRAC_CLZ_##wc(diff, R);\t\t\t\t \\\n-\t diff -= _FP_WFRACXBITS_##fs;\t\t\t\t \\\n-\t if (diff)\t\t\t\t\t\t\t \\\n-\t\t{\t\t\t\t\t\t\t \\\n-\t\t R##_e -= diff;\t\t\t\t\t \\\n-\t\t _FP_FRAC_SLL_##wc(R, diff);\t\t\t\t \\\n-\t\t}\t\t\t\t\t\t\t \\\n-\t }\t\t\t\t\t\t\t\t \\\n-\t}\t\t\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n- }\t\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN):\t\t\t\t \\\n- _FP_CHOOSENAN(fs, wc, R, X, Y);\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):\t\t\t \\\n- R##_e = X##_e;\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL):\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):\t\t\t\t \\\n- _FP_FRAC_COPY_##wc(R, X);\t\t\t\t\t\t \\\n- R##_s = X##_s;\t\t\t\t\t\t\t \\\n- R##_c = X##_c;\t\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL):\t\t\t \\\n- R##_e = Y##_e;\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN):\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):\t\t\t\t \\\n- _FP_FRAC_COPY_##wc(R, Y);\t\t\t\t\t\t \\\n- R##_s = Y##_s;\t\t\t\t\t\t\t \\\n- R##_c = Y##_c;\t\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):\t\t\t\t \\\n- if (X##_s != Y##_s)\t\t\t\t\t\t\t \\\n- {\t\t\t\t\t\t\t\t\t \\\n-\t/* +INF + -INF => NAN */\t\t\t\t\t \\\n-\t_FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);\t\t\t\t \\\n-\tR##_s = X##_s ^ Y##_s;\t\t\t\t\t\t \\\n-\tR##_c = FP_CLS_NAN;\t\t\t\t\t\t \\\n-\tbreak;\t\t\t\t\t\t\t\t \\\n- }\t\t\t\t\t\t\t\t\t \\\n- /* FALLTHRU */\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO):\t\t\t\t \\\n- R##_s = X##_s;\t\t\t\t\t\t\t \\\n- R##_c = FP_CLS_INF;\t\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF):\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF):\t\t\t\t \\\n- R##_s = Y##_s;\t\t\t\t\t\t\t \\\n- R##_c = FP_CLS_INF;\t\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):\t\t\t \\\n- /* make sure the sign is correct */\t\t\t\t\t \\\n- if (FP_ROUNDMODE == FP_RND_MINF)\t\t\t\t\t \\\n- R##_s = X##_s | Y##_s;\t\t\t\t\t\t \\\n- else\t\t\t\t\t\t\t\t \\\n- R##_s = X##_s & Y##_s;\t\t\t\t\t\t \\\n- R##_c = FP_CLS_ZERO;\t\t\t\t\t\t \\\n- break;\t\t\t\t\t\t\t\t \\\n-\t\t\t\t\t\t\t\t\t \\\n- default:\t\t\t\t\t\t\t\t \\\n- abort();\t\t\t\t\t\t\t\t \\\n- }\t\t\t\t\t\t\t\t\t \\\n-} while (0)\n-\n-\n-/*\n- * Main negation routine. FIXME -- when we care about setting exception\n- * bits reliably, this will not do. We should examine all of the fp classes.\n- */\n-\n-#define _FP_NEG(fs, wc, R, X)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_FRAC_COPY_##wc(R, X);\t\t\\\n- R##_c = X##_c;\t\t\t\\\n- R##_e = X##_e;\t\t\t\\\n- R##_s = 1 ^ X##_s;\t\t\t\\\n- } while (0)\n-\n-\n-/*\n- * Main multiplication routine. The input values should be cooked.\n- */\n-\n-#define _FP_MUL(fs, wc, R, X, Y)\t\t\t\\\n-do {\t\t\t\t\t\t\t\\\n- R##_s = X##_s ^ Y##_s;\t\t\t\t\\\n- switch (_FP_CLS_COMBINE(X##_c, Y##_c))\t\t\\\n- {\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL):\t\\\n- R##_c = FP_CLS_NORMAL;\t\t\t\t\\\n- R##_e = X##_e + Y##_e + 1;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- _FP_MUL_MEAT_##fs(R,X,Y);\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- if (_FP_FRAC_OVERP_##wc(fs, R))\t\t\t\\\n- _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs);\t\\\n- else\t\t\t\t\t\t\\\n- R##_e--;\t\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN):\t\t\\\n- _FP_CHOOSENAN(fs, wc, R, X, Y);\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):\t\t\\\n- R##_s = X##_s;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):\t\\\n- _FP_FRAC_COPY_##wc(R, X);\t\t\t\t\\\n- R##_c = X##_c;\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):\t\t\\\n- R##_s = Y##_s;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):\t\\\n- _FP_FRAC_COPY_##wc(R, Y);\t\t\t\t\\\n- R##_c = Y##_c;\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF):\t\t\\\n- R##_c = FP_CLS_NAN;\t\t\t\t\t\\\n- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- default:\t\t\t\t\t\t\\\n- abort();\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\\\n-} while (0)\n-\n-\n-/*\n- * Main division routine. The input values should be cooked.\n- */\n-\n-#define _FP_DIV(fs, wc, R, X, Y)\t\t\t\\\n-do {\t\t\t\t\t\t\t\\\n- R##_s = X##_s ^ Y##_s;\t\t\t\t\\\n- switch (_FP_CLS_COMBINE(X##_c, Y##_c))\t\t\\\n- {\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL):\t\\\n- R##_c = FP_CLS_NORMAL;\t\t\t\t\\\n- R##_e = X##_e - Y##_e;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- _FP_DIV_MEAT_##fs(R,X,Y);\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN):\t\t\\\n- _FP_CHOOSENAN(fs, wc, R, X, Y);\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):\t\t\\\n- R##_s = X##_s;\t\t\t\t\t\\\n- _FP_FRAC_COPY_##wc(R, X);\t\t\t\t\\\n- R##_c = X##_c;\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):\t\t\\\n- R##_s = Y##_s;\t\t\t\t\t\\\n- _FP_FRAC_COPY_##wc(R, Y);\t\t\t\t\\\n- R##_c = Y##_c;\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL):\t\\\n- R##_c = FP_CLS_ZERO;\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):\t\\\n- R##_c = FP_CLS_INF;\t\t\t\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):\t\t\\\n- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):\t\\\n- R##_c = FP_CLS_NAN;\t\t\t\t\t\\\n- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);\t\t\\\n- break;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n- default:\t\t\t\t\t\t\\\n- abort();\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\\\n-} while (0)\n-\n-\n-/*\n- * Main differential comparison routine. The inputs should be raw not\n- * cooked. The return is -1,0,1 for normal values, 2 otherwise.\n- */\n-\n-#define _FP_CMP(fs, wc, ret, X, Y, un)\t\t\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- /* NANs are unordered */\t\t\t\t\t\t\\\n- if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X))\t\t\\\n-\t|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y)))\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tret = un;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n- int __x_zero = (!X##_e && _FP_FRAC_ZEROP_##wc(X)) ? 1 : 0;\t\\\n- int __y_zero = (!Y##_e && _FP_FRAC_ZEROP_##wc(Y)) ? 1 : 0;\t\\\n-\t\t\t\t\t\t\t\t\t\\\n-\tif (__x_zero && __y_zero)\t\t\t\t\t\\\n-\t ret = 0;\t\t\t\t\t\t\t\\\n-\telse if (__x_zero)\t\t\t\t\t\t\\\n-\t ret = Y##_s ? 1 : -1;\t\t\t\t\t\t\\\n-\telse if (__y_zero)\t\t\t\t\t\t\\\n-\t ret = X##_s ? -1 : 1;\t\t\t\t\t\t\\\n-\telse if (X##_s != Y##_s)\t\t\t\t\t\\\n-\t ret = X##_s ? -1 : 1;\t\t\t\t\t\t\\\n-\telse if (X##_e > Y##_e)\t\t\t\t\t\t\\\n-\t ret = X##_s ? -1 : 1;\t\t\t\t\t\t\\\n-\telse if (X##_e < Y##_e)\t\t\t\t\t\t\\\n-\t ret = X##_s ? 1 : -1;\t\t\t\t\t\t\\\n-\telse if (_FP_FRAC_GT_##wc(X, Y))\t\t\t\t\\\n-\t ret = X##_s ? -1 : 1;\t\t\t\t\t\t\\\n-\telse if (_FP_FRAC_GT_##wc(Y, X))\t\t\t\t\\\n-\t ret = X##_s ? 1 : -1;\t\t\t\t\t\t\\\n-\telse\t\t\t\t\t\t\t\t\\\n-\t ret = 0;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-/* Simplification for strict equality. */\n-\n-#define _FP_CMP_EQ(fs, wc, ret, X, Y)\t\t\t\t\t \\\n- do {\t\t\t\t\t\t\t\t\t \\\n- /* NANs are unordered */\t\t\t\t\t\t \\\n- if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X))\t\t \\\n-\t|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y)))\t \\\n- {\t\t\t\t\t\t\t\t\t \\\n-\tret = 1;\t\t\t\t\t\t\t \\\n- }\t\t\t\t\t\t\t\t\t \\\n- else\t\t\t\t\t\t\t\t \\\n- {\t\t\t\t\t\t\t\t\t \\\n-\tret = !(X##_e == Y##_e\t\t\t\t\t\t \\\n-\t\t&& _FP_FRAC_EQ_##wc(X, Y)\t\t\t\t \\\n-\t\t&& (X##_s == Y##_s || !X##_e && _FP_FRAC_ZEROP_##wc(X))); \\\n- }\t\t\t\t\t\t\t\t\t \\\n- } while (0)\n-\n-/*\n- * Main square root routine. The input value should be cooked.\n- */\n-\n-#define _FP_SQRT(fs, wc, R, X)\t\t\t\t\t\t\\\n-do {\t\t\t\t\t\t\t\t\t\\\n- _FP_FRAC_DECL_##wc(T); _FP_FRAC_DECL_##wc(S);\t\t\t\\\n- _FP_W_TYPE q;\t\t\t\t\t\t\t\\\n- switch (X##_c)\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n- case FP_CLS_NAN:\t\t\t\t\t\t\t\\\n- \tR##_s = 0;\t\t\t\t\t\t\t\\\n- \tR##_c = FP_CLS_NAN;\t\t\t\t\t\t\\\n- \t_FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc);\t\t\t\\\n- \tbreak;\t\t\t\t\t\t\t\t\\\n- case FP_CLS_INF:\t\t\t\t\t\t\t\\\n- \tif (X##_s)\t\t\t\t\t\t\t\\\n- \t {\t\t\t\t\t\t\t\t\\\n- \t R##_s = 0;\t\t\t\t\t\t\t\\\n-\t R##_c = FP_CLS_NAN; /* sNAN */\t\t\t\t\\\n- \t }\t\t\t\t\t\t\t\t\\\n- \telse\t\t\t\t\t\t\t\t\\\n- \t {\t\t\t\t\t\t\t\t\\\n- \t R##_s = 0;\t\t\t\t\t\t\t\\\n- \t R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */\t\t\t\\\n- \t }\t\t\t\t\t\t\t\t\\\n- \tbreak;\t\t\t\t\t\t\t\t\\\n- case FP_CLS_ZERO:\t\t\t\t\t\t\t\\\n-\tR##_s = X##_s;\t\t\t\t\t\t\t\\\n- \tR##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */\t\t\t\\\n-\tbreak;\t\t\t\t\t\t\t\t\\\n- case FP_CLS_NORMAL:\t\t\t\t\t\t\t\\\n- \tR##_s = 0;\t\t\t\t\t\t\t\\\n- if (X##_s)\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\\\n-\t R##_c = FP_CLS_NAN; /* sNAN */\t\t\t\t\\\n-\t break;\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\\\n- \tR##_c = FP_CLS_NORMAL;\t\t\t\t\t\t\\\n- if (X##_e & 1)\t\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_##wc(X, 1);\t\t\t\t\t\\\n- R##_e = X##_e >> 1;\t\t\t\t\t\t\\\n- _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc);\t\t\t\\\n- _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc);\t\t\t\\\n- q = _FP_OVERFLOW_##fs;\t\t\t\t\t\t\\\n- _FP_FRAC_SLL_##wc(X, 1);\t\t\t\t\t\\\n- _FP_SQRT_MEAT_##wc(R, S, T, X, q);\t\t\t\t\\\n- _FP_FRAC_SRL_##wc(R, 1);\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-/*\n- * Convert from FP to integer\n- */\n-\n-/* \"When a NaN, infinity, large positive argument >= 2147483648.0, or\n- * large negative argument <= -2147483649.0 is converted to an integer,\n- * the invalid_current bit...should be set and fp_exception_IEEE_754 should\n- * be raised. If the floating point invalid trap is disabled, no trap occurs\n- * and a numerical result is generated: if the sign bit of the operand\n- * is 0, the result is 2147483647; if the sign bit of the operand is 1,\n- * the result is -2147483648.\"\n- * Similarly for conversion to extended ints, except that the boundaries\n- * are >= 2^63, <= -(2^63 + 1), and the results are 2^63 + 1 for s=0 and\n- * -2^63 for s=1.\n- * -- SPARC Architecture Manual V9, Appendix B, which specifies how\n- * SPARCs resolve implementation dependencies in the IEEE-754 spec.\n- * I don't believe that the code below follows this. I'm not even sure\n- * it's right!\n- * It doesn't cope with needing to convert to an n bit integer when there\n- * is no n bit integer type. Fortunately gcc provides long long so this\n- * isn't a problem for sparc32.\n- * I have, however, fixed its NaN handling to conform as above.\n- * -- PMM 02/1998\n- * NB: rsigned is not 'is r declared signed?' but 'should the value stored\n- * in r be signed or unsigned?'. r is always(?) declared unsigned.\n- * Comments below are mine, BTW -- PMM\n- */\n-#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned)\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- switch (X##_c)\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n- case FP_CLS_NORMAL:\t\t\t\t\t\t\\\n-\tif (X##_e < 0)\t\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t /* case FP_CLS_NAN: see above! */\t\t\t\t\\\n-\t case FP_CLS_ZERO:\t\t\t\t\t\t\\\n-\t r = 0;\t\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\telse if (X##_e >= rsize - (rsigned != 0))\t\t\t\\\n-\t {\t/* overflow */\t\t\t\t\t\t\\\n-\t case FP_CLS_NAN: \\\n- case FP_CLS_INF:\t\t\t\t\t\t\\\n-\t if (rsigned)\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t\tr = 1;\t\t\t\t\t\t\t\\\n-\t\tr <<= rsize - 1;\t\t\t\t\t\\\n-\t\tr -= 1 - X##_s;\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\t else\t\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t\tr = 0;\t\t\t\t\t\t\t\\\n-\t\tif (!X##_s)\t\t\t\t\t\t\\\n-\t\t r = ~r;\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\telse\t\t\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t if (_FP_W_TYPE_SIZE*wc < rsize)\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t\t_FP_FRAC_ASSEMBLE_##wc(r, X, rsize);\t\t\t\\\n-\t\tr <<= X##_e - _FP_WFRACBITS_##fs;\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\t else\t\t\t\t\t\t\t\\\n-\t {\t\t\t\t\t\t\t\t\\\n-\t\tif (X##_e >= _FP_WFRACBITS_##fs)\t\t\t\\\n-\t\t _FP_FRAC_SLL_##wc(X, (X##_e - _FP_WFRACBITS_##fs + 1));\\\n-\t\telse\t\t\t\t\t\t\t\\\n-\t\t _FP_FRAC_SRL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1));\\\n-\t\t_FP_FRAC_ASSEMBLE_##wc(r, X, rsize);\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\t if (rsigned && X##_s)\t\t\t\t\t\\\n-\t r = -r;\t\t\t\t\t\t\t\\\n-\t }\t\t\t\t\t\t\t\t\\\n-\tbreak;\t\t\t\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype)\t\t\t\\\n- do {\t\t\t\t\t\t\t\t\t\\\n- if (r)\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_c = FP_CLS_NORMAL;\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n-\tif ((X##_s = (r < 0)))\t\t\t\t\t\t\\\n-\t r = -r;\t\t\t\t\t\t\t\\\n-\t/* Note that `r' is now considered unsigned, so we don't have\t\\\n-\t to worry about the single signed overflow case. */\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n-\tif (rsize <= _FP_W_TYPE_SIZE)\t\t\t\t\t\\\n-\t __FP_CLZ(X##_e, r);\t\t\t\t\t\t\\\n-\telse\t\t\t\t\t\t\t\t\\\n-\t __FP_CLZ_2(X##_e, (_FP_W_TYPE)(r >> _FP_W_TYPE_SIZE), \t\\\n-\t\t (_FP_W_TYPE)r);\t\t\t\t\t\\\n-\tif (rsize < _FP_W_TYPE_SIZE)\t\t\t\t\t\\\n-\t\tX##_e -= (_FP_W_TYPE_SIZE - rsize);\t\t\t\\\n-\tX##_e = rsize - X##_e - 1;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n-\tif (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e)\t\\\n-\t __FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize);\t\\\n-\tr &= ~((_FP_W_TYPE)1 << X##_e);\t\t\t\t\t\\\n-\t_FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize);\t\\\n-\t_FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1));\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- else\t\t\t\t\t\t\t\t\\\n- {\t\t\t\t\t\t\t\t\t\\\n-\tX##_c = FP_CLS_ZERO, X##_s = 0;\t\t\t\t\t\\\n- }\t\t\t\t\t\t\t\t\t\\\n- } while (0)\n-\n-\n-#define FP_CONV(dfs,sfs,dwc,swc,D,S)\t\t\t\\\n- do {\t\t\t\t\t\t\t\\\n- _FP_FRAC_CONV_##dwc##_##swc(dfs, sfs, D, S);\t\\\n- D##_e = S##_e;\t\t\t\t\t\\\n- D##_c = S##_c;\t\t\t\t\t\\\n- D##_s = S##_s;\t\t\t\t\t\\\n- } while (0)\n-\n-/*\n- * Helper primitives.\n- */\n-\n-/* Count leading zeros in a word. */\n-\n-#ifndef __FP_CLZ\n-#if _FP_W_TYPE_SIZE < 64\n-/* this is just to shut the compiler up about shifts > word length -- PMM 02/1998 */\n-#define __FP_CLZ(r, x)\t\t\t\t\\\n- do {\t\t\t\t\t\t\\\n- _FP_W_TYPE _t = (x);\t\t\t\\\n- r = _FP_W_TYPE_SIZE - 1;\t\t\t\\\n- if (_t > 0xffff) r -= 16;\t\t\t\\\n- if (_t > 0xffff) _t >>= 16;\t\t\t\\\n- if (_t > 0xff) r -= 8;\t\t\t\\\n- if (_t > 0xff) _t >>= 8;\t\t\t\\\n- if (_t & 0xf0) r -= 4;\t\t\t\\\n- if (_t & 0xf0) _t >>= 4;\t\t\t\\\n- if (_t & 0xc) r -= 2;\t\t\t\\\n- if (_t & 0xc) _t >>= 2;\t\t\t\\\n- if (_t & 0x2) r -= 1;\t\t\t\\\n- } while (0)\n-#else /* not _FP_W_TYPE_SIZE < 64 */\n-#define __FP_CLZ(r, x)\t\t\t\t\\\n- do {\t\t\t\t\t\t\\\n- _FP_W_TYPE _t = (x);\t\t\t\\\n- r = _FP_W_TYPE_SIZE - 1;\t\t\t\\\n- if (_t > 0xffffffff) r -= 32;\t\t\\\n- if (_t > 0xffffffff) _t >>= 32;\t\t\\\n- if (_t > 0xffff) r -= 16;\t\t\t\\\n- if (_t > 0xffff) _t >>= 16;\t\t\t\\\n- if (_t > 0xff) r -= 8;\t\t\t\\\n- if (_t > 0xff) _t >>= 8;\t\t\t\\\n- if (_t & 0xf0) r -= 4;\t\t\t\\\n- if (_t & 0xf0) _t >>= 4;\t\t\t\\\n- if (_t & 0xc) r -= 2;\t\t\t\\\n- if (_t & 0xc) _t >>= 2;\t\t\t\\\n- if (_t & 0x2) r -= 1;\t\t\t\\\n- } while (0)\n-#endif /* not _FP_W_TYPE_SIZE < 64 */\n-#endif /* ndef __FP_CLZ */\n-\n-#define _FP_DIV_HELP_imm(q, r, n, d)\t\t\\\n- do {\t\t\t\t\t\t\\\n- q = n / d, r = n % d;\t\t\t\\\n- } while (0)\n-\ndiff --git a/arch/powerpc/math-emu/single.h b/arch/powerpc/math-emu/single.h\ndeleted file mode 100644\nindex f19d994..0000000\n--- a/arch/powerpc/math-emu/single.h\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-/*\n- * Definitions for IEEE Single Precision\n- */\n-\n-#if _FP_W_TYPE_SIZE < 32\n-#error \"Here's a nickel kid. Go buy yourself a real computer.\"\n-#endif\n-\n-#define _FP_FRACBITS_S\t\t24\n-#define _FP_FRACXBITS_S\t\t(_FP_W_TYPE_SIZE - _FP_FRACBITS_S)\n-#define _FP_WFRACBITS_S\t\t(_FP_WORKBITS + _FP_FRACBITS_S)\n-#define _FP_WFRACXBITS_S\t(_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)\n-#define _FP_EXPBITS_S\t\t8\n-#define _FP_EXPBIAS_S\t\t127\n-#define _FP_EXPMAX_S\t\t255\n-#define _FP_QNANBIT_S\t\t((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))\n-#define _FP_IMPLBIT_S\t\t((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))\n-#define _FP_OVERFLOW_S\t\t((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))\n-\n-/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be\n- chosen by the target machine. */\n-\n-union _FP_UNION_S\n-{\n- float flt;\n- struct {\n-#if __BYTE_ORDER == __BIG_ENDIAN\n- unsigned sign : 1;\n- unsigned exp : _FP_EXPBITS_S;\n- unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);\n-#else\n- unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);\n- unsigned exp : _FP_EXPBITS_S;\n- unsigned sign : 1;\n-#endif\n- } bits __attribute__((packed));\n-};\n-\n-#define FP_DECL_S(X)\t\t_FP_DECL(1,X)\n-#define FP_UNPACK_RAW_S(X,val)\t_FP_UNPACK_RAW_1(S,X,val)\n-#define FP_PACK_RAW_S(val,X)\t_FP_PACK_RAW_1(S,val,X)\n-\n-#define FP_UNPACK_S(X,val)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_UNPACK_RAW_1(S,X,val);\t\t\\\n- _FP_UNPACK_CANONICAL(S,1,X);\t\\\n- } while (0)\n-\n-#define FP_PACK_S(val,X)\t\t\\\n- do {\t\t\t\t\t\\\n- _FP_PACK_CANONICAL(S,1,X);\t\t\\\n- _FP_PACK_RAW_1(S,val,X);\t\t\\\n- } while (0)\n-\n-#define FP_NEG_S(R,X)\t\t_FP_NEG(S,1,R,X)\n-#define FP_ADD_S(R,X,Y)\t\t_FP_ADD(S,1,R,X,Y)\n-#define FP_SUB_S(R,X,Y)\t\t_FP_SUB(S,1,R,X,Y)\n-#define FP_MUL_S(R,X,Y)\t\t_FP_MUL(S,1,R,X,Y)\n-#define FP_DIV_S(R,X,Y)\t\t_FP_DIV(S,1,R,X,Y)\n-#define FP_SQRT_S(R,X)\t\t_FP_SQRT(S,1,R,X)\n-\n-#define FP_CMP_S(r,X,Y,un)\t_FP_CMP(S,1,r,X,Y,un)\n-#define FP_CMP_EQ_S(r,X,Y)\t_FP_CMP_EQ(S,1,r,X,Y)\n-\n-#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)\n-#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)\ndiff --git a/arch/powerpc/math-emu/soft-fp.h b/arch/powerpc/math-emu/soft-fp.h\ndeleted file mode 100644\nindex cca3959..0000000\n--- a/arch/powerpc/math-emu/soft-fp.h\n+++ /dev/null\n@@ -1,104 +0,0 @@\n-#ifndef SOFT_FP_H\n-#define SOFT_FP_H\n-\n-#include \"sfp-machine.h\"\n-\n-#define _FP_WORKBITS\t\t3\n-#define _FP_WORK_LSB\t\t((_FP_W_TYPE)1 << 3)\n-#define _FP_WORK_ROUND\t\t((_FP_W_TYPE)1 << 2)\n-#define _FP_WORK_GUARD\t\t((_FP_W_TYPE)1 << 1)\n-#define _FP_WORK_STICKY\t\t((_FP_W_TYPE)1 << 0)\n-\n-#ifndef FP_RND_NEAREST\n-# define FP_RND_NEAREST\t\t0\n-# define FP_RND_ZERO\t\t1\n-# define FP_RND_PINF\t\t2\n-# define FP_RND_MINF\t\t3\n-#ifndef FP_ROUNDMODE\n-# define FP_ROUNDMODE\t\tFP_RND_NEAREST\n-#endif\n-#endif\n-\n-#define _FP_ROUND_NEAREST(wc, X)\t\t\t\\\n-({ int __ret = 0;\t\t\t\t\t\\\n- int __frac = _FP_FRAC_LOW_##wc(X) & 15;\t\t\\\n- if (__frac & 7) {\t\t\t\t\t\\\n- __ret = EFLAG_INEXACT;\t\t\t\t\\\n- if ((__frac & 7) != _FP_WORK_ROUND)\t\t\\\n- _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND);\t\t\\\n- else if (__frac & _FP_WORK_LSB)\t\t\t\\\n- _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND);\t\t\\\n- }\t\t\t\t\t\t\t\\\n- __ret;\t\t\t\t\t\t\\\n-})\n-\n-#define _FP_ROUND_ZERO(wc, X)\t\t\t\t\\\n-({ int __ret = 0;\t\t\t\t\t\\\n- if (_FP_FRAC_LOW_##wc(X) & 7)\t\t\t\\\n- __ret = EFLAG_INEXACT;\t\t\t\t\\\n- __ret;\t\t\t\t\t\t\\\n-})\n-\n-#define _FP_ROUND_PINF(wc, X)\t\t\t\t\\\n-({ int __ret = EFLAG_INEXACT;\t\t\t\t\\\n- if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7))\t\t\\\n- _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB);\t\t\\\n- else __ret = 0;\t\t\t\t\t\\\n- __ret;\t\t\t\t\t\t\\\n-})\n-\n-#define _FP_ROUND_MINF(wc, X)\t\t\t\t\\\n-({ int __ret = EFLAG_INEXACT;\t\t\t\t\\\n- if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7))\t\t\\\n- _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB);\t\t\\\n- else __ret = 0;\t\t\t\t\t\\\n- __ret;\t\t\t\t\t\t\\\n-})\n-\n-#define _FP_ROUND(wc, X)\t\t\t\\\n-({\tint __ret = 0;\t\t\t\t\\\n-\tswitch (FP_ROUNDMODE)\t\t\t\\\n-\t{\t\t\t\t\t\\\n-\t case FP_RND_NEAREST:\t\t\t\\\n-\t __ret |= _FP_ROUND_NEAREST(wc,X);\t\\\n-\t break;\t\t\t\t\\\n-\t case FP_RND_ZERO:\t\t\t\\\n-\t __ret |= _FP_ROUND_ZERO(wc,X);\t\\\n-\t break;\t\t\t\t\\\n-\t case FP_RND_PINF:\t\t\t\\\n-\t __ret |= _FP_ROUND_PINF(wc,X);\t\\\n-\t break;\t\t\t\t\\\n-\t case FP_RND_MINF:\t\t\t\\\n-\t __ret |= _FP_ROUND_MINF(wc,X);\t\\\n-\t break;\t\t\t\t\\\n-\t};\t\t\t\t\t\\\n-\t__ret;\t\t\t\t\t\\\n-})\n-\n-#define FP_CLS_NORMAL\t\t0\n-#define FP_CLS_ZERO\t\t1\n-#define FP_CLS_INF\t\t2\n-#define FP_CLS_NAN\t\t3\n-\n-#define _FP_CLS_COMBINE(x,y)\t(((x) << 2) | (y))\n-\n-#include \"op-1.h\"\n-#include \"op-2.h\"\n-#include \"op-4.h\"\n-#include \"op-common.h\"\n-\n-/* Sigh. Silly things longlong.h needs. */\n-#define UWtype\t\t_FP_W_TYPE\n-#define W_TYPE_SIZE\t_FP_W_TYPE_SIZE\n-\n-typedef int SItype __attribute__((mode(SI)));\n-typedef int DItype __attribute__((mode(DI)));\n-typedef unsigned int USItype __attribute__((mode(SI)));\n-typedef unsigned int UDItype __attribute__((mode(DI)));\n-#if _FP_W_TYPE_SIZE == 32\n-typedef unsigned int UHWtype __attribute__((mode(HI)));\n-#elif _FP_W_TYPE_SIZE == 64\n-typedef USItype UHWtype;\n-#endif\n-\n-#endif\ndiff --git a/arch/powerpc/math-emu/stfs.c b/arch/powerpc/math-emu/stfs.c\nindex 8689aa4..6122147 100644\n--- a/arch/powerpc/math-emu/stfs.c\n+++ b/arch/powerpc/math-emu/stfs.c\n@@ -2,23 +2,24 @@\n #include <linux/errno.h>\n #include <asm/uaccess.h>\n \n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n+#include <asm/sfp-machine.h>\n+#include <math-emu/soft-fp.h>\n+#include <math-emu/double.h>\n+#include <math-emu/single.h>\n \n int\n stfs(void *frS, void *ea)\n {\n \tFP_DECL_D(A);\n \tFP_DECL_S(R);\n+\tFP_DECL_EX;\n \tfloat f;\n-\tint err;\n \n #ifdef DEBUG\n \tprintk(\"%s: S %p, ea %p\\n\", __func__, frS, ea);\n #endif\n \n-\t__FP_UNPACK_D(A, frS);\n+\tFP_UNPACK_DP(A, frS);\n \n #ifdef DEBUG\n \tprintk(\"A: %ld %lu %lu %ld (%ld)\\n\", A_s, A_f1, A_f0, A_e, A_c);\n@@ -30,12 +31,12 @@ stfs(void *frS, void *ea)\n \tprintk(\"R: %ld %lu %ld (%ld)\\n\", R_s, R_f, R_e, R_c);\n #endif\n \n-\terr = _FP_PACK_CANONICAL(S, 1, R);\n-\tif (!err || !__FPU_TRAP_P(err)) {\n-\t\t__FP_PACK_RAW_1(S, &f, R);\n+\t_FP_PACK_CANONICAL(S, 1, R);\n+\tif (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) {\n+\t\t_FP_PACK_RAW_1_P(S, &f, R);\n \t\tif (copy_to_user(ea, &f, sizeof(float)))\n \t\t\treturn -EFAULT;\n \t}\n \n-\treturn err;\n+\treturn FP_CUR_EXCEPTIONS;\n }\ndiff --git a/arch/powerpc/math-emu/types.c b/arch/powerpc/math-emu/types.c\ndeleted file mode 100644\nindex e1ed15d..0000000\n--- a/arch/powerpc/math-emu/types.c\n+++ /dev/null\n@@ -1,51 +0,0 @@\n-#include \"soft-fp.h\"\n-#include \"double.h\"\n-#include \"single.h\"\n-\n-void\n-fp_unpack_d(long *_s, unsigned long *_f1, unsigned long *_f0,\n-\t long *_e, long *_c, void *val)\n-{\n-\tFP_DECL_D(X);\n-\n-\t__FP_UNPACK_RAW_2(D, X, val);\n-\n-\t_FP_UNPACK_CANONICAL(D, 2, X);\n-\n-\t*_s = X_s;\n-\t*_f1 = X_f1;\n-\t*_f0 = X_f0;\n-\t*_e = X_e;\n-\t*_c = X_c;\n-}\n-\n-int\n-fp_pack_d(void *val, long X_s, unsigned long X_f1,\n-\t unsigned long X_f0, long X_e, long X_c)\n-{\n-\tint exc;\n-\n-\texc = _FP_PACK_CANONICAL(D, 2, X);\n-\tif (!exc || !__FPU_TRAP_P(exc))\n-\t\t__FP_PACK_RAW_2(D, val, X);\n-\treturn exc;\n-}\n-\n-int\n-fp_pack_ds(void *val, long X_s, unsigned long X_f1,\n-\t unsigned long X_f0, long X_e, long X_c)\n-{\n-\tFP_DECL_S(__X);\n-\tint exc;\n-\n-\tFP_CONV(S, D, 1, 2, __X, X);\n-\texc = _FP_PACK_CANONICAL(S, 1, __X);\n-\tif (!exc || !__FPU_TRAP_P(exc)) {\n-\t\t_FP_UNPACK_CANONICAL(S, 1, __X);\n-\t\tFP_CONV(D, S, 2, 1, X, __X);\n-\t\texc |= _FP_PACK_CANONICAL(D, 2, X);\n-\t\tif (!exc || !__FPU_TRAP_P(exc))\n-\t\t\t__FP_PACK_RAW_2(D, val, X);\n-\t}\n-\treturn exc;\n-}\ndiff --git a/arch/powerpc/math-emu/udivmodti4.c b/arch/powerpc/math-emu/udivmodti4.c\nindex 7e112dc..6172044 100644\n--- a/arch/powerpc/math-emu/udivmodti4.c\n+++ b/arch/powerpc/math-emu/udivmodti4.c\n@@ -1,6 +1,6 @@\n /* This has so very few changes over libgcc2's __udivmoddi4 it isn't funny. */\n \n-#include \"soft-fp.h\"\n+#include <math-emu/soft-fp.h>\n \n #undef count_leading_zeros\n #define count_leading_zeros __FP_CLZ\n", "prefixes": [ "v2" ] }