代码拉取完成,页面将自动刷新
From 08fc38c7c5d764a69899f2305a0b5211675de02c Mon Sep 17 00:00:00 2001
From: swcompiler <lc@wxiat.com>
Date: Fri, 29 Nov 2024 14:24:53 +0800
Subject: [PATCH 14/23] Sw64: float128 Implementation
---
sysdeps/sw_64/e_sqrtl.c | 48 +++++++++++++++++++++++
sysdeps/sw_64/ots_add.c | 40 +++++++++++++++++++
sysdeps/sw_64/ots_cmp.c | 63 ++++++++++++++++++++++++++++++
sysdeps/sw_64/ots_cmpe.c | 78 ++++++++++++++++++++++++++++++++++++++
sysdeps/sw_64/ots_cvtqux.c | 39 +++++++++++++++++++
sysdeps/sw_64/ots_cvtqx.c | 38 +++++++++++++++++++
sysdeps/sw_64/ots_cvttx.c | 47 +++++++++++++++++++++++
sysdeps/sw_64/ots_cvtxq.c | 41 ++++++++++++++++++++
sysdeps/sw_64/ots_cvtxt.c | 43 +++++++++++++++++++++
sysdeps/sw_64/ots_div.c | 40 +++++++++++++++++++
sysdeps/sw_64/ots_mul.c | 40 +++++++++++++++++++
sysdeps/sw_64/ots_nintxq.c | 53 ++++++++++++++++++++++++++
sysdeps/sw_64/ots_sub.c | 40 +++++++++++++++++++
13 files changed, 610 insertions(+)
create mode 100644 sysdeps/sw_64/e_sqrtl.c
create mode 100644 sysdeps/sw_64/ots_add.c
create mode 100644 sysdeps/sw_64/ots_cmp.c
create mode 100644 sysdeps/sw_64/ots_cmpe.c
create mode 100644 sysdeps/sw_64/ots_cvtqux.c
create mode 100644 sysdeps/sw_64/ots_cvtqx.c
create mode 100644 sysdeps/sw_64/ots_cvttx.c
create mode 100644 sysdeps/sw_64/ots_cvtxq.c
create mode 100644 sysdeps/sw_64/ots_cvtxt.c
create mode 100644 sysdeps/sw_64/ots_div.c
create mode 100644 sysdeps/sw_64/ots_mul.c
create mode 100644 sysdeps/sw_64/ots_nintxq.c
create mode 100644 sysdeps/sw_64/ots_sub.c
diff --git a/sysdeps/sw_64/e_sqrtl.c b/sysdeps/sw_64/e_sqrtl.c
new file mode 100644
index 00000000..13cc1f0e
--- /dev/null
+++ b/sysdeps/sw_64/e_sqrtl.c
@@ -0,0 +1,48 @@
+/* long double square root in software floating-point emulation.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad.h>
+#include <shlib-compat.h>
+
+long double
+__ieee754_sqrtl (const long double a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (C);
+ long double c;
+ long _round = 4; /* dynamic rounding */
+
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_Q (A, a);
+ FP_SQRT_Q (C, A);
+ FP_PACK_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+ return c;
+}
+
+/* ??? We forgot to add this symbol in 2.15. Getting this into 2.18 isn't as
+ straight-forward as just adding the alias, since a generic Versions file
+ includes the 2.15 version and the linker uses the first one it sees. */
+#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18)
+compat_symbol (libm, __ieee754_sqrtl, __sqrtl_finite, GLIBC_2_18);
+#endif
diff --git a/sysdeps/sw_64/ots_add.c b/sysdeps/sw_64/ots_add.c
new file mode 100644
index 00000000..4e3f160c
--- /dev/null
+++ b/sysdeps/sw_64/ots_add.c
@@ -0,0 +1,40 @@
+/* Software floating-point emulation: addition.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+void
+_OtsAddX (long al, long ah, long bl, long bh, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_SEMIRAW_Q (A, a);
+ AXP_UNPACK_SEMIRAW_Q (B, b);
+ FP_ADD_Q (C, A, B);
+ AXP_PACK_SEMIRAW_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_cmp.c b/sysdeps/sw_64/ots_cmp.c
new file mode 100644
index 00000000..42766f23
--- /dev/null
+++ b/sysdeps/sw_64/ots_cmp.c
@@ -0,0 +1,63 @@
+/* Software floating-point emulation: comparison.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+static long
+internal_equality (long al, long ah, long bl, long bh, long neq)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ long r;
+
+ AXP_UNPACK_RAW_Q (A, a);
+ AXP_UNPACK_RAW_Q (B, b);
+
+ if ((A_e == _FP_EXPMAX_Q && !_FP_FRAC_ZEROP_2 (A))
+ || (B_e == _FP_EXPMAX_Q && !_FP_FRAC_ZEROP_2 (B)))
+ {
+ /* EQ and NE signal invalid operation only if either operand is SNaN. */
+ if (FP_ISSIGNAN_Q (A) || FP_ISSIGNAN_Q (B))
+ {
+ FP_SET_EXCEPTION (FP_EX_INVALID);
+ FP_HANDLE_EXCEPTIONS;
+ }
+ return -1;
+ }
+
+ r = (A_e == B_e && _FP_FRAC_EQ_2 (A, B)
+ && (A_s == B_s || (!A_e && _FP_FRAC_ZEROP_2 (A))));
+ r ^= neq;
+
+ return r;
+}
+
+long
+_OtsEqlX (long al, long ah, long bl, long bh)
+{
+ return internal_equality (al, ah, bl, bh, 0);
+}
+
+long
+_OtsNeqX (long al, long ah, long bl, long bh)
+{
+ return internal_equality (al, ah, bl, bh, 1);
+}
diff --git a/sysdeps/sw_64/ots_cmpe.c b/sysdeps/sw_64/ots_cmpe.c
new file mode 100644
index 00000000..7604e94e
--- /dev/null
+++ b/sysdeps/sw_64/ots_cmpe.c
@@ -0,0 +1,78 @@
+/* Software floating-point emulation: comparison.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+static long
+internal_compare (long al, long ah, long bl, long bh)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ long r;
+
+ AXP_UNPACK_RAW_Q (A, a);
+ AXP_UNPACK_RAW_Q (B, b);
+ FP_CMP_Q (r, A, B, 2, 2);
+
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
+
+long
+_OtsLssX (long al, long ah, long bl, long bh)
+{
+ long r = internal_compare (al, ah, bl, bh);
+ if (r == 2)
+ return -1;
+ else
+ return r < 0;
+}
+
+long
+_OtsLeqX (long al, long ah, long bl, long bh)
+{
+ long r = internal_compare (al, ah, bl, bh);
+ if (r == 2)
+ return -1;
+ else
+ return r <= 0;
+}
+
+long
+_OtsGtrX (long al, long ah, long bl, long bh)
+{
+ long r = internal_compare (al, ah, bl, bh);
+ if (r == 2)
+ return -1;
+ else
+ return r > 0;
+}
+
+long
+_OtsGeqX (long al, long ah, long bl, long bh)
+{
+ long r = internal_compare (al, ah, bl, bh);
+ if (r == 2)
+ return -1;
+ else
+ return r >= 0;
+}
diff --git a/sysdeps/sw_64/ots_cvtqux.c b/sysdeps/sw_64/ots_cvtqux.c
new file mode 100644
index 00000000..283bbe19
--- /dev/null
+++ b/sysdeps/sw_64/ots_cvtqux.c
@@ -0,0 +1,39 @@
+/* Software floating-point emulation: unsigned integer to float conversion.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+/* Should never actually be used, since we've more bits of precision
+ than the incomming long, but needed for linkage. */
+#undef FP_ROUNDMODE
+#define FP_ROUNDMODE FP_RND_ZERO
+
+void
+_OtsCvtQUX (unsigned long a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_FROM_INT_Q (C, a, 64, unsigned long);
+ AXP_PACK_RAW_Q (c, C);
+
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_cvtqx.c b/sysdeps/sw_64/ots_cvtqx.c
new file mode 100644
index 00000000..dd51eb27
--- /dev/null
+++ b/sysdeps/sw_64/ots_cvtqx.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation: signed integer to float conversion.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+/* Should never actually be used, since we've more bits of precision
+ than the incomming long, but needed for linkage. */
+#undef FP_ROUNDMODE
+#define FP_ROUNDMODE FP_RND_ZERO
+
+void
+_OtsCvtQX (long a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_FROM_INT_Q (C, a, 64, unsigned long);
+ AXP_PACK_RAW_Q (c, C);
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_cvttx.c b/sysdeps/sw_64/ots_cvttx.c
new file mode 100644
index 00000000..4defb56d
--- /dev/null
+++ b/sysdeps/sw_64/ots_cvttx.c
@@ -0,0 +1,47 @@
+/* Software floating-point emulation: floating point extension.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+#include "double.h"
+
+/* Should never actually be used, since we're extending, but needed
+ for linkage. */
+#undef FP_ROUNDMODE
+#define FP_ROUNDMODE FP_RND_ZERO
+
+void
+_OtsConvertFloatTX (double a)
+{
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_UNPACK_RAW_D (A, a);
+#if _FP_W_TYPE_SIZE < 64
+ FP_EXTEND (Q, D, 4, 2, C, A);
+#else
+ FP_EXTEND (Q, D, 2, 1, C, A);
+#endif
+ AXP_PACK_RAW_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_cvtxq.c b/sysdeps/sw_64/ots_cvtxq.c
new file mode 100644
index 00000000..e88adf14
--- /dev/null
+++ b/sysdeps/sw_64/ots_cvtxq.c
@@ -0,0 +1,41 @@
+/* Software floating-point emulation: float to integer conversion.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+long
+_OtsCvtXQ (long al, long ah, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ unsigned long r;
+ long s;
+
+ /* If bit 3 is set, then integer overflow detection is requested. */
+ s = _round & 8 ? 1 : -1;
+ _round = _round & 3;
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, 64, s);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/sysdeps/sw_64/ots_cvtxt.c b/sysdeps/sw_64/ots_cvtxt.c
new file mode 100644
index 00000000..a20db3a7
--- /dev/null
+++ b/sysdeps/sw_64/ots_cvtxt.c
@@ -0,0 +1,43 @@
+/* Software floating-point emulation: floating point truncation.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+#include "double.h"
+
+double
+_OtsConvertFloatXT (long al, long ah, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_D (R);
+ double r;
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_SEMIRAW_Q (A, a);
+#if _FP_W_TYPE_SIZE < 64
+ FP_TRUNC (D, Q, 2, 4, R, A);
+#else
+ FP_TRUNC (D, Q, 1, 2, R, A);
+#endif
+ FP_PACK_SEMIRAW_D (r, R);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/sysdeps/sw_64/ots_div.c b/sysdeps/sw_64/ots_div.c
new file mode 100644
index 00000000..af0e7d60
--- /dev/null
+++ b/sysdeps/sw_64/ots_div.c
@@ -0,0 +1,40 @@
+/* Software floating-point emulation: division.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+void
+_OtsDivX (long al, long ah, long bl, long bh, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_Q (A, a);
+ AXP_UNPACK_Q (B, b);
+ FP_DIV_Q (C, A, B);
+ AXP_PACK_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_mul.c b/sysdeps/sw_64/ots_mul.c
new file mode 100644
index 00000000..41dba23d
--- /dev/null
+++ b/sysdeps/sw_64/ots_mul.c
@@ -0,0 +1,40 @@
+/* Software floating-point emulation: multiplication.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+void
+_OtsMulX (long al, long ah, long bl, long bh, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_Q (A, a);
+ AXP_UNPACK_Q (B, b);
+ FP_MUL_Q (C, A, B);
+ AXP_PACK_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+
+ AXP_RETURN_Q (c);
+}
diff --git a/sysdeps/sw_64/ots_nintxq.c b/sysdeps/sw_64/ots_nintxq.c
new file mode 100644
index 00000000..ac4c610a
--- /dev/null
+++ b/sysdeps/sw_64/ots_nintxq.c
@@ -0,0 +1,53 @@
+/* Software floating-point emulation: convert to fortran nearest.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+long
+_OtsNintXQ (long al, long ah, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ unsigned long r;
+ long s;
+
+ /* If bit 3 is set, then integer overflow detection is requested. */
+ s = _round & 8 ? 1 : -1;
+ _round = _round & 3;
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_SEMIRAW_Q (A, a);
+
+ /* Build 0.5 * sign(A) */
+ B_e = _FP_EXPBIAS_Q;
+ __FP_FRAC_SET_2 (B, 0, 0);
+ B_s = A_s;
+
+ FP_ADD_Q (C, A, B);
+ _FP_FRAC_SRL_2 (C, _FP_WORKBITS);
+ _FP_FRAC_HIGH_RAW_Q (C) &= ~(_FP_W_TYPE) _FP_IMPLBIT_Q;
+ FP_TO_INT_Q (r, C, 64, s);
+ if (s > 0 && (_fex &= FP_EX_INVALID))
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/sysdeps/sw_64/ots_sub.c b/sysdeps/sw_64/ots_sub.c
new file mode 100644
index 00000000..c0bc573e
--- /dev/null
+++ b/sysdeps/sw_64/ots_sub.c
@@ -0,0 +1,40 @@
+/* Software floating-point emulation: subtraction.
+ Copyright (C) 1997-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "local-soft-fp.h"
+
+void
+_OtsSubX (long al, long ah, long bl, long bh, long _round)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ AXP_DECL_RETURN_Q (c);
+
+ FP_INIT_ROUNDMODE;
+ AXP_UNPACK_SEMIRAW_Q (A, a);
+ AXP_UNPACK_SEMIRAW_Q (B, b);
+ FP_SUB_Q (C, A, B);
+ AXP_PACK_SEMIRAW_Q (c, C);
+ FP_HANDLE_EXCEPTIONS;
+
+ AXP_RETURN_Q (c);
+}
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。