Re: [PATCH] soft-fp: Update soft-fp from glibc

2022-08-16 Thread Kito Cheng via Gcc-patches
Hi Joseph:

I saw other soft-fp updates will also ask for some approval on the
list too, anyway I know that now :)

Thanks!

On Tue, Aug 16, 2022 at 10:18 PM Joseph Myers  wrote:
>
> On Tue, 16 Aug 2022, Kito Cheng wrote:
>
> > ping
>
> Under our write access policies, "Importing files maintained outside the
> tree from their official versions." does not require review or approval.
>
> --
> Joseph S. Myers
> jos...@codesourcery.com


Re: [PATCH] soft-fp: Update soft-fp from glibc

2022-08-16 Thread Joseph Myers
On Tue, 16 Aug 2022, Kito Cheng wrote:

> ping

Under our write access policies, "Importing files maintained outside the 
tree from their official versions." does not require review or approval.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH] soft-fp: Update soft-fp from glibc

2022-08-16 Thread Kito Cheng via Gcc-patches
ping

On Wed, Aug 10, 2022 at 10:23 PM Kito Cheng  wrote:
>
> This patch is updating all soft-fp from glibc, most changes are
> copyright years update, removing "Contributed by" lines and update URL for
> license, and changes other than those update are adding conversion
> function between IEEE half and 32-bit/64-bit integer, those functions are
> required by RISC-V _Float16 support.
>
> libgcc/ChangeLog:
>
> * soft-fp/fixhfdi.c: New.
> * soft-fp/fixhfsi.c: Likewise.
> * soft-fp/fixunshfdi.c: Likewise.
> * soft-fp/fixunshfsi.c: Likewise.
> * soft-fp/floatdihf.c: Likewise.
> * soft-fp/floatsihf.c: Likewise.
> * soft-fp/floatundihf.c: Likewise.
> * soft-fp/floatunsihf.c: Likewise.
> * soft-fp/adddf3.c: Updating copyright years, removing "Contributed 
> by"
> lines and update URL for license.
> * soft-fp/addsf3.c: Likewise.
> * soft-fp/addtf3.c: Likewise.
> * soft-fp/divdf3.c: Likewise.
> * soft-fp/divsf3.c: Likewise.
> * soft-fp/divtf3.c: Likewise.
> * soft-fp/double.h: Likewise.
> * soft-fp/eqdf2.c: Likewise.
> * soft-fp/eqhf2.c: Likewise.
> * soft-fp/eqsf2.c: Likewise.
> * soft-fp/eqtf2.c: Likewise.
> * soft-fp/extenddftf2.c: Likewise.
> * soft-fp/extended.h: Likewise.
> * soft-fp/extendhfdf2.c: Likewise.
> * soft-fp/extendhfsf2.c: Likewise.
> * soft-fp/extendhftf2.c: Likewise.
> * soft-fp/extendhfxf2.c: Likewise.
> * soft-fp/extendsfdf2.c: Likewise.
> * soft-fp/extendsftf2.c: Likewise.
> * soft-fp/extendxftf2.c: Likewise.
> * soft-fp/fixdfdi.c: Likewise.
> * soft-fp/fixdfsi.c: Likewise.
> * soft-fp/fixdfti.c: Likewise.
> * soft-fp/fixhfti.c: Likewise.
> * soft-fp/fixsfdi.c: Likewise.
> * soft-fp/fixsfsi.c: Likewise.
> * soft-fp/fixsfti.c: Likewise.
> * soft-fp/fixtfdi.c: Likewise.
> * soft-fp/fixtfsi.c: Likewise.
> * soft-fp/fixtfti.c: Likewise.
> * soft-fp/fixunsdfdi.c: Likewise.
> * soft-fp/fixunsdfsi.c: Likewise.
> * soft-fp/fixunsdfti.c: Likewise.
> * soft-fp/fixunshfti.c: Likewise.
> * soft-fp/fixunssfdi.c: Likewise.
> * soft-fp/fixunssfsi.c: Likewise.
> * soft-fp/fixunssfti.c: Likewise.
> * soft-fp/fixunstfdi.c: Likewise.
> * soft-fp/fixunstfsi.c: Likewise.
> * soft-fp/fixunstfti.c: Likewise.
> * soft-fp/floatdidf.c: Likewise.
> * soft-fp/floatdisf.c: Likewise.
> * soft-fp/floatditf.c: Likewise.
> * soft-fp/floatsidf.c: Likewise.
> * soft-fp/floatsisf.c: Likewise.
> * soft-fp/floatsitf.c: Likewise.
> * soft-fp/floattidf.c: Likewise.
> * soft-fp/floattihf.c: Likewise.
> * soft-fp/floattisf.c: Likewise.
> * soft-fp/floattitf.c: Likewise.
> * soft-fp/floatundidf.c: Likewise.
> * soft-fp/floatundisf.c: Likewise.
> * soft-fp/floatunditf.c: Likewise.
> * soft-fp/floatunsidf.c: Likewise.
> * soft-fp/floatunsisf.c: Likewise.
> * soft-fp/floatunsitf.c: Likewise.
> * soft-fp/floatuntidf.c: Likewise.
> * soft-fp/floatuntihf.c: Likewise.
> * soft-fp/floatuntisf.c: Likewise.
> * soft-fp/floatuntitf.c: Likewise.
> * soft-fp/gedf2.c: Likewise.
> * soft-fp/gesf2.c: Likewise.
> * soft-fp/getf2.c: Likewise.
> * soft-fp/half.h: Likewise.
> * soft-fp/ledf2.c: Likewise.
> * soft-fp/lesf2.c: Likewise.
> * soft-fp/letf2.c: Likewise.
> * soft-fp/muldf3.c: Likewise.
> * soft-fp/mulsf3.c: Likewise.
> * soft-fp/multf3.c: Likewise.
> * soft-fp/negdf2.c: Likewise.
> * soft-fp/negsf2.c: Likewise.
> * soft-fp/negtf2.c: Likewise.
> * soft-fp/op-1.h: Likewise.
> * soft-fp/op-2.h: Likewise.
> * soft-fp/op-4.h: Likewise.
> * soft-fp/op-8.h: Likewise.
> * soft-fp/op-common.h: Likewise.
> * soft-fp/quad.h: Likewise.
> * soft-fp/single.h: Likewise.
> * soft-fp/soft-fp.h: Likewise.
> * soft-fp/subdf3.c: Likewise.
> * soft-fp/subsf3.c: Likewise.
> * soft-fp/subtf3.c: Likewise.
> * soft-fp/truncdfhf2.c: Likewise.
> * soft-fp/truncdfsf2.c: Likewise.
> * soft-fp/truncsfhf2.c: Likewise.
> * soft-fp/trunctfdf2.c: Likewise.
> * soft-fp/trunctfhf2.c: Likewise.
> * soft-fp/trunctfsf2.c: Likewise.
> * soft-fp/trunctfxf2.c: Likewise.
> * soft-fp/truncxfhf2.c: Likewise.
> * soft-fp/unorddf2.c: Likewise.
> * soft-fp/unordsf2.c: Likewise.
> ---
>  libgcc/soft-fp/adddf3.c  |  6 ++---
>  libgcc/soft-fp/addsf3.c  |  6 ++---
>  libgcc/soft-fp/addtf3.c  |  6 ++---
>  libgcc/soft-fp/divdf3.c  |  6 ++---
>  libgcc/soft-fp/divsf3.c

[PATCH] soft-fp: Update soft-fp from glibc

2022-08-10 Thread Kito Cheng
This patch is updating all soft-fp from glibc, most changes are
copyright years update, removing "Contributed by" lines and update URL for
license, and changes other than those update are adding conversion
function between IEEE half and 32-bit/64-bit integer, those functions are
required by RISC-V _Float16 support.

libgcc/ChangeLog:

* soft-fp/fixhfdi.c: New.
* soft-fp/fixhfsi.c: Likewise.
* soft-fp/fixunshfdi.c: Likewise.
* soft-fp/fixunshfsi.c: Likewise.
* soft-fp/floatdihf.c: Likewise.
* soft-fp/floatsihf.c: Likewise.
* soft-fp/floatundihf.c: Likewise.
* soft-fp/floatunsihf.c: Likewise.
* soft-fp/adddf3.c: Updating copyright years, removing "Contributed by"
lines and update URL for license.
* soft-fp/addsf3.c: Likewise.
* soft-fp/addtf3.c: Likewise.
* soft-fp/divdf3.c: Likewise.
* soft-fp/divsf3.c: Likewise.
* soft-fp/divtf3.c: Likewise.
* soft-fp/double.h: Likewise.
* soft-fp/eqdf2.c: Likewise.
* soft-fp/eqhf2.c: Likewise.
* soft-fp/eqsf2.c: Likewise.
* soft-fp/eqtf2.c: Likewise.
* soft-fp/extenddftf2.c: Likewise.
* soft-fp/extended.h: Likewise.
* soft-fp/extendhfdf2.c: Likewise.
* soft-fp/extendhfsf2.c: Likewise.
* soft-fp/extendhftf2.c: Likewise.
* soft-fp/extendhfxf2.c: Likewise.
* soft-fp/extendsfdf2.c: Likewise.
* soft-fp/extendsftf2.c: Likewise.
* soft-fp/extendxftf2.c: Likewise.
* soft-fp/fixdfdi.c: Likewise.
* soft-fp/fixdfsi.c: Likewise.
* soft-fp/fixdfti.c: Likewise.
* soft-fp/fixhfti.c: Likewise.
* soft-fp/fixsfdi.c: Likewise.
* soft-fp/fixsfsi.c: Likewise.
* soft-fp/fixsfti.c: Likewise.
* soft-fp/fixtfdi.c: Likewise.
* soft-fp/fixtfsi.c: Likewise.
* soft-fp/fixtfti.c: Likewise.
* soft-fp/fixunsdfdi.c: Likewise.
* soft-fp/fixunsdfsi.c: Likewise.
* soft-fp/fixunsdfti.c: Likewise.
* soft-fp/fixunshfti.c: Likewise.
* soft-fp/fixunssfdi.c: Likewise.
* soft-fp/fixunssfsi.c: Likewise.
* soft-fp/fixunssfti.c: Likewise.
* soft-fp/fixunstfdi.c: Likewise.
* soft-fp/fixunstfsi.c: Likewise.
* soft-fp/fixunstfti.c: Likewise.
* soft-fp/floatdidf.c: Likewise.
* soft-fp/floatdisf.c: Likewise.
* soft-fp/floatditf.c: Likewise.
* soft-fp/floatsidf.c: Likewise.
* soft-fp/floatsisf.c: Likewise.
* soft-fp/floatsitf.c: Likewise.
* soft-fp/floattidf.c: Likewise.
* soft-fp/floattihf.c: Likewise.
* soft-fp/floattisf.c: Likewise.
* soft-fp/floattitf.c: Likewise.
* soft-fp/floatundidf.c: Likewise.
* soft-fp/floatundisf.c: Likewise.
* soft-fp/floatunditf.c: Likewise.
* soft-fp/floatunsidf.c: Likewise.
* soft-fp/floatunsisf.c: Likewise.
* soft-fp/floatunsitf.c: Likewise.
* soft-fp/floatuntidf.c: Likewise.
* soft-fp/floatuntihf.c: Likewise.
* soft-fp/floatuntisf.c: Likewise.
* soft-fp/floatuntitf.c: Likewise.
* soft-fp/gedf2.c: Likewise.
* soft-fp/gesf2.c: Likewise.
* soft-fp/getf2.c: Likewise.
* soft-fp/half.h: Likewise.
* soft-fp/ledf2.c: Likewise.
* soft-fp/lesf2.c: Likewise.
* soft-fp/letf2.c: Likewise.
* soft-fp/muldf3.c: Likewise.
* soft-fp/mulsf3.c: Likewise.
* soft-fp/multf3.c: Likewise.
* soft-fp/negdf2.c: Likewise.
* soft-fp/negsf2.c: Likewise.
* soft-fp/negtf2.c: Likewise.
* soft-fp/op-1.h: Likewise.
* soft-fp/op-2.h: Likewise.
* soft-fp/op-4.h: Likewise.
* soft-fp/op-8.h: Likewise.
* soft-fp/op-common.h: Likewise.
* soft-fp/quad.h: Likewise.
* soft-fp/single.h: Likewise.
* soft-fp/soft-fp.h: Likewise.
* soft-fp/subdf3.c: Likewise.
* soft-fp/subsf3.c: Likewise.
* soft-fp/subtf3.c: Likewise.
* soft-fp/truncdfhf2.c: Likewise.
* soft-fp/truncdfsf2.c: Likewise.
* soft-fp/truncsfhf2.c: Likewise.
* soft-fp/trunctfdf2.c: Likewise.
* soft-fp/trunctfhf2.c: Likewise.
* soft-fp/trunctfsf2.c: Likewise.
* soft-fp/trunctfxf2.c: Likewise.
* soft-fp/truncxfhf2.c: Likewise.
* soft-fp/unorddf2.c: Likewise.
* soft-fp/unordsf2.c: Likewise.
---
 libgcc/soft-fp/adddf3.c  |  6 ++---
 libgcc/soft-fp/addsf3.c  |  6 ++---
 libgcc/soft-fp/addtf3.c  |  6 ++---
 libgcc/soft-fp/divdf3.c  |  6 ++---
 libgcc/soft-fp/divsf3.c  |  6 ++---
 libgcc/soft-fp/divtf3.c  |  6 ++---
 libgcc/soft-fp/double.h  |  8 ++-
 libgcc/soft-fp/eqdf2.c   |  6 ++---
 libgcc/soft-fp/eqhf2.c   |  2 +-
 libgcc/soft-fp/eqsf2.c   |  6 ++---
 libgcc/soft-fp/eqtf2.c   |  6 ++---
 libgcc/soft-fp/extenddftf2.c |  6 

[PATCH] soft-fp: Update soft-fp from glibc

2021-07-07 Thread H.J. Lu via Gcc-patches
From: liuhongt 

1. Add __extendhfdf2/__extendhfsf2 to return an IEEE half converted to
IEEE double/single.
2. Add __truncdfhf2/__extendsfhf2 to truncate IEEE double/single into
IEEE half.
3. Add __eqhf2/__nehf2 to return 0 if a == b and a,b are not NAN,
otherwise return 1.

These are needed by x86 _Float16.

* soft-fp/eqhf2.c: New file.
* soft-fp/extendhfdf2.c: Likewise.
* soft-fp/extendhfsf2.c: Likewise.
* soft-fp/truncdfhf2.c: Likewise.
* soft-fp/truncsfhf2.c: Likewise.
* soft-fp/half.h (FP_CMP_EQ_H): New.
---
 libgcc/soft-fp/eqhf2.c   | 49 +
 libgcc/soft-fp/extendhfdf2.c | 53 
 libgcc/soft-fp/extendhfsf2.c | 49 +
 libgcc/soft-fp/half.h|  2 ++
 libgcc/soft-fp/truncdfhf2.c  | 52 +++
 libgcc/soft-fp/truncsfhf2.c  | 48 
 6 files changed, 253 insertions(+)
 create mode 100644 libgcc/soft-fp/eqhf2.c
 create mode 100644 libgcc/soft-fp/extendhfdf2.c
 create mode 100644 libgcc/soft-fp/extendhfsf2.c
 create mode 100644 libgcc/soft-fp/truncdfhf2.c
 create mode 100644 libgcc/soft-fp/truncsfhf2.c

diff --git a/libgcc/soft-fp/eqhf2.c b/libgcc/soft-fp/eqhf2.c
new file mode 100644
index 000..6d6634e5c54
--- /dev/null
+++ b/libgcc/soft-fp/eqhf2.c
@@ -0,0 +1,49 @@
+/* Software floating-point emulation.
+   Return 0 iff a == b, 1 otherwise
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   .  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+CMPtype
+__eqhf2 (HFtype a, HFtype b)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  FP_DECL_H (B);
+  CMPtype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_UNPACK_RAW_H (B, b);
+  FP_CMP_EQ_H (r, A, B, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+strong_alias (__eqhf2, __nehf2);
diff --git a/libgcc/soft-fp/extendhfdf2.c b/libgcc/soft-fp/extendhfdf2.c
new file mode 100644
index 000..337ba791d48
--- /dev/null
+++ b/libgcc/soft-fp/extendhfdf2.c
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+   Return an IEEE half converted to IEEE double
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   .  */
+
+#define FP_NO_EXACT_UNDERFLOW
+#include "soft-fp.h"
+#include "half.h"
+#include "double.h"
+
+DFtype
+__extendhfdf2 (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  FP_DECL_D (R);
+  DFtype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H 

Re: [PATCH] soft-fp: Update soft-fp from glibc

2021-07-01 Thread H.J. Lu via Gcc-patches
On Thu, Jul 1, 2021 at 1:12 PM Jeff Law  wrote:
>
>
>
> On 7/1/2021 1:28 PM, H.J. Lu via Gcc-patches wrote:
> > This patch is updating soft-fp from glibc:
> >
> > 1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended.
> > 2. Add __truncxfhf2 to truncate IEEE extended into IEEE half.
> >
> > These are needed by x86 _Float16 support.
> Presumably these are lifted verbatim from glibc?  If so, clearly an ACK

That is correct.  I am checking it in.

> for the trunk.
>
> jeff
>

Thanks.

-- 
H.J.


Re: [PATCH] soft-fp: Update soft-fp from glibc

2021-07-01 Thread Jeff Law via Gcc-patches




On 7/1/2021 1:28 PM, H.J. Lu via Gcc-patches wrote:

This patch is updating soft-fp from glibc:

1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended.
2. Add __truncxfhf2 to truncate IEEE extended into IEEE half.

These are needed by x86 _Float16 support.
Presumably these are lifted verbatim from glibc?  If so, clearly an ACK 
for the trunk.


jeff



[PATCH] soft-fp: Update soft-fp from glibc

2021-07-01 Thread H.J. Lu via Gcc-patches
This patch is updating soft-fp from glibc:

1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended.
2. Add __truncxfhf2 to truncate IEEE extended into IEEE half.

These are needed by x86 _Float16 support.
---
 libgcc/soft-fp/extendhfxf2.c | 53 
 libgcc/soft-fp/truncxfhf2.c  | 52 +++
 2 files changed, 105 insertions(+)
 create mode 100644 libgcc/soft-fp/extendhfxf2.c
 create mode 100644 libgcc/soft-fp/truncxfhf2.c

diff --git a/libgcc/soft-fp/extendhfxf2.c b/libgcc/soft-fp/extendhfxf2.c
new file mode 100644
index 000..1cb5fef9477
--- /dev/null
+++ b/libgcc/soft-fp/extendhfxf2.c
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+   Return an IEEE half converted to IEEE extended.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   .  */
+
+#define FP_NO_EXACT_UNDERFLOW
+#include "soft-fp.h"
+#include "half.h"
+#include "extended.h"
+
+XFtype
+__extendhfxf2 (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  FP_DECL_E (R);
+  XFtype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+#if _FP_W_TYPE_SIZE < 64
+  FP_EXTEND (E, H, 4, 1, R, A);
+#else
+  FP_EXTEND (E, H, 2, 1, R, A);
+#endif
+  FP_PACK_RAW_E (r, R);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/soft-fp/truncxfhf2.c b/libgcc/soft-fp/truncxfhf2.c
new file mode 100644
index 000..688ad24523d
--- /dev/null
+++ b/libgcc/soft-fp/truncxfhf2.c
@@ -0,0 +1,52 @@
+/* Software floating-point emulation.
+   Truncate IEEE extended into IEEE half.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   .  */
+
+#include "soft-fp.h"
+#include "half.h"
+#include "extended.h"
+
+HFtype
+__truncxfhf2 (XFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_E (A);
+  FP_DECL_H (R);
+  HFtype r;
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_SEMIRAW_E (A, a);
+#if _FP_W_TYPE_SIZE < 64
+  FP_TRUNC (H, E, 1, 4, R, A);
+#else
+  FP_TRUNC (H, E, 1, 2, R, A);
+#endif
+  FP_PACK_SEMIRAW_H (r, R);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
-- 
2.31.1



Re: [PATCH] soft-fp: Update soft-fp from glibc

2019-05-16 Thread Joseph Myers
On Wed, 15 May 2019, H.J. Lu wrote:

> This patch is updating all soft-fp from glibc, most changes are
> copyright years update, and changes other than years update are
> 
>   * soft-fp/extenddftf2.c: Use "_FP_W_TYPE_SIZE < 64" to check if
>   4_FP_W_TYPEs are used for IEEE quad precision.
>   * soft-fp/extendhftf2.c: Likewise.
>   * soft-fp/extendsftf2.c: Likewise.
>   * soft-fp/extendxftf2.c: Likewise.
>   * soft-fp/trunctfdf2.c: Likewise.
>   * soft-fp/trunctfhf2.c: Likewise.
>   * soft-fp/trunctfsf2.c: Likewise.
>   * soft-fp/trunctfxf2.c: Likewise.
>   * config/rs6000/ibm-ldouble.c: Likewise.
> 
> OK for trunk?

OK.

-- 
Joseph S. Myers
jos...@codesourcery.com


[PATCH] soft-fp: Update soft-fp from glibc

2019-05-15 Thread H.J. Lu
This patch is updating all soft-fp from glibc, most changes are
copyright years update, and changes other than years update are

* soft-fp/extenddftf2.c: Use "_FP_W_TYPE_SIZE < 64" to check if
4_FP_W_TYPEs are used for IEEE quad precision.
* soft-fp/extendhftf2.c: Likewise.
* soft-fp/extendsftf2.c: Likewise.
* soft-fp/extendxftf2.c: Likewise.
* soft-fp/trunctfdf2.c: Likewise.
* soft-fp/trunctfhf2.c: Likewise.
* soft-fp/trunctfsf2.c: Likewise.
* soft-fp/trunctfxf2.c: Likewise.
* config/rs6000/ibm-ldouble.c: Likewise.

OK for trunk?

Thanks.

H.J.
---
 libgcc/config/rs6000/ibm-ldouble.c | 4 ++--
 libgcc/soft-fp/adddf3.c| 2 +-
 libgcc/soft-fp/addsf3.c| 2 +-
 libgcc/soft-fp/addtf3.c| 2 +-
 libgcc/soft-fp/divdf3.c| 2 +-
 libgcc/soft-fp/divsf3.c| 2 +-
 libgcc/soft-fp/divtf3.c| 2 +-
 libgcc/soft-fp/double.h| 2 +-
 libgcc/soft-fp/eqdf2.c | 2 +-
 libgcc/soft-fp/eqsf2.c | 2 +-
 libgcc/soft-fp/eqtf2.c | 2 +-
 libgcc/soft-fp/extenddftf2.c   | 4 ++--
 libgcc/soft-fp/extended.h  | 2 +-
 libgcc/soft-fp/extendhftf2.c   | 4 ++--
 libgcc/soft-fp/extendsfdf2.c   | 2 +-
 libgcc/soft-fp/extendsftf2.c   | 4 ++--
 libgcc/soft-fp/extendxftf2.c   | 4 ++--
 libgcc/soft-fp/fixdfdi.c   | 2 +-
 libgcc/soft-fp/fixdfsi.c   | 2 +-
 libgcc/soft-fp/fixdfti.c   | 2 +-
 libgcc/soft-fp/fixhfti.c   | 2 +-
 libgcc/soft-fp/fixsfdi.c   | 2 +-
 libgcc/soft-fp/fixsfsi.c   | 2 +-
 libgcc/soft-fp/fixsfti.c   | 2 +-
 libgcc/soft-fp/fixtfdi.c   | 2 +-
 libgcc/soft-fp/fixtfsi.c   | 2 +-
 libgcc/soft-fp/fixtfti.c   | 2 +-
 libgcc/soft-fp/fixunsdfdi.c| 2 +-
 libgcc/soft-fp/fixunsdfsi.c| 2 +-
 libgcc/soft-fp/fixunsdfti.c| 2 +-
 libgcc/soft-fp/fixunshfti.c| 2 +-
 libgcc/soft-fp/fixunssfdi.c| 2 +-
 libgcc/soft-fp/fixunssfsi.c| 2 +-
 libgcc/soft-fp/fixunssfti.c| 2 +-
 libgcc/soft-fp/fixunstfdi.c| 2 +-
 libgcc/soft-fp/fixunstfsi.c| 2 +-
 libgcc/soft-fp/fixunstfti.c| 2 +-
 libgcc/soft-fp/floatdidf.c | 2 +-
 libgcc/soft-fp/floatdisf.c | 2 +-
 libgcc/soft-fp/floatditf.c | 2 +-
 libgcc/soft-fp/floatsidf.c | 2 +-
 libgcc/soft-fp/floatsisf.c | 2 +-
 libgcc/soft-fp/floatsitf.c | 2 +-
 libgcc/soft-fp/floattidf.c | 2 +-
 libgcc/soft-fp/floattihf.c | 2 +-
 libgcc/soft-fp/floattisf.c | 2 +-
 libgcc/soft-fp/floattitf.c | 2 +-
 libgcc/soft-fp/floatundidf.c   | 2 +-
 libgcc/soft-fp/floatundisf.c   | 2 +-
 libgcc/soft-fp/floatunditf.c   | 2 +-
 libgcc/soft-fp/floatunsidf.c   | 2 +-
 libgcc/soft-fp/floatunsisf.c   | 2 +-
 libgcc/soft-fp/floatunsitf.c   | 2 +-
 libgcc/soft-fp/floatuntidf.c   | 2 +-
 libgcc/soft-fp/floatuntihf.c   | 2 +-
 libgcc/soft-fp/floatuntisf.c   | 2 +-
 libgcc/soft-fp/floatuntitf.c   | 2 +-
 libgcc/soft-fp/gedf2.c | 2 +-
 libgcc/soft-fp/gesf2.c | 2 +-
 libgcc/soft-fp/getf2.c | 2 +-
 libgcc/soft-fp/half.h  | 2 +-
 libgcc/soft-fp/ledf2.c | 2 +-
 libgcc/soft-fp/lesf2.c | 2 +-
 libgcc/soft-fp/letf2.c | 2 +-
 libgcc/soft-fp/muldf3.c| 2 +-
 libgcc/soft-fp/mulsf3.c| 2 +-
 libgcc/soft-fp/multf3.c| 2 +-
 libgcc/soft-fp/negdf2.c| 2 +-
 libgcc/soft-fp/negsf2.c| 2 +-
 libgcc/soft-fp/negtf2.c| 2 +-
 libgcc/soft-fp/op-1.h  | 2 +-
 libgcc/soft-fp/op-2.h  | 2 +-
 libgcc/soft-fp/op-4.h  | 2 +-
 libgcc/soft-fp/op-8.h  | 2 +-
 libgcc/soft-fp/op-common.h | 2 +-
 libgcc/soft-fp/quad.h  | 2 +-
 libgcc/soft-fp/single.h| 2 +-
 libgcc/soft-fp/soft-fp.h   | 2 +-
 libgcc/soft-fp/subdf3.c| 2 +-
 libgcc/soft-fp/subsf3.c| 2 +-
 libgcc/soft-fp/subtf3.c| 2 +-
 libgcc/soft-fp/truncdfsf2.c| 2 +-
 libgcc/soft-fp/trunctfdf2.c| 4 ++--
 libgcc/soft-fp/trunctfhf2.c| 4 ++--
 libgcc/soft-fp/trunctfsf2.c| 4 ++--
 libgcc/soft-fp/trunctfxf2.c| 4 ++--
 libgcc/soft-fp/unorddf2.c  | 2 +-
 libgcc/soft-fp/unordsf2.c  | 2 +-
 libgcc/soft-fp/unordtf2.c  | 2 +-
 89 files changed, 98 insertions(+), 98 deletions(-)

diff --git a/libgcc/config/rs6000/ibm-ldouble.c 
b/libgcc/config/rs6000/ibm-ldouble.c
index f9118d8fc394..0e1c443af011 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -407,7 +407,7 @@ fmsub (double a, double b, double c)
 FP_UNPACK_RAW_D (C, c);
 
 /* Extend double to quad.  */
-#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+#if _FP_W_TYPE_SIZE < 64
 FP_EXTEND(Q,D,4,2,X,A);
 FP_EXTEND(Q,D,4,2,Y,B);