diff --git a/.gitignore b/.gitignore index 0efc72e..a02dee0 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,8 @@ /gcc-12.1.1-20220628.tar.xz /gcc-12.1.1-20220810.tar.xz /gcc-12.2.1-20220819.tar.xz +/gcc-12.2.1-20221103.tar.xz +/isl-0.24.tar.bz2 +/newlib-cygwin-a8526cb52bedabd4d6ba4b227a5185627f871aa1.tar.xz +/nvptx-tools-472b6e78b3ba918d727698f79911360b7c808247.tar.xz +/gcc-12.2.1-20221121.tar.xz diff --git a/gcc.spec b/gcc.spec index c663713..4babd01 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,12 +1,12 @@ -%global DATE 20220819 -%global gitrev 12a206c28987ada47b447ebd200d1fd9639c8edd +%global DATE 20221121 +%global gitrev b3f5a0d53b84ed27cf00cfa2b9c3e2c78935c07d %global gcc_version 12.2.1 %global gcc_major 12 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 1 -%global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e -%global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0 +%global gcc_release 4 +%global nvptx_tools_gitrev 472b6e78b3ba918d727698f79911360b7c808247 +%global newlib_cygwin_gitrev a8526cb52bedabd4d6ba4b227a5185627f871aa1 %global _unpackaged_files_terminate_build 0 %global _performance_build 1 # Hardening slows the compiler way too much. @@ -46,7 +46,7 @@ %else %global build_go 0 %endif -%ifarch %{ix86} x86_64 %{arm} %{mips} s390 s390x riscv64 +%ifarch %{ix86} x86_64 %{arm} aarch64 %{mips} s390 s390x riscv64 %global build_d 1 %else %global build_d 0 @@ -151,7 +151,7 @@ Source1: nvptx-tools-%{nvptx_tools_gitrev}.tar.xz # git --git-dir=newlib-cygwin-dir.tmp/.git archive --prefix=newlib-cygwin-%%{newlib_cygwin_gitrev}/ %%{newlib_cygwin_gitrev} ":(exclude)newlib/libc/sys/linux/include/rpc/*.[hx]" | xz -9e > newlib-cygwin-%%{newlib_cygwin_gitrev}.tar.xz # rm -rf newlib-cygwin-dir.tmp Source2: newlib-cygwin-%{newlib_cygwin_gitrev}.tar.xz -%global isl_version 0.18 +%global isl_version 0.24 Source3: https://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2 URL: http://gcc.gnu.org # Need binutils with -pie support >= 2.14.90.0.4-4 @@ -275,8 +275,7 @@ Patch8: gcc12-no-add-needed.patch Patch9: gcc12-Wno-format-security.patch Patch10: gcc12-rh1574936.patch Patch11: gcc12-d-shared-libphobos.patch -Patch12: gcc12-p2327r1.patch -Patch13: gcc12-pr106590.patch +Patch12: gcc12-pr107468.patch Patch100: gcc12-fortran-fdec-duplicates.patch Patch101: gcc12-fortran-flogical-as-integer.patch @@ -804,8 +803,7 @@ so that there cannot be any synchronization problems. %patch10 -p0 -b .rh1574936~ %endif %patch11 -p0 -b .d-shared-libphobos~ -%patch12 -p0 -b .p2327r1~ -%patch13 -p0 -b .pr106590~ +%patch12 -p0 -b .pr107468~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -932,7 +930,7 @@ cp -f -v /usr/lib/rpm/redhat/config.guess ../../isl-%{isl_version}/config.guess cp -f -v /usr/lib/rpm/redhat/config.sub ../../isl-%{isl_version}/config.sub %endif -sed -i 's|libisl|libgcc12privateisl|g' \ +sed -i 's|libisl\([^-]\)|libgcc12privateisl\1|g' \ ../../isl-%{isl_version}/Makefile.{am,in} ../../isl-%{isl_version}/configure \ CC=/usr/bin/gcc CXX=/usr/bin/g++ \ @@ -940,9 +938,9 @@ sed -i 's|libisl|libgcc12privateisl|g' \ make %{?_smp_mflags} make install cd ../isl-install/lib -rm libgcc12privateisl.so{,.15} -mv libgcc12privateisl.so.15.3.0 libisl.so.15 -ln -sf libisl.so.15 libisl.so +rm libgcc12privateisl.so{,.23} +mv libgcc12privateisl.so.23.1.0 libisl.so.23 +ln -sf libisl.so.23 libisl.so cd ../.. %endif @@ -1151,7 +1149,7 @@ make jit.sphinx.install-html jit_htmldir=`pwd`/../../rpm.doc/libgccjit-devel/htm cd .. %if %{build_isl} -cp -a isl-install/lib/libisl.so.15 gcc/ +cp -a isl-install/lib/libisl.so.23 gcc/ %endif # Make generated man pages even if Pod::Man is not new enough @@ -1301,7 +1299,7 @@ FULLPATH=%{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major} FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major} %if %{build_isl} -cp -a isl-install/lib/libisl.so.15 $FULLPATH/ +cp -a isl-install/lib/libisl.so.23 $FULLPATH/ %endif # fix some things @@ -3224,20 +3222,58 @@ end %endif %changelog -* Fri Sep 02 2022 David Abdurachmanov 12.2.1-1.1.riscv64 +* Fri Jan 06 2022 David Abdurachmanov 12.2.1-4.1.riscv64 - Update config.{sub,guess} scripts for ISL - Fix annobin plugin Fedora version check +* Mon Nov 21 2022 Jakub Jelinek 12.2.1-4 +- update from releases/gcc-12 branch + - PRs c++/104066, c++/105774, c++/106829, c++/107358, c/41041, c/106981, + c/107001, libstdc++/95048, libstdc++/103295, target/104688, + target/107183, target/107304, target/107404, target/107713, + target/107748, tree-optimization/107121, tree-optimization/107206 +- fix up std::from_chars behavior in rounding modes other than FE_TONEAREST + (PR libstdc++/107468) + +* Thu Nov 3 2022 Jakub Jelinek 12.2.1-3 +- update from releases/gcc-12 branch + - PRs c++/93259, c++/105774, c++/106759, c++/106829, c++/106893, c++/106925, + c++/107358, c/106947, c/106981, c/107001, fortran/82868, + fortran/100029, fortran/100040, fortran/100097, fortran/100098, + fortran/100103, fortran/100132, fortran/100136, fortran/100245, + fortran/103413, fortran/103694, fortran/105012, fortran/105633, + fortran/106566, fortran/106579, fortran/106817, fortran/106857, + fortran/106985, fortran/106986, fortran/107054, libstdc++/105678, + libstdc++/106320, libstdc++/106589, libstdc++/106607, + libstdc++/106695, lto/107418, middle-end/106548, middle-end/106982, + other/106782, rtl-optimization/106187, target/96072, target/99184, + target/99685, target/100645, target/101322, target/103353, + target/104482, target/105421, target/105463, target/105485, + target/106017, target/106355, target/106459, target/106491, + target/106524, target/106704, target/106714, target/106721, + target/107061, target/107064, target/107248, target/107364, + tree-optimization/102892, tree-optimization/105937, + tree-optimization/106322, tree-optimization/106809, + tree-optimization/106841, tree-optimization/106860, + tree-optimization/106892, tree-optimization/106922, + tree-optimization/106934, tree-optimization/107107, + tree-optimization/107121, tree-optimization/107160, + tree-optimization/107212, tree-optimization/107254, + tree-optimization/107323 + +* Wed Sep 7 2022 Kalev Lember 12.2.1-2 +- enable GDC on aarch64 + * Fri Aug 19 2022 Jakub Jelinek 12.2.1-1 - update from releases/gcc-12 branch - - GCC 12.1 release + - GCC 12.2 release - PRs c++/67048, c++/106369, c/106016, d/106623, d/106638, lto/106334, lto/106540, middle-end/106492, tree-optimization/106513 - fix an if-conversion wrong-code bug (PR rtl-optimization/106590) - implement C++23 P2327R1 - de-deprecating volatile compound operations - as a DR -* Wed Aug 8 2022 Jakub Jelinek 12.1.1-4 +* Wed Aug 10 2022 Jakub Jelinek 12.1.1-4 - update from releases/gcc-12 branch - PRs analyzer/105285, analyzer/106204, analyzer/106225, c++/53164, c++/96363, c++/100374, c++/105541, c++/105626, c++/105634, c++/105637, diff --git a/gcc12-isl-dl.patch b/gcc12-isl-dl.patch index 825fb88..824288b 100644 --- a/gcc12-isl-dl.patch +++ b/gcc12-isl-dl.patch @@ -26,7 +26,7 @@ # Generate header and source files from the machine description, # and compile them. --- gcc/graphite.h.jj 2016-01-27 12:44:06.000000000 +0100 -+++ gcc/graphite.h 2016-01-27 13:26:38.309876856 +0100 ++++ gcc/graphite.h 2022-11-03 19:14:50.369690720 +0100 @@ -24,6 +24,591 @@ along with GCC; see the file COPYING3. #include "sese.h" @@ -41,15 +41,15 @@ + DYNSYM (isl_aff_set_coefficient_si); \ + DYNSYM (isl_aff_set_constant_si); \ + DYNSYM (isl_aff_zero_on_domain); \ -+ DYNSYM (isl_band_free); \ -+ DYNSYM (isl_band_get_children); \ -+ DYNSYM (isl_band_get_partial_schedule); \ -+ DYNSYM (isl_band_has_children); \ -+ DYNSYM (isl_band_list_free); \ -+ DYNSYM (isl_band_list_get_band); \ -+ DYNSYM (isl_band_list_get_ctx); \ -+ DYNSYM (isl_band_list_n_band); \ -+ DYNSYM (isl_band_n_member); \ ++ /* DYNSYM (isl_band_free); */ \ ++ /* DYNSYM (isl_band_get_children); */ \ ++ /* DYNSYM (isl_band_get_partial_schedule); */ \ ++ /* DYNSYM (isl_band_has_children); */ \ ++ /* DYNSYM (isl_band_list_free); */ \ ++ /* DYNSYM (isl_band_list_get_band); */ \ ++ /* DYNSYM (isl_band_list_get_ctx); */ \ ++ /* DYNSYM (isl_band_list_n_band); */ \ ++ /* DYNSYM (isl_band_n_member); */ \ + DYNSYM (isl_basic_map_add_constraint); \ + DYNSYM (isl_basic_map_project_out); \ + DYNSYM (isl_basic_map_universe); \ @@ -91,7 +91,7 @@ + DYNSYM (isl_map_is_empty); \ + DYNSYM (isl_map_lex_ge); \ + DYNSYM (isl_map_lex_le); \ -+ DYNSYM (isl_map_n_out); \ ++ /* DYNSYM (isl_map_n_out); */ \ + DYNSYM (isl_map_range); \ + DYNSYM (isl_map_set_tuple_id); \ + DYNSYM (isl_map_universe); \ @@ -124,7 +124,7 @@ + DYNSYM (isl_pw_aff_sub); \ + DYNSYM (isl_pw_aff_zero_set); \ + DYNSYM (isl_schedule_free); \ -+ DYNSYM (isl_schedule_get_band_forest); \ ++ /* DYNSYM (isl_schedule_get_band_forest); */ \ + DYNSYM (isl_set_add_constraint); \ + DYNSYM (isl_set_add_dims); \ + DYNSYM (isl_set_apply); \ @@ -641,7 +641,7 @@ + + if (isl_pointers__.inited) + return isl_pointers__.h != NULL; -+ h = dlopen ("libisl.so.15", RTLD_LAZY); ++ h = dlopen ("libisl.so.23", RTLD_LAZY); + isl_pointers__.h = h; + if (h == NULL) + return false; diff --git a/gcc12-isl-dl2.patch b/gcc12-isl-dl2.patch index 5402a8e..2e12499 100644 --- a/gcc12-isl-dl2.patch +++ b/gcc12-isl-dl2.patch @@ -2,7 +2,7 @@ * toplev.cc (toplev_main_argv): New variable. (toplev_main): Initialize it. - * graphite.cc (init_isl_pointers): Load libisl.so.15 from gcc's private + * graphite.cc (init_isl_pointers): Load libisl.so.23 from gcc's private directory. --- gcc/toplev.cc.jj 2008-12-09 23:59:10.000000000 +0100 @@ -39,12 +39,12 @@ if (isl_pointers__.inited) return isl_pointers__.h != NULL; -- h = dlopen ("libisl.so.15", RTLD_LAZY); +- h = dlopen ("libisl.so.23", RTLD_LAZY); + len = progname - toplev_main_argv[0]; -+ buf = XALLOCAVAR (char, len + sizeof "libisl.so.15"); ++ buf = XALLOCAVAR (char, len + sizeof "libisl.so.23"); + memcpy (buf, toplev_main_argv[0], len); -+ strcpy (buf + len, "libisl.so.15"); -+ len += sizeof "libisl.so.15"; ++ strcpy (buf + len, "libisl.so.23"); ++ len += sizeof "libisl.so.23"; + p = strstr (buf, "/libexec/"); + if (p != NULL) + { @@ -61,7 +61,7 @@ + { + len = progname - toplev_main_argv[0]; + memcpy (buf, toplev_main_argv[0], len); -+ strcpy (buf + len, "libisl.so.15"); ++ strcpy (buf + len, "libisl.so.23"); + } + } + if (h == NULL) diff --git a/gcc12-p2327r1.patch b/gcc12-p2327r1.patch deleted file mode 100644 index 4c6e695..0000000 --- a/gcc12-p2327r1.patch +++ /dev/null @@ -1,135 +0,0 @@ -2022-08-16 Jakub Jelinek - - * typeck.cc (cp_build_modify_expr): Implement - P2327R1 - De-deprecating volatile compound operations. Don't warn - for |=, &= or ^= with volatile lhs. - * expr.cc (mark_use) : Adjust warning wording, - leave out simple. - - * g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile - compound |=, &= and ^= operations. - * g++.dg/cpp2a/volatile3.C: Likewise. - * g++.dg/cpp2a/volatile5.C: Likewise. - ---- gcc/cp/expr.cc -+++ gcc/cp/expr.cc -@@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, - case MODIFY_EXPR: - { - tree lhs = TREE_OPERAND (expr, 0); -- /* [expr.ass] "A simple assignment whose left operand is of -+ /* [expr.ass] "An assignment whose left operand is of - a volatile-qualified type is deprecated unless the assignment - is either a discarded-value expression or appears in an - unevaluated context." */ -@@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, - && !TREE_THIS_VOLATILE (expr)) - { - if (warning_at (location_of (expr), OPT_Wvolatile, -- "using value of simple assignment with " -+ "using value of assignment with " - "%-qualified left operand is " - "deprecated")) - /* Make sure not to warn about this assignment again. */ ---- gcc/cp/typeck.cc -+++ gcc/cp/typeck.cc -@@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, - - /* An expression of the form E1 op= E2. [expr.ass] says: - "Such expressions are deprecated if E1 has volatile-qualified -- type." We warn here rather than in cp_genericize_r because -+ type and op is not one of the bitwise operators |, &, ^." -+ We warn here rather than in cp_genericize_r because - for compound assignments we are supposed to warn even if the - assignment is a discarded-value expression. */ -- if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)) -+ if (modifycode != BIT_AND_EXPR -+ && modifycode != BIT_IOR_EXPR -+ && modifycode != BIT_XOR_EXPR -+ && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))) - warning_at (loc, OPT_Wvolatile, - "compound assignment with %-qualified left " - "operand is deprecated"); ---- gcc/testsuite/g++.dg/cpp2a/volatile1.C -+++ gcc/testsuite/g++.dg/cpp2a/volatile1.C -@@ -56,6 +56,9 @@ fn2 () - vi = i; - vi = i = 42; - i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - (vi = 42, 45); - (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -@@ -74,8 +77,9 @@ fn2 () - vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } -+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } -+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } - vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -@@ -131,7 +135,8 @@ void raccoon () - volatile T t, u; - t = 42; - u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } -+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } - } - - void ---- gcc/testsuite/g++.dg/cpp2a/volatile3.C -+++ gcc/testsuite/g++.dg/cpp2a/volatile3.C -@@ -57,6 +57,9 @@ fn2 () - vi = i; - vi = i = 42; - i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } -+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } -+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } - &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - (vi = 42, 45); - (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -@@ -75,8 +78,9 @@ fn2 () - vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } -+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } -+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } - vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -@@ -132,7 +136,8 @@ void raccoon () - volatile T t, u; - t = 42; - u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } -+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } - } - - void ---- gcc/testsuite/g++.dg/cpp2a/volatile5.C -+++ gcc/testsuite/g++.dg/cpp2a/volatile5.C -@@ -8,8 +8,8 @@ f (bool b) - { - (b ? x : y) = 1; - (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } } -- z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } -- ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } -- (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } -- (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } -+ z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } -+ ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } -+ (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } -+ (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } - } diff --git a/gcc12-pr106590.patch b/gcc12-pr106590.patch deleted file mode 100644 index 11e0cd4..0000000 --- a/gcc12-pr106590.patch +++ /dev/null @@ -1,159 +0,0 @@ -2022-08-15 Jakub Jelinek - - PR rtl-optimization/106590 - * ifcvt.cc (check_for_cc_cmp_clobbers): New function. - (noce_convert_multiple_sets_1): If SEQ sets or clobbers any regs - mentioned in cc_cmp or rev_cc_cmp, don't consider seq2 for any - further conditional moves. - - * gcc.dg/torture/pr106590.c: New test. - ---- gcc/ifcvt.cc -+++ gcc/ifcvt.cc -@@ -3369,6 +3369,20 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) - return TRUE; - } - -+/* Helper function for noce_convert_multiple_sets_1. If store to -+ DEST can affect P[0] or P[1], clear P[0]. Called via note_stores. */ -+ -+static void -+check_for_cc_cmp_clobbers (rtx dest, const_rtx, void *p0) -+{ -+ rtx *p = (rtx *) p0; -+ if (p[0] == NULL_RTX) -+ return; -+ if (reg_overlap_mentioned_p (dest, p[0]) -+ || (p[1] && reg_overlap_mentioned_p (dest, p[1]))) -+ p[0] = NULL_RTX; -+} -+ - /* This goes through all relevant insns of IF_INFO->then_bb and tries to - create conditional moves. In case a simple move sufficis the insn - should be listed in NEED_NO_CMOV. The rewired-src cases should be -@@ -3519,7 +3533,7 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, - - as min/max and emit an insn, accordingly. */ - unsigned cost1 = 0, cost2 = 0; -- rtx_insn *seq, *seq1, *seq2; -+ rtx_insn *seq, *seq1, *seq2 = NULL; - rtx temp_dest = NULL_RTX, temp_dest1 = NULL_RTX, temp_dest2 = NULL_RTX; - bool read_comparison = false; - -@@ -3531,9 +3545,10 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, - as well. This allows the backend to emit a cmov directly without - creating an additional compare for each. If successful, costing - is easier and this sequence is usually preferred. */ -- seq2 = try_emit_cmove_seq (if_info, temp, cond, -- new_val, old_val, need_cmov, -- &cost2, &temp_dest2, cc_cmp, rev_cc_cmp); -+ if (cc_cmp) -+ seq2 = try_emit_cmove_seq (if_info, temp, cond, -+ new_val, old_val, need_cmov, -+ &cost2, &temp_dest2, cc_cmp, rev_cc_cmp); - - /* The backend might have created a sequence that uses the - condition. Check this. */ -@@ -3588,6 +3603,24 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, - return FALSE; - } - -+ if (cc_cmp) -+ { -+ /* Check if SEQ can clobber registers mentioned in -+ cc_cmp and/or rev_cc_cmp. If yes, we need to use -+ only seq1 from that point on. */ -+ rtx cc_cmp_pair[2] = { cc_cmp, rev_cc_cmp }; -+ for (walk = seq; walk; walk = NEXT_INSN (walk)) -+ { -+ note_stores (walk, check_for_cc_cmp_clobbers, cc_cmp_pair); -+ if (cc_cmp_pair[0] == NULL_RTX) -+ { -+ cc_cmp = NULL_RTX; -+ rev_cc_cmp = NULL_RTX; -+ break; -+ } -+ } -+ } -+ - /* End the sub sequence and emit to the main sequence. */ - emit_insn (seq); - ---- gcc/testsuite/gcc.dg/torture/pr106590.c -+++ gcc/testsuite/gcc.dg/torture/pr106590.c -@@ -0,0 +1,75 @@ -+/* PR rtl-optimization/106590 } */ -+/* { dg-do run } */ -+/* { dg-additional-options "-mtune=skylake" { target { i?86-*-* x86_64-*-* } } } */ -+ -+typedef struct A { short a; } A; -+typedef A *B; -+typedef struct C { int c, d; } C; -+typedef C *D; -+ -+B -+foo (void) -+{ -+ static A r = { .a = 1 }; -+ return &r; -+} -+ -+D -+bar (void) -+{ -+ static C r = { .c = 1, .d = 23 }; -+ return &r; -+} -+ -+static inline int __attribute__((always_inline)) -+baz (short a) -+{ -+ int e = 1, f; -+ short g; -+ D h; -+ -+ switch (a) -+ { -+ case 1: -+ f = 23; -+ g = 1; -+ break; -+ case 2: -+ f = 20; -+ g = 2; -+ break; -+ } -+ -+ h = bar (); -+ -+ if (h->d != f || h->c != g) -+ __builtin_abort (); -+ return e; -+} -+ -+int -+qux (void) -+{ -+ B i = foo (); -+ int e = 1; -+ -+ switch (i->a) -+ { -+ case 1: -+ case 2: -+ e = baz (i->a); -+ break; -+ case 3: -+ e = 0; -+ break; -+ } -+ -+ return e; -+} -+ -+int -+main () -+{ -+ qux (); -+ return 0; -+} diff --git a/gcc12-pr107468.patch b/gcc12-pr107468.patch new file mode 100644 index 0000000..0949b11 --- /dev/null +++ b/gcc12-pr107468.patch @@ -0,0 +1,124 @@ +libstdc++: Update from latest fast_float [PR107468] + +The following patch is a cherry-pick from +https://github.com/fastfloat/fast_float/pull/153 +to restrict fast_float Clinger's fast path to when rounding mode +is FE_TONEAREST. +Using std::fegetround showed in benchmarks too slow, so instead +it uses a check with 2 float additions and comparison to verify +if rounding is FE_TONEAREST. + +2022-11-20 Jakub Jelinek + + PR libstdc++/107468 + * src/c++17/fast_float/fast_float.h (detail::rounds_to_nearest): New + function, taken from https://github.com/fastfloat/fast_float/pull/153. + (from_chars_advanced): Only use Clinger's fast path if + detail::rounds_to_nearest(). + * testsuite/20_util/from_chars/pr107468.cc: New test. + +--- libstdc++-v3/src/c++17/fast_float/fast_float.h.jj 2022-04-28 15:56:18.315632888 +0200 ++++ libstdc++-v3/src/c++17/fast_float/fast_float.h 2022-11-20 18:53:49.570830249 +0100 +@@ -2842,6 +2842,48 @@ from_chars_result parse_infnan(const cha + return answer; + } + ++/** ++ * Returns true if the floating-pointing rounding mode is to 'nearest'. ++ * It is the default on most system. This function is meant to be inexpensive. ++ * Credit : @mwalcott3 ++ */ ++fastfloat_really_inline bool rounds_to_nearest() noexcept { ++ // See ++ // A fast function to check your floating-point rounding mode ++ // https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/ ++ // ++ // This function is meant to be equivalent to : ++ // prior: #include ++ // return fegetround() == FE_TONEAREST; ++ // However, it is expected to be much faster than the fegetround() ++ // function call. ++ // ++ // The volatile keywoard prevents the compiler from computing the function ++ // at compile-time. ++ // There might be other ways to prevent compile-time optimizations (e.g., asm). ++ // The value does not need to be std::numeric_limits::min(), any small ++ // value so that 1 + x should round to 1 would do (after accounting for excess ++ // precision, as in 387 instructions). ++ static volatile float fmin = std::numeric_limits::min(); ++ float fmini = fmin; // we copy it so that it gets loaded at most once. ++ // ++ // Explanation: ++ // Only when fegetround() == FE_TONEAREST do we have that ++ // fmin + 1.0f == 1.0f - fmin. ++ // ++ // FE_UPWARD: ++ // fmin + 1.0f > 1 ++ // 1.0f - fmin == 1 ++ // ++ // FE_DOWNWARD or FE_TOWARDZERO: ++ // fmin + 1.0f == 1 ++ // 1.0f - fmin < 1 ++ // ++ // Note: This may fail to be accurate if fast-math has been ++ // enabled, as rounding conventions may not apply. ++ return (fmini + 1.0f == 1.0f - fmini); ++} ++ + } // namespace detail + + template +@@ -2870,7 +2912,7 @@ from_chars_result from_chars_advanced(co + answer.ec = std::errc(); // be optimistic + answer.ptr = pns.lastmatch; + // Next is Clinger's fast path. +- if (binary_format::min_exponent_fast_path() <= pns.exponent && pns.exponent <= binary_format::max_exponent_fast_path() && pns.mantissa <=binary_format::max_mantissa_fast_path() && !pns.too_many_digits) { ++ if (binary_format::min_exponent_fast_path() <= pns.exponent && pns.exponent <= binary_format::max_exponent_fast_path() && pns.mantissa <=binary_format::max_mantissa_fast_path() && !pns.too_many_digits && detail::rounds_to_nearest()) { + value = T(pns.mantissa); + if (pns.exponent < 0) { value = value / binary_format::exact_power_of_ten(-pns.exponent); } + else { value = value * binary_format::exact_power_of_ten(pns.exponent); } +--- libstdc++-v3/testsuite/20_util/from_chars/pr107468.cc.jj ++++ libstdc++-v3/testsuite/20_util/from_chars/pr107468.cc +@@ -0,0 +1,42 @@ ++// Copyright (C) 2022 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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 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 General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING3. If not see ++// . ++ ++// { dg-do run { target c++17 } } ++// { dg-add-options ieee } ++ ++#include ++#include ++#include ++#include ++ ++int ++main() ++{ ++ // FP from_char not available otherwise. ++#if __cpp_lib_to_chars >= 201611L \ ++ && _GLIBCXX_USE_C99_FENV_TR1 \ ++ && defined(FE_DOWNWARD) \ ++ && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) ++ // PR libstdc++/107468 ++ float f; ++ char buf[] = "3.355447e+07"; ++ std::fesetround(FE_DOWNWARD); ++ auto [ptr, ec] = std::from_chars(buf, buf + sizeof(buf) - 1, f, std::chars_format::scientific); ++ VERIFY( ec == std::errc() && ptr == buf + sizeof(buf) - 1 ); ++ VERIFY( f == 33554472.0f ); ++#endif ++} diff --git a/sources b/sources index 20c9d7c..4f41efa 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (gcc-12.2.1-20220819.tar.xz) = 40464b6c544edd91ea744354a38bb2ec075d021b3bece7997b40b462dbca5a7b86105ae157fa081b1a6bd1c9f4813a51eec245b56a2bd2eb171e90ce048c0f25 -SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94 -SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c -SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7 +SHA512 (gcc-12.2.1-20221121.tar.xz) = 6fef1438e77d8b7e7aeddea6d2d6a82c37d2e93f65ad9007f04206e1a368dd70597cef01188de4ee9bbfe1811a129303ce10b49cb9758a2b44abe4f0312d073a +SHA512 (isl-0.24.tar.bz2) = aab3bddbda96b801d0f56d2869f943157aad52a6f6e6a61745edd740234c635c38231af20bc3f1a08d416a5e973a90e18249078ed8e4ae2f1d5de57658738e95 +SHA512 (newlib-cygwin-a8526cb52bedabd4d6ba4b227a5185627f871aa1.tar.xz) = b099246fe4a5d0a372cdaee5da49083df5b2f4440a4e83961600cdf22d37da50c99ce9ae46b769f188a67034ee038cf863260988fc9d594e8e5fb3905a381dec +SHA512 (nvptx-tools-472b6e78b3ba918d727698f79911360b7c808247.tar.xz) = 91690321bf96460c3b3e229199a6f752ed1c27c6933d4345dc7e237dc068f604ad211bb3a0373e14d4f332bee05b6227d6933e14e0b475ffdfea8b511ab735e6