https://gcc.gnu.org/g:7e71190b8085d37431784cf2e99503ea4d3a5916
commit 7e71190b8085d37431784cf2e99503ea4d3a5916 Author: Michael Meissner <[email protected]> Date: Sat Sep 26 14:09:06 2026 -0400 Add ppc-eqhf2 and ppc-eqbf2 2026-09-26 Michael Meissner <[email protected]> * config/rs6000/ppc-eqbf2.c: New file. * config/rs6000/ppc-eqhf2.c: Likewise. * config/rs6000/t-float16: Add ppc-eqbf2 and ppc-eqhf2. Don't build normal eqhf2. Diff: --- libgcc/config/rs6000/ppc-eqbf2.c | 83 ++++++++++++++++++++++++++++++++++++++++ libgcc/config/rs6000/ppc-eqhf2.c | 83 ++++++++++++++++++++++++++++++++++++++++ libgcc/config/rs6000/t-float16 | 9 +++-- 3 files changed, 171 insertions(+), 4 deletions(-) diff --git a/libgcc/config/rs6000/ppc-eqbf2.c b/libgcc/config/rs6000/ppc-eqbf2.c new file mode 100644 index 000000000000..74efa96e1231 --- /dev/null +++ b/libgcc/config/rs6000/ppc-eqbf2.c @@ -0,0 +1,83 @@ +/* Software floating-point emulation. + Return 0 iff a == b, 1 otherwise + Copyright (C) 2021-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/eqhf2.c. + + We provide 2 conversions, one that returns the BFtype in a floating point + register and the other returns it in a general purpose register that is used + when BFtype must be converted to the 32/64-bit scalar tyhpe. */ + +#include "soft-fp.h" +#include "brain.h" + +/* When BFtype is passed in FPR registers. */ +CMPtype +__eqbf2 (BFtype a, BFtype b) +{ + FP_DECL_EX; + FP_DECL_B (A); + FP_DECL_B (B); + CMPtype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_B (A, a); + FP_UNPACK_RAW_B (B, b); + FP_CMP_EQ_B (r, A, B, 1); + FP_HANDLE_EXCEPTIONS; + + return r; +} + +strong_alias (__eqbf2, __nebf2); + +/* When BFtype is passed in GPR registers. */ +CMPtype +__eqbf2_gpr (unsigned short us_a, unsigned short us_b) +{ + FP_DECL_EX; + FP_DECL_B (A); + FP_DECL_B (B); + CMPtype r; + union ushort_bf u_a, u_b; + BFtype a, b; + + u_a.us = us_a; + u_b.us = us_b; + a = u_a.bf; + b = u_b.bf; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_B (A, a); + FP_UNPACK_RAW_B (B, b); + FP_CMP_EQ_B (r, A, B, 1); + FP_HANDLE_EXCEPTIONS; + + return r; +} + +strong_alias (__eqbf2_gpr, __nebf2_gpr); diff --git a/libgcc/config/rs6000/ppc-eqhf2.c b/libgcc/config/rs6000/ppc-eqhf2.c new file mode 100644 index 000000000000..7c44b6cff7a7 --- /dev/null +++ b/libgcc/config/rs6000/ppc-eqhf2.c @@ -0,0 +1,83 @@ +/* Software floating-point emulation. + Return 0 iff a == b, 1 otherwise + Copyright (C) 2021-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/eqhf2.c. + + We provide 2 conversions, one that returns the BFtype in a floating point + register and the other returns it in a general purpose register that is used + when BFtype must be converted to the 32/64-bit scalar tyhpe. */ + +#include "soft-fp.h" +#include "half.h" + +/* When HFtype is passed in FPR registers. */ +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); + +/* When HFtype is passed in GPR registers. */ +CMPtype +__eqhf2_gpr (unsigned short us_a, unsigned short us_b) +{ + FP_DECL_EX; + FP_DECL_H (A); + FP_DECL_H (B); + CMPtype r; + union ushort_hf u_a, u_b; + HFtype a, b; + + u_a.us = us_a; + u_b.us = us_b; + a = u_a.hf; + b = u_b.hf; + + 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_gpr, __nehf2_gpr); diff --git a/libgcc/config/rs6000/t-float16 b/libgcc/config/rs6000/t-float16 index 8bb913e12c17..c7222bc5b1dd 100644 --- a/libgcc/config/rs6000/t-float16 +++ b/libgcc/config/rs6000/t-float16 @@ -1,6 +1,5 @@ # _Float16 library support, source files in soft-ftp -fp16_funcs_1 = eqhf2 \ - floatbitinthf +fp16_funcs_1 = floatbitinthf fp16_src_1 = $(addprefix $(srcdir)/soft-fp/,$(addsuffix .c,$(fp16_funcs_1))) fp16_obj_1 = $(addsuffix $(objext),$(fp16_funcs_1)) @@ -10,7 +9,8 @@ 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 + ppc-floatunsihf ppc-floatundihf ppc-floatuntihf \ + ppc-eqhf2 fp16_src_2 = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix .c,$(fp16_funcs_2))) fp16_obj_2 = $(addsuffix $(objext),$(fp16_funcs_2)) @@ -37,7 +37,8 @@ bfp16_funcs_2 = extendbf-sfdf2 truncsfdf-bf2 \ ppc-floatsibf ppc-floatdibf ppc-floattibf \ ppc-floatunsibf ppc-floatundibf ppc-floatuntibf \ ppc-fixbfsi ppc-fixbfdi ppc-fixbfti \ - ppc-fixunsbfsi ppc-fixunsbfdi ppc-fixunsbfti + ppc-fixunsbfsi ppc-fixunsbfdi ppc-fixunsbfti \ + ppc-eqbf2 bfp16_src_2 = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix .c,$(bfp16_funcs_2))) bfp16_obj_2 = $(addsuffix $(objext),$(bfp16_funcs_2))
