From e230261073950e554319f56716d2b17c09a28658 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Wed, 10 Aug 2022 21:54:24 +0800 Subject: soft-fp: Update soft-fp from glibc 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. * soft-fp/unordtf2.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 ++---- libgcc/soft-fp/extended.h | 5 ++--- libgcc/soft-fp/extendhfdf2.c | 2 +- libgcc/soft-fp/extendhfsf2.c | 2 +- libgcc/soft-fp/extendhftf2.c | 4 ++-- libgcc/soft-fp/extendhfxf2.c | 2 +- libgcc/soft-fp/extendsfdf2.c | 6 ++---- libgcc/soft-fp/extendsftf2.c | 6 ++---- libgcc/soft-fp/extendxftf2.c | 5 ++--- libgcc/soft-fp/fixdfdi.c | 6 ++---- libgcc/soft-fp/fixdfsi.c | 6 ++---- libgcc/soft-fp/fixdfti.c | 5 ++--- libgcc/soft-fp/fixhfdi.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/fixhfsi.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/fixhfti.c | 4 ++-- libgcc/soft-fp/fixsfdi.c | 6 ++---- libgcc/soft-fp/fixsfsi.c | 6 ++---- libgcc/soft-fp/fixsfti.c | 5 ++--- libgcc/soft-fp/fixtfdi.c | 6 ++---- libgcc/soft-fp/fixtfsi.c | 6 ++---- libgcc/soft-fp/fixtfti.c | 5 ++--- libgcc/soft-fp/fixunsdfdi.c | 6 ++---- libgcc/soft-fp/fixunsdfsi.c | 6 ++---- libgcc/soft-fp/fixunsdfti.c | 5 ++--- libgcc/soft-fp/fixunshfdi.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/fixunshfsi.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/fixunshfti.c | 4 ++-- libgcc/soft-fp/fixunssfdi.c | 6 ++---- libgcc/soft-fp/fixunssfsi.c | 6 ++---- libgcc/soft-fp/fixunssfti.c | 5 ++--- libgcc/soft-fp/fixunstfdi.c | 6 ++---- libgcc/soft-fp/fixunstfsi.c | 6 ++---- libgcc/soft-fp/fixunstfti.c | 5 ++--- libgcc/soft-fp/floatdidf.c | 6 ++---- libgcc/soft-fp/floatdihf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/floatdisf.c | 6 ++---- libgcc/soft-fp/floatditf.c | 6 ++---- libgcc/soft-fp/floatsidf.c | 6 ++---- libgcc/soft-fp/floatsihf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/floatsisf.c | 6 ++---- libgcc/soft-fp/floatsitf.c | 6 ++---- libgcc/soft-fp/floattidf.c | 5 ++--- libgcc/soft-fp/floattihf.c | 4 ++-- libgcc/soft-fp/floattisf.c | 5 ++--- libgcc/soft-fp/floattitf.c | 5 ++--- libgcc/soft-fp/floatundidf.c | 6 ++---- libgcc/soft-fp/floatundihf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/floatundisf.c | 6 ++---- libgcc/soft-fp/floatunditf.c | 6 ++---- libgcc/soft-fp/floatunsidf.c | 6 ++---- libgcc/soft-fp/floatunsihf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/floatunsisf.c | 6 ++---- libgcc/soft-fp/floatunsitf.c | 6 ++---- libgcc/soft-fp/floatuntidf.c | 5 ++--- libgcc/soft-fp/floatuntihf.c | 4 ++-- libgcc/soft-fp/floatuntisf.c | 5 ++--- libgcc/soft-fp/floatuntitf.c | 5 ++--- libgcc/soft-fp/gedf2.c | 6 ++---- libgcc/soft-fp/gesf2.c | 6 ++---- libgcc/soft-fp/getf2.c | 6 ++---- libgcc/soft-fp/half.h | 7 ++++--- libgcc/soft-fp/ledf2.c | 6 ++---- libgcc/soft-fp/lesf2.c | 6 ++---- libgcc/soft-fp/letf2.c | 6 ++---- libgcc/soft-fp/muldf3.c | 6 ++---- libgcc/soft-fp/mulsf3.c | 6 ++---- libgcc/soft-fp/multf3.c | 6 ++---- libgcc/soft-fp/negdf2.c | 6 ++---- libgcc/soft-fp/negsf2.c | 6 ++---- libgcc/soft-fp/negtf2.c | 6 ++---- libgcc/soft-fp/op-1.h | 8 ++------ libgcc/soft-fp/op-2.h | 8 ++------ libgcc/soft-fp/op-4.h | 8 ++------ libgcc/soft-fp/op-8.h | 7 ++----- libgcc/soft-fp/op-common.h | 8 ++------ libgcc/soft-fp/quad.h | 8 ++------ libgcc/soft-fp/single.h | 8 ++------ libgcc/soft-fp/soft-fp.h | 8 ++------ libgcc/soft-fp/subdf3.c | 6 ++---- libgcc/soft-fp/subsf3.c | 6 ++---- libgcc/soft-fp/subtf3.c | 6 ++---- libgcc/soft-fp/truncdfhf2.c | 2 +- libgcc/soft-fp/truncdfsf2.c | 6 ++---- libgcc/soft-fp/truncsfhf2.c | 2 +- libgcc/soft-fp/trunctfdf2.c | 6 ++---- libgcc/soft-fp/trunctfhf2.c | 4 ++-- libgcc/soft-fp/trunctfsf2.c | 6 ++---- libgcc/soft-fp/trunctfxf2.c | 5 ++--- libgcc/soft-fp/truncxfhf2.c | 2 +- libgcc/soft-fp/unorddf2.c | 5 ++--- libgcc/soft-fp/unordsf2.c | 5 ++--- libgcc/soft-fp/unordtf2.c | 5 ++--- 103 files changed, 545 insertions(+), 345 deletions(-) create mode 100644 libgcc/soft-fp/fixhfdi.c create mode 100644 libgcc/soft-fp/fixhfsi.c create mode 100644 libgcc/soft-fp/fixunshfdi.c create mode 100644 libgcc/soft-fp/fixunshfsi.c create mode 100644 libgcc/soft-fp/floatdihf.c create mode 100644 libgcc/soft-fp/floatsihf.c create mode 100644 libgcc/soft-fp/floatundihf.c create mode 100644 libgcc/soft-fp/floatunsihf.c (limited to 'libgcc') diff --git a/libgcc/soft-fp/adddf3.c b/libgcc/soft-fp/adddf3.c index 4d60ffa..1b0a0d5 100644 --- a/libgcc/soft-fp/adddf3.c +++ b/libgcc/soft-fp/adddf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a + b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/addsf3.c b/libgcc/soft-fp/addsf3.c index bf9cd84..ef9a4ee 100644 --- a/libgcc/soft-fp/addsf3.c +++ b/libgcc/soft-fp/addsf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a + b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/addtf3.c b/libgcc/soft-fp/addtf3.c index 482c2cb..cdf3aa0 100644 --- a/libgcc/soft-fp/addtf3.c +++ b/libgcc/soft-fp/addtf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a + b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/divdf3.c b/libgcc/soft-fp/divdf3.c index 46bbb88..bc3c3c6e 100644 --- a/libgcc/soft-fp/divdf3.c +++ b/libgcc/soft-fp/divdf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a / b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/divsf3.c b/libgcc/soft-fp/divsf3.c index dbafb38..204e855 100644 --- a/libgcc/soft-fp/divsf3.c +++ b/libgcc/soft-fp/divsf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a / b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/divtf3.c b/libgcc/soft-fp/divtf3.c index 3f23ce7..e618c5e 100644 --- a/libgcc/soft-fp/divtf3.c +++ b/libgcc/soft-fp/divtf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a / b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/double.h b/libgcc/soft-fp/double.h index 7f897ec..497ab92 100644 --- a/libgcc/soft-fp/double.h +++ b/libgcc/soft-fp/double.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Definitions for IEEE Double Precision - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_DOUBLE_H #define SOFT_FP_DOUBLE_H 1 diff --git a/libgcc/soft-fp/eqdf2.c b/libgcc/soft-fp/eqdf2.c index 2a44ee3..d872010 100644 --- a/libgcc/soft-fp/eqdf2.c +++ b/libgcc/soft-fp/eqdf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 otherwise - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/eqhf2.c b/libgcc/soft-fp/eqhf2.c index 6d6634e..fc702ab 100644 --- a/libgcc/soft-fp/eqhf2.c +++ b/libgcc/soft-fp/eqhf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 otherwise - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/eqsf2.c b/libgcc/soft-fp/eqsf2.c index c515044..206df85 100644 --- a/libgcc/soft-fp/eqsf2.c +++ b/libgcc/soft-fp/eqsf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 otherwise - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/eqtf2.c b/libgcc/soft-fp/eqtf2.c index 5feac41..ff94805 100644 --- a/libgcc/soft-fp/eqtf2.c +++ b/libgcc/soft-fp/eqtf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 otherwise - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/extenddftf2.c b/libgcc/soft-fp/extenddftf2.c index 0568ddf..70df60d 100644 --- a/libgcc/soft-fp/extenddftf2.c +++ b/libgcc/soft-fp/extenddftf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a converted to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/extended.h b/libgcc/soft-fp/extended.h index 435be3d..14e306d 100644 --- a/libgcc/soft-fp/extended.h +++ b/libgcc/soft-fp/extended.h @@ -1,8 +1,7 @@ /* Software floating-point emulation. Definitions for IEEE Extended Precision. - Copyright (C) 1999-2019 Free Software Foundation, Inc. + Copyright (C) 1999-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by 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 @@ -25,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_EXTENDED_H #define SOFT_FP_EXTENDED_H 1 diff --git a/libgcc/soft-fp/extendhfdf2.c b/libgcc/soft-fp/extendhfdf2.c index 337ba79..9bb970a 100644 --- a/libgcc/soft-fp/extendhfdf2.c +++ b/libgcc/soft-fp/extendhfdf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Return an IEEE half converted to IEEE double - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/extendhfsf2.c b/libgcc/soft-fp/extendhfsf2.c index a02f46d..0370ea6 100644 --- a/libgcc/soft-fp/extendhfsf2.c +++ b/libgcc/soft-fp/extendhfsf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Return an IEEE half converted to IEEE single - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/extendhftf2.c b/libgcc/soft-fp/extendhftf2.c index c71ab53..b7069c1 100644 --- a/libgcc/soft-fp/extendhftf2.c +++ b/libgcc/soft-fp/extendhftf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Return an IEEE half converted to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/extendhfxf2.c b/libgcc/soft-fp/extendhfxf2.c index 1cb5fef..1d80f0f 100644 --- a/libgcc/soft-fp/extendhfxf2.c +++ b/libgcc/soft-fp/extendhfxf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Return an IEEE half converted to IEEE extended. - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/extendsfdf2.c b/libgcc/soft-fp/extendsfdf2.c index 1e3ce92..6f0b8659 100644 --- a/libgcc/soft-fp/extendsfdf2.c +++ b/libgcc/soft-fp/extendsfdf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a converted to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/extendsftf2.c b/libgcc/soft-fp/extendsftf2.c index 82b5d62..5ba18dd 100644 --- a/libgcc/soft-fp/extendsftf2.c +++ b/libgcc/soft-fp/extendsftf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a converted to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/extendxftf2.c b/libgcc/soft-fp/extendxftf2.c index d9885e5..4d56b1d 100644 --- a/libgcc/soft-fp/extendxftf2.c +++ b/libgcc/soft-fp/extendxftf2.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Return a converted to IEEE quad - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "extended.h" diff --git a/libgcc/soft-fp/fixdfdi.c b/libgcc/soft-fp/fixdfdi.c index a96d10d..e077b39 100644 --- a/libgcc/soft-fp/fixdfdi.c +++ b/libgcc/soft-fp/fixdfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixdfsi.c b/libgcc/soft-fp/fixdfsi.c index 5ccab27..9f3ba7b 100644 --- a/libgcc/soft-fp/fixdfsi.c +++ b/libgcc/soft-fp/fixdfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixdfti.c b/libgcc/soft-fp/fixdfti.c index 7a09e79..fad1a97 100644 --- a/libgcc/soft-fp/fixdfti.c +++ b/libgcc/soft-fp/fixdfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE double to 128bit signed integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixhfdi.c b/libgcc/soft-fp/fixhfdi.c new file mode 100644 index 0000000..630a1e3 --- /dev/null +++ b/libgcc/soft-fp/fixhfdi.c @@ -0,0 +1,45 @@ +/* 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/fixhfsi.c b/libgcc/soft-fp/fixhfsi.c new file mode 100644 index 0000000..4699a75 --- /dev/null +++ b/libgcc/soft-fp/fixhfsi.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a IEEE half to 32bit 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/fixhfti.c b/libgcc/soft-fp/fixhfti.c index f953856..7997669 100644 --- a/libgcc/soft-fp/fixhfti.c +++ b/libgcc/soft-fp/fixhfti.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Convert IEEE half to 128bit signed integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + 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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/fixsfdi.c b/libgcc/soft-fp/fixsfdi.c index 4da18b9..99e1d81 100644 --- a/libgcc/soft-fp/fixsfdi.c +++ b/libgcc/soft-fp/fixsfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixsfsi.c b/libgcc/soft-fp/fixsfsi.c index 3705b9a..a50d061 100644 --- a/libgcc/soft-fp/fixsfsi.c +++ b/libgcc/soft-fp/fixsfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixsfti.c b/libgcc/soft-fp/fixsfti.c index d6905fb..dfbcd5c 100644 --- a/libgcc/soft-fp/fixsfti.c +++ b/libgcc/soft-fp/fixsfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE single to 128bit signed integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixtfdi.c b/libgcc/soft-fp/fixtfdi.c index 44f48f5..2db9a5a 100644 --- a/libgcc/soft-fp/fixtfdi.c +++ b/libgcc/soft-fp/fixtfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/fixtfsi.c b/libgcc/soft-fp/fixtfsi.c index 842df9a..535fb78 100644 --- a/libgcc/soft-fp/fixtfsi.c +++ b/libgcc/soft-fp/fixtfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit signed integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/fixtfti.c b/libgcc/soft-fp/fixtfti.c index bddc7f8..5f854dc 100644 --- a/libgcc/soft-fp/fixtfti.c +++ b/libgcc/soft-fp/fixtfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE quad to 128bit signed integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/fixunsdfdi.c b/libgcc/soft-fp/fixunsdfdi.c index 58a90e4..40ed18c 100644 --- a/libgcc/soft-fp/fixunsdfdi.c +++ b/libgcc/soft-fp/fixunsdfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixunsdfsi.c b/libgcc/soft-fp/fixunsdfsi.c index 8ed28b0..7614734 100644 --- a/libgcc/soft-fp/fixunsdfsi.c +++ b/libgcc/soft-fp/fixunsdfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixunsdfti.c b/libgcc/soft-fp/fixunsdfti.c index 61b5f71..592b2d5 100644 --- a/libgcc/soft-fp/fixunsdfti.c +++ b/libgcc/soft-fp/fixunsdfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE double to 128bit unsigned integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/fixunshfdi.c b/libgcc/soft-fp/fixunshfdi.c new file mode 100644 index 0000000..3ca9c1a --- /dev/null +++ b/libgcc/soft-fp/fixunshfdi.c @@ -0,0 +1,45 @@ +/* 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/fixunshfsi.c b/libgcc/soft-fp/fixunshfsi.c new file mode 100644 index 0000000..66dd699 --- /dev/null +++ b/libgcc/soft-fp/fixunshfsi.c @@ -0,0 +1,45 @@ +/* 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/fixunshfti.c b/libgcc/soft-fp/fixunshfti.c index 2191e4b..f3346dd 100644 --- a/libgcc/soft-fp/fixunshfti.c +++ b/libgcc/soft-fp/fixunshfti.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Convert IEEE half to 128bit unsigned integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + 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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/fixunssfdi.c b/libgcc/soft-fp/fixunssfdi.c index 18ca264..595abbb 100644 --- a/libgcc/soft-fp/fixunssfdi.c +++ b/libgcc/soft-fp/fixunssfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixunssfsi.c b/libgcc/soft-fp/fixunssfsi.c index 080d53b..deccd62 100644 --- a/libgcc/soft-fp/fixunssfsi.c +++ b/libgcc/soft-fp/fixunssfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixunssfti.c b/libgcc/soft-fp/fixunssfti.c index 0f6bc24..449c8a2 100644 --- a/libgcc/soft-fp/fixunssfti.c +++ b/libgcc/soft-fp/fixunssfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE single to 128bit unsigned integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/fixunstfdi.c b/libgcc/soft-fp/fixunstfdi.c index de6faa4..4adb512 100644 --- a/libgcc/soft-fp/fixunstfdi.c +++ b/libgcc/soft-fp/fixunstfdi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 64bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/fixunstfsi.c b/libgcc/soft-fp/fixunstfsi.c index 6b45fe1..0ec085d 100644 --- a/libgcc/soft-fp/fixunstfsi.c +++ b/libgcc/soft-fp/fixunstfsi.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a to 32bit unsigned integer - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/fixunstfti.c b/libgcc/soft-fp/fixunstfti.c index 6e65ab1..8e749d7 100644 --- a/libgcc/soft-fp/fixunstfti.c +++ b/libgcc/soft-fp/fixunstfti.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert IEEE quad to 128bit unsigned integer - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/floatdidf.c b/libgcc/soft-fp/floatdidf.c index 6ecf95f..5158277 100644 --- a/libgcc/soft-fp/floatdidf.c +++ b/libgcc/soft-fp/floatdidf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit signed integer to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/floatdihf.c b/libgcc/soft-fp/floatdihf.c new file mode 100644 index 0000000..284a516 --- /dev/null +++ b/libgcc/soft-fp/floatdihf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 64bit signed 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/floatdisf.c b/libgcc/soft-fp/floatdisf.c index 34f9c0a..ee63e80 100644 --- a/libgcc/soft-fp/floatdisf.c +++ b/libgcc/soft-fp/floatdisf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit signed integer to IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floatditf.c b/libgcc/soft-fp/floatditf.c index 709a665..115694d 100644 --- a/libgcc/soft-fp/floatditf.c +++ b/libgcc/soft-fp/floatditf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit signed integer to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floatsidf.c b/libgcc/soft-fp/floatsidf.c index eabc989..c9908bf 100644 --- a/libgcc/soft-fp/floatsidf.c +++ b/libgcc/soft-fp/floatsidf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit signed integer to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floatsihf.c b/libgcc/soft-fp/floatsihf.c new file mode 100644 index 0000000..2caa11d --- /dev/null +++ b/libgcc/soft-fp/floatsihf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 32bit signed 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/floatsisf.c b/libgcc/soft-fp/floatsisf.c index 7c302e2..5cf0131 100644 --- a/libgcc/soft-fp/floatsisf.c +++ b/libgcc/soft-fp/floatsisf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit signed integer to IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floatsitf.c b/libgcc/soft-fp/floatsitf.c index e44889a..a0c3e5f 100644 --- a/libgcc/soft-fp/floatsitf.c +++ b/libgcc/soft-fp/floatsitf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit signed integer to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floattidf.c b/libgcc/soft-fp/floattidf.c index 889e6ae..794b364 100644 --- a/libgcc/soft-fp/floattidf.c +++ b/libgcc/soft-fp/floattidf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit signed integer to IEEE double - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/floattihf.c b/libgcc/soft-fp/floattihf.c index 2dc3834..57c5650 100644 --- a/libgcc/soft-fp/floattihf.c +++ b/libgcc/soft-fp/floattihf.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Convert a 128bit signed integer to IEEE half - Copyright (C) 2007-2019 Free Software Foundation, Inc. + 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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/floattisf.c b/libgcc/soft-fp/floattisf.c index 6ea6b27..2af3b7d 100644 --- a/libgcc/soft-fp/floattisf.c +++ b/libgcc/soft-fp/floattisf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit signed integer to IEEE single - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floattitf.c b/libgcc/soft-fp/floattitf.c index 1c3e891..ba513b1 100644 --- a/libgcc/soft-fp/floattitf.c +++ b/libgcc/soft-fp/floattitf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit signed integer to IEEE quad - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/floatundidf.c b/libgcc/soft-fp/floatundidf.c index 38c8638..17d2197 100644 --- a/libgcc/soft-fp/floatundidf.c +++ b/libgcc/soft-fp/floatundidf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit unsigned integer to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/floatundihf.c b/libgcc/soft-fp/floatundihf.c new file mode 100644 index 0000000..f325a80 --- /dev/null +++ b/libgcc/soft-fp/floatundihf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 64bit 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/floatundisf.c b/libgcc/soft-fp/floatundisf.c index 0e83569..05cb097 100644 --- a/libgcc/soft-fp/floatundisf.c +++ b/libgcc/soft-fp/floatundisf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit unsigned integer to IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floatunditf.c b/libgcc/soft-fp/floatunditf.c index ba5b5c5..429825a 100644 --- a/libgcc/soft-fp/floatunditf.c +++ b/libgcc/soft-fp/floatunditf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 64bit unsigned integer to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floatunsidf.c b/libgcc/soft-fp/floatunsidf.c index d338fb9..6c9832f 100644 --- a/libgcc/soft-fp/floatunsidf.c +++ b/libgcc/soft-fp/floatunsidf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit unsigned integer to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floatunsihf.c b/libgcc/soft-fp/floatunsihf.c new file mode 100644 index 0000000..8d690a0 --- /dev/null +++ b/libgcc/soft-fp/floatunsihf.c @@ -0,0 +1,45 @@ +/* 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 + . */ + +#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; +} diff --git a/libgcc/soft-fp/floatunsisf.c b/libgcc/soft-fp/floatunsisf.c index a44c0a8..403ad50 100644 --- a/libgcc/soft-fp/floatunsisf.c +++ b/libgcc/soft-fp/floatunsisf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit unsigned integer to IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floatunsitf.c b/libgcc/soft-fp/floatunsitf.c index e972561..e4e9004 100644 --- a/libgcc/soft-fp/floatunsitf.c +++ b/libgcc/soft-fp/floatunsitf.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Convert a 32bit unsigned integer to IEEE quad - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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_EXCEPTIONS #include "soft-fp.h" diff --git a/libgcc/soft-fp/floatuntidf.c b/libgcc/soft-fp/floatuntidf.c index ca311aa..9473b7e 100644 --- a/libgcc/soft-fp/floatuntidf.c +++ b/libgcc/soft-fp/floatuntidf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit unsigned integer to IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/floatuntihf.c b/libgcc/soft-fp/floatuntihf.c index 37423b77..189f91b 100644 --- a/libgcc/soft-fp/floatuntihf.c +++ b/libgcc/soft-fp/floatuntihf.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Convert a 128bit unsigned integer to IEEE half. - Copyright (C) 2007-2019 Free Software Foundation, Inc. + 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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/floatuntisf.c b/libgcc/soft-fp/floatuntisf.c index 5cf0331..ec0d3db 100644 --- a/libgcc/soft-fp/floatuntisf.c +++ b/libgcc/soft-fp/floatuntisf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit unsigned integer to IEEE single - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/floatuntitf.c b/libgcc/soft-fp/floatuntitf.c index 78e7176..e14bd7d 100644 --- a/libgcc/soft-fp/floatuntitf.c +++ b/libgcc/soft-fp/floatuntitf.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Convert a 128bit unsigned integer to IEEE quad - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/gedf2.c b/libgcc/soft-fp/gedf2.c index bcefb61..0b2cc4e 100644 --- a/libgcc/soft-fp/gedf2.c +++ b/libgcc/soft-fp/gedf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/gesf2.c b/libgcc/soft-fp/gesf2.c index 22f0b6a..cf8a047 100644 --- a/libgcc/soft-fp/gesf2.c +++ b/libgcc/soft-fp/gesf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/getf2.c b/libgcc/soft-fp/getf2.c index 6c7e38f..2802e39 100644 --- a/libgcc/soft-fp/getf2.c +++ b/libgcc/soft-fp/getf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/half.h b/libgcc/soft-fp/half.h index 4108f5c..a8c5c31 100644 --- a/libgcc/soft-fp/half.h +++ b/libgcc/soft-fp/half.h @@ -1,6 +1,6 @@ /* Software floating-point emulation. Definitions for IEEE Half Precision. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -24,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_HALF_H #define SOFT_FP_HALF_H 1 @@ -167,5 +167,6 @@ union _FP_UNION_H #define _FP_FRAC_HIGH_RAW_H(X) _FP_FRAC_HIGH_1 (X) #define _FP_FRAC_HIGH_DW_H(X) _FP_FRAC_HIGH_1 (X) -#define FP_CMP_EQ_H(r, X, Y, ex) _FP_CMP_EQ (H, 1, (r), X, Y, (ex)) +#define FP_CMP_EQ_H(r, X, Y, ex) _FP_CMP_EQ (H, 1, (r), X, Y, (ex)) + #endif /* !SOFT_FP_HALF_H */ diff --git a/libgcc/soft-fp/ledf2.c b/libgcc/soft-fp/ledf2.c index c36148e..931ae7d 100644 --- a/libgcc/soft-fp/ledf2.c +++ b/libgcc/soft-fp/ledf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/lesf2.c b/libgcc/soft-fp/lesf2.c index e323353..8500a48 100644 --- a/libgcc/soft-fp/lesf2.c +++ b/libgcc/soft-fp/lesf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/letf2.c b/libgcc/soft-fp/letf2.c index 43d9f77..c432dbe 100644 --- a/libgcc/soft-fp/letf2.c +++ b/libgcc/soft-fp/letf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/muldf3.c b/libgcc/soft-fp/muldf3.c index 71a80e2..951eed1 100644 --- a/libgcc/soft-fp/muldf3.c +++ b/libgcc/soft-fp/muldf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a * b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/mulsf3.c b/libgcc/soft-fp/mulsf3.c index 582e00a..a0fb39e 100644 --- a/libgcc/soft-fp/mulsf3.c +++ b/libgcc/soft-fp/mulsf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a * b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/multf3.c b/libgcc/soft-fp/multf3.c index 377abef..378eddd 100644 --- a/libgcc/soft-fp/multf3.c +++ b/libgcc/soft-fp/multf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a * b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/negdf2.c b/libgcc/soft-fp/negdf2.c index 1c6a22f..5a31a94 100644 --- a/libgcc/soft-fp/negdf2.c +++ b/libgcc/soft-fp/negdf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return -a - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/negsf2.c b/libgcc/soft-fp/negsf2.c index 2f589c9..839873c 100644 --- a/libgcc/soft-fp/negsf2.c +++ b/libgcc/soft-fp/negsf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return -a - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/negtf2.c b/libgcc/soft-fp/negtf2.c index 77c0393..afdea7f 100644 --- a/libgcc/soft-fp/negtf2.c +++ b/libgcc/soft-fp/negtf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return -a - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/op-1.h b/libgcc/soft-fp/op-1.h index 4509fdc..ea407b6 100644 --- a/libgcc/soft-fp/op-1.h +++ b/libgcc/soft-fp/op-1.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Basic one-word fraction declaration and manipulation. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_OP_1_H #define SOFT_FP_OP_1_H 1 diff --git a/libgcc/soft-fp/op-2.h b/libgcc/soft-fp/op-2.h index 96bdc41..412b972 100644 --- a/libgcc/soft-fp/op-2.h +++ b/libgcc/soft-fp/op-2.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Basic two-word fraction declaration and manipulation. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_OP_2_H #define SOFT_FP_OP_2_H 1 diff --git a/libgcc/soft-fp/op-4.h b/libgcc/soft-fp/op-4.h index 65a0644..2c47125d 100644 --- a/libgcc/soft-fp/op-4.h +++ b/libgcc/soft-fp/op-4.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Basic four-word fraction declaration and manipulation. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_OP_4_H #define SOFT_FP_OP_4_H 1 diff --git a/libgcc/soft-fp/op-8.h b/libgcc/soft-fp/op-8.h index 2014a8e..b335d06 100644 --- a/libgcc/soft-fp/op-8.h +++ b/libgcc/soft-fp/op-8.h @@ -1,10 +1,7 @@ /* Software floating-point emulation. Basic eight-word fraction declaration and manipulation. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_OP_8_H #define SOFT_FP_OP_8_H 1 diff --git a/libgcc/soft-fp/op-common.h b/libgcc/soft-fp/op-common.h index a640679..fde4489 100644 --- a/libgcc/soft-fp/op-common.h +++ b/libgcc/soft-fp/op-common.h @@ -1,10 +1,6 @@ /* Software floating-point emulation. Common operations. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,7 +23,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_OP_COMMON_H #define SOFT_FP_OP_COMMON_H 1 diff --git a/libgcc/soft-fp/quad.h b/libgcc/soft-fp/quad.h index ef860b4..3889bb4 100644 --- a/libgcc/soft-fp/quad.h +++ b/libgcc/soft-fp/quad.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Definitions for IEEE Quad Precision. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_QUAD_H #define SOFT_FP_QUAD_H 1 diff --git a/libgcc/soft-fp/single.h b/libgcc/soft-fp/single.h index 8c71fc7..2d3a19d 100644 --- a/libgcc/soft-fp/single.h +++ b/libgcc/soft-fp/single.h @@ -1,11 +1,7 @@ /* Software floating-point emulation. Definitions for IEEE Single Precision. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,7 +24,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_SINGLE_H #define SOFT_FP_SINGLE_H 1 diff --git a/libgcc/soft-fp/soft-fp.h b/libgcc/soft-fp/soft-fp.h index aee8e5d..3799be4 100644 --- a/libgcc/soft-fp/soft-fp.h +++ b/libgcc/soft-fp/soft-fp.h @@ -1,10 +1,6 @@ /* Software floating-point emulation. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz), - David S. Miller (davem@redhat.com) and - Peter Maydell (pmaydell@chiark.greenend.org.uk). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,7 +23,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef SOFT_FP_H #define SOFT_FP_H 1 diff --git a/libgcc/soft-fp/subdf3.c b/libgcc/soft-fp/subdf3.c index 69ecf76..895df4b 100644 --- a/libgcc/soft-fp/subdf3.c +++ b/libgcc/soft-fp/subdf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a - b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/subsf3.c b/libgcc/soft-fp/subsf3.c index 3d22128..ef8c07a 100644 --- a/libgcc/soft-fp/subsf3.c +++ b/libgcc/soft-fp/subsf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a - b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/subtf3.c b/libgcc/soft-fp/subtf3.c index 09df5fe..673085d 100644 --- a/libgcc/soft-fp/subtf3.c +++ b/libgcc/soft-fp/subtf3.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Return a - b - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "quad.h" diff --git a/libgcc/soft-fp/truncdfhf2.c b/libgcc/soft-fp/truncdfhf2.c index 8bcb278..32fb3c3 100644 --- a/libgcc/soft-fp/truncdfhf2.c +++ b/libgcc/soft-fp/truncdfhf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Truncate IEEE double into IEEE half. - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/truncdfsf2.c b/libgcc/soft-fp/truncdfsf2.c index 56a7593..816b4e4 100644 --- a/libgcc/soft-fp/truncdfsf2.c +++ b/libgcc/soft-fp/truncdfsf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Truncate IEEE double into IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/truncsfhf2.c b/libgcc/soft-fp/truncsfhf2.c index 25bee29..47089fd 100644 --- a/libgcc/soft-fp/truncsfhf2.c +++ b/libgcc/soft-fp/truncsfhf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Truncate IEEE single into IEEE half. - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/trunctfdf2.c b/libgcc/soft-fp/trunctfdf2.c index f62d541..68420cd 100644 --- a/libgcc/soft-fp/trunctfdf2.c +++ b/libgcc/soft-fp/trunctfdf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Truncate IEEE quad into IEEE double - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/trunctfhf2.c b/libgcc/soft-fp/trunctfhf2.c index 61d08f8..147b207 100644 --- a/libgcc/soft-fp/trunctfhf2.c +++ b/libgcc/soft-fp/trunctfhf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Truncate IEEE quad into IEEE half. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -24,7 +24,7 @@ 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" diff --git a/libgcc/soft-fp/trunctfsf2.c b/libgcc/soft-fp/trunctfsf2.c index 965e1c4..59fcf79 100644 --- a/libgcc/soft-fp/trunctfsf2.c +++ b/libgcc/soft-fp/trunctfsf2.c @@ -1,9 +1,7 @@ /* Software floating-point emulation. Truncate IEEE quad into IEEE single - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2022 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 @@ -26,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/trunctfxf2.c b/libgcc/soft-fp/trunctfxf2.c index 0d828fa..96ad48d 100644 --- a/libgcc/soft-fp/trunctfxf2.c +++ b/libgcc/soft-fp/trunctfxf2.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Truncate IEEE quad into IEEE extended - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Uros Bizjak (ubizjak@gmail.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "extended.h" diff --git a/libgcc/soft-fp/truncxfhf2.c b/libgcc/soft-fp/truncxfhf2.c index 688ad24..b3c6629 100644 --- a/libgcc/soft-fp/truncxfhf2.c +++ b/libgcc/soft-fp/truncxfhf2.c @@ -1,6 +1,6 @@ /* Software floating-point emulation. Truncate IEEE extended into IEEE half. - Copyright (C) 2021 Free Software Foundation, Inc. + 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 diff --git a/libgcc/soft-fp/unorddf2.c b/libgcc/soft-fp/unorddf2.c index 5075207..0d17763 100644 --- a/libgcc/soft-fp/unorddf2.c +++ b/libgcc/soft-fp/unorddf2.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Return 1 iff a or b is a NaN, 0 otherwise. - Copyright (C) 2006-2019 Free Software Foundation, Inc. + Copyright (C) 2006-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Joseph Myers (joseph@codesourcery.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "double.h" diff --git a/libgcc/soft-fp/unordsf2.c b/libgcc/soft-fp/unordsf2.c index 5b8fa10..5e6fa62 100644 --- a/libgcc/soft-fp/unordsf2.c +++ b/libgcc/soft-fp/unordsf2.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Return 1 iff a or b is a NaN, 0 otherwise. - Copyright (C) 2006-2019 Free Software Foundation, Inc. + Copyright (C) 2006-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Joseph Myers (joseph@codesourcery.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "single.h" diff --git a/libgcc/soft-fp/unordtf2.c b/libgcc/soft-fp/unordtf2.c index b92e012..365388e 100644 --- a/libgcc/soft-fp/unordtf2.c +++ b/libgcc/soft-fp/unordtf2.c @@ -1,8 +1,7 @@ /* Software floating-point emulation. Return 1 iff a or b is a NaN, 0 otherwise. - Copyright (C) 2006-2019 Free Software Foundation, Inc. + Copyright (C) 2006-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Joseph Myers (joseph@codesourcery.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,7 +24,7 @@ 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 "quad.h" -- cgit v1.1 From 27d68a60783b52504a08503d3fe12054de104241 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 4 Jul 2022 20:17:47 +0800 Subject: RISC-V: Support _Float16 type. RISC-V decide use _Float16 as primary IEEE half precision type, and this already become part of psABI, this patch has added folloing support for _Float16: - Soft-float support for _Float16. - Make sure _Float16 available on C++ mode. - Name mangling for _Float16 on C++ mode. gcc/ChangeLog * config/riscv/riscv-builtins.cc: include stringpool.h (riscv_float16_type_node): New. (riscv_init_builtin_types): Ditto. (riscv_init_builtins): Call riscv_init_builtin_types. * config/riscv/riscv-modes.def (HF): New. * config/riscv/riscv.cc (riscv_output_move): Handle HFmode. (riscv_mangle_type): New. (riscv_scalar_mode_supported_p): Ditto. (riscv_libgcc_floating_mode_supported_p): Ditto. (riscv_excess_precision): Ditto. (riscv_floatn_mode): Ditto. (riscv_init_libfuncs): Ditto. (TARGET_MANGLE_TYPE): Ditto. (TARGET_SCALAR_MODE_SUPPORTED_P): Ditto. (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Ditto. (TARGET_INIT_LIBFUNCS): Ditto. (TARGET_C_EXCESS_PRECISION): Ditto. (TARGET_FLOATN_MODE): Ditto. * config/riscv/riscv.md (mode): Add HF. (softload): Add HF. (softstore): Ditto. (fmt): Ditto. (UNITMODE): Ditto. (movhf): New. (*movhf_softfloat): New. libgcc/ChangeLog: * config/riscv/sfp-machine.h (_FP_NANFRAC_H): New. (_FP_NANFRAC_H): Ditto. (_FP_NANSIGN_H): Ditto. * config/riscv/t-softfp32 (softfp_extensions): Add HF related routines. (softfp_truncations): Ditto. (softfp_extras): Ditto. * config/riscv/t-softfp64 (softfp_extras): Add HF related routines. gcc/testsuite/ChangeLog: * g++.target/riscv/_Float16.C: New. * gcc.target/riscv/_Float16-soft-1.c: Ditto. * gcc.target/riscv/_Float16-soft-2.c: Ditto. * gcc.target/riscv/_Float16-soft-3.c: Ditto. * gcc.target/riscv/_Float16-soft-4.c: Ditto. * gcc.target/riscv/_Float16.c: Ditto. --- libgcc/config/riscv/sfp-machine.h | 3 +++ libgcc/config/riscv/t-softfp32 | 5 +++++ libgcc/config/riscv/t-softfp64 | 1 + 3 files changed, 9 insertions(+) (limited to 'libgcc') diff --git a/libgcc/config/riscv/sfp-machine.h b/libgcc/config/riscv/sfp-machine.h index 27fbe6e..b2901f0 100644 --- a/libgcc/config/riscv/sfp-machine.h +++ b/libgcc/config/riscv/sfp-machine.h @@ -41,6 +41,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) +#define _FP_NANFRAC_H _FP_QNANBIT_H #define _FP_NANFRAC_S _FP_QNANBIT_S #define _FP_NANFRAC_D _FP_QNANBIT_D, 0 #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 @@ -63,6 +64,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) +#define _FP_NANFRAC_H _FP_QNANBIT_H #define _FP_NANFRAC_S _FP_QNANBIT_S #define _FP_NANFRAC_D _FP_QNANBIT_D #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0 @@ -80,6 +82,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define CMPtype __gcc_CMPtype +#define _FP_NANSIGN_H 0 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 diff --git a/libgcc/config/riscv/t-softfp32 b/libgcc/config/riscv/t-softfp32 index 59be1df..55261f9 100644 --- a/libgcc/config/riscv/t-softfp32 +++ b/libgcc/config/riscv/t-softfp32 @@ -41,3 +41,8 @@ else softfp_extras := divsf3 divdf3 divtf3 endif + +softfp_extensions += hfsf hfdf hftf +softfp_truncations += tfhf dfhf sfhf +softfp_extras += fixhfsi fixhfdi fixunshfsi fixunshfdi \ + floatsihf floatdihf floatunsihf floatundihf diff --git a/libgcc/config/riscv/t-softfp64 b/libgcc/config/riscv/t-softfp64 index 7587095..c87d242 100644 --- a/libgcc/config/riscv/t-softfp64 +++ b/libgcc/config/riscv/t-softfp64 @@ -1,3 +1,4 @@ include $(srcdir)/config/riscv/t-softfp32 softfp_int_modes += ti +softfp_extras += fixhfti fixunshfti floattihf floatuntihf -- cgit v1.1 From 47a61e65148c6f1c237638144eb72ed5afd86387 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 17 Aug 2022 00:17:17 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index fcae8df..5fe8e73 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,121 @@ +2022-08-16 Kito Cheng + + * config/riscv/sfp-machine.h (_FP_NANFRAC_H): New. + (_FP_NANFRAC_H): Ditto. + (_FP_NANSIGN_H): Ditto. + * config/riscv/t-softfp32 (softfp_extensions): Add HF related + routines. + (softfp_truncations): Ditto. + (softfp_extras): Ditto. + * config/riscv/t-softfp64 (softfp_extras): Add HF related routines. + +2022-08-16 Kito Cheng + + * 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. + * soft-fp/unordtf2.c: Likewise. + 2022-07-18 Claudiu Zissulescu * config/arc/lib2funcs.c (udivmodsi4): Update AND mask. -- cgit v1.1 From eb6358247a9386db2828450477d86064f213e0a8 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 25 Aug 2022 10:21:20 +0200 Subject: cr16: remove obsoleted port contrib/ChangeLog: * config-list.mk: Remove cr16. gcc/ChangeLog: * doc/extend.texi: Remove cr16 related stuff. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. * doc/md.texi: Likewise. * function-tests.cc (test_expansion_to_rtl): Likewise. * common/config/cr16/cr16-common.cc: Removed. * config/cr16/constraints.md: Removed. * config/cr16/cr16-protos.h: Removed. * config/cr16/cr16.cc: Removed. * config/cr16/cr16.h: Removed. * config/cr16/cr16.md: Removed. * config/cr16/cr16.opt: Removed. * config/cr16/predicates.md: Removed. * config/cr16/t-cr16: Removed. libgcc/ChangeLog: * config.host: Remove cr16 related stuff. * config/cr16/crti.S: Removed. * config/cr16/crtlibid.S: Removed. * config/cr16/crtn.S: Removed. * config/cr16/divmodhi3.c: Removed. * config/cr16/lib1funcs.S: Removed. * config/cr16/t-cr16: Removed. * config/cr16/t-crtlibid: Removed. * config/cr16/unwind-cr16.c: Removed. * config/cr16/unwind-dw2.h: Removed. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Remove cr16 related stuff. --- libgcc/config.host | 6 - libgcc/config/cr16/crti.S | 54 -- libgcc/config/cr16/crtlibid.S | 28 - libgcc/config/cr16/crtn.S | 44 - libgcc/config/cr16/divmodhi3.c | 115 --- libgcc/config/cr16/lib1funcs.S | 563 ------------- libgcc/config/cr16/t-cr16 | 29 - libgcc/config/cr16/t-crtlibid | 22 - libgcc/config/cr16/unwind-cr16.c | 1682 -------------------------------------- libgcc/config/cr16/unwind-dw2.h | 80 -- 10 files changed, 2623 deletions(-) delete mode 100644 libgcc/config/cr16/crti.S delete mode 100644 libgcc/config/cr16/crtlibid.S delete mode 100644 libgcc/config/cr16/crtn.S delete mode 100644 libgcc/config/cr16/divmodhi3.c delete mode 100644 libgcc/config/cr16/lib1funcs.S delete mode 100644 libgcc/config/cr16/t-cr16 delete mode 100644 libgcc/config/cr16/t-crtlibid delete mode 100644 libgcc/config/cr16/unwind-cr16.c delete mode 100644 libgcc/config/cr16/unwind-dw2.h (limited to 'libgcc') diff --git a/libgcc/config.host b/libgcc/config.host index b2a0a8e..9a28b10 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -110,8 +110,6 @@ bfin*-*) bpf-*-*) cpu_type=bpf ;; -cr16-*-*) - ;; csky*-*-*) cpu_type=csky ;; @@ -591,10 +589,6 @@ bpf-*-*) tmake_file="$tmake_file ${cpu_type}/t-${cpu_type}" extra_parts="crti.o crtn.o" ;; -cr16-*-elf) - tmake_file="${tmake_file} cr16/t-cr16 cr16/t-crtlibid t-fdpbit" - extra_parts="$extra_parts crti.o crtn.o crtlibid.o" - ;; cris-*-elf) tmake_file="$tmake_file cris/t-cris t-softfp-sfdf t-softfp cris/t-elfmulti" ;; diff --git a/libgcc/config/cr16/crti.S b/libgcc/config/cr16/crti.S deleted file mode 100644 index 463d0e3..0000000 --- a/libgcc/config/cr16/crti.S +++ /dev/null @@ -1,54 +0,0 @@ -# Specialized code needed to support construction and destruction of -# file-scope objects in C++ and Java code, and to support exception handling. -# Copyright (C) 2012-2022 Free Software Foundation, Inc. -# Contributed by KPIT Cummins Infosystems Limited. - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3, or (at your option) any -# later version. -# -# This file 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 -# General Public License for more details. -# -# Under Section 7 of GPL version 3, you are granted additional -# permissions described in the GCC Runtime Library Exception, version -# 3.1, as published by the Free Software Foundation. -# -# You should have received a copy of the GNU General Public License and -# a copy of the GCC Runtime Library Exception along with this program; -# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -# . - - -/* This file just supplies function prologues for the .init and .fini - sections. It is linked in before crtbegin.o. */ - - .ident "GNU C crti.o" - - .section .init - .globl __init - .type __init,@function -__init: -#if defined (__ID_SHARED_LIB__) - push $2, r12, ra - movd $__current_shared_library_r12_offset_, (r1,r0) - loadd [r12]0(r1,r0), (r12) -#else - push ra -#endif - - .section .fini - .globl __fini - .type __fini,@function -__fini: -#if defined (__ID_SHARED_LIB__) - push $2, r12, ra - movd $__current_shared_library_r12_offset_, (r1,r0) - loadd [r12]0(r1,r0), (r12) -#else - push ra -#endif - diff --git a/libgcc/config/cr16/crtlibid.S b/libgcc/config/cr16/crtlibid.S deleted file mode 100644 index f3b8f52..0000000 --- a/libgcc/config/cr16/crtlibid.S +++ /dev/null @@ -1,28 +0,0 @@ -# Provide a weak definition of the library ID, for the benefit of certain -# configure scripts. -# Copyright (C) 2012-2022 Free Software Foundation, Inc. -# Contributed by KPIT Cummins Infosystems Limited. - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3, or (at your option) any -# later version. -# -# This file 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 -# General Public License for more details. -# -# Under Section 7 of GPL version 3, you are granted additional -# permissions described in the GCC Runtime Library Exception, version -# 3.1, as published by the Free Software Foundation. -# -# You should have received a copy of the GNU General Public License and -# a copy of the GCC Runtime Library Exception along with this program; -# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -# . - - .ident "GNU C crtlibid.o" - -.weak __current_shared_library_r12_offset_ -.set __current_shared_library_r12_offset_, 0 diff --git a/libgcc/config/cr16/crtn.S b/libgcc/config/cr16/crtn.S deleted file mode 100644 index c0ef6a5..0000000 --- a/libgcc/config/cr16/crtn.S +++ /dev/null @@ -1,44 +0,0 @@ -# Specialized code needed to support construction and destruction of -# file-scope objects in C++ and Java code, and to support exception handling. -# Copyright (C) 2012-2022 Free Software Foundation, Inc. -# Contributed by KPIT Cummins Infosystems Limited. - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3, or (at your option) any -# later version. -# -# This file 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 -# General Public License for more details. -# -# Under Section 7 of GPL version 3, you are granted additional -# permissions described in the GCC Runtime Library Exception, version -# 3.1, as published by the Free Software Foundation. -# -# You should have received a copy of the GNU General Public License and -# a copy of the GCC Runtime Library Exception along with this program; -# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -# . - - -/* This file supplies function epilogues for the .init and .fini sections. - It is linked in after all other files. */ - - .ident "GNU C crtn.o" - - .section .init -#if defined (__ID_SHARED_LIB__) - popret $2, r12, ra -#else - popret ra -#endif - - .section .fini -#if defined (__ID_SHARED_LIB__) - popret $2, r12, ra -#else - popret ra -#endif - diff --git a/libgcc/config/cr16/divmodhi3.c b/libgcc/config/cr16/divmodhi3.c deleted file mode 100644 index 21265d0..0000000 --- a/libgcc/config/cr16/divmodhi3.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Libgcc Target specific implementation - Emulating div and mod. - Copyright (C) 2012-2022 Free Software Foundation, Inc. - Contributed by KPIT Cummins Infosystems Limited. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC 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 General Public - License for more details. - - Under Section 7 of GPL version 3, you are granted additional - permissions described in the GCC Runtime Library Exception, version - 3.1, as published by the Free Software Foundation. - - You should have received a copy of the GNU General Public License and - a copy of the GCC Runtime Library Exception along with this program; - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - - -/* Emulate the division and modulus operation. */ - -unsigned short -udivmodhi4 (unsigned short num, unsigned short den, short modwanted) -{ - unsigned short bit = 1; - unsigned short res = 0; - - while (den < num && bit && !(den & (1 << 15))) - { - den <<= 1; - bit <<= 1; - } - while (bit) - { - if (num >= den) - { - num -= den; - res |= bit; - } - bit >>= 1; - den >>= 1; - } - - if (modwanted) - return num; - return res; -} - -short -__divhi3 (short a, short b) -{ - short neg = 0; - short res; - - if (a < 0) - { - a = -a; - neg = !neg; - } - - if (b < 0) - { - b = -b; - neg = !neg; - } - - res = udivmodhi4 (a, b, 0); - - if (neg) - res = -res; - - return res; -} - -short -__modhi3 (short a, short b) -{ - short neg = 0; - short res; - - if (a < 0) - { - a = -a; - neg = 1; - } - - if (b < 0) - b = -b; - - res = udivmodhi4 (a, b, 1); - - if (neg) - res = -res; - - return res; -} - -short -__udivhi3 (short a, short b) -{ - return udivmodhi4 (a, b, 0); -} - -short -__umodhi3 (short a, short b) -{ - return udivmodhi4 (a, b, 1); -} diff --git a/libgcc/config/cr16/lib1funcs.S b/libgcc/config/cr16/lib1funcs.S deleted file mode 100644 index 502ec1a..0000000 --- a/libgcc/config/cr16/lib1funcs.S +++ /dev/null @@ -1,563 +0,0 @@ -/* Libgcc Target specific implementation. - Copyright (C) 2012-2022 Free Software Foundation, Inc. - Contributed by KPIT Cummins Infosystems Limited. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 3, or (at your option) any later - version. - - GCC 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 General Public License - for more details. - - Under Section 7 of GPL version 3, you are granted additional - permissions described in the GCC Runtime Library Exception, version - 3.1, as published by the Free Software Foundation. - - You should have received a copy of the GNU General Public License and - a copy of the GCC Runtime Library Exception along with this program; - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - -#ifdef L_mulsi3 - .text - .align 4 - .globl ___mulsi3 -___mulsi3: - movw r4,r0 - movw r2,r1 - /* Extended multiplication between the 2 lower words */ - muluw r1,(r1,r0) - - /* Multiply the lower word of each parameter */ - mulw r2,r5 - - /* With the higher word of the other */ - mulw r3,r4 - - /* Add products to the higher part of the final result */ - addw r4,r1 - addw r5,r1 - jump (ra) -#endif - -#ifdef L_divdi3 - .text - .align 4 - .globl ___divdi3 - -___divdi3: - push $4, r7, ra - - /* Param #1 Long Long low bit first */ - loadd 12(sp), (r1, r0) - loadd 16(sp), (r3, r2) - - /* Param #2 Long Long low bit first */ - loadd 20(sp), (r5, r4) - loadd 24(sp), (r7, r6) - - /* Set neg to 0 */ - movw $0, r10 - - subd $16, (sp) - - /* Compare if param1 is greater than 0 */ - cmpw $0, r3 - ble L4 - - /* Invert param1 and neg */ - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - xord (r9, r8), (r1, r0) /* Xor low bits of param 1 with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of param 1 with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of param 1 */ - xorw $1, r10 /* Invert neg */ - bcc L4 /* If no carry occurred go to L4 */ - addd $1, (r3, r2) /* Add 1 to high bits of param 1 */ - -L4: stord (r1, r0), 0(sp) - stord (r3, r2), 4(sp) - - /* Compare if param2 is greater than 0 */ - cmpw $0, r7 - ble L5 - - /* Invert param2 and neg */ - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - xord (r9, r8), (r5, r4) /* Xor low bits of param 2 with temp */ - xord (r9, r8), (r7, r6) /* Xor high bits of param 2 with temp */ - addd $1, (r5, r4) /* Add 1 to low bits of param 2 */ - xorw $1, r10 /* Invert neg */ - bcc L5 /* If no carry occurred go to L5 */ - addd $1, (r7, r6) /* Add 1 to high bits of param 2 */ - -L5: stord (r5, r4), 8(sp) - stord (r7, r6), 12(sp) - movw $0, r2 - - /* Call udivmoddi3 */ -#ifdef __PIC__ - loadd ___udivmoddi3@cGOT(r12), (r1,r0) - jal (r1,r0) -#else - bal (ra), ___udivmoddi3 -#endif - - /* If (neg) */ - addd $16, (sp) - cmpw $0, r10 /* Compare 0 with neg */ - beq Lexit__ - - /* Neg = -Neg */ - xord (r9, r8), (r1, r0) /* Xor low bits of ures with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of ures with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of ures */ - bcc Lexit__ - addd $1, (r3, r2) /* Add 1 to high bit of ures */ - -Lexit__: -# ifdef __ID_SHARED_LIB__ - pop $2, r12 -# endif - popret $4, r7, ra -#endif - -#ifdef L_lshrdi3 - .text - .align 4 - .globl ___lshrdi3 - -___lshrdi3: - push $3, r7 - - /* Load parameters from stack in this order */ - movw r2, r6 /* Number of shifts */ - loadd 6(sp), (r1, r0) /* Low bits */ - loadd 10(sp), (r3, r2)/* High bits */ - - xorw $-1, r6 /* Invert number of shifts */ - addw $1, r6 /* Add 1 by number of shifts */ - - movw r6, r7 /* Copy number of shifts */ - - tbit $15, r6 /* Test if number is negative */ - bfs L2 /* If negative jump to L2 */ - - movd (r1, r0), (r9, r8) /* Copy low bits */ - - subw $32, r7 /* Calc how many bits will overflow */ - /* Shift the temp low bit to the right to see the overflowing bits */ - lshd r7, (r9, r8) - - cmpw $32, r6 /* If number of shifts is higher than 31 */ - blt L1 /* Shift by moving */ - - lshd r6, (r3, r2) /* Shift high bits */ - lshd r6, (r1, r0) /* Shift low bits */ - addd (r9, r8), (r3, r2) /* Add overflow to the high bits */ - popret $3, r7 /* Return */ - -L1: movd $0, (r1, r0) /* Reset low bit */ - movd (r9, r8), (r3, r2) /* Add the overflow from the low bit */ - popret $3, r7 /* Return */ - -L2: movd (r3, r2), (r9, r8) /* Copy high bits */ - - addw $32, r7 /* Calc how many bits will overflow */ - /* Shift the temp low bit to the left to see the overflowing bits */ - lshd r7, (r9, r8) - - cmpw $-32, r6 /* If number of shifts is lower than -31 */ - bgt L3 /* Shift by moving */ - - lshd r6, (r1, r0) /* Shift low bits */ - lshd r6, (r3, r2) /* Shift high bits */ - addd (r9, r8), (r1, r0) /* Add overflow to the low bits */ - popret $3, r7 /* Return */ - -L3: movd $0, (r3, r2) /* Reset the high bit */ - movd (r9, r8), (r1, r0) /* Add the overflow from the high bit */ - popret $3, r7 /* Return */ -#endif - -#ifdef L_moddi3 - .text - .align 4 - .globl ___moddi3 - -___moddi3: - push $4, r7, ra - - /* Param #1 Long Long low bit first */ - loadd 12(sp), (r1, r0) - loadd 16(sp), (r3, r2) - - /* Param #2 Long Long low bit first */ - loadd 20(sp), (r5, r4) - loadd 24(sp), (r7, r6) - - subd $18, (sp) - - /* Set neg to 0 */ - storw $0, 16(sp) - - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - - /* Compare if param1 is greater than 0 */ - cmpw $0, r3 - ble L4 - - /* Invert param1 and neg */ - xord (r9, r8), (r1, r0) /* Xor low bits of param 1 with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of param 1 with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of param 1 */ - storw $1, 16(sp) - bcc L4 /* If no carry occurred go to L4 */ - addd $1, (r3, r2) /* Add 1 to high bits of param 1 */ - -L4: stord (r1, r0), 0(sp) - stord (r3, r2), 4(sp) - - /* Compare if param2 is greater than 0 */ - cmpw $0, r7 - ble L5 - - /* Invert param2 and neg */ - xord (r9, r8), (r5, r4) /* Xor low bits of param 2 with temp */ - xord (r9, r8), (r7, r6) /* Xor high bits of param 2 with temp */ - addd $1, (r5, r4) /* Add 1 to low bits of param 2 */ - bcc L5 /* If no carry occurred go to L5 */ - addd $1, (r7, r6) /* Add 1 to high bits of param 2 */ - -L5: stord (r5, r4), 8(sp) - stord (r7, r6), 12(sp) - movw $1, r2 - - /* Call udivmoddi3 */ -#ifdef __PIC__ - loadd ___udivmoddi3@cGOT(r12), (r1,r0) - jal (r1,r0) -#else - bal (ra), ___udivmoddi3 -#endif - - /* If (neg) */ - loadw 16(sp), r10 /* Load neg from stack */ - addd $18, (sp) - cmpw $0, r10 /* Compare 0 with neg */ - beq Lexit__ - - /* Neg = -Neg */ - xord (r9, r8), (r1, r0) /* Xor low bits of ures with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of ures with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of ures */ - bcc Lexit__ - addd $1, (r3, r2) /* Add 1 to high bit of ures */ -Lexit__: -# ifdef __ID_SHARED_LIB__ - pop $2, r12 -# endif - popret $4, r7, ra -#endif - -#ifdef L_muldi3 - .text - .align 4 - .globl ___muldi3 - -___muldi3: - push $2, r13 - push $7, r7 - - /* Param #1 Long Long low bit first */ - loadd 18(sp), (r1, r0) - loadd 22(sp), (r3, r2) - - /* Param #2 Long Long low bit first */ - loadd 26(sp), (r5, r4) - loadd 30(sp), (r7, r6) - - /* Clear r13, r12 */ - movd $0, (r12) - movd $0, (r13) - - /* Set neg */ - movw $0, r10 - - /* Compare if param1 is greater than 0 */ - cmpw $0, r3 - ble L1 - - /* Invert param1 and neg */ - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - xord (r9, r8), (r1, r0) /* Xor low bits of param 1 with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of param 1 with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of param 1 */ - xorw $1, r10 /* Invert neg */ - bcc L1 /* If no carry occurred go to L1 */ - addd $1, (r3, r2) /* Add 1 to high bits of param 1 */ - -L1: /* Compare if param2 is greater than 0 */ - cmpw $0, r7 - ble L2 - - /* Invert param2 and neg */ - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - xord (r9, r8), (r5, r4) /* Xor low bits of param 2 with temp */ - xord (r9, r8), (r7, r6) /* Xor high bits of param 2 with temp */ - addd $1, (r5, r4) /* Add 1 to low bits of param 2 */ - xorw $1, r10 /* Invert neg */ - bcc L2 /* If no carry occurred go to L2 */ - addd $1, (r7, r6) /* Add 1 to high bits of param 2 */ - -L2: storw r10, 18(sp) /* Store neg to stack so we can use r10 */ - - /* B*D */ - /* Bl*Dl */ - macuw r0, r4, (r12) /* Multiply r0 and r4 and add to r12 */ - - /* Bh*Dl */ - movd $0, (r9, r8) /* Clear r9, r8 */ - macuw r1, r4, (r9, r8) /* Multiply Bh*Dl and add result to (r9, r8) */ - movw r9, r10 /* Shift left: r9 to r10 */ - lshd $16, (r9, r8) /* Shift left: r8 to r9 */ - movw $0, r11 /* Clear r11 */ - addd (r9, r8), (r12) /* Add (r9, r8) to r12 */ - bcc L3 /* If no carry occurred go to L3 */ - addd $1, (r13) /* If carry occurred add 1 to r13 */ - -L3: addd (r11, r10), (r13) /* Add (r11, r10) to r13 */ - - /* Bl*Dh */ - movd $0, (r9, r8) /* Clear (r9, r8) */ - macuw r0, r5, (r9, r8) /* Multiply r0 and r5 and stor in (r9, r8) */ - movw r9, r10 /* Shift left: r9 to r10 */ - lshd $16, (r9, r8) /* Shift left: r8 to r9 */ - addd (r9, r8), (r12) /* Add (r9, r8) to r12 */ - bcc L4 /* If no carry occurred go to L4 */ - addd $1, (r13) /* If carry occurred add 1 to r13 */ - -L4: addd (r11, r10), (r13) /* Add (r11, r10) to r13 */ - - /* Bh*Dh */ - movd $0, (r9, r8) /* Clear (r9, r8) */ - macuw r1, r5, (r9, r8) /* Multiply r1 and r5 and add to r13 */ - addd (r9, r8), (r13) /* Add (r9, r8) to result */ - - /* A*D */ - /* Al*Dl */ - movd $0, (r11, r10) /* Clear (r11, r10) */ - macuw r2, r4, (r11, r10)/* Multiply r2 and r4 and add to (r11, r10) */ - - addd (r13), (r11, r10) /* Copy r13 to (r11, r10) */ - - /* Al*Dh */ - movd $0, (r9, r8) /* Clear (r9, r8) */ - macuw r2, r5, (r9, r8) /* Multiply r2 and r5 and add to (r9, r8) */ - addw r8, r11 /* Add r8 to r11 */ - - /* Ah*Dl */ - muluw r3, (r5, r4) /* Multiply r3 and r4 and stor in (r5, r4) */ - addw r4, r11 /* Add r4 to r11 */ - - /* B*C */ - /* Bl*Cl */ - movd $0, (r9, r8) /* Clear (r9, r8) */ - macuw r0, r6, (r9, r8) /* Multiply r0 and r6 and add to (r9, r8) */ - addd (r9, r8), (r11, r10)/* Add (r9, r8) to result */ - - /* Bl*Ch */ - movd $0, (r9, r8) /* Clear (r9, r8) */ - macuw r0, r7, (r9, r8) /* Multiply r0 and r7 and add to (r9, r8) */ - addw r8, r11 /* Add r8 to r11 */ - - loadw 18(sp), r8 /* Load neg from stack */ - - /* Bh*Cl */ - muluw r1, (r7, r6) /* Multiply r1 and r6 and stor in (r7, r6) */ - addw r6, r11 /* Add r6 to r11 */ - -E1: movd (r11, r10), (r3, r2) - movd (r12), (r1, r0) - - /* If (neg) */ - cmpw $0, r8 /* Compare 0 with neg */ - beq Lexit__ - - /* Neg = -Neg */ - movd $-1, (r9, r8) /* Temp set to FFFFFFFF */ - xord (r9, r8), (r1, r0) /* Xor low bits of result with temp */ - xord (r9, r8), (r3, r2) /* Xor high bits of result with temp */ - addd $1, (r1, r0) /* Add 1 to low bits of result */ - bcc Lexit__ - addd $1, (r3, r2) /* Add 1 to high bit of result */ -Lexit__: - pop $7, r7 - popret $2, r13 -#endif - -#ifdef L_negdi2 - .text - .align 4 - .globl ___negdi2 - -___negdi2: - /* Load parameter from the registers in this order */ - loadd 0(sp), (r1, r0) - loadd 4(sp), (r3, r2) - - movd $-1, (r6, r5) /* Set temp to FFFFFFFF */ - xord (r6, r5), (r1, r0) /* Xor low bits with temp */ - xord (r6, r5), (r3, r2) /* Xor high bits with temp */ - addd $1, (r1, r0) /* Add one */ - jcc (ra) - addd $1, (r3, r2) /* Add the carry to the high bits */ - jump (ra) -#endif - -#ifdef L_udivdi3 - .text - .align 4 - .globl ___udivdi3 - -___udivdi3: - movw $0, r2 - br ___udivmoddi3 -#endif - -#ifdef L_udivmoddi3 - .text - .align 4 - .globl ___udivmoddi3 - -___udivmoddi3: - push $2, r13 - push $7, r7 - - /* Param #1 Long Long low bit first */ - loadd 18(sp), (r1, r0) - storw r2, 18(sp) /* Store modulo on stack */ - loadd 22(sp), (r3, r2) - - /* Param #2 Long Long low bit first */ - loadd 26(sp), (r5, r4) - loadd 30(sp), (r7, r6) - - /* Set ures to 0 */ - movd $0, (r13) - movd $0, (r12) - - cmpd (r12), (r5, r4) - beq LE - -L5: movd $1, (r9, r8) /* Store 1 in low bits from bit */ - movd $0, (r11, r10) /* Store 0 in high bits from bit */ - -L6: /* While (den < num && (!den & (1LL<<63))) */ - /* Compare high bits from param 1 and param 2 */ - cmpd (r7, r6), (r3, r2) - bhi L10 /* If param 2 is greater go to L10 */ - bne L8 /* If param 1 is greater go to L8 */ - cmpd (r5, r4), (r1, r0) /* Compare low bits from param 1 and param 2 */ - /* If param 2 is greater or the same go to L1 */ - bhs L10 - -L8: /* Check if most significant bit of param 2 is set */ - tbit $15, r7 - bfs L10 /* If PSR is set go to L10 */ - - /* Shift bit */ - lshd $1, (r11, r10) /* Shift left: high bits of bit */ - /* Check if most significant bit of bit is set */ - tbit $15, r9 - lshd $1, (r9, r8) /* Shift left: low bits of bit */ - bfs L28 /* If PSR is set go to L28 */ - -L9: /* Shift b */ - lshd $1, (r7, r6) /* Shift left: high bits of param 2 */ - /* Check if most significant bit of param 2 is set */ - tbit $15, r5 - lshd $1, (r5, r4) /* Shift left: low bits of param 2 */ - bfc L6 /* If PSR is set go to L6 */ - addw $1, r6 /* Add 1 to the highest bits of b */ - br L6 /* Go to L6 */ - -L10: /* While (bit) */ - cmpd $0, (r11, r10) - bne L11 - cmpd $0, (r9, r8) - beq E1 - -L11: /* If (num >= den) */ - cmpd (r3, r2), (r7, r6) /* Compare high bits of param 1 and param 2 */ - blo L15 /* If param 1 lower than param 2 go to L15 */ - bne L12 /* If not equal go to L12 */ - cmpd (r1, r0), (r5, r4) /* Compare low bits of param 1 and param 2 */ - blo L15 /* If param 1 lower than param 2 go to L15 */ - -L12: /* Ures |= bit */ - ord (r11, r10), (r13) - ord (r9, r8), (r12) - - /* Num -= den */ - subd (r7, r6), (r3, r2) /* Subtract highest 32 bits from each other */ - subd (r5, r4), (r1, r0) /* Subtract lowest 32 bits from each other */ - bcc L15 /* If no carry occurred go to L15 */ - subd $1, (r3, r2) /* Subtract the carry */ - -L15: /* Shift bit to the right */ - lshd $-1, (r9, r8) /* Shift right: low bits of bit */ - /* Check if least significant bit of high bits is set */ - tbit $0, r10 - lshd $-1, (r11, r10) /* Shift right: high bits of bit */ - bfs L18 /* If PSR is set go to L18 */ - -L17: /* Shift param#2 to the right */ - lshd $-1, (r5, r4) /* Shift right: low bits of param 2 */ - /* Check if least significant bit of high bits is set */ - tbit $0, r6 - lshd $-1, (r7, r6) /* Shift right: high bits of param 2 */ - bfc L10 /* If PSR is not set go to L10 */ - /* Or with 0x8000 to set most significant bit */ - orw $32768, r5 - br L10 /* Go to L10 */ - -L18: /* Or with 0x8000 to set most significant bit */ - orw $32768, r9 - br L17 - -L28: /* Left shift bit */ - addw $1, r10 /* Add 1 to highest bits of bit */ - br L9 /* Go to L9 */ - -LE: cmpd (r12), (r7, r6) - bne L5 - excp dvz - br Lexit__ - -E1: loadw 18(sp), r4 - cmpw $0, r4 - bne Lexit__ - - /* Return result */ - movd (r12), (r1, r0) - movd (r13), (r3, r2) -Lexit__: - pop $7, r7 - popret $2, r13 -#endif - -#ifdef L_umoddi3 - .text - .align 4 - .globl ___umoddi3 - -___umoddi3: - movw $1, r2 - br ___udivmoddi3 -#endif - diff --git a/libgcc/config/cr16/t-cr16 b/libgcc/config/cr16/t-cr16 deleted file mode 100644 index 1e375d2..0000000 --- a/libgcc/config/cr16/t-cr16 +++ /dev/null @@ -1,29 +0,0 @@ -# Makefile fragment for building LIBGCC for the Renesas CR16 target. -# Copyright (C) 2012-2022 Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published -# by the Free Software Foundation; either version 3, or (at your -# option) any later version. -# -# GCC 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with GCC; see the file COPYING3. If not see -# . - -LIB1ASMSRC = cr16/lib1funcs.S -LIB1ASMFUNCS = _mulsi3 _lshrdi3 _muldi3 _divdi3 _udivdi3 _udivmoddi3 \ - _umoddi3 _moddi3 - -LIB2ADD = $(srcdir)/config/cr16/divmodhi3.c \ - $(srcdir)/udivmodsi4.c \ - $(srcdir)/udivmod.c \ - $(srcdir)/divmod.c - -LIB2ADDEH = $(srcdir)/config/cr16/unwind-cr16.c diff --git a/libgcc/config/cr16/t-crtlibid b/libgcc/config/cr16/t-crtlibid deleted file mode 100644 index 86cc5c6..0000000 --- a/libgcc/config/cr16/t-crtlibid +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile fragment for building LIBGCC for the Renesas CR16 target. -# Copyright (C) 2012-2022 Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published -# by the Free Software Foundation; either version 3, or (at your -# option) any later version. -# -# GCC 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with GCC; see the file COPYING3. If not see -# . - -# Assemble startup files. -crtlibid.o: $(srcdir)/config/cr16/crtlibid.S - $(gcc_compile) -c -x assembler-with-cpp $< diff --git a/libgcc/config/cr16/unwind-cr16.c b/libgcc/config/cr16/unwind-cr16.c deleted file mode 100644 index 8625da8..0000000 --- a/libgcc/config/cr16/unwind-cr16.c +++ /dev/null @@ -1,1682 +0,0 @@ -/* DWARF2 exception handling and frame unwind runtime interface routines. - Copyright (C) 1997-2022 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC 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 General Public - License for more details. - - Under Section 7 of GPL version 3, you are granted additional - permissions described in the GCC Runtime Library Exception, version - 3.1, as published by the Free Software Foundation. - - You should have received a copy of the GNU General Public License and - a copy of the GCC Runtime Library Exception along with this program; - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - -#include "tconfig.h" -#include "tsystem.h" -#include "coretypes.h" -#include "tm.h" -#include "dwarf2.h" -#include "unwind.h" -#ifdef __USING_SJLJ_EXCEPTIONS__ -# define NO_SIZE_OF_ENCODED_VALUE -#endif -#include "unwind-pe.h" -#include "unwind-dw2-fde.h" -#include "gthr.h" -#include "unwind-dw2.h" - -#ifdef HAVE_SYS_SDT_H -#include -#endif - -#ifndef __USING_SJLJ_EXCEPTIONS__ - -#ifndef __LIBGCC_STACK_GROWS_DOWNWARD__ -#define __LIBGCC_STACK_GROWS_DOWNWARD__ 0 -#else -#undef __LIBGCC_STACK_GROWS_DOWNWARD__ -#define __LIBGCC_STACK_GROWS_DOWNWARD__ 1 -#endif - -/* Dwarf frame registers used for pre gcc 3.0 compiled glibc. */ -#ifndef PRE_GCC3_DWARF_FRAME_REGISTERS -#define PRE_GCC3_DWARF_FRAME_REGISTERS __LIBGCC_DWARF_FRAME_REGISTERS__ -#endif - -#ifndef DWARF_REG_TO_UNWIND_COLUMN -#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO) -#endif - -#ifdef REG_VALUE_IN_UNWIND_CONTEXT -typedef _Unwind_Word _Unwind_Context_Reg_Val; - -#ifndef ASSUME_EXTENDED_UNWIND_CONTEXT -#define ASSUME_EXTENDED_UNWIND_CONTEXT 1 -#endif - -static inline _Unwind_Word -_Unwind_Get_Unwind_Word (_Unwind_Context_Reg_Val val) -{ - return val; -} - -static inline _Unwind_Context_Reg_Val -_Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word val) -{ - return val; -} -#else -typedef void *_Unwind_Context_Reg_Val; - -static inline _Unwind_Word -_Unwind_Get_Unwind_Word (_Unwind_Context_Reg_Val val) -{ - return (_Unwind_Word) (_Unwind_Internal_Ptr) val; -} - -static inline _Unwind_Context_Reg_Val -_Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word val) -{ - return (_Unwind_Context_Reg_Val) (_Unwind_Internal_Ptr) val; -} -#endif - -#ifndef ASSUME_EXTENDED_UNWIND_CONTEXT -#define ASSUME_EXTENDED_UNWIND_CONTEXT 0 -#endif - -/* This is the register and unwind state for a particular frame. This - provides the information necessary to unwind up past a frame and return - to its caller. */ -struct _Unwind_Context -{ - _Unwind_Context_Reg_Val reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; - void *cfa; - void *ra; - void *lsda; - struct dwarf_eh_bases bases; - /* Signal frame context. */ -#define SIGNAL_FRAME_BIT ((~(_Unwind_Word) 0 >> 1) + 1) - /* Context which has version/args_size/by_value fields. */ -#define EXTENDED_CONTEXT_BIT ((~(_Unwind_Word) 0 >> 2) + 1) - _Unwind_Word flags; - /* 0 for now, can be increased when further fields are added to - struct _Unwind_Context. */ - _Unwind_Word version; - _Unwind_Word args_size; - char by_value[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; -}; - -/* Byte size of every register managed by these routines. */ -static unsigned char dwarf_reg_size_table[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; - - -/* Read unaligned data from the instruction buffer. */ - -union unaligned -{ - void *p; - unsigned u2 __attribute__ ((mode (HI))); - unsigned u4 __attribute__ ((mode (SI))); - unsigned u8 __attribute__ ((mode (DI))); - signed s2 __attribute__ ((mode (HI))); - signed s4 __attribute__ ((mode (SI))); - signed s8 __attribute__ ((mode (DI))); -} __attribute__ ((packed)); - -static void uw_update_context (struct _Unwind_Context *, _Unwind_FrameState *); -static _Unwind_Reason_Code uw_frame_state_for (struct _Unwind_Context *, - _Unwind_FrameState *); - -static inline void * -read_pointer (const void *p) { const union unaligned *up = p; return up->p; } - -static inline int -read_1u (const void *p) { return *(const unsigned char *) p; } - -static inline int -read_1s (const void *p) { return *(const signed char *) p; } - -static inline int -read_2u (const void *p) { const union unaligned *up = p; return up->u2; } - -static inline int -read_2s (const void *p) { const union unaligned *up = p; return up->s2; } - -static inline unsigned int -read_4u (const void *p) { const union unaligned *up = p; return up->u4; } - -static inline int -read_4s (const void *p) { const union unaligned *up = p; return up->s4; } - -static inline unsigned long -read_8u (const void *p) { const union unaligned *up = p; return up->u8; } - -static inline unsigned long -read_8s (const void *p) { const union unaligned *up = p; return up->s8; } - -static inline _Unwind_Word -_Unwind_IsSignalFrame (struct _Unwind_Context *context) -{ - return (context->flags & SIGNAL_FRAME_BIT) ? 1 : 0; -} - -static inline void -_Unwind_SetSignalFrame (struct _Unwind_Context *context, int val) -{ - if (val) - context->flags |= SIGNAL_FRAME_BIT; - else - context->flags &= ~SIGNAL_FRAME_BIT; -} - -static inline _Unwind_Word -_Unwind_IsExtendedContext (struct _Unwind_Context *context) -{ - return (ASSUME_EXTENDED_UNWIND_CONTEXT - || (context->flags & EXTENDED_CONTEXT_BIT)); -} - -/* Get the value of register INDEX as saved in CONTEXT. */ - -inline _Unwind_Word -_Unwind_GetGR (struct _Unwind_Context *context, int index) -{ - int size; - _Unwind_Context_Reg_Val val; - -#ifdef DWARF_ZERO_REG - if (index == DWARF_ZERO_REG) - return 0; -#endif - - index = DWARF_REG_TO_UNWIND_COLUMN (index); - gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); - size = dwarf_reg_size_table[index]; - val = context->reg[index]; - - if (_Unwind_IsExtendedContext (context) && context->by_value[index]) - return _Unwind_Get_Unwind_Word (val); - - /* This will segfault if the register hasn't been saved. */ - if (size == sizeof(_Unwind_Ptr)) - return * (_Unwind_Ptr *) (_Unwind_Internal_Ptr) val; - else - { - gcc_assert (size == sizeof(_Unwind_Word)); - return * (_Unwind_Word *) (_Unwind_Internal_Ptr) val; - } -} - -static inline void * -_Unwind_GetPtr (struct _Unwind_Context *context, int index) -{ - return (void *)(_Unwind_Ptr) _Unwind_GetGR (context, index); -} - -/* Get the value of the CFA as saved in CONTEXT. */ - -_Unwind_Word -_Unwind_GetCFA (struct _Unwind_Context *context) -{ - return (_Unwind_Ptr) context->cfa; -} - -/* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ - -inline void -_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val) -{ - int size; - void *ptr; - - index = DWARF_REG_TO_UNWIND_COLUMN (index); - gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); - size = dwarf_reg_size_table[index]; - - if (_Unwind_IsExtendedContext (context) && context->by_value[index]) - { - context->reg[index] = _Unwind_Get_Unwind_Context_Reg_Val (val); - return; - } - - ptr = (void *) (_Unwind_Internal_Ptr) context->reg[index]; - - if (size == sizeof(_Unwind_Ptr)) - * (_Unwind_Ptr *) ptr = val; - else - { -#if defined( __CR16C__ ) - if (size == sizeof(_Unwind_Word)) - * (_Unwind_Word *) ptr = val; - else - { - typedef unsigned _CR16_Unwind_Word __attribute__((__mode__(__word__))); - gcc_assert (index + 1 < (int) sizeof(dwarf_reg_size_table)); - * (_CR16_Unwind_Word *) ptr = val & 0xffff ; /* low 16-bit */ - ptr = context->reg[index + 1]; - * (_CR16_Unwind_Word *) ptr = val >> 16 ; /* high 16-bit */ - } -#else - gcc_assert (size == sizeof(_Unwind_Word)); - * (_Unwind_Word *) ptr = val; -#endif - } -} - -/* Get the pointer to a register INDEX as saved in CONTEXT. */ - -static inline void * -_Unwind_GetGRPtr (struct _Unwind_Context *context, int index) -{ - index = DWARF_REG_TO_UNWIND_COLUMN (index); - if (_Unwind_IsExtendedContext (context) && context->by_value[index]) - return &context->reg[index]; - return (void *) (_Unwind_Internal_Ptr) context->reg[index]; -} - -/* Set the pointer to a register INDEX as saved in CONTEXT. */ - -static inline void -_Unwind_SetGRPtr (struct _Unwind_Context *context, int index, void *p) -{ - index = DWARF_REG_TO_UNWIND_COLUMN (index); - if (_Unwind_IsExtendedContext (context)) - context->by_value[index] = 0; - context->reg[index] = (_Unwind_Context_Reg_Val) (_Unwind_Internal_Ptr) p; -} - -/* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ - -static inline void -_Unwind_SetGRValue (struct _Unwind_Context *context, int index, - _Unwind_Word val) -{ - index = DWARF_REG_TO_UNWIND_COLUMN (index); - gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); - gcc_assert (dwarf_reg_size_table[index] == sizeof (_Unwind_Context_Reg_Val)); - - context->by_value[index] = 1; - context->reg[index] = _Unwind_Get_Unwind_Context_Reg_Val (val); -} - -/* Return nonzero if register INDEX is stored by value rather than - by reference. */ - -static inline int -_Unwind_GRByValue (struct _Unwind_Context *context, int index) -{ - index = DWARF_REG_TO_UNWIND_COLUMN (index); - return context->by_value[index]; -} - -/* Retrieve the return address for CONTEXT. */ - -inline _Unwind_Ptr -_Unwind_GetIP (struct _Unwind_Context *context) -{ - return (_Unwind_Ptr) context->ra; -} - -/* Retrieve the return address and flag whether that IP is before - or after first not yet fully executed instruction. */ - -inline _Unwind_Ptr -_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) -{ - *ip_before_insn = _Unwind_IsSignalFrame (context); - return (_Unwind_Ptr) context->ra; -} - -/* Overwrite the return address for CONTEXT with VAL. */ - -inline void -_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) -{ - context->ra = (void *) val; -} - -void * -_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) -{ - return context->lsda; -} - -_Unwind_Ptr -_Unwind_GetRegionStart (struct _Unwind_Context *context) -{ - return (_Unwind_Ptr) context->bases.func; -} - -void * -_Unwind_FindEnclosingFunction (void *pc) -{ - struct dwarf_eh_bases bases; - const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases); - if (fde) - return bases.func; - else - return NULL; -} - -_Unwind_Ptr -_Unwind_GetDataRelBase (struct _Unwind_Context *context) -{ - return (_Unwind_Ptr) context->bases.dbase; -} - -_Unwind_Ptr -_Unwind_GetTextRelBase (struct _Unwind_Context *context) -{ - return (_Unwind_Ptr) context->bases.tbase; -} - -#include "md-unwind-support.h" - -/* Extract any interesting information from the CIE for the translation - unit F belongs to. Return a pointer to the byte after the augmentation, - or NULL if we encountered an undecipherable augmentation. */ - -static const unsigned char * -extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context, - _Unwind_FrameState *fs) -{ - const unsigned char *aug = cie->augmentation; - const unsigned char *p = aug + strlen ((const char *)aug) + 1; - const unsigned char *ret = NULL; - _uleb128_t utmp; - _sleb128_t stmp; - - /* g++ v2 "eh" has pointer immediately following augmentation string, - so it must be handled first. */ - if (aug[0] == 'e' && aug[1] == 'h') - { - fs->eh_ptr = read_pointer (p); - p += sizeof (void *); - aug += 2; - } - - /* After the augmentation resp. pointer for "eh" augmentation - follows for CIE version >= 4 address size byte and - segment size byte. */ - if (__builtin_expect (cie->version >= 4, 0)) - { - if (p[0] != sizeof (void *) || p[1] != 0) - return NULL; - p += 2; - } - /* Immediately following this are the code and - data alignment and return address column. */ - p = read_uleb128 (p, &utmp); - fs->code_align = (_Unwind_Word)utmp; - p = read_sleb128 (p, &stmp); - fs->data_align = (_Unwind_Sword)stmp; - if (cie->version == 1) - fs->retaddr_column = *p++; - else - { - p = read_uleb128 (p, &utmp); - fs->retaddr_column = (_Unwind_Word)utmp; - } - fs->lsda_encoding = DW_EH_PE_omit; - - /* If the augmentation starts with 'z', then a uleb128 immediately - follows containing the length of the augmentation field following - the size. */ - if (*aug == 'z') - { - p = read_uleb128 (p, &utmp); - ret = p + utmp; - - fs->saw_z = 1; - ++aug; - } - - /* Iterate over recognized augmentation subsequences. */ - while (*aug != '\0') - { - /* "L" indicates a byte showing how the LSDA pointer is encoded. */ - if (aug[0] == 'L') - { - fs->lsda_encoding = *p++; - aug += 1; - } - - /* "R" indicates a byte indicating how FDE addresses are encoded. */ - else if (aug[0] == 'R') - { - fs->fde_encoding = *p++; - aug += 1; - } - - /* "P" indicates a personality routine in the CIE augmentation. */ - else if (aug[0] == 'P') - { - _Unwind_Ptr personality; - - p = read_encoded_value (context, *p, p + 1, &personality); - fs->personality = (_Unwind_Personality_Fn) personality; - aug += 1; - } - - /* "S" indicates a signal frame. */ - else if (aug[0] == 'S') - { - fs->signal_frame = 1; - aug += 1; - } - - /* Otherwise we have an unknown augmentation string. - Bail unless we saw a 'z' prefix. */ - else - return ret; - } - - return ret ? ret : p; -} - - -/* Decode a DW_OP stack program. Return the top of stack. Push INITIAL - onto the stack to start. */ - -static _Unwind_Word -execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end, - struct _Unwind_Context *context, _Unwind_Word initial) -{ - _Unwind_Word stack[64]; /* ??? Assume this is enough. */ - int stack_elt; - - stack[0] = initial; - stack_elt = 1; - - while (op_ptr < op_end) - { - enum dwarf_location_atom op = *op_ptr++; - _Unwind_Word result; - _uleb128_t reg, utmp; - _sleb128_t offset, stmp; - - switch (op) - { - case DW_OP_lit0: - case DW_OP_lit1: - case DW_OP_lit2: - case DW_OP_lit3: - case DW_OP_lit4: - case DW_OP_lit5: - case DW_OP_lit6: - case DW_OP_lit7: - case DW_OP_lit8: - case DW_OP_lit9: - case DW_OP_lit10: - case DW_OP_lit11: - case DW_OP_lit12: - case DW_OP_lit13: - case DW_OP_lit14: - case DW_OP_lit15: - case DW_OP_lit16: - case DW_OP_lit17: - case DW_OP_lit18: - case DW_OP_lit19: - case DW_OP_lit20: - case DW_OP_lit21: - case DW_OP_lit22: - case DW_OP_lit23: - case DW_OP_lit24: - case DW_OP_lit25: - case DW_OP_lit26: - case DW_OP_lit27: - case DW_OP_lit28: - case DW_OP_lit29: - case DW_OP_lit30: - case DW_OP_lit31: - result = op - DW_OP_lit0; - break; - - case DW_OP_addr: - result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr); - op_ptr += sizeof (void *); - break; - - case DW_OP_GNU_encoded_addr: - { - _Unwind_Ptr presult; - op_ptr = read_encoded_value (context, *op_ptr, op_ptr+1, &presult); - result = presult; - } - break; - - case DW_OP_const1u: - result = read_1u (op_ptr); - op_ptr += 1; - break; - case DW_OP_const1s: - result = read_1s (op_ptr); - op_ptr += 1; - break; - case DW_OP_const2u: - result = read_2u (op_ptr); - op_ptr += 2; - break; - case DW_OP_const2s: - result = read_2s (op_ptr); - op_ptr += 2; - break; - case DW_OP_const4u: - result = read_4u (op_ptr); - op_ptr += 4; - break; - case DW_OP_const4s: - result = read_4s (op_ptr); - op_ptr += 4; - break; - case DW_OP_const8u: - result = read_8u (op_ptr); - op_ptr += 8; - break; - case DW_OP_const8s: - result = read_8s (op_ptr); - op_ptr += 8; - break; - case DW_OP_constu: - op_ptr = read_uleb128 (op_ptr, &utmp); - result = (_Unwind_Word)utmp; - break; - case DW_OP_consts: - op_ptr = read_sleb128 (op_ptr, &stmp); - result = (_Unwind_Sword)stmp; - break; - - case DW_OP_reg0: - case DW_OP_reg1: - case DW_OP_reg2: - case DW_OP_reg3: - case DW_OP_reg4: - case DW_OP_reg5: - case DW_OP_reg6: - case DW_OP_reg7: - case DW_OP_reg8: - case DW_OP_reg9: - case DW_OP_reg10: - case DW_OP_reg11: - case DW_OP_reg12: - case DW_OP_reg13: - case DW_OP_reg14: - case DW_OP_reg15: - case DW_OP_reg16: - case DW_OP_reg17: - case DW_OP_reg18: - case DW_OP_reg19: - case DW_OP_reg20: - case DW_OP_reg21: - case DW_OP_reg22: - case DW_OP_reg23: - case DW_OP_reg24: - case DW_OP_reg25: - case DW_OP_reg26: - case DW_OP_reg27: - case DW_OP_reg28: - case DW_OP_reg29: - case DW_OP_reg30: - case DW_OP_reg31: - result = _Unwind_GetGR (context, op - DW_OP_reg0); - break; - case DW_OP_regx: - op_ptr = read_uleb128 (op_ptr, ®); - result = _Unwind_GetGR (context, reg); - break; - - case DW_OP_breg0: - case DW_OP_breg1: - case DW_OP_breg2: - case DW_OP_breg3: - case DW_OP_breg4: - case DW_OP_breg5: - case DW_OP_breg6: - case DW_OP_breg7: - case DW_OP_breg8: - case DW_OP_breg9: - case DW_OP_breg10: - case DW_OP_breg11: - case DW_OP_breg12: - case DW_OP_breg13: - case DW_OP_breg14: - case DW_OP_breg15: - case DW_OP_breg16: - case DW_OP_breg17: - case DW_OP_breg18: - case DW_OP_breg19: - case DW_OP_breg20: - case DW_OP_breg21: - case DW_OP_breg22: - case DW_OP_breg23: - case DW_OP_breg24: - case DW_OP_breg25: - case DW_OP_breg26: - case DW_OP_breg27: - case DW_OP_breg28: - case DW_OP_breg29: - case DW_OP_breg30: - case DW_OP_breg31: - op_ptr = read_sleb128 (op_ptr, &offset); - result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset; - break; - case DW_OP_bregx: - op_ptr = read_uleb128 (op_ptr, ®); - op_ptr = read_sleb128 (op_ptr, &offset); - result = _Unwind_GetGR (context, reg) + (_Unwind_Word)offset; - break; - - case DW_OP_dup: - gcc_assert (stack_elt); - result = stack[stack_elt - 1]; - break; - - case DW_OP_drop: - gcc_assert (stack_elt); - stack_elt -= 1; - goto no_push; - - case DW_OP_pick: - offset = *op_ptr++; - gcc_assert (offset < stack_elt - 1); - result = stack[stack_elt - 1 - offset]; - break; - - case DW_OP_over: - gcc_assert (stack_elt >= 2); - result = stack[stack_elt - 2]; - break; - - case DW_OP_swap: - { - _Unwind_Word t; - gcc_assert (stack_elt >= 2); - t = stack[stack_elt - 1]; - stack[stack_elt - 1] = stack[stack_elt - 2]; - stack[stack_elt - 2] = t; - goto no_push; - } - - case DW_OP_rot: - { - _Unwind_Word t1, t2, t3; - - gcc_assert (stack_elt >= 3); - t1 = stack[stack_elt - 1]; - t2 = stack[stack_elt - 2]; - t3 = stack[stack_elt - 3]; - stack[stack_elt - 1] = t2; - stack[stack_elt - 2] = t3; - stack[stack_elt - 3] = t1; - goto no_push; - } - - case DW_OP_deref: - case DW_OP_deref_size: - case DW_OP_abs: - case DW_OP_neg: - case DW_OP_not: - case DW_OP_plus_uconst: - /* Unary operations. */ - gcc_assert (stack_elt); - stack_elt -= 1; - - result = stack[stack_elt]; - - switch (op) - { - case DW_OP_deref: - { - void *ptr = (void *) (_Unwind_Ptr) result; - result = (_Unwind_Ptr) read_pointer (ptr); - } - break; - - case DW_OP_deref_size: - { - void *ptr = (void *) (_Unwind_Ptr) result; - switch (*op_ptr++) - { - case 1: - result = read_1u (ptr); - break; - case 2: - result = read_2u (ptr); - break; - case 4: - result = read_4u (ptr); - break; - case 8: - result = read_8u (ptr); - break; - default: - gcc_unreachable (); - } - } - break; - - case DW_OP_abs: - if ((_Unwind_Sword) result < 0) - result = -result; - break; - case DW_OP_neg: - result = -result; - break; - case DW_OP_not: - result = ~result; - break; - case DW_OP_plus_uconst: - op_ptr = read_uleb128 (op_ptr, &utmp); - result += (_Unwind_Word)utmp; - break; - - default: - gcc_unreachable (); - } - break; - - case DW_OP_and: - case DW_OP_div: - case DW_OP_minus: - case DW_OP_mod: - case DW_OP_mul: - case DW_OP_or: - case DW_OP_plus: - case DW_OP_shl: - case DW_OP_shr: - case DW_OP_shra: - case DW_OP_xor: - case DW_OP_le: - case DW_OP_ge: - case DW_OP_eq: - case DW_OP_lt: - case DW_OP_gt: - case DW_OP_ne: - { - /* Binary operations. */ - _Unwind_Word first, second; - gcc_assert (stack_elt >= 2); - stack_elt -= 2; - - second = stack[stack_elt]; - first = stack[stack_elt + 1]; - - switch (op) - { - case DW_OP_and: - result = second & first; - break; - case DW_OP_div: - result = (_Unwind_Sword) second / (_Unwind_Sword) first; - break; - case DW_OP_minus: - result = second - first; - break; - case DW_OP_mod: - result = second % first; - break; - case DW_OP_mul: - result = second * first; - break; - case DW_OP_or: - result = second | first; - break; - case DW_OP_plus: - result = second + first; - break; - case DW_OP_shl: - result = second << first; - break; - case DW_OP_shr: - result = second >> first; - break; - case DW_OP_shra: - result = (_Unwind_Sword) second >> first; - break; - case DW_OP_xor: - result = second ^ first; - break; - case DW_OP_le: - result = (_Unwind_Sword) second <= (_Unwind_Sword) first; - break; - case DW_OP_ge: - result = (_Unwind_Sword) second >= (_Unwind_Sword) first; - break; - case DW_OP_eq: - result = (_Unwind_Sword) second == (_Unwind_Sword) first; - break; - case DW_OP_lt: - result = (_Unwind_Sword) second < (_Unwind_Sword) first; - break; - case DW_OP_gt: - result = (_Unwind_Sword) second > (_Unwind_Sword) first; - break; - case DW_OP_ne: - result = (_Unwind_Sword) second != (_Unwind_Sword) first; - break; - - default: - gcc_unreachable (); - } - } - break; - - case DW_OP_skip: - offset = read_2s (op_ptr); - op_ptr += 2; - op_ptr += offset; - goto no_push; - - case DW_OP_bra: - gcc_assert (stack_elt); - stack_elt -= 1; - - offset = read_2s (op_ptr); - op_ptr += 2; - if (stack[stack_elt] != 0) - op_ptr += offset; - goto no_push; - - case DW_OP_nop: - goto no_push; - - default: - gcc_unreachable (); - } - - /* Most things push a result value. */ - gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack)); - stack[stack_elt++] = result; - no_push:; - } - - /* We were executing this program to get a value. It should be - at top of stack. */ - gcc_assert (stack_elt); - stack_elt -= 1; - return stack[stack_elt]; -} - - -/* Decode DWARF 2 call frame information. Takes pointers the - instruction sequence to decode, current register information and - CIE info, and the PC range to evaluate. */ - -static void -execute_cfa_program (const unsigned char *insn_ptr, - const unsigned char *insn_end, - struct _Unwind_Context *context, - _Unwind_FrameState *fs) -{ - struct frame_state_reg_info *unused_rs = NULL; - - /* Don't allow remember/restore between CIE and FDE programs. */ - fs->regs.prev = NULL; - - /* The comparison with the return address uses < rather than <= because - we are only interested in the effects of code before the call; for a - noreturn function, the return address may point to unrelated code with - a different stack configuration that we are not interested in. We - assume that the call itself is unwind info-neutral; if not, or if - there are delay instructions that adjust the stack, these must be - reflected at the point immediately before the call insn. - In signal frames, return address is after last completed instruction, - so we add 1 to return address to make the comparison <=. */ - while (insn_ptr < insn_end - && fs->pc < context->ra + _Unwind_IsSignalFrame (context)) - { - unsigned char insn = *insn_ptr++; - _uleb128_t reg, utmp; - _sleb128_t offset, stmp; - - if ((insn & 0xc0) == DW_CFA_advance_loc) - fs->pc += (insn & 0x3f) * fs->code_align; - else if ((insn & 0xc0) == DW_CFA_offset) - { - reg = insn & 0x3f; - insn_ptr = read_uleb128 (insn_ptr, &utmp); - offset = (_Unwind_Sword) utmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; - } - else if ((insn & 0xc0) == DW_CFA_restore) - { - reg = insn & 0x3f; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_UNSAVED; - } - else switch (insn) - { - case DW_CFA_set_loc: - { - _Unwind_Ptr pc; - - insn_ptr = read_encoded_value (context, fs->fde_encoding, - insn_ptr, &pc); - fs->pc = (void *) pc; - } - break; - - case DW_CFA_advance_loc1: - fs->pc += read_1u (insn_ptr) * fs->code_align; - insn_ptr += 1; - break; - case DW_CFA_advance_loc2: - fs->pc += read_2u (insn_ptr) * fs->code_align; - insn_ptr += 2; - break; - case DW_CFA_advance_loc4: - fs->pc += read_4u (insn_ptr) * fs->code_align; - insn_ptr += 4; - break; - - case DW_CFA_offset_extended: - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_uleb128 (insn_ptr, &utmp); - offset = (_Unwind_Sword) utmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; - break; - - case DW_CFA_restore_extended: - insn_ptr = read_uleb128 (insn_ptr, ®); - /* FIXME, this is wrong; the CIE might have said that the - register was saved somewhere. */ - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; - break; - - case DW_CFA_same_value: - insn_ptr = read_uleb128 (insn_ptr, ®); - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; - break; - - case DW_CFA_undefined: - insn_ptr = read_uleb128 (insn_ptr, ®); - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNDEFINED; - break; - - case DW_CFA_nop: - break; - - case DW_CFA_register: - { - _uleb128_t reg2; - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_uleb128 (insn_ptr, ®2); - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_SAVED_REG; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.reg = - (_Unwind_Word)reg2; - } - break; - - case DW_CFA_remember_state: - { - struct frame_state_reg_info *new_rs; - if (unused_rs) - { - new_rs = unused_rs; - unused_rs = unused_rs->prev; - } - else - new_rs = alloca (sizeof (struct frame_state_reg_info)); - - *new_rs = fs->regs; - fs->regs.prev = new_rs; - } - break; - - case DW_CFA_restore_state: - { - struct frame_state_reg_info *old_rs = fs->regs.prev; - fs->regs = *old_rs; - old_rs->prev = unused_rs; - unused_rs = old_rs; - } - break; - - case DW_CFA_def_cfa: - insn_ptr = read_uleb128 (insn_ptr, &utmp); - fs->regs.cfa_reg = (_Unwind_Word)utmp; - insn_ptr = read_uleb128 (insn_ptr, &utmp); - fs->regs.cfa_offset = (_Unwind_Word)utmp; - fs->regs.cfa_how = CFA_REG_OFFSET; - break; - - case DW_CFA_def_cfa_register: - insn_ptr = read_uleb128 (insn_ptr, &utmp); - fs->regs.cfa_reg = (_Unwind_Word)utmp; - fs->regs.cfa_how = CFA_REG_OFFSET; - break; - - case DW_CFA_def_cfa_offset: - insn_ptr = read_uleb128 (insn_ptr, &utmp); - fs->regs.cfa_offset = utmp; - /* cfa_how deliberately not set. */ - break; - - case DW_CFA_def_cfa_expression: - fs->regs.cfa_exp = insn_ptr; - fs->regs.cfa_how = CFA_EXP; - insn_ptr = read_uleb128 (insn_ptr, &utmp); - insn_ptr += utmp; - break; - - case DW_CFA_expression: - insn_ptr = read_uleb128 (insn_ptr, ®); - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_SAVED_EXP; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.exp = insn_ptr; - insn_ptr = read_uleb128 (insn_ptr, &utmp); - insn_ptr += utmp; - break; - - /* Dwarf3. */ - case DW_CFA_offset_extended_sf: - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_sleb128 (insn_ptr, &stmp); - offset = stmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; - break; - - case DW_CFA_def_cfa_sf: - insn_ptr = read_uleb128 (insn_ptr, &utmp); - fs->regs.cfa_reg = (_Unwind_Word)utmp; - insn_ptr = read_sleb128 (insn_ptr, &stmp); - fs->regs.cfa_offset = (_Unwind_Sword)stmp; - fs->regs.cfa_how = CFA_REG_OFFSET; - fs->regs.cfa_offset *= fs->data_align; - break; - - case DW_CFA_def_cfa_offset_sf: - insn_ptr = read_sleb128 (insn_ptr, &stmp); - fs->regs.cfa_offset = (_Unwind_Sword)stmp; - fs->regs.cfa_offset *= fs->data_align; - /* cfa_how deliberately not set. */ - break; - - case DW_CFA_val_offset: - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_uleb128 (insn_ptr, &utmp); - offset = (_Unwind_Sword) utmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_VAL_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; - break; - - case DW_CFA_val_offset_sf: - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_sleb128 (insn_ptr, &stmp); - offset = stmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_VAL_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; - break; - - case DW_CFA_val_expression: - insn_ptr = read_uleb128 (insn_ptr, ®); - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_VAL_EXP; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.exp = insn_ptr; - insn_ptr = read_uleb128 (insn_ptr, &utmp); - insn_ptr += utmp; - break; - - case DW_CFA_GNU_window_save: - /* ??? Hardcoded for SPARC register window configuration. */ - for (reg = 16; reg < 32; ++reg) - { - fs->regs.reg[reg].how = REG_SAVED_OFFSET; - fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *); - } - break; - - case DW_CFA_GNU_args_size: - insn_ptr = read_uleb128 (insn_ptr, &utmp); - context->args_size = (_Unwind_Word)utmp; - break; - - case DW_CFA_GNU_negative_offset_extended: - /* Obsoleted by DW_CFA_offset_extended_sf, but used by - older PowerPC code. */ - insn_ptr = read_uleb128 (insn_ptr, ®); - insn_ptr = read_uleb128 (insn_ptr, &utmp); - offset = (_Unwind_Word) utmp * fs->data_align; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how - = REG_SAVED_OFFSET; - fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = -offset; - break; - - default: - gcc_unreachable (); - } - } -} - -/* Given the _Unwind_Context CONTEXT for a stack frame, look up the FDE for - its caller and decode it into FS. This function also sets the - args_size and lsda members of CONTEXT, as they are really information - about the caller's frame. */ - -static _Unwind_Reason_Code -uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) -{ - const struct dwarf_fde *fde; - const struct dwarf_cie *cie; - const unsigned char *aug, *insn, *end; - - memset (fs, 0, sizeof (*fs)); - context->args_size = 0; - context->lsda = 0; - - if (context->ra == 0) - return _URC_END_OF_STACK; - - fde = _Unwind_Find_FDE (context->ra + _Unwind_IsSignalFrame (context) - 1, - &context->bases); - if (fde == NULL) - { -#ifdef MD_FALLBACK_FRAME_STATE_FOR - /* Couldn't find frame unwind info for this function. Try a - target-specific fallback mechanism. This will necessarily - not provide a personality routine or LSDA. */ - return MD_FALLBACK_FRAME_STATE_FOR (context, fs); -#else - return _URC_END_OF_STACK; -#endif - } - - fs->pc = context->bases.func; - - cie = get_cie (fde); - insn = extract_cie_info (cie, context, fs); - if (insn == NULL) - /* CIE contained unknown augmentation. */ - return _URC_FATAL_PHASE1_ERROR; - - /* First decode all the insns in the CIE. */ - end = (const unsigned char *) next_fde ((const struct dwarf_fde *) cie); - execute_cfa_program (insn, end, context, fs); - - /* Locate augmentation for the fde. */ - aug = (const unsigned char *) fde + sizeof (*fde); - aug += 2 * size_of_encoded_value (fs->fde_encoding); - insn = NULL; - if (fs->saw_z) - { - _uleb128_t i; - aug = read_uleb128 (aug, &i); - insn = aug + i; - } - if (fs->lsda_encoding != DW_EH_PE_omit) - { - _Unwind_Ptr lsda; - - aug = read_encoded_value (context, fs->lsda_encoding, aug, &lsda); - context->lsda = (void *) lsda; - } - - /* Then the insns in the FDE up to our target PC. */ - if (insn == NULL) - insn = aug; - end = (const unsigned char *) next_fde (fde); - execute_cfa_program (insn, end, context, fs); - - return _URC_NO_REASON; -} - -typedef struct frame_state -{ - void *cfa; - void *eh_ptr; - long cfa_offset; - long args_size; - long reg_or_offset[PRE_GCC3_DWARF_FRAME_REGISTERS+1]; - unsigned short cfa_reg; - unsigned short retaddr_column; - char saved[PRE_GCC3_DWARF_FRAME_REGISTERS+1]; -} frame_state; - -struct frame_state * __frame_state_for (void *, struct frame_state *); - -/* Called from pre-G++ 3.0 __throw to find the registers to restore for - a given PC_TARGET. The caller should allocate a local variable of - `struct frame_state' and pass its address to STATE_IN. */ - -struct frame_state * -__frame_state_for (void *pc_target, struct frame_state *state_in) -{ - struct _Unwind_Context context; - _Unwind_FrameState fs; - int reg; - - memset (&context, 0, sizeof (struct _Unwind_Context)); - if (!ASSUME_EXTENDED_UNWIND_CONTEXT) - context.flags = EXTENDED_CONTEXT_BIT; - context.ra = pc_target + 1; - - if (uw_frame_state_for (&context, &fs) != _URC_NO_REASON) - return 0; - - /* We have no way to pass a location expression for the CFA to our - caller. It wouldn't understand it anyway. */ - if (fs.regs.cfa_how == CFA_EXP) - return 0; - - for (reg = 0; reg < PRE_GCC3_DWARF_FRAME_REGISTERS + 1; reg++) - { - state_in->saved[reg] = fs.regs.reg[reg].how; - switch (state_in->saved[reg]) - { - case REG_SAVED_REG: - state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.reg; - break; - case REG_SAVED_OFFSET: - state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.offset; - break; - default: - state_in->reg_or_offset[reg] = 0; - break; - } - } - - state_in->cfa_offset = fs.regs.cfa_offset; - state_in->cfa_reg = fs.regs.cfa_reg; - state_in->retaddr_column = fs.retaddr_column; - state_in->args_size = context.args_size; - state_in->eh_ptr = fs.eh_ptr; - - return state_in; -} - -typedef union { _Unwind_Ptr ptr; _Unwind_Word word; } _Unwind_SpTmp; - -static inline void -_Unwind_SetSpColumn (struct _Unwind_Context *context, void *cfa, - _Unwind_SpTmp *tmp_sp) -{ - int size = dwarf_reg_size_table[__builtin_dwarf_sp_column ()]; - - if (size == sizeof(_Unwind_Ptr)) - tmp_sp->ptr = (_Unwind_Ptr) cfa; - else - { - gcc_assert (size == sizeof(_Unwind_Word)); - tmp_sp->word = (_Unwind_Ptr) cfa; - } - _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp); -} - -static void -uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) -{ - struct _Unwind_Context orig_context = *context; - void *cfa; - long i; - -#ifdef __LIBGCC_EH_RETURN_STACKADJ_RTX__ - /* Special handling here: Many machines do not use a frame pointer, - and track the CFA only through offsets from the stack pointer from - one frame to the next. In this case, the stack pointer is never - stored, so it has no saved address in the context. What we do - have is the CFA from the previous stack frame. - - In very special situations (such as unwind info for signal return), - there may be location expressions that use the stack pointer as well. - - Do this conditionally for one frame. This allows the unwind info - for one frame to save a copy of the stack pointer from the previous - frame, and be able to use much easier CFA mechanisms to do it. - Always zap the saved stack pointer value for the next frame; carrying - the value over from one frame to another doesn't make sense. */ - - _Unwind_SpTmp tmp_sp; - - if (!_Unwind_GetGRPtr (&orig_context, __builtin_dwarf_sp_column ())) - _Unwind_SetSpColumn (&orig_context, context->cfa, &tmp_sp); - _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), NULL); -#endif - - /* Compute this frame's CFA. */ - switch (fs->regs.cfa_how) - { - case CFA_REG_OFFSET: - cfa = _Unwind_GetPtr (&orig_context, fs->regs.cfa_reg); - cfa += fs->regs.cfa_offset; - break; - - case CFA_EXP: - { - const unsigned char *exp = fs->regs.cfa_exp; - _uleb128_t len; - - exp = read_uleb128 (exp, &len); - cfa = (void *) (_Unwind_Ptr) - execute_stack_op (exp, exp + len, &orig_context, 0); - break; - } - - default: - gcc_unreachable (); - } - context->cfa = cfa; - - /* Compute the addresses of all registers saved in this frame. */ - for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i) - switch (fs->regs.reg[i].how) - { - case REG_UNSAVED: - case REG_UNDEFINED: - break; - - case REG_SAVED_OFFSET: - _Unwind_SetGRPtr (context, i, - (void *) (cfa + fs->regs.reg[i].loc.offset)); - break; - - case REG_SAVED_REG: - if (_Unwind_GRByValue (&orig_context, fs->regs.reg[i].loc.reg)) - _Unwind_SetGRValue (context, i, - _Unwind_GetGR (&orig_context, - fs->regs.reg[i].loc.reg)); - else - _Unwind_SetGRPtr (context, i, - _Unwind_GetGRPtr (&orig_context, - fs->regs.reg[i].loc.reg)); - break; - - case REG_SAVED_EXP: - { - const unsigned char *exp = fs->regs.reg[i].loc.exp; - _uleb128_t len; - _Unwind_Ptr val; - - exp = read_uleb128 (exp, &len); - val = execute_stack_op (exp, exp + len, &orig_context, - (_Unwind_Ptr) cfa); - _Unwind_SetGRPtr (context, i, (void *) val); - } - break; - - case REG_SAVED_VAL_OFFSET: - _Unwind_SetGRValue (context, i, - (_Unwind_Internal_Ptr) - (cfa + fs->regs.reg[i].loc.offset)); - break; - - case REG_SAVED_VAL_EXP: - { - const unsigned char *exp = fs->regs.reg[i].loc.exp; - _uleb128_t len; - _Unwind_Ptr val; - - exp = read_uleb128 (exp, &len); - val = execute_stack_op (exp, exp + len, &orig_context, - (_Unwind_Ptr) cfa); - _Unwind_SetGRValue (context, i, val); - } - break; - } - - _Unwind_SetSignalFrame (context, fs->signal_frame); - -#ifdef MD_FROB_UPDATE_CONTEXT - MD_FROB_UPDATE_CONTEXT (context, fs); -#endif -} - -/* CONTEXT describes the unwind state for a frame, and FS describes the FDE - of its caller. Update CONTEXT to refer to the caller as well. Note - that the args_size and lsda members are not updated here, but later in - uw_frame_state_for. */ - -static void -uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) -{ - uw_update_context_1 (context, fs); - - /* In general this unwinder doesn't make any distinction between - undefined and same_value rule. Call-saved registers are assumed - to have same_value rule by default and explicit undefined - rule is handled like same_value. The only exception is - DW_CFA_undefined on retaddr_column which is supposed to - mark outermost frame in DWARF 3. */ - if (fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (fs->retaddr_column)].how - == REG_UNDEFINED) - /* uw_frame_state_for uses context->ra == 0 check to find outermost - stack frame. */ - context->ra = 0; - else - /* Compute the return address now, since the return address column - can change from frame to frame. */ - context->ra = __builtin_extract_return_addr - (_Unwind_GetPtr (context, fs->retaddr_column)); -#if defined( __CR16C__ ) - context->ra = (void*)( ( (unsigned)context->ra ) << 1 ) ; -#endif -} - -static void -uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) -{ - uw_update_context (context, fs); -} - -/* Fill in CONTEXT for top-of-stack. The only valid registers at this - level will be the return address and the CFA. */ - -#define uw_init_context(CONTEXT) \ - do \ - { \ - /* Do any necessary initialization to access arbitrary stack frames. \ - On the SPARC, this means flushing the register windows. */ \ - __builtin_unwind_init (); \ - uw_init_context_1 (CONTEXT, __builtin_dwarf_cfa (), \ - __builtin_return_address (0)); \ - } \ - while (0) - -static inline void -init_dwarf_reg_size_table (void) -{ - __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); -} - -static void __attribute__((noinline)) -uw_init_context_1 (struct _Unwind_Context *context, - void *outer_cfa, void *outer_ra) -{ - void *ra = __builtin_extract_return_addr (__builtin_return_address (0)); - _Unwind_FrameState fs; - _Unwind_SpTmp sp_slot; - _Unwind_Reason_Code code; - - memset (context, 0, sizeof (struct _Unwind_Context)); - context->ra = ra; - if (!ASSUME_EXTENDED_UNWIND_CONTEXT) - context->flags = EXTENDED_CONTEXT_BIT; - - code = uw_frame_state_for (context, &fs); - gcc_assert (code == _URC_NO_REASON); - -#if __GTHREADS - { - static __gthread_once_t once_regsizes = __GTHREAD_ONCE_INIT; - if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0 - && dwarf_reg_size_table[0] == 0) - init_dwarf_reg_size_table (); - } -#else - if (dwarf_reg_size_table[0] == 0) - init_dwarf_reg_size_table (); -#endif - - /* Force the frame state to use the known cfa value. */ - _Unwind_SetSpColumn (context, outer_cfa, &sp_slot); - fs.regs.cfa_how = CFA_REG_OFFSET; - fs.regs.cfa_reg = __builtin_dwarf_sp_column (); -#if !defined( __CR16C__ ) - fs.regs.cfa_offset = 0; -#else - fs.regs.cfa_offset -= context->args_size ; -#endif - - uw_update_context_1 (context, &fs); - - /* If the return address column was saved in a register in the - initialization context, then we can't see it in the given - call frame data. So have the initialization context tell us. */ - context->ra = __builtin_extract_return_addr (outer_ra); -} - -static void _Unwind_DebugHook (void *, void *) - __attribute__ ((__noinline__, __used__, __noclone__)); - -/* This function is called during unwinding. It is intended as a hook - for a debugger to intercept exceptions. CFA is the CFA of the - target frame. HANDLER is the PC to which control will be - transferred. */ -static void -_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)), - void *handler __attribute__ ((__unused__))) -{ - /* We only want to use stap probes starting with v3. Earlier - versions added too much startup cost. */ -#if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3 - STAP_PROBE2 (libgcc, unwind, cfa, handler); -#else - asm (""); -#endif -} - -/* Install TARGET into CURRENT so that we can return to it. This is a - macro because __builtin_eh_return must be invoked in the context of - our caller. */ -#if defined( __CR16C__ ) - -#define uw_install_context(CURRENT, TARGET, FRAMES) \ - do \ - { \ - long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ - void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ - handler = (void*)( ( (unsigned)handler ) >> 1 ) ; \ - _Unwind_DebugHook ((TARGET)->cfa, handler); \ - __builtin_eh_return (offset, handler); \ - } \ - while (0) -#else -#define uw_install_context(CURRENT, TARGET, FRAMES) \ - do \ - { \ - long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ - void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ - _Unwind_DebugHook ((TARGET)->cfa, handler); \ - __builtin_eh_return (offset, handler); \ - } \ - while (0) -#endif /* __CR16C__ */ - -static long -uw_install_context_1 (struct _Unwind_Context *current, - struct _Unwind_Context *target) -{ - long i; - _Unwind_SpTmp sp_slot; - - /* If the target frame does not have a saved stack pointer, - then set up the target's CFA. */ - if (!_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ())) - _Unwind_SetSpColumn (target, target->cfa, &sp_slot); - - for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__; ++i) - { - void *c = (void *) (_Unwind_Internal_Ptr) current->reg[i]; - void *t = (void *) (_Unwind_Internal_Ptr)target->reg[i]; - - gcc_assert (current->by_value[i] == 0); - if (target->by_value[i] && c) - { - _Unwind_Word w; - _Unwind_Ptr p; - if (dwarf_reg_size_table[i] == sizeof (_Unwind_Word)) - { - w = (_Unwind_Internal_Ptr) t; - memcpy (c, &w, sizeof (_Unwind_Word)); - } - else - { - gcc_assert (dwarf_reg_size_table[i] == sizeof (_Unwind_Ptr)); - p = (_Unwind_Internal_Ptr) t; - memcpy (c, &p, sizeof (_Unwind_Ptr)); - } - } - else if (t && c && t != c) - memcpy (c, t, dwarf_reg_size_table[i]); - } - - /* If the current frame doesn't have a saved stack pointer, then we - need to rely on EH_RETURN_STACKADJ_RTX to get our target stack - pointer value reloaded. */ - if (!_Unwind_GetGRPtr (current, __builtin_dwarf_sp_column ())) - { - void *target_cfa; - - target_cfa = _Unwind_GetPtr (target, __builtin_dwarf_sp_column ()); - - /* We adjust SP by the difference between CURRENT and TARGET's CFA. */ - if (__LIBGCC_STACK_GROWS_DOWNWARD__) - return target_cfa - current->cfa + target->args_size; - else - return current->cfa - target_cfa - target->args_size; - } - return 0; -} - -static inline _Unwind_Ptr -uw_identify_context (struct _Unwind_Context *context) -{ - /* The CFA is not sufficient to disambiguate the context of a function - interrupted by a signal before establishing its frame and the context - of the signal itself. */ - if (__LIBGCC_STACK_GROWS_DOWNWARD__) - return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context); - else - return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context); -} - - -#include "unwind.inc" - -#if defined (USE_GAS_SYMVER) && defined (SHARED) && defined (USE_LIBUNWIND_EXCEPTIONS) -alias (_Unwind_Backtrace); -alias (_Unwind_DeleteException); -alias (_Unwind_FindEnclosingFunction); -alias (_Unwind_ForcedUnwind); -alias (_Unwind_GetDataRelBase); -alias (_Unwind_GetTextRelBase); -alias (_Unwind_GetCFA); -alias (_Unwind_GetGR); -alias (_Unwind_GetIP); -alias (_Unwind_GetLanguageSpecificData); -alias (_Unwind_GetRegionStart); -alias (_Unwind_RaiseException); -alias (_Unwind_Resume); -alias (_Unwind_Resume_or_Rethrow); -alias (_Unwind_SetGR); -alias (_Unwind_SetIP); -#endif - -#endif /* !USING_SJLJ_EXCEPTIONS */ diff --git a/libgcc/config/cr16/unwind-dw2.h b/libgcc/config/cr16/unwind-dw2.h deleted file mode 100644 index 0c478e5..0000000 --- a/libgcc/config/cr16/unwind-dw2.h +++ /dev/null @@ -1,80 +0,0 @@ -/* DWARF2 frame unwind data structure. - Copyright (C) 1997-2022 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC 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 General Public - License for more details. - - Under Section 7 of GPL version 3, you are granted additional - permissions described in the GCC Runtime Library Exception, version - 3.1, as published by the Free Software Foundation. - - You should have received a copy of the GNU General Public License and - a copy of the GCC Runtime Library Exception along with this program; - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - . */ - -/* The result of interpreting the frame unwind info for a frame. - This is all symbolic at this point, as none of the values can - be resolved until the target pc is located. */ -typedef struct -{ - /* Each register save state can be described in terms of a CFA slot, - another register, or a location expression. */ - struct frame_state_reg_info - { - struct { - union { - _Unwind_Word reg; - _Unwind_Sword offset; - const unsigned char *exp; - } loc; - enum { - REG_UNSAVED, - REG_SAVED_OFFSET, - REG_SAVED_REG, - REG_SAVED_EXP, - REG_SAVED_VAL_OFFSET, - REG_SAVED_VAL_EXP, - REG_UNDEFINED - } how; - } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; - - /* Used to implement DW_CFA_remember_state. */ - struct frame_state_reg_info *prev; - - /* The CFA can be described in terms of a reg+offset or a - location expression. */ - _Unwind_Sword cfa_offset; - _Unwind_Word cfa_reg; - const unsigned char *cfa_exp; - enum { - CFA_UNSET, - CFA_REG_OFFSET, - CFA_EXP - } cfa_how; - } regs; - - /* The PC described by the current frame state. */ - void *pc; - - /* The information we care about from the CIE/FDE. */ - _Unwind_Personality_Fn personality; - _Unwind_Sword data_align; - _Unwind_Word code_align; - _Unwind_Word retaddr_column; - unsigned char fde_encoding; - unsigned char lsda_encoding; - unsigned char saw_z; - unsigned char signal_frame; - void *eh_ptr; -} _Unwind_FrameState; - -- cgit v1.1 From 16f542d6b866828e23e699e294e617ca428b04ee Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 27 Aug 2022 00:17:09 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 5fe8e73..ac76f7d 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,16 @@ +2022-08-26 Martin Liska + + * config.host: Remove cr16 related stuff. + * config/cr16/crti.S: Removed. + * config/cr16/crtlibid.S: Removed. + * config/cr16/crtn.S: Removed. + * config/cr16/divmodhi3.c: Removed. + * config/cr16/lib1funcs.S: Removed. + * config/cr16/t-cr16: Removed. + * config/cr16/t-crtlibid: Removed. + * config/cr16/unwind-cr16.c: Removed. + * config/cr16/unwind-dw2.h: Removed. + 2022-08-16 Kito Cheng * config/riscv/sfp-machine.h (_FP_NANFRAC_H): New. -- cgit v1.1 From 1ddf31af2f3fbfba45882a95dd6eb81bae59f90a Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 25 Aug 2022 10:33:45 +0200 Subject: m32c-rtems: remove obsoleted port contrib/ChangeLog: * config-list.mk: Remove the port. gcc/ChangeLog: * config.gcc: Remove the port. * config/m32c/rtems.h: Removed. libgcc/ChangeLog: * config.host: Remove the port. --- libgcc/config.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libgcc') diff --git a/libgcc/config.host b/libgcc/config.host index 9a28b10..fe2cf78 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1510,7 +1510,7 @@ am33_2.0-*-linux*) extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" tmake_file="$tmake_file t-fdpbit" ;; -m32c-*-elf*|m32c-*-rtems*) +m32c-*-elf*) tmake_file="$tmake_file m32c/t-m32c" ;; nvptx-*) -- cgit v1.1 From 3de9fb3235998a052ba5978bc0fd8ff3fad88810 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 31 Aug 2022 00:16:45 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index ac76f7d..3358060 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,7 @@ +2022-08-30 Martin Liska + + * config.host: Remove the port. + 2022-08-26 Martin Liska * config.host: Remove cr16 related stuff. -- cgit v1.1 From dc832fb39fc0f9e5f3a86e3b8399259b1adccc8d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 25 Aug 2022 14:30:51 +0200 Subject: 32-bit PA-RISC with HP-UX: remove deprecated ports ChangeLog: * configure: Regenerate. * configure.ac: Delete hpux9 and hpux10. config/ChangeLog: * mh-pa-hpux10: Removed. contrib/ChangeLog: * config-list.mk: Remove deprecated ports. contrib/header-tools/ChangeLog: * README: Remove deprecated ports. * reduce-headers: Likewise. gcc/ChangeLog: * config.build: Remove deprecated ports. * config.gcc: Likewise. * config.host: Likewise. * configure.ac: Likewise. * configure: Regenerate. * config/pa/pa-hpux10.h: Removed. * config/pa/pa-hpux10.opt: Removed. * config/pa/t-dce-thr: Removed. gnattools/ChangeLog: * configure.ac: Remove deprecated ports. * configure: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate. * crossconfig.m4: Remove deprecated ports. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-conv.C: Remove useless test. * gcc.c-torture/execute/ieee/hugeval.x: Likewise. * gcc.dg/torture/pr47917.c: Likewise. * lib/target-supports.exp: Likewise. libgcc/ChangeLog: * config.host: Remove hppa. libitm/ChangeLog: * configure: Regenerate. fixincludes/ChangeLog: * configure: Regenerate. --- libgcc/config.host | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'libgcc') diff --git a/libgcc/config.host b/libgcc/config.host index fe2cf78..9dcc253 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -648,17 +648,6 @@ hppa*-*-linux*) extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" md_unwind_header=pa/linux-unwind.h ;; -hppa[12]*-*-hpux10*) - tmake_file="$tmake_file pa/t-hpux pa/t-hpux10 t-libgcc-pic t-slibgcc" - # Set the libgcc version number - if test x$ac_cv_sjlj_exceptions = xyes; then - tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver" - else - tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver" - fi - tmake_file="$tmake_file pa/t-slibgcc-hpux t-slibgcc-hpux" - md_unwind_header=pa/hpux-unwind.h - ;; hppa*64*-*-hpux11*) tmake_file="$tmake_file pa/t-hpux pa/t-pa64 pa/t-dimode" tmake_file="$tmake_file pa/t-stublib t-libgcc-pic t-slibgcc" @@ -675,17 +664,6 @@ hppa*64*-*-hpux11*) libgcc_stub.a" md_unwind_header=pa/hpux-unwind.h ;; -hppa[12]*-*-hpux11*) - tmake_file="$tmake_file pa/t-hpux pa/t-stublib t-libgcc-pic t-slibgcc" - # Set the libgcc version number - if test x$ac_cv_sjlj_exceptions = xyes; then - tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver" - else - tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver" - fi - tmake_file="$tmake_file pa/t-slibgcc-hpux t-slibgcc-hpux" - md_unwind_header=pa/hpux-unwind.h - ;; hppa*-*-openbsd*) tmake_file="$tmake_file pa/t-openbsd" ;; -- cgit v1.1 From 542c60c4fb557ec437e3d20634fd59a61d619ac3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 1 Sep 2022 00:17:39 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 3358060..e0deb15 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,7 @@ +2022-08-31 Martin Liska + + * config.host: Remove hppa. + 2022-08-30 Martin Liska * config.host: Remove the port. -- cgit v1.1 From 6e80a1d164d1f996ad08a512c000025a7c2ca893 Mon Sep 17 00:00:00 2001 From: Thomas Neumann Date: Tue, 1 Mar 2022 21:57:35 +0100 Subject: eliminate mutex in fast path of __register_frame The __register_frame/__deregister_frame functions are used to register unwinding frames from JITed code in a sorted list. That list itself is protected by object_mutex, which leads to terrible performance in multi-threaded code and is somewhat expensive even if single-threaded. There was already a fast-path that avoided taking the mutex if no frame was registered at all. This commit eliminates both the mutex and the sorted list from the atomic fast path, and replaces it with a btree that uses optimistic lock coupling during lookup. This allows for fully parallel unwinding and is essential to scale exception handling to large core counts. libgcc/ChangeLog: * unwind-dw2-fde.c (release_registered_frames): Cleanup at shutdown. (__register_frame_info_table_bases): Use btree in atomic fast path. (__deregister_frame_info_bases): Likewise. (_Unwind_Find_FDE): Likewise. (base_from_object): Make parameter const. (classify_object_over_fdes): Add query-only mode. (get_pc_range): Compute PC range for lookup. * unwind-dw2-fde.h (last_fde): Make parameter const. * unwind-dw2-btree.h: New file. --- libgcc/unwind-dw2-btree.h | 953 ++++++++++++++++++++++++++++++++++++++++++++++ libgcc/unwind-dw2-fde.c | 194 +++++++--- libgcc/unwind-dw2-fde.h | 2 +- 3 files changed, 1098 insertions(+), 51 deletions(-) create mode 100644 libgcc/unwind-dw2-btree.h (limited to 'libgcc') diff --git a/libgcc/unwind-dw2-btree.h b/libgcc/unwind-dw2-btree.h new file mode 100644 index 0000000..8853f0e --- /dev/null +++ b/libgcc/unwind-dw2-btree.h @@ -0,0 +1,953 @@ +/* Lock-free btree for manually registered unwind frames. */ +/* Copyright (C) 2022 Free Software Foundation, Inc. + Contributed by Thomas Neumann + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC 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 General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef GCC_UNWIND_DW2_BTREE_H +#define GCC_UNWIND_DW2_BTREE_H + +#include + +// Common logic for version locks. +struct version_lock +{ + // The lock itself. The lowest bit indicates an exclusive lock, + // the second bit indicates waiting threads. All other bits are + // used as counter to recognize changes. + // Overflows are okay here, we must only prevent overflow to the + // same value within one lock_optimistic/validate + // range. Even on 32 bit platforms that would require 1 billion + // frame registrations within the time span of a few assembler + // instructions. + uintptr_t version_lock; +}; + +#ifdef __GTHREAD_HAS_COND +// We should never get contention within the tree as it rarely changes. +// But if we ever do get contention we use these for waiting. +static __gthread_mutex_t version_lock_mutex = __GTHREAD_MUTEX_INIT; +static __gthread_cond_t version_lock_cond = __GTHREAD_COND_INIT; +#endif + +// Initialize in locked state. +static inline void +version_lock_initialize_locked_exclusive (struct version_lock *vl) +{ + vl->version_lock = 1; +} + +// Try to lock the node exclusive. +static inline bool +version_lock_try_lock_exclusive (struct version_lock *vl) +{ + uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + if (state & 1) + return false; + return __atomic_compare_exchange_n (&(vl->version_lock), &state, state | 1, + false, __ATOMIC_SEQ_CST, + __ATOMIC_SEQ_CST); +} + +// Lock the node exclusive, blocking as needed. +static void +version_lock_lock_exclusive (struct version_lock *vl) +{ +#ifndef __GTHREAD_HAS_COND +restart: +#endif + + // We should virtually never get contention here, as frame + // changes are rare. + uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + if (!(state & 1)) + { + if (__atomic_compare_exchange_n (&(vl->version_lock), &state, state | 1, + false, __ATOMIC_SEQ_CST, + __ATOMIC_SEQ_CST)) + return; + } + + // We did get contention, wait properly. +#ifdef __GTHREAD_HAS_COND + __gthread_mutex_lock (&version_lock_mutex); + state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + while (true) + { + // Check if the lock is still held. + if (!(state & 1)) + { + if (__atomic_compare_exchange_n (&(vl->version_lock), &state, + state | 1, false, __ATOMIC_SEQ_CST, + __ATOMIC_SEQ_CST)) + { + __gthread_mutex_unlock (&version_lock_mutex); + return; + } + else + { + continue; + } + } + + // Register waiting thread. + if (!(state & 2)) + { + if (!__atomic_compare_exchange_n (&(vl->version_lock), &state, + state | 2, false, __ATOMIC_SEQ_CST, + __ATOMIC_SEQ_CST)) + continue; + } + + // And sleep. + __gthread_cond_wait (&version_lock_cond, &version_lock_mutex); + state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + } +#else + // Spin if we do not have condition variables available. + // We expect no contention here, spinning should be okay. + goto restart; +#endif +} + +// Release a locked node and increase the version lock. +static void +version_lock_unlock_exclusive (struct version_lock *vl) +{ + // increase version, reset exclusive lock bits + uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_t ns = (state + 4) & (~((uintptr_t) 3)); + state = __atomic_exchange_n (&(vl->version_lock), ns, __ATOMIC_SEQ_CST); + +#ifdef __GTHREAD_HAS_COND + if (state & 2) + { + // Wake up waiting threads. This should be extremely rare. + __gthread_mutex_lock (&version_lock_mutex); + __gthread_cond_broadcast (&version_lock_cond); + __gthread_mutex_unlock (&version_lock_mutex); + } +#endif +} + +// Acquire an optimistic "lock". Note that this does not lock at all, it +// only allows for validation later. +static inline bool +version_lock_lock_optimistic (const struct version_lock *vl, uintptr_t *lock) +{ + uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + *lock = state; + + // Acquiring the lock fails when there is currently an exclusive lock. + return !(state & 1); +} + +// Validate a previously acquired "lock". +static inline bool +version_lock_validate (const struct version_lock *vl, uintptr_t lock) +{ + // Prevent the reordering of non-atomic loads behind the atomic load. + // Hans Boehm, Can Seqlocks Get Along with Programming Language Memory + // Models?, Section 4. + __atomic_thread_fence (__ATOMIC_ACQUIRE); + + // Check that the node is still in the same state. + uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + return (state == lock); +} + +// The largest possible separator value. +static const uintptr_t max_separator = ~((uintptr_t) (0)); + +struct btree_node; + +// Inner entry. The child tree contains all entries <= separator. +struct inner_entry +{ + uintptr_t separator; + struct btree_node *child; +}; + +// Leaf entry. Stores an object entry. +struct leaf_entry +{ + uintptr_t base, size; + struct object *ob; +}; + +// Node types. +enum node_type +{ + btree_node_inner, + btree_node_leaf, + btree_node_free +}; + +// Node sizes. Chosen such that the result size is roughly 256 bytes. +#define max_fanout_inner 15 +#define max_fanout_leaf 10 + +// A btree node. +struct btree_node +{ + // The version lock used for optimistic lock coupling. + struct version_lock version_lock; + // The number of entries. + unsigned entry_count; + // The type. + enum node_type type; + // The payload. + union + { + // The inner nodes have fence keys, i.e., the right-most entry includes a + // separator. + struct inner_entry children[max_fanout_inner]; + struct leaf_entry entries[max_fanout_leaf]; + } content; +}; + +// Is an inner node? +static inline bool +btree_node_is_inner (const struct btree_node *n) +{ + return n->type == btree_node_inner; +} + +// Is a leaf node? +static inline bool +btree_node_is_leaf (const struct btree_node *n) +{ + return n->type == btree_node_leaf; +} + +// Should the node be merged? +static inline bool +btree_node_needs_merge (const struct btree_node *n) +{ + return n->entry_count < (btree_node_is_inner (n) ? (max_fanout_inner / 2) + : (max_fanout_leaf / 2)); +} + +// Get the fence key for inner nodes. +static inline uintptr_t +btree_node_get_fence_key (const struct btree_node *n) +{ + // For inner nodes we just return our right-most entry. + return n->content.children[n->entry_count - 1].separator; +} + +// Find the position for a slot in an inner node. +static unsigned +btree_node_find_inner_slot (const struct btree_node *n, uintptr_t value) +{ + for (unsigned index = 0, ec = n->entry_count; index != ec; ++index) + if (n->content.children[index].separator >= value) + return index; + return n->entry_count; +} + +// Find the position for a slot in a leaf node. +static unsigned +btree_node_find_leaf_slot (const struct btree_node *n, uintptr_t value) +{ + for (unsigned index = 0, ec = n->entry_count; index != ec; ++index) + if (n->content.entries[index].base + n->content.entries[index].size > value) + return index; + return n->entry_count; +} + +// Try to lock the node exclusive. +static inline bool +btree_node_try_lock_exclusive (struct btree_node *n) +{ + return version_lock_try_lock_exclusive (&(n->version_lock)); +} + +// Lock the node exclusive, blocking as needed. +static inline void +btree_node_lock_exclusive (struct btree_node *n) +{ + version_lock_lock_exclusive (&(n->version_lock)); +} + +// Release a locked node and increase the version lock. +static inline void +btree_node_unlock_exclusive (struct btree_node *n) +{ + version_lock_unlock_exclusive (&(n->version_lock)); +} + +// Acquire an optimistic "lock". Note that this does not lock at all, it +// only allows for validation later. +static inline bool +btree_node_lock_optimistic (const struct btree_node *n, uintptr_t *lock) +{ + return version_lock_lock_optimistic (&(n->version_lock), lock); +} + +// Validate a previously acquire lock. +static inline bool +btree_node_validate (const struct btree_node *n, uintptr_t lock) +{ + return version_lock_validate (&(n->version_lock), lock); +} + +// Insert a new separator after splitting. +static void +btree_node_update_separator_after_split (struct btree_node *n, + uintptr_t old_separator, + uintptr_t new_separator, + struct btree_node *new_right) +{ + unsigned slot = btree_node_find_inner_slot (n, old_separator); + for (unsigned index = n->entry_count; index > slot; --index) + n->content.children[index] = n->content.children[index - 1]; + n->content.children[slot].separator = new_separator; + n->content.children[slot + 1].child = new_right; + n->entry_count++; +} + +// A btree. Suitable for static initialization, all members are zero at the +// beginning. +struct btree +{ + // The root of the btree. + struct btree_node *root; + // The free list of released node. + struct btree_node *free_list; + // The version lock used to protect the root. + struct version_lock root_lock; +}; + +// Initialize a btree. Not actually used, just for exposition. +static inline void +btree_init (struct btree *t) +{ + t->root = NULL; + t->free_list = NULL; + t->root_lock.version_lock = 0; +}; + +static void +btree_release_tree_recursively (struct btree *t, struct btree_node *n); + +// Destroy a tree and release all nodes. +static void +btree_destroy (struct btree *t) +{ + // Disable the mechanism before cleaning up. + struct btree_node *old_root + = __atomic_exchange_n (&(t->root), NULL, __ATOMIC_SEQ_CST); + if (old_root) + btree_release_tree_recursively (t, old_root); + + // Release all free nodes. + while (t->free_list) + { + struct btree_node *next = t->free_list->content.children[0].child; + free (t->free_list); + t->free_list = next; + } +} + +// Allocate a node. This node will be returned in locked exclusive state. +static struct btree_node * +btree_allocate_node (struct btree *t, bool inner) +{ + while (true) + { + // Try the free list first. + struct btree_node *next_free + = __atomic_load_n (&(t->free_list), __ATOMIC_SEQ_CST); + if (next_free) + { + if (!btree_node_try_lock_exclusive (next_free)) + continue; + // The node might no longer be free, check that again after acquiring + // the exclusive lock. + if (next_free->type == btree_node_free) + { + struct btree_node *ex = next_free; + if (__atomic_compare_exchange_n ( + &(t->free_list), &ex, next_free->content.children[0].child, + false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + { + next_free->entry_count = 0; + next_free->type = inner ? btree_node_inner : btree_node_leaf; + return next_free; + } + } + btree_node_unlock_exclusive (next_free); + continue; + } + + // No free node available, allocate a new one. + struct btree_node *new_node + = (struct btree_node *) (malloc (sizeof (struct btree_node))); + version_lock_initialize_locked_exclusive ( + &(new_node->version_lock)); // initialize the node in locked state. + new_node->entry_count = 0; + new_node->type = inner ? btree_node_inner : btree_node_leaf; + return new_node; + } +} + +// Release a node. This node must be currently locked exclusively and will +// be placed in the free list. +static void +btree_release_node (struct btree *t, struct btree_node *node) +{ + // We cannot release the memory immediately because there might still be + // concurrent readers on that node. Put it in the free list instead. + node->type = btree_node_free; + struct btree_node *next_free + = __atomic_load_n (&(t->free_list), __ATOMIC_SEQ_CST); + do + { + node->content.children[0].child = next_free; + } while (!__atomic_compare_exchange_n (&(t->free_list), &next_free, node, + false, __ATOMIC_SEQ_CST, + __ATOMIC_SEQ_CST)); + btree_node_unlock_exclusive (node); +} + +// Recursively release a tree. The btree is by design very shallow, thus +// we can risk recursion here. +static void +btree_release_tree_recursively (struct btree *t, struct btree_node *node) +{ + btree_node_lock_exclusive (node); + if (btree_node_is_inner (node)) + { + for (unsigned index = 0; index < node->entry_count; ++index) + btree_release_tree_recursively (t, node->content.children[index].child); + } + btree_release_node (t, node); +} + +// Check if we are splitting the root. +static void +btree_handle_root_split (struct btree *t, struct btree_node **node, + struct btree_node **parent) +{ + // We want to keep the root pointer stable to allow for contention + // free reads. Thus, we split the root by first moving the content + // of the root node to a new node, and then split that new node. + if (!*parent) + { + // Allocate a new node, this guarantees us that we will have a parent + // afterwards. + struct btree_node *new_node + = btree_allocate_node (t, btree_node_is_inner (*node)); + struct btree_node *old_node = *node; + new_node->entry_count = old_node->entry_count; + new_node->content = old_node->content; + old_node->content.children[0].separator = max_separator; + old_node->content.children[0].child = new_node; + old_node->entry_count = 1; + old_node->type = btree_node_inner; + + *parent = old_node; + *node = new_node; + } +} + +// Split an inner node. +static void +btree_split_inner (struct btree *t, struct btree_node **inner, + struct btree_node **parent, uintptr_t target) +{ + // Check for the root. + btree_handle_root_split (t, inner, parent); + + // Create two inner node. + uintptr_t right_fence = btree_node_get_fence_key (*inner); + struct btree_node *left_inner = *inner; + struct btree_node *right_inner = btree_allocate_node (t, true); + unsigned split = left_inner->entry_count / 2; + right_inner->entry_count = left_inner->entry_count - split; + for (unsigned index = 0; index < right_inner->entry_count; ++index) + right_inner->content.children[index] + = left_inner->content.children[split + index]; + left_inner->entry_count = split; + uintptr_t left_fence = btree_node_get_fence_key (left_inner); + btree_node_update_separator_after_split (*parent, right_fence, left_fence, + right_inner); + if (target <= left_fence) + { + *inner = left_inner; + btree_node_unlock_exclusive (right_inner); + } + else + { + *inner = right_inner; + btree_node_unlock_exclusive (left_inner); + } +} + +// Split a leaf node. +static void +btree_split_leaf (struct btree *t, struct btree_node **leaf, + struct btree_node **parent, uintptr_t fence, uintptr_t target) +{ + // Check for the root. + btree_handle_root_split (t, leaf, parent); + + // Create two leaf nodes. + uintptr_t right_fence = fence; + struct btree_node *left_leaf = *leaf; + struct btree_node *right_leaf = btree_allocate_node (t, false); + unsigned split = left_leaf->entry_count / 2; + right_leaf->entry_count = left_leaf->entry_count - split; + for (unsigned index = 0; index != right_leaf->entry_count; ++index) + right_leaf->content.entries[index] + = left_leaf->content.entries[split + index]; + left_leaf->entry_count = split; + uintptr_t left_fence = right_leaf->content.entries[0].base - 1; + btree_node_update_separator_after_split (*parent, right_fence, left_fence, + right_leaf); + if (target <= left_fence) + { + *leaf = left_leaf; + btree_node_unlock_exclusive (right_leaf); + } + else + { + *leaf = right_leaf; + btree_node_unlock_exclusive (left_leaf); + } +} + +// Merge (or balance) child nodes. +static struct btree_node * +btree_merge_node (struct btree *t, unsigned child_slot, + struct btree_node *parent, uintptr_t target) +{ + // Choose the emptiest neighbor and lock both. The target child is already + // locked. + unsigned left_slot; + struct btree_node *left_node, *right_node; + if ((child_slot == 0) + || (((child_slot + 1) < parent->entry_count) + && (parent->content.children[child_slot + 1].child->entry_count + < parent->content.children[child_slot - 1].child->entry_count))) + { + left_slot = child_slot; + left_node = parent->content.children[left_slot].child; + right_node = parent->content.children[left_slot + 1].child; + btree_node_lock_exclusive (right_node); + } + else + { + left_slot = child_slot - 1; + left_node = parent->content.children[left_slot].child; + right_node = parent->content.children[left_slot + 1].child; + btree_node_lock_exclusive (left_node); + } + + // Can we merge both nodes into one node? + unsigned total_count = left_node->entry_count + right_node->entry_count; + unsigned max_count + = btree_node_is_inner (left_node) ? max_fanout_inner : max_fanout_leaf; + if (total_count <= max_count) + { + // Merge into the parent? + if (parent->entry_count == 2) + { + // Merge children into parent. This can only happen at the root. + if (btree_node_is_inner (left_node)) + { + for (unsigned index = 0; index != left_node->entry_count; ++index) + parent->content.children[index] + = left_node->content.children[index]; + for (unsigned index = 0; index != right_node->entry_count; + ++index) + parent->content.children[index + left_node->entry_count] + = right_node->content.children[index]; + } + else + { + parent->type = btree_node_leaf; + for (unsigned index = 0; index != left_node->entry_count; ++index) + parent->content.entries[index] + = left_node->content.entries[index]; + for (unsigned index = 0; index != right_node->entry_count; + ++index) + parent->content.entries[index + left_node->entry_count] + = right_node->content.entries[index]; + } + parent->entry_count = total_count; + btree_release_node (t, left_node); + btree_release_node (t, right_node); + return parent; + } + else + { + // Regular merge. + if (btree_node_is_inner (left_node)) + { + for (unsigned index = 0; index != right_node->entry_count; + ++index) + left_node->content.children[left_node->entry_count++] + = right_node->content.children[index]; + } + else + { + for (unsigned index = 0; index != right_node->entry_count; + ++index) + left_node->content.entries[left_node->entry_count++] + = right_node->content.entries[index]; + } + parent->content.children[left_slot].separator + = parent->content.children[left_slot + 1].separator; + for (unsigned index = left_slot + 1; index + 1 < parent->entry_count; + ++index) + parent->content.children[index] + = parent->content.children[index + 1]; + parent->entry_count--; + btree_release_node (t, right_node); + btree_node_unlock_exclusive (parent); + return left_node; + } + } + + // No merge possible, rebalance instead. + if (left_node->entry_count > right_node->entry_count) + { + // Shift from left to right. + unsigned to_shift + = (left_node->entry_count - right_node->entry_count) / 2; + if (btree_node_is_inner (left_node)) + { + for (unsigned index = 0; index != right_node->entry_count; ++index) + { + unsigned pos = right_node->entry_count - 1 - index; + right_node->content.children[pos + to_shift] + = right_node->content.children[pos]; + } + for (unsigned index = 0; index != to_shift; ++index) + right_node->content.children[index] + = left_node->content + .children[left_node->entry_count - to_shift + index]; + } + else + { + for (unsigned index = 0; index != right_node->entry_count; ++index) + { + unsigned pos = right_node->entry_count - 1 - index; + right_node->content.entries[pos + to_shift] + = right_node->content.entries[pos]; + } + for (unsigned index = 0; index != to_shift; ++index) + right_node->content.entries[index] + = left_node->content + .entries[left_node->entry_count - to_shift + index]; + } + left_node->entry_count -= to_shift; + right_node->entry_count += to_shift; + } + else + { + // Shift from right to left. + unsigned to_shift + = (right_node->entry_count - left_node->entry_count) / 2; + if (btree_node_is_inner (left_node)) + { + for (unsigned index = 0; index != to_shift; ++index) + left_node->content.children[left_node->entry_count + index] + = right_node->content.children[index]; + for (unsigned index = 0; index != right_node->entry_count - to_shift; + ++index) + right_node->content.children[index] + = right_node->content.children[index + to_shift]; + } + else + { + for (unsigned index = 0; index != to_shift; ++index) + left_node->content.entries[left_node->entry_count + index] + = right_node->content.entries[index]; + for (unsigned index = 0; index != right_node->entry_count - to_shift; + ++index) + right_node->content.entries[index] + = right_node->content.entries[index + to_shift]; + } + left_node->entry_count += to_shift; + right_node->entry_count -= to_shift; + } + uintptr_t left_fence; + if (btree_node_is_leaf (left_node)) + { + left_fence = right_node->content.entries[0].base - 1; + } + else + { + left_fence = btree_node_get_fence_key (left_node); + } + parent->content.children[left_slot].separator = left_fence; + btree_node_unlock_exclusive (parent); + if (target <= left_fence) + { + btree_node_unlock_exclusive (right_node); + return left_node; + } + else + { + btree_node_unlock_exclusive (left_node); + return right_node; + } +} + +// Insert an entry. +static bool +btree_insert (struct btree *t, uintptr_t base, uintptr_t size, + struct object *ob) +{ + // Sanity check. + if (!size) + return false; + + // Access the root. + struct btree_node *iter, *parent = NULL; + { + version_lock_lock_exclusive (&(t->root_lock)); + iter = t->root; + if (iter) + { + btree_node_lock_exclusive (iter); + } + else + { + t->root = iter = btree_allocate_node (t, false); + } + version_lock_unlock_exclusive (&(t->root_lock)); + } + + // Walk down the btree with classic lock coupling and eager splits. + // Strictly speaking this is not performance optimal, we could use + // optimistic lock coupling until we hit a node that has to be modified. + // But that is more difficult to implement and frame registration is + // rare anyway, we use simple locking for now. + + uintptr_t fence = max_separator; + while (btree_node_is_inner (iter)) + { + // Use eager splits to avoid lock coupling up. + if (iter->entry_count == max_fanout_inner) + btree_split_inner (t, &iter, &parent, base); + + unsigned slot = btree_node_find_inner_slot (iter, base); + if (parent) + btree_node_unlock_exclusive (parent); + parent = iter; + fence = iter->content.children[slot].separator; + iter = iter->content.children[slot].child; + btree_node_lock_exclusive (iter); + } + + // Make sure we have space. + if (iter->entry_count == max_fanout_leaf) + btree_split_leaf (t, &iter, &parent, fence, base); + if (parent) + btree_node_unlock_exclusive (parent); + + // Insert in node. + unsigned slot = btree_node_find_leaf_slot (iter, base); + if ((slot < iter->entry_count) && (iter->content.entries[slot].base == base)) + { + // Duplicate entry, this should never happen. + btree_node_unlock_exclusive (iter); + return false; + } + for (unsigned index = iter->entry_count; index > slot; --index) + iter->content.entries[index] = iter->content.entries[index - 1]; + struct leaf_entry *e = &(iter->content.entries[slot]); + e->base = base; + e->size = size; + e->ob = ob; + iter->entry_count++; + btree_node_unlock_exclusive (iter); + return true; +} + +// Remove an entry. +static struct object * +btree_remove (struct btree *t, uintptr_t base) +{ + // Access the root. + version_lock_lock_exclusive (&(t->root_lock)); + struct btree_node *iter = t->root; + if (iter) + btree_node_lock_exclusive (iter); + version_lock_unlock_exclusive (&(t->root_lock)); + if (!iter) + return NULL; + + // Same strategy as with insert, walk down with lock coupling and + // merge eagerly. + while (btree_node_is_inner (iter)) + { + unsigned slot = btree_node_find_inner_slot (iter, base); + struct btree_node *next = iter->content.children[slot].child; + btree_node_lock_exclusive (next); + if (btree_node_needs_merge (next)) + { + // Use eager merges to avoid lock coupling up. + iter = btree_merge_node (t, slot, iter, base); + } + else + { + btree_node_unlock_exclusive (iter); + iter = next; + } + } + + // Remove existing entry. + unsigned slot = btree_node_find_leaf_slot (iter, base); + if ((slot >= iter->entry_count) || (iter->content.entries[slot].base != base)) + { + // Not found, this should never happen. + btree_node_unlock_exclusive (iter); + return NULL; + } + struct object *ob = iter->content.entries[slot].ob; + for (unsigned index = slot; index + 1 < iter->entry_count; ++index) + iter->content.entries[index] = iter->content.entries[index + 1]; + iter->entry_count--; + btree_node_unlock_exclusive (iter); + return ob; +} + +// Find the corresponding entry for the given address. +static struct object * +btree_lookup (const struct btree *t, uintptr_t target_addr) +{ + // Within this function many loads are relaxed atomic loads. + // Use a macro to keep the code reasonable. +#define RLOAD(x) __atomic_load_n (&(x), __ATOMIC_RELAXED) + + // For targets where unwind info is usually not registered through these + // APIs anymore, avoid any sequential consistent atomics. + // Use relaxed MO here, it is up to the app to ensure that the library + // loading/initialization happens-before using that library in other + // threads (in particular unwinding with that library's functions + // appearing in the backtraces). Calling that library's functions + // without waiting for the library to initialize would be racy. + if (__builtin_expect (!RLOAD (t->root), 1)) + return NULL; + + // The unwinding tables are mostly static, they only change when + // frames are added or removed. This makes it extremely unlikely that they + // change during a given unwinding sequence. Thus, we optimize for the + // contention free case and use optimistic lock coupling. This does not + // require any writes to shared state, instead we validate every read. It is + // important that we do not trust any value that we have read until we call + // validate again. Data can change at arbitrary points in time, thus we always + // copy something into a local variable and validate again before acting on + // the read. In the unlikely event that we encounter a concurrent change we + // simply restart and try again. + +restart: + struct btree_node *iter; + uintptr_t lock; + { + // Accessing the root node requires defending against concurrent pointer + // changes Thus we couple rootLock -> lock on root node -> validate rootLock + if (!version_lock_lock_optimistic (&(t->root_lock), &lock)) + goto restart; + iter = RLOAD (t->root); + if (!version_lock_validate (&(t->root_lock), lock)) + goto restart; + if (!iter) + return NULL; + uintptr_t child_lock; + if ((!btree_node_lock_optimistic (iter, &child_lock)) + || (!version_lock_validate (&(t->root_lock), lock))) + goto restart; + lock = child_lock; + } + + // Now we can walk down towards the right leaf node. + while (true) + { + enum node_type type = RLOAD (iter->type); + unsigned entry_count = RLOAD (iter->entry_count); + if (!btree_node_validate (iter, lock)) + goto restart; + if (!entry_count) + return NULL; + + if (type == btree_node_inner) + { + // We cannot call find_inner_slot here because we need (relaxed) + // atomic reads here. + unsigned slot = 0; + while ( + ((slot + 1) < entry_count) + && (RLOAD (iter->content.children[slot].separator) < target_addr)) + ++slot; + struct btree_node *child = RLOAD (iter->content.children[slot].child); + if (!btree_node_validate (iter, lock)) + goto restart; + + // The node content can change at any point in time, thus we must + // interleave parent and child checks. + uintptr_t child_lock; + if (!btree_node_lock_optimistic (child, &child_lock)) + goto restart; + if (!btree_node_validate (iter, lock)) + goto restart; // make sure we still point to the correct node after + // acquiring the optimistic lock. + + // Go down + iter = child; + lock = child_lock; + } + else + { + // We cannot call find_leaf_slot here because we need (relaxed) + // atomic reads here. + unsigned slot = 0; + while (((slot + 1) < entry_count) + && (RLOAD (iter->content.entries[slot].base) + + RLOAD (iter->content.entries[slot].size) + <= target_addr)) + ++slot; + struct leaf_entry entry; + entry.base = RLOAD (iter->content.entries[slot].base); + entry.size = RLOAD (iter->content.entries[slot].size); + entry.ob = RLOAD (iter->content.entries[slot].ob); + if (!btree_node_validate (iter, lock)) + goto restart; + + // Check if we have a hit. + if ((entry.base <= target_addr) + && (target_addr < entry.base + entry.size)) + { + return entry.ob; + } + return NULL; + } + } +#undef RLOAD +} + +#endif /* unwind-dw2-btree.h */ diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c index 8ee55be..000ee69 100644 --- a/libgcc/unwind-dw2-fde.c +++ b/libgcc/unwind-dw2-fde.c @@ -42,15 +42,34 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #endif +#ifdef ATOMIC_FDE_FAST_PATH +#include "unwind-dw2-btree.h" + +static struct btree registered_frames; + +static void +release_registered_frames (void) __attribute__ ((destructor (110))); +static void +release_registered_frames (void) +{ + /* Release the b-tree and all frames. Frame releases that happen later are + * silently ignored */ + btree_destroy (®istered_frames); +} + +static void +get_pc_range (const struct object *ob, uintptr_t *range); +static void +init_object (struct object *ob); + +#else + /* The unseen_objects list contains objects that have been registered but not yet categorized in any way. The seen_objects list has had its pc_begin and count fields initialized at minimum, and is sorted by decreasing value of pc_begin. */ static struct object *unseen_objects; static struct object *seen_objects; -#ifdef ATOMIC_FDE_FAST_PATH -static int any_objects_registered; -#endif #ifdef __GTHREAD_MUTEX_INIT static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT; @@ -78,6 +97,7 @@ init_object_mutex_once (void) static __gthread_mutex_t object_mutex; #endif #endif +#endif /* Called from crtbegin.o to register the unwind info for an object. */ @@ -99,23 +119,23 @@ __register_frame_info_bases (const void *begin, struct object *ob, ob->fde_end = NULL; #endif +#ifdef ATOMIC_FDE_FAST_PATH + // Initialize eagerly to avoid locking later + init_object (ob); + + // And register the frame + uintptr_t range[2]; + get_pc_range (ob, range); + btree_insert (®istered_frames, range[0], range[1] - range[0], ob); +#else init_object_mutex_once (); __gthread_mutex_lock (&object_mutex); ob->next = unseen_objects; unseen_objects = ob; -#ifdef ATOMIC_FDE_FAST_PATH - /* Set flag that at least one library has registered FDEs. - Use relaxed MO here, it is up to the app to ensure that the library - loading/initialization happens-before using that library in other - threads (in particular unwinding with that library's functions - appearing in the backtraces). Calling that library's functions - without waiting for the library to initialize would be racy. */ - if (!any_objects_registered) - __atomic_store_n (&any_objects_registered, 1, __ATOMIC_RELAXED); -#endif __gthread_mutex_unlock (&object_mutex); +#endif } void @@ -153,23 +173,23 @@ __register_frame_info_table_bases (void *begin, struct object *ob, ob->s.b.from_array = 1; ob->s.b.encoding = DW_EH_PE_omit; +#ifdef ATOMIC_FDE_FAST_PATH + // Initialize eagerly to avoid locking later + init_object (ob); + + // And register the frame + uintptr_t range[2]; + get_pc_range (ob, range); + btree_insert (®istered_frames, range[0], range[1] - range[0], ob); +#else init_object_mutex_once (); __gthread_mutex_lock (&object_mutex); ob->next = unseen_objects; unseen_objects = ob; -#ifdef ATOMIC_FDE_FAST_PATH - /* Set flag that at least one library has registered FDEs. - Use relaxed MO here, it is up to the app to ensure that the library - loading/initialization happens-before using that library in other - threads (in particular unwinding with that library's functions - appearing in the backtraces). Calling that library's functions - without waiting for the library to initialize would be racy. */ - if (!any_objects_registered) - __atomic_store_n (&any_objects_registered, 1, __ATOMIC_RELAXED); -#endif __gthread_mutex_unlock (&object_mutex); +#endif } void @@ -200,16 +220,33 @@ __register_frame_table (void *begin) void * __deregister_frame_info_bases (const void *begin) { - struct object **p; struct object *ob = 0; /* If .eh_frame is empty, we haven't registered. */ if ((const uword *) begin == 0 || *(const uword *) begin == 0) return ob; +#ifdef ATOMIC_FDE_FAST_PATH + // Find the corresponding PC range + struct object lookupob; + lookupob.tbase = 0; + lookupob.dbase = 0; + lookupob.u.single = begin; + lookupob.s.i = 0; + lookupob.s.b.encoding = DW_EH_PE_omit; +#ifdef DWARF2_OBJECT_END_PTR_EXTENSION + lookupob.fde_end = NULL; +#endif + uintptr_t range[2]; + get_pc_range (&lookupob, range); + + // And remove + ob = btree_remove (®istered_frames, range[0]); +#else init_object_mutex_once (); __gthread_mutex_lock (&object_mutex); + struct object **p; for (p = &unseen_objects; *p ; p = &(*p)->next) if ((*p)->u.single == begin) { @@ -241,6 +278,8 @@ __deregister_frame_info_bases (const void *begin) out: __gthread_mutex_unlock (&object_mutex); +#endif + gcc_assert (ob); return (void *) ob; } @@ -264,7 +303,7 @@ __deregister_frame (void *begin) instead of an _Unwind_Context. */ static _Unwind_Ptr -base_from_object (unsigned char encoding, struct object *ob) +base_from_object (unsigned char encoding, const struct object *ob) { if (encoding == DW_EH_PE_omit) return 0; @@ -628,13 +667,17 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count) } } - -/* Update encoding, mixed_encoding, and pc_begin for OB for the - fde array beginning at THIS_FDE. Return the number of fdes - encountered along the way. */ +/* Inspect the fde array beginning at this_fde. This + function can be used either in query mode (RANGE is + not null, OB is const), or in update mode (RANGE is + null, OB is modified). In query mode the function computes + the range of PC values and stores it in RANGE. In + update mode it updates encoding, mixed_encoding, and pc_begin + for OB. Return the number of fdes encountered along the way. */ static size_t -classify_object_over_fdes (struct object *ob, const fde *this_fde) +classify_object_over_fdes (struct object *ob, const fde *this_fde, + uintptr_t *range) { const struct dwarf_cie *last_cie = 0; size_t count = 0; @@ -660,14 +703,18 @@ classify_object_over_fdes (struct object *ob, const fde *this_fde) if (encoding == DW_EH_PE_omit) return -1; base = base_from_object (encoding, ob); - if (ob->s.b.encoding == DW_EH_PE_omit) - ob->s.b.encoding = encoding; - else if (ob->s.b.encoding != encoding) - ob->s.b.mixed_encoding = 1; + if (!range) + { + if (ob->s.b.encoding == DW_EH_PE_omit) + ob->s.b.encoding = encoding; + else if (ob->s.b.encoding != encoding) + ob->s.b.mixed_encoding = 1; + } } - read_encoded_value_with_base (encoding, base, this_fde->pc_begin, - &pc_begin); + const unsigned char *p; + p = read_encoded_value_with_base (encoding, base, this_fde->pc_begin, + &pc_begin); /* Take care to ignore link-once functions that were removed. In these cases, the function address will be NULL, but if @@ -683,8 +730,29 @@ classify_object_over_fdes (struct object *ob, const fde *this_fde) continue; count += 1; - if ((void *) pc_begin < ob->pc_begin) - ob->pc_begin = (void *) pc_begin; + if (range) + { + _Unwind_Ptr pc_range, pc_end; + read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range); + pc_end = pc_begin + pc_range; + if ((!range[0]) && (!range[1])) + { + range[0] = pc_begin; + range[1] = pc_end; + } + else + { + if (pc_begin < range[0]) + range[0] = pc_begin; + if (pc_end > range[1]) + range[1] = pc_end; + } + } + else + { + if ((void *) pc_begin < ob->pc_begin) + ob->pc_begin = (void *) pc_begin; + } } return count; @@ -769,7 +837,7 @@ init_object (struct object* ob) fde **p = ob->u.array; for (count = 0; *p; ++p) { - size_t cur_count = classify_object_over_fdes (ob, *p); + size_t cur_count = classify_object_over_fdes (ob, *p, NULL); if (cur_count == (size_t) -1) goto unhandled_fdes; count += cur_count; @@ -777,7 +845,7 @@ init_object (struct object* ob) } else { - count = classify_object_over_fdes (ob, ob->u.single); + count = classify_object_over_fdes (ob, ob->u.single, NULL); if (count == (size_t) -1) { static const fde terminator; @@ -821,6 +889,32 @@ init_object (struct object* ob) ob->s.b.sorted = 1; } +#ifdef ATOMIC_FDE_FAST_PATH +/* Get the PC range for lookup */ +static void +get_pc_range (const struct object *ob, uintptr_t *range) +{ + // It is safe to cast to non-const object* here as + // classify_object_over_fdes does not modify ob in query mode. + struct object *ncob = (struct object *) (uintptr_t) ob; + range[0] = range[1] = 0; + if (ob->s.b.sorted) + { + classify_object_over_fdes (ncob, ob->u.sort->orig_data, range); + } + else if (ob->s.b.from_array) + { + fde **p = ob->u.array; + for (; *p; ++p) + classify_object_over_fdes (ncob, *p, range); + } + else + { + classify_object_over_fdes (ncob, ob->u.single, range); + } +} +#endif + /* A linear search through a set of FDEs for the given PC. This is used when there was insufficient memory to allocate and sort an array. */ @@ -985,6 +1079,9 @@ binary_search_mixed_encoding_fdes (struct object *ob, void *pc) static const fde * search_object (struct object* ob, void *pc) { + /* The fast path initializes objects eagerly to avoid locking. + * On the slow path we initialize them now */ +#ifndef ATOMIC_FDE_FAST_PATH /* If the data hasn't been sorted, try to do this now. We may have more memory available than last time we tried. */ if (! ob->s.b.sorted) @@ -997,6 +1094,7 @@ search_object (struct object* ob, void *pc) if (pc < ob->pc_begin) return NULL; } +#endif if (ob->s.b.sorted) { @@ -1033,17 +1131,12 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases) const fde *f = NULL; #ifdef ATOMIC_FDE_FAST_PATH - /* For targets where unwind info is usually not registered through these - APIs anymore, avoid taking a global lock. - Use relaxed MO here, it is up to the app to ensure that the library - loading/initialization happens-before using that library in other - threads (in particular unwinding with that library's functions - appearing in the backtraces). Calling that library's functions - without waiting for the library to initialize would be racy. */ - if (__builtin_expect (!__atomic_load_n (&any_objects_registered, - __ATOMIC_RELAXED), 1)) + ob = btree_lookup (®istered_frames, (uintptr_t) pc); + if (!ob) return NULL; -#endif + + f = search_object (ob, pc); +#else init_object_mutex_once (); __gthread_mutex_lock (&object_mutex); @@ -1081,6 +1174,7 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases) fini: __gthread_mutex_unlock (&object_mutex); +#endif if (f) { diff --git a/libgcc/unwind-dw2-fde.h b/libgcc/unwind-dw2-fde.h index 8a011c3..77c2caa 100644 --- a/libgcc/unwind-dw2-fde.h +++ b/libgcc/unwind-dw2-fde.h @@ -166,7 +166,7 @@ next_fde (const fde *f) extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *); static inline int -last_fde (struct object *obj __attribute__ ((__unused__)), const fde *f) +last_fde (const struct object *obj __attribute__ ((__unused__)), const fde *f) { #ifdef DWARF2_OBJECT_END_PTR_EXTENSION return f == (const fde *) obj->fde_end || f->length == 0; -- cgit v1.1 From 7ee0fa100f0f28d7b88237d520131e07b7b49f0a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 17 Sep 2022 00:17:20 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index e0deb15..d07fc9c 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,15 @@ +2022-09-16 Thomas Neumann + + * unwind-dw2-fde.c (release_registered_frames): Cleanup at shutdown. + (__register_frame_info_table_bases): Use btree in atomic fast path. + (__deregister_frame_info_bases): Likewise. + (_Unwind_Find_FDE): Likewise. + (base_from_object): Make parameter const. + (classify_object_over_fdes): Add query-only mode. + (get_pc_range): Compute PC range for lookup. + * unwind-dw2-fde.h (last_fde): Make parameter const. + * unwind-dw2-btree.h: New file. + 2022-08-31 Martin Liska * config.host: Remove hppa. -- cgit v1.1 From d458f806afe07d1e06bdf275e94d05a716f41bf6 Mon Sep 17 00:00:00 2001 From: Thomas Neumann Date: Sun, 18 Sep 2022 11:31:01 +0200 Subject: Remove dependency on uintptr_t in libgcc uintptr_t is no available for all targets, use __UINTPTR_TYPE__ instead. libgcc/ChangeLog: * unwind-dw2-fde.c: Replace uintptr_t with typedef for __UINTPTR_TYPE__. * unwind-dw2-btree.h: Likewise. --- libgcc/unwind-dw2-btree.h | 69 ++++++++++++++++++++++++----------------------- libgcc/unwind-dw2-fde.c | 18 +++++++------ 2 files changed, 45 insertions(+), 42 deletions(-) (limited to 'libgcc') diff --git a/libgcc/unwind-dw2-btree.h b/libgcc/unwind-dw2-btree.h index 8853f0e..ace507d 100644 --- a/libgcc/unwind-dw2-btree.h +++ b/libgcc/unwind-dw2-btree.h @@ -39,7 +39,7 @@ struct version_lock // range. Even on 32 bit platforms that would require 1 billion // frame registrations within the time span of a few assembler // instructions. - uintptr_t version_lock; + uintptr_type version_lock; }; #ifdef __GTHREAD_HAS_COND @@ -60,7 +60,7 @@ version_lock_initialize_locked_exclusive (struct version_lock *vl) static inline bool version_lock_try_lock_exclusive (struct version_lock *vl) { - uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_type state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); if (state & 1) return false; return __atomic_compare_exchange_n (&(vl->version_lock), &state, state | 1, @@ -78,7 +78,7 @@ restart: // We should virtually never get contention here, as frame // changes are rare. - uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_type state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); if (!(state & 1)) { if (__atomic_compare_exchange_n (&(vl->version_lock), &state, state | 1, @@ -134,8 +134,8 @@ static void version_lock_unlock_exclusive (struct version_lock *vl) { // increase version, reset exclusive lock bits - uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); - uintptr_t ns = (state + 4) & (~((uintptr_t) 3)); + uintptr_type state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_type ns = (state + 4) & (~((uintptr_type) 3)); state = __atomic_exchange_n (&(vl->version_lock), ns, __ATOMIC_SEQ_CST); #ifdef __GTHREAD_HAS_COND @@ -152,9 +152,9 @@ version_lock_unlock_exclusive (struct version_lock *vl) // Acquire an optimistic "lock". Note that this does not lock at all, it // only allows for validation later. static inline bool -version_lock_lock_optimistic (const struct version_lock *vl, uintptr_t *lock) +version_lock_lock_optimistic (const struct version_lock *vl, uintptr_type *lock) { - uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_type state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); *lock = state; // Acquiring the lock fails when there is currently an exclusive lock. @@ -163,7 +163,7 @@ version_lock_lock_optimistic (const struct version_lock *vl, uintptr_t *lock) // Validate a previously acquired "lock". static inline bool -version_lock_validate (const struct version_lock *vl, uintptr_t lock) +version_lock_validate (const struct version_lock *vl, uintptr_type lock) { // Prevent the reordering of non-atomic loads behind the atomic load. // Hans Boehm, Can Seqlocks Get Along with Programming Language Memory @@ -171,26 +171,26 @@ version_lock_validate (const struct version_lock *vl, uintptr_t lock) __atomic_thread_fence (__ATOMIC_ACQUIRE); // Check that the node is still in the same state. - uintptr_t state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); + uintptr_type state = __atomic_load_n (&(vl->version_lock), __ATOMIC_SEQ_CST); return (state == lock); } // The largest possible separator value. -static const uintptr_t max_separator = ~((uintptr_t) (0)); +static const uintptr_type max_separator = ~((uintptr_type) (0)); struct btree_node; // Inner entry. The child tree contains all entries <= separator. struct inner_entry { - uintptr_t separator; + uintptr_type separator; struct btree_node *child; }; // Leaf entry. Stores an object entry. struct leaf_entry { - uintptr_t base, size; + uintptr_type base, size; struct object *ob; }; @@ -248,7 +248,7 @@ btree_node_needs_merge (const struct btree_node *n) } // Get the fence key for inner nodes. -static inline uintptr_t +static inline uintptr_type btree_node_get_fence_key (const struct btree_node *n) { // For inner nodes we just return our right-most entry. @@ -257,7 +257,7 @@ btree_node_get_fence_key (const struct btree_node *n) // Find the position for a slot in an inner node. static unsigned -btree_node_find_inner_slot (const struct btree_node *n, uintptr_t value) +btree_node_find_inner_slot (const struct btree_node *n, uintptr_type value) { for (unsigned index = 0, ec = n->entry_count; index != ec; ++index) if (n->content.children[index].separator >= value) @@ -267,7 +267,7 @@ btree_node_find_inner_slot (const struct btree_node *n, uintptr_t value) // Find the position for a slot in a leaf node. static unsigned -btree_node_find_leaf_slot (const struct btree_node *n, uintptr_t value) +btree_node_find_leaf_slot (const struct btree_node *n, uintptr_type value) { for (unsigned index = 0, ec = n->entry_count; index != ec; ++index) if (n->content.entries[index].base + n->content.entries[index].size > value) @@ -299,14 +299,14 @@ btree_node_unlock_exclusive (struct btree_node *n) // Acquire an optimistic "lock". Note that this does not lock at all, it // only allows for validation later. static inline bool -btree_node_lock_optimistic (const struct btree_node *n, uintptr_t *lock) +btree_node_lock_optimistic (const struct btree_node *n, uintptr_type *lock) { return version_lock_lock_optimistic (&(n->version_lock), lock); } // Validate a previously acquire lock. static inline bool -btree_node_validate (const struct btree_node *n, uintptr_t lock) +btree_node_validate (const struct btree_node *n, uintptr_type lock) { return version_lock_validate (&(n->version_lock), lock); } @@ -314,8 +314,8 @@ btree_node_validate (const struct btree_node *n, uintptr_t lock) // Insert a new separator after splitting. static void btree_node_update_separator_after_split (struct btree_node *n, - uintptr_t old_separator, - uintptr_t new_separator, + uintptr_type old_separator, + uintptr_type new_separator, struct btree_node *new_right) { unsigned slot = btree_node_find_inner_slot (n, old_separator); @@ -474,13 +474,13 @@ btree_handle_root_split (struct btree *t, struct btree_node **node, // Split an inner node. static void btree_split_inner (struct btree *t, struct btree_node **inner, - struct btree_node **parent, uintptr_t target) + struct btree_node **parent, uintptr_type target) { // Check for the root. btree_handle_root_split (t, inner, parent); // Create two inner node. - uintptr_t right_fence = btree_node_get_fence_key (*inner); + uintptr_type right_fence = btree_node_get_fence_key (*inner); struct btree_node *left_inner = *inner; struct btree_node *right_inner = btree_allocate_node (t, true); unsigned split = left_inner->entry_count / 2; @@ -489,7 +489,7 @@ btree_split_inner (struct btree *t, struct btree_node **inner, right_inner->content.children[index] = left_inner->content.children[split + index]; left_inner->entry_count = split; - uintptr_t left_fence = btree_node_get_fence_key (left_inner); + uintptr_type left_fence = btree_node_get_fence_key (left_inner); btree_node_update_separator_after_split (*parent, right_fence, left_fence, right_inner); if (target <= left_fence) @@ -507,13 +507,14 @@ btree_split_inner (struct btree *t, struct btree_node **inner, // Split a leaf node. static void btree_split_leaf (struct btree *t, struct btree_node **leaf, - struct btree_node **parent, uintptr_t fence, uintptr_t target) + struct btree_node **parent, uintptr_type fence, + uintptr_type target) { // Check for the root. btree_handle_root_split (t, leaf, parent); // Create two leaf nodes. - uintptr_t right_fence = fence; + uintptr_type right_fence = fence; struct btree_node *left_leaf = *leaf; struct btree_node *right_leaf = btree_allocate_node (t, false); unsigned split = left_leaf->entry_count / 2; @@ -522,7 +523,7 @@ btree_split_leaf (struct btree *t, struct btree_node **leaf, right_leaf->content.entries[index] = left_leaf->content.entries[split + index]; left_leaf->entry_count = split; - uintptr_t left_fence = right_leaf->content.entries[0].base - 1; + uintptr_type left_fence = right_leaf->content.entries[0].base - 1; btree_node_update_separator_after_split (*parent, right_fence, left_fence, right_leaf); if (target <= left_fence) @@ -540,7 +541,7 @@ btree_split_leaf (struct btree *t, struct btree_node **leaf, // Merge (or balance) child nodes. static struct btree_node * btree_merge_node (struct btree *t, unsigned child_slot, - struct btree_node *parent, uintptr_t target) + struct btree_node *parent, uintptr_type target) { // Choose the emptiest neighbor and lock both. The target child is already // locked. @@ -693,7 +694,7 @@ btree_merge_node (struct btree *t, unsigned child_slot, left_node->entry_count += to_shift; right_node->entry_count -= to_shift; } - uintptr_t left_fence; + uintptr_type left_fence; if (btree_node_is_leaf (left_node)) { left_fence = right_node->content.entries[0].base - 1; @@ -718,7 +719,7 @@ btree_merge_node (struct btree *t, unsigned child_slot, // Insert an entry. static bool -btree_insert (struct btree *t, uintptr_t base, uintptr_t size, +btree_insert (struct btree *t, uintptr_type base, uintptr_type size, struct object *ob) { // Sanity check. @@ -747,7 +748,7 @@ btree_insert (struct btree *t, uintptr_t base, uintptr_t size, // But that is more difficult to implement and frame registration is // rare anyway, we use simple locking for now. - uintptr_t fence = max_separator; + uintptr_type fence = max_separator; while (btree_node_is_inner (iter)) { // Use eager splits to avoid lock coupling up. @@ -790,7 +791,7 @@ btree_insert (struct btree *t, uintptr_t base, uintptr_t size, // Remove an entry. static struct object * -btree_remove (struct btree *t, uintptr_t base) +btree_remove (struct btree *t, uintptr_type base) { // Access the root. version_lock_lock_exclusive (&(t->root_lock)); @@ -838,7 +839,7 @@ btree_remove (struct btree *t, uintptr_t base) // Find the corresponding entry for the given address. static struct object * -btree_lookup (const struct btree *t, uintptr_t target_addr) +btree_lookup (const struct btree *t, uintptr_type target_addr) { // Within this function many loads are relaxed atomic loads. // Use a macro to keep the code reasonable. @@ -867,7 +868,7 @@ btree_lookup (const struct btree *t, uintptr_t target_addr) restart: struct btree_node *iter; - uintptr_t lock; + uintptr_type lock; { // Accessing the root node requires defending against concurrent pointer // changes Thus we couple rootLock -> lock on root node -> validate rootLock @@ -878,7 +879,7 @@ restart: goto restart; if (!iter) return NULL; - uintptr_t child_lock; + uintptr_type child_lock; if ((!btree_node_lock_optimistic (iter, &child_lock)) || (!version_lock_validate (&(t->root_lock), lock))) goto restart; @@ -910,7 +911,7 @@ restart: // The node content can change at any point in time, thus we must // interleave parent and child checks. - uintptr_t child_lock; + uintptr_type child_lock; if (!btree_node_lock_optimistic (child, &child_lock)) goto restart; if (!btree_node_validate (iter, lock)) diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c index 000ee69..919abfe 100644 --- a/libgcc/unwind-dw2-fde.c +++ b/libgcc/unwind-dw2-fde.c @@ -42,6 +42,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #endif +typedef __UINTPTR_TYPE__ uintptr_type; + #ifdef ATOMIC_FDE_FAST_PATH #include "unwind-dw2-btree.h" @@ -58,7 +60,7 @@ release_registered_frames (void) } static void -get_pc_range (const struct object *ob, uintptr_t *range); +get_pc_range (const struct object *ob, uintptr_type *range); static void init_object (struct object *ob); @@ -124,7 +126,7 @@ __register_frame_info_bases (const void *begin, struct object *ob, init_object (ob); // And register the frame - uintptr_t range[2]; + uintptr_type range[2]; get_pc_range (ob, range); btree_insert (®istered_frames, range[0], range[1] - range[0], ob); #else @@ -178,7 +180,7 @@ __register_frame_info_table_bases (void *begin, struct object *ob, init_object (ob); // And register the frame - uintptr_t range[2]; + uintptr_type range[2]; get_pc_range (ob, range); btree_insert (®istered_frames, range[0], range[1] - range[0], ob); #else @@ -237,7 +239,7 @@ __deregister_frame_info_bases (const void *begin) #ifdef DWARF2_OBJECT_END_PTR_EXTENSION lookupob.fde_end = NULL; #endif - uintptr_t range[2]; + uintptr_type range[2]; get_pc_range (&lookupob, range); // And remove @@ -677,7 +679,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count) static size_t classify_object_over_fdes (struct object *ob, const fde *this_fde, - uintptr_t *range) + uintptr_type *range) { const struct dwarf_cie *last_cie = 0; size_t count = 0; @@ -892,11 +894,11 @@ init_object (struct object* ob) #ifdef ATOMIC_FDE_FAST_PATH /* Get the PC range for lookup */ static void -get_pc_range (const struct object *ob, uintptr_t *range) +get_pc_range (const struct object *ob, uintptr_type *range) { // It is safe to cast to non-const object* here as // classify_object_over_fdes does not modify ob in query mode. - struct object *ncob = (struct object *) (uintptr_t) ob; + struct object *ncob = (struct object *) (uintptr_type) ob; range[0] = range[1] = 0; if (ob->s.b.sorted) { @@ -1131,7 +1133,7 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases) const fde *f = NULL; #ifdef ATOMIC_FDE_FAST_PATH - ob = btree_lookup (®istered_frames, (uintptr_t) pc); + ob = btree_lookup (®istered_frames, (uintptr_type) pc); if (!ob) return NULL; -- cgit v1.1 From 0990a778376b63b789a8ff5aa949325ba375c025 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 19 Sep 2022 00:17:27 +0000 Subject: Daily bump. --- libgcc/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index d07fc9c..7c434c9 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2022-09-18 Thomas Neumann + + * unwind-dw2-fde.c: Replace uintptr_t with typedef + for __UINTPTR_TYPE__. + * unwind-dw2-btree.h: Likewise. + 2022-09-16 Thomas Neumann * unwind-dw2-fde.c (release_registered_frames): Cleanup at shutdown. -- cgit v1.1 From 0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Mon, 19 Sep 2022 09:46:58 +0200 Subject: Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints this patch fixed PR target/99184 which incorrectly rounded during 64-bit (long) double to 16-bit and 32-bit integers. The patch just removes the respective roundings from libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere use respective functions internally, the only user is in libf7.c::f7_exp which reads f7_round (qq, qq); int16_t q = f7_get_s16 (qq); so that f7_get_s16() operates on an already rounded value, and therefore this code works unaltered with or without rounding in to_integer. PR target/99184 libgcc/config/avr/libf7/ * libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit and 32-bit integers. --- libgcc/config/avr/libf7/libf7-asm.sx | 50 ------------------------------------ 1 file changed, 50 deletions(-) (limited to 'libgcc') diff --git a/libgcc/config/avr/libf7/libf7-asm.sx b/libgcc/config/avr/libf7/libf7-asm.sx index cfdbecd..752a939 100644 --- a/libgcc/config/avr/libf7/libf7-asm.sx +++ b/libgcc/config/avr/libf7/libf7-asm.sx @@ -601,9 +601,6 @@ DEFUN to_integer tst C6 brmi .Lsaturate.T ; > INTxx_MAX => saturate - rcall .Lround - brmi .Lsaturate.T ; > INTxx_MAX => saturate - brtc 9f ; >= 0 => return sbrc Mask, 5 .global __negdi2 @@ -658,30 +655,6 @@ DEFUN to_integer .global __clr_8 XJMP __clr_8 -.Lround: - ;; C6.7 is known to be 0 here. - ;; Return N = 1 iff we have to saturate. - cpi Mask, 0xf - breq .Lround16 - cpi Mask, 0x1f - breq .Lround32 - - ;; For now, no rounding in the 64-bit case. This rounding - ;; would have to be integrated into the right-shift. - cln - ret - -.Lround32: - rol C2 - adc C3, ZERO - adc C4, ZERO - rjmp 2f - -.Lround16: - rol C4 -2: adc C5, ZERO - adc C6, ZERO - ret ENDF to_integer #endif /* F7MOD_to_integer_ */ @@ -725,29 +698,6 @@ DEFUN to_unsigned clr CA F7call lshrdi3 POP r16 - - ;; Rounding - ;; ??? C6.7 is known to be 0 here. - cpi Mask, 0xf - breq .Lround16 - cpi Mask, 0x1f - breq .Lround32 - - ;; For now, no rounding in the 64-bit case. This rounding - ;; would have to be integrated into the right-shift. - ret - -.Lround32: - rol C2 - adc C3, ZERO - adc C4, ZERO - rjmp 2f - -.Lround16: - rol C4 -2: adc C5, ZERO - adc C6, ZERO - brcs .Lset_0xffff ; Rounding overflow => saturate ret .Lset_0xffff: -- cgit v1.1 From 43be56c4c6fb6b7f059df832eefb1cd049ff02de Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 20 Sep 2022 00:17:49 +0000 Subject: Daily bump. --- libgcc/config/avr/libf7/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libgcc') diff --git a/libgcc/config/avr/libf7/ChangeLog b/libgcc/config/avr/libf7/ChangeLog index d24215e..026dafd 100644 --- a/libgcc/config/avr/libf7/ChangeLog +++ b/libgcc/config/avr/libf7/ChangeLog @@ -1,3 +1,9 @@ +2022-09-19 Georg-Johann Lay + + PR target/99184 + * libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit + and 32-bit integers. + 2020-06-23 David Edelsohn * t-libf7: Use -include. -- cgit v1.1