https://gcc.gnu.org/g:7f399ae4704d4a9335a8ce289d557f640399d671

commit 7f399ae4704d4a9335a8ce289d557f640399d671
Author: Michael Meissner <[email protected]>
Date:   Fri Sep 25 15:17:48 2026 -0400

    Add _gpr HFmode conversion functions.
    
    2026-09-25  Michael Meissner  <[email protected]>
    
            * config/rs60000/pc-fixhfdi.c: New file.
            * config/rs6000/ppc-fixhfsi.c: Likewise.
            * config/rs6000/ppc-fixhfti.c: Likewise.
            * config/rs60000/pc-fixunshfdi.c: Likewise.
            * config/rs6000/ppc-fixunshfsi.c: Likewise.
            * config/rs6000/ppc-fixunshfti.c: Likewise.
            * config/rs6000/ppc-floatdihf.c: Likewise.
            * config/rs6000/ppc-floatsihf.c: Likewise.
            * config/rs6000/ppc-floattihf.c: Likewise.
            * config/rs6000/ppc-floatundihf.c: Likewise.
            * config/rs6000/ppc-floatunsihf.c: Likewise.
            * config/rs6000/ppc-floatuntihf.c: Likewise.
            * config/rs6000/t-float16: Add support for the HF _gpr functions.

Diff:
---
 libgcc/config/rs6000/ppc-fixhfdi.c     | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-fixhfsi.c     | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-fixhfti.c     | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-fixunshfdi.c  | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-fixunshfsi.c  | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-fixunshfti.c  | 71 ++++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floatdihf.c   | 69 +++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floatsihf.c   | 69 +++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floattihf.c   | 69 +++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floatundihf.c | 68 ++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floatunsihf.c | 68 ++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/ppc-floatuntihf.c | 68 ++++++++++++++++++++++++++++++++
 libgcc/config/rs6000/t-float16         | 11 +++---
 13 files changed, 843 insertions(+), 5 deletions(-)

diff --git a/libgcc/config/rs6000/ppc-fixhfdi.c 
b/libgcc/config/rs6000/ppc-fixhfdi.c
new file mode 100644
index 000000000000..3ee87c31dea5
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixhfdi.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert a IEEE half to 64bit signed integer
+   Copyright (C) 2022 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
+   <http://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixhfdi.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+DItype
+__fixhfdi (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UDItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, DI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+DItype
+__fixhfdi_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UDItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, DI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-fixhfsi.c 
b/libgcc/config/rs6000/ppc-fixhfsi.c
new file mode 100644
index 000000000000..41d6eec7291c
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixhfsi.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert IEEE half to 32bit unsigned integer
+   Copyright (C) 2022 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
+   <http://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixhfsi.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+SItype
+__fixhfsi (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  USItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, SI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+SItype
+__fixhfsi_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  USItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, SI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-fixhfti.c 
b/libgcc/config/rs6000/ppc-fixhfti.c
new file mode 100644
index 000000000000..9e5c2b4f089b
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixhfti.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert IEEE half to 128bit signed integer
+   Copyright (C) 2007-2022 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixhfti.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+TItype
+__fixhfti (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UTItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, TI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+TItype
+__fixhfti_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UTItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, TI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-fixunshfdi.c 
b/libgcc/config/rs6000/ppc-fixunshfdi.c
new file mode 100644
index 000000000000..d26b1842560a
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixunshfdi.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert IEEE half to 64bit unsigned integer
+   Copyright (C) 2022 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
+   <http://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixhfdi.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+UDItype
+__fixunshfdi (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UDItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, DI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+UDItype
+__fixunshfdi_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UDItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, DI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-fixunshfsi.c 
b/libgcc/config/rs6000/ppc-fixunshfsi.c
new file mode 100644
index 000000000000..90d7d34bb5be
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixunshfsi.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert IEEE half to 32bit unsigned integer
+   Copyright (C) 2022 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
+   <http://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixunshfsi.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+USItype
+__fixunshfsi (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  USItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, SI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+USItype
+__fixunshfsi_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  USItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, SI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-fixunshfti.c 
b/libgcc/config/rs6000/ppc-fixunshfti.c
new file mode 100644
index 000000000000..b0880f04621f
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-fixunshfti.c
@@ -0,0 +1,71 @@
+/* Software floating-point emulation.
+   Convert IEEE half to 128bit unsigned integer
+   Copyright (C) 2007-2022 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/fixhunshfti.c
+
+   We provide 2 conversions, one that takes the HFtype in a floating point
+   register and the other takes it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+UTItype
+__fixunshfti (HFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UTItype r;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, TI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
+
+UTItype
+__fixunshfti_gpr (unsigned short us)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  UTItype r;
+  union ushort_hf u;
+  HFtype a;
+
+  u.us = us;
+  a = u.hf;
+
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_H (A, a);
+  FP_TO_INT_H (r, A, TI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/libgcc/config/rs6000/ppc-floatdihf.c 
b/libgcc/config/rs6000/ppc-floatdihf.c
new file mode 100644
index 000000000000..40a8ff3b1f53
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floatdihf.c
@@ -0,0 +1,69 @@
+/* Software floating-point emulation.
+   Convert a 32bit signed integer to hfloat16
+   Copyright (C) 2024 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floatdihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floatdihf (DItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, DI_BITS, UDItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floatdihf_gpr (DItype i)
+{
+  union ushort_hf u;
+
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, DI_BITS, UDItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/ppc-floatsihf.c 
b/libgcc/config/rs6000/ppc-floatsihf.c
new file mode 100644
index 000000000000..2d394e8fb6f2
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floatsihf.c
@@ -0,0 +1,69 @@
+/* Software floating-point emulation.
+   Convert a 32bit signed integer to hfloat16
+   Copyright (C) 2024 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floatsihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floatsihf (SItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, SI_BITS, USItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floatsihf_gpr (SItype i)
+{
+  union ushort_hf u;
+
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, SI_BITS, USItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/ppc-floattihf.c 
b/libgcc/config/rs6000/ppc-floattihf.c
new file mode 100644
index 000000000000..9f3d6a4093f9
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floattihf.c
@@ -0,0 +1,69 @@
+/* Software floating-point emulation.
+   Convert a 128bit signed integer to hfloat16
+   Copyright (C) 2007-2023 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floattihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floattihf (TItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floattihf_gpr (TItype i)
+{
+  union ushort_hf u;
+
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/ppc-floatundihf.c 
b/libgcc/config/rs6000/ppc-floatundihf.c
new file mode 100644
index 000000000000..08f0b03bc670
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floatundihf.c
@@ -0,0 +1,68 @@
+/* Software floating-point emulation.
+   Convert a 64bit unsigned integer to hfloat16
+   Copyright (C) 2007-2023 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floatundihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floatundihf (UDItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, DI_BITS, UDItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floatundihf_gpr (UDItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+  union ushort_hf u;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, DI_BITS, UDItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/ppc-floatunsihf.c 
b/libgcc/config/rs6000/ppc-floatunsihf.c
new file mode 100644
index 000000000000..ab0888226dac
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floatunsihf.c
@@ -0,0 +1,68 @@
+/* Software floating-point emulation.
+   Convert a 32bit unsigned integer to IEEE half.
+   Copyright (C) 2022 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
+   <http://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floatunssihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floatunsihf (USItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, SI_BITS, USItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floatunsihf_gpr (USItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+  union ushort_hf u;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, SI_BITS, USItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/ppc-floatuntihf.c 
b/libgcc/config/rs6000/ppc-floatuntihf.c
new file mode 100644
index 000000000000..a9e2ce95d755
--- /dev/null
+++ b/libgcc/config/rs6000/ppc-floatuntihf.c
@@ -0,0 +1,68 @@
+/* Software floating-point emulation.
+   Convert a 128bit unsigned integer to hfloat16
+   Copyright (C) 2007-2023 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
+   <https://www.gnu.org/licenses/>.
+
+   This is a clone of softfp/floatuntihf.c.
+
+   We provide 2 conversions, one that returns the HFtype in a floating point
+   register and the other returns it in a general purpose register that is used
+   when HFtype must be converted to the 32/64-bit scalar tyhpe.  */
+
+#include "soft-fp.h"
+#include "half.h"
+
+HFtype
+__floatuntihf (UTItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
+
+unsigned short
+__floatuntihf_gpr (UTItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_H (A);
+  HFtype a;
+  union ushort_hf u;
+
+  FP_INIT_ROUNDMODE;
+  FP_FROM_INT_H (A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_H (a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  u.hf = a;
+  return u.us;
+}
diff --git a/libgcc/config/rs6000/t-float16 b/libgcc/config/rs6000/t-float16
index 93d2ca31d18f..e04072c0fa80 100644
--- a/libgcc/config/rs6000/t-float16
+++ b/libgcc/config/rs6000/t-float16
@@ -1,16 +1,17 @@
 # _Float16 library support, source files in soft-ftp
 fp16_funcs_1   = eqhf2 \
-                 fixhfsi  fixhfdi fixhfti \
-                 fixunshfsi fixunshfdi fixunshfti \
-                 floatsihf floatdihf floattihf \
-                 floatunsihf floatundihf floatuntihf \
                  floatbitinthf
 
 fp16_src_1     = $(addprefix $(srcdir)/soft-fp/,$(addsuffix 
.c,$(fp16_funcs_1)))
 fp16_obj_1     = $(addsuffix $(objext),$(fp16_funcs_1))
 
 # _Float16 library support, source files in config/rs6000
-fp16_funcs_2   = extendhf-sfdf2 truncsfdf-hf2
+fp16_funcs_2   = extendhf-sfdf2 truncsfdf-hf2 \
+                 ppc-fixhfsi  ppc-fixhfdi ppc-fixhfti \
+                 ppc-fixunshfsi ppc-fixunshfdi ppc-fixunshfti \
+                 ppc-floatsihf ppc-floatdihf ppc-floattihf \
+                 ppc-floatunsihf ppc-floatundihf ppc-floatuntihf
+
 fp16_src_2     = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix 
.c,$(fp16_funcs_2)))
 fp16_obj_2     = $(addsuffix $(objext),$(fp16_funcs_2))

Reply via email to