* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-04-26 20:39 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-04-26 20:39 UTC (permalink / raw
To: gentoo-commits
commit: 28d2380b495e99daca3b01ca9e6a73a623a2f3d2
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 26 20:38:52 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 26 20:38:52 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=28d2380b
13.2.0: drop upstream patches
We only put them in here to include in 13.1.0-r1. They're already on releases/gcc-13.
Signed-off-by: Sam James <sam <AT> gentoo.org>
...573_13_ICE-in-vectorizable_live_operation.patch | 134 ---------------------
...l_all_PR109585_13_rtl-alias-analysis-typo.patch | 68 -----------
.../77_all_all_PR109609_13_tail-call-fnspec.patch | 105 ----------------
3 files changed, 307 deletions(-)
diff --git a/13.2.0/gentoo/75_all_all_PR109573_13_ICE-in-vectorizable_live_operation.patch b/13.2.0/gentoo/75_all_all_PR109573_13_ICE-in-vectorizable_live_operation.patch
deleted file mode 100644
index 31abade..0000000
--- a/13.2.0/gentoo/75_all_all_PR109573_13_ICE-in-vectorizable_live_operation.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=263d1ed0484fc81d3f93e39cdd2f9eb0ce4d3e88
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109573
-https://bugs.gentoo.org/904455
-
-kFrom 263d1ed0484fc81d3f93e39cdd2f9eb0ce4d3e88 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Fri, 21 Apr 2023 12:57:17 +0200
-Subject: [PATCH] tree-optimization/109573 - avoid ICEing on unexpected live
- def
-
-The following relaxes the assert in vectorizable_live_operation
-where we catch currently unhandled cases to also allow an
-intermediate copy as it happens here but also relax the assert
-to checking only.
-
- PR tree-optimization/109573
- * tree-vect-loop.cc (vectorizable_live_operation): Allow
- unhandled SSA copy as well. Demote assert to checking only.
-
- * g++.dg/vect/pr109573.cc: New testcase.
-
-(cherry picked from commit cddfe6bc40b3dc0806e260bbfb4cac82d609a258)
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/vect/pr109573.cc
-@@ -0,0 +1,91 @@
-+// { dg-do compile }
-+// { dg-require-effective-target c++20 }
-+
-+void *operator new(__SIZE_TYPE__, void *__p) { return __p; }
-+template <typename _Head> struct _Head_base {
-+ _Head _M_head_impl;
-+};
-+template <unsigned long, typename...> struct _Tuple_impl;
-+template <unsigned long _Idx, typename _Head, typename... _Tail>
-+struct _Tuple_impl<_Idx, _Head, _Tail...> : _Tuple_impl<_Idx + 1, _Tail...>,
-+ _Head_base<_Head> {
-+ template <typename _UHead, typename... _UTail>
-+ _Tuple_impl(_UHead __head, _UTail... __tail)
-+ : _Tuple_impl<_Idx + 1, _Tail...>(__tail...), _Head_base<_Head>(__head) {}
-+};
-+template <unsigned long _Idx, typename _Head> struct _Tuple_impl<_Idx, _Head> {
-+ template <typename _UHead> _Tuple_impl(_UHead);
-+};
-+template <typename... _Elements> struct tuple : _Tuple_impl<0, _Elements...> {
-+ template <typename... _UElements>
-+ tuple(_UElements... __elements)
-+ : _Tuple_impl<0, _Elements...>(__elements...) {}
-+};
-+unsigned long position_;
-+struct Zone {
-+ template <typename T, typename... Args> T *New(Args... args) {
-+ return new (reinterpret_cast<void *>(position_)) T(args...);
-+ }
-+};
-+struct Label {
-+ int pos_;
-+ int near_link_pos_;
-+};
-+enum Condition { below_equal };
-+void bind(Label *);
-+Zone *zone();
-+unsigned long deopt_info_address();
-+int MakeDeferredCode___trans_tmp_2, MakeDeferredCode___trans_tmp_3,
-+ Prologue___trans_tmp_6, MakeDeferredCode___trans_tmp_1;
-+struct MaglevAssembler {
-+ template <typename Function, typename... Args>
-+ void MakeDeferredCode(Function &&, Args &&...);
-+ template <typename Function, typename... Args>
-+ void JumpToDeferredIf(Condition, Function, Args... args) {
-+ MakeDeferredCode(Function(), args...);
-+ }
-+ void Prologue();
-+};
-+struct ZoneLabelRef {
-+ ZoneLabelRef(Zone *zone) : label_(zone->New<Label>()) {}
-+ ZoneLabelRef(MaglevAssembler *) : ZoneLabelRef(zone()) {}
-+ Label *operator*() { return label_; }
-+ Label *label_;
-+};
-+template <typename Function>
-+struct FunctionArgumentsTupleHelper
-+ : FunctionArgumentsTupleHelper<decltype(&Function::operator())> {};
-+template <typename C, typename R, typename... A>
-+struct FunctionArgumentsTupleHelper<R (C::*)(A...) const> {
-+ using Tuple = tuple<A...>;
-+};
-+template <typename> struct StripFirstTupleArg;
-+template <typename T1, typename... T>
-+struct StripFirstTupleArg<tuple<T1, T...>> {
-+ using Stripped = tuple<T...>;
-+};
-+template <typename Function> struct DeferredCodeInfoImpl {
-+ template <typename... InArgs>
-+ DeferredCodeInfoImpl(int *, int, int, Function, InArgs... args)
-+ : args(args...) {}
-+ StripFirstTupleArg<
-+ typename FunctionArgumentsTupleHelper<Function>::Tuple>::Stripped args;
-+};
-+template <typename Function, typename... Args>
-+void MaglevAssembler::MakeDeferredCode(Function &&deferred_code_gen,
-+ Args &&...args) {
-+ zone()->New<DeferredCodeInfoImpl<Function>>(
-+ &MakeDeferredCode___trans_tmp_1, MakeDeferredCode___trans_tmp_2,
-+ MakeDeferredCode___trans_tmp_3, deferred_code_gen, args...);
-+}
-+void MaglevAssembler::Prologue() {
-+ int *__trans_tmp_9;
-+ ZoneLabelRef deferred_call_stack_guard_return(this);
-+ __trans_tmp_9 = reinterpret_cast<int *>(deopt_info_address());
-+ JumpToDeferredIf(
-+ below_equal, [](MaglevAssembler, int *, ZoneLabelRef, int, int) {},
-+ __trans_tmp_9, deferred_call_stack_guard_return, Prologue___trans_tmp_6,
-+ 0);
-+ Label __trans_tmp_7 = **deferred_call_stack_guard_return;
-+ bind(&__trans_tmp_7);
-+}
---- a/gcc/tree-vect-loop.cc
-+++ b/gcc/tree-vect-loop.cc
-@@ -10114,9 +10114,10 @@ vectorizable_live_operation (vec_info *vinfo,
- use_stmt))
- {
- enum tree_code code = gimple_assign_rhs_code (use_stmt);
-- gcc_assert (code == CONSTRUCTOR
-- || code == VIEW_CONVERT_EXPR
-- || CONVERT_EXPR_CODE_P (code));
-+ gcc_checking_assert (code == SSA_NAME
-+ || code == CONSTRUCTOR
-+ || code == VIEW_CONVERT_EXPR
-+ || CONVERT_EXPR_CODE_P (code));
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Using original scalar computation for "
---
-2.31.1
diff --git a/13.2.0/gentoo/76_all_all_PR109585_13_rtl-alias-analysis-typo.patch b/13.2.0/gentoo/76_all_all_PR109585_13_rtl-alias-analysis-typo.patch
deleted file mode 100644
index b40e3af..0000000
--- a/13.2.0/gentoo/76_all_all_PR109585_13_rtl-alias-analysis-typo.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bb406a6aea336966681927a27f54ee89c4fd4ea1
-
-From bb406a6aea336966681927a27f54ee89c4fd4ea1 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Mon, 24 Apr 2023 13:31:07 +0200
-Subject: [PATCH] rtl-optimization/109585 - alias analysis typo
-
-When r10-514-gc6b84edb6110dd2b4fb improved access path analysis
-it introduced a typo that triggers when there's an access to a
-trailing array in the first access path leading to false
-disambiguation.
-
- PR rtl-optimization/109585
- * tree-ssa-alias.cc (aliasing_component_refs_p): Fix typo.
-
- * gcc.dg/torture/pr109585.c: New testcase.
-
-(cherry picked from commit 6d4bd27a60447c7505cb4783e675e98a191a8904)
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr109585.c
-@@ -0,0 +1,33 @@
-+/* { dg-do run } */
-+
-+#include <stdlib.h>
-+
-+struct P {
-+ long v;
-+ struct P *n;
-+};
-+
-+struct F {
-+ long x;
-+ struct P fam[];
-+};
-+
-+int __attribute__((noipa))
-+f(struct F *f, int i)
-+{
-+ struct P *p = f->fam;
-+ asm("" : "+r"(f): "r"(p));
-+ p->v = 0;
-+ p->n = 0;
-+ return f->fam->n != 0;
-+}
-+
-+int
-+main()
-+{
-+ struct F *m = malloc (sizeof (long) + 2 * sizeof (struct P));
-+ m->fam[0].n = &m->fam[1];
-+ if (f (m, 0))
-+ abort ();
-+ return 0;
-+}
---- a/gcc/tree-ssa-alias.cc
-+++ b/gcc/tree-ssa-alias.cc
-@@ -1330,7 +1330,7 @@ aliasing_component_refs_p (tree ref1,
- /* If we didn't find a common base, try the other way around. */
- if (cmp_outer <= 0
- || (end_struct_ref1
-- && compare_type_sizes (TREE_TYPE (end_struct_ref1), type1) <= 0))
-+ && compare_type_sizes (TREE_TYPE (end_struct_ref1), type2) <= 0))
- {
- int res = aliasing_component_refs_walk (ref2, type2, base2,
- offset2, max_size2,
---
-2.31.1
diff --git a/13.2.0/gentoo/77_all_all_PR109609_13_tail-call-fnspec.patch b/13.2.0/gentoo/77_all_all_PR109609_13_tail-call-fnspec.patch
deleted file mode 100644
index 9871b81..0000000
--- a/13.2.0/gentoo/77_all_all_PR109609_13_tail-call-fnspec.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=df49e4602882eabe0642699fb71a70f6e120e263
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109609
-
-From df49e4602882eabe0642699fb71a70f6e120e263 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Tue, 25 Apr 2023 14:56:44 +0200
-Subject: [PATCH] tree-optimization/109609 - correctly interpret arg size in
- fnspec
-
-By majority vote and a hint from the API name which is
-arg_max_access_size_given_by_arg_p this interprets a memory access
-size specified as given as other argument such as for strncpy
-in the testcase which has "1cO313" as specifying the _maximum_
-size read/written rather than the exact size. There are two
-uses interpreting it that way already and one differing. The
-following adjusts the differing and clarifies the documentation.
-
- PR tree-optimization/109609
- * attr-fnspec.h (arg_max_access_size_given_by_arg_p):
- Clarify semantics.
- * tree-ssa-alias.cc (check_fnspec): Correctly interpret
- the size given by arg_max_access_size_given_by_arg_p as
- maximum, not exact, size.
-
- * gcc.dg/torture/pr109609.c: New testcase.
-
-(cherry picked from commit e8d00353017f895d03a9eabae3506fd126ce1a2d)
---- a/gcc/attr-fnspec.h
-+++ b/gcc/attr-fnspec.h
-@@ -54,7 +54,7 @@
- ' ' nothing is known
- 't' the size of value written/read corresponds to the size of
- of the pointed-to type of the argument type
-- '1'...'9' specifies the size of value written/read is given by the
-+ '1'...'9' specifies the size of value written/read is bound by the
- specified argument
- */
-
-@@ -169,7 +169,7 @@ public:
- && str[idx] != 'x' && str[idx] != 'X';
- }
-
-- /* Return true if load of memory pointed to by argument I is specified
-+ /* Return true if load of memory pointed to by argument I is bound
- by another argument. In this case set ARG. */
- bool
- arg_max_access_size_given_by_arg_p (unsigned int i, unsigned int *arg)
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr109609.c
-@@ -0,0 +1,26 @@
-+/* { dg-do run } */
-+
-+#define N 23
-+#define MAX_LEN 13
-+char dst[N + 1];
-+
-+void __attribute__((noipa))
-+invert(const char *id)
-+{
-+ char buf[MAX_LEN];
-+ char *ptr = buf + sizeof(buf); // start from the end of buf
-+ *(--ptr) = '\0'; // terminate string
-+ while (*id && ptr > buf) {
-+ *(--ptr) = *(id++); // copy id backwards
-+ }
-+ __builtin_strncpy(dst, ptr, N); // copy ptr/buf to dst
-+}
-+
-+
-+int main()
-+{
-+ invert("abcde");
-+ if (__builtin_strcmp(dst, "edcba"))
-+ __builtin_abort();
-+ return 0;
-+}
---- a/gcc/tree-ssa-alias.cc
-+++ b/gcc/tree-ssa-alias.cc
-@@ -2726,9 +2726,21 @@ check_fnspec (gcall *call, ao_ref *ref, bool clobber)
- t = TREE_CHAIN (t);
- size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_VALUE (t)));
- }
-- ao_ref_init_from_ptr_and_size (&dref,
-- gimple_call_arg (call, i),
-- size);
-+ poly_int64 size_hwi;
-+ if (size
-+ && poly_int_tree_p (size, &size_hwi)
-+ && coeffs_in_range_p (size_hwi, 0,
-+ HOST_WIDE_INT_MAX / BITS_PER_UNIT))
-+ {
-+ size_hwi = size_hwi * BITS_PER_UNIT;
-+ ao_ref_init_from_ptr_and_range (&dref,
-+ gimple_call_arg (call, i),
-+ true, 0, -1, size_hwi);
-+ }
-+ else
-+ ao_ref_init_from_ptr_and_range (&dref,
-+ gimple_call_arg (call, i),
-+ false, 0, -1, -1);
- if (refs_may_alias_p_1 (&dref, ref, false))
- return 1;
- }
---
-2.31.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-04-29 23:28 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-04-29 23:28 UTC (permalink / raw
To: gentoo-commits
commit: 490c1c096ca1d3a1f4a84801a46231d64c07ba49
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 29 22:41:36 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 29 22:41:36 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=490c1c09
13.2.0: cut 2 patchset
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/README.history | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 1ae5deb..20af64a 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,8 @@
+2 29 Apr 2023
+ - 75_all_all_PR109573_13_ICE-in-vectorizable_live_operation.patch
+ - 76_all_all_PR109585_13_rtl-alias-analysis-typo.patch
+ - 77_all_all_PR109609_13_tail-call-fnspec.patch
+
1 26 April 2023
+ 01_all_default-fortify-source.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-05-26 2:50 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-05-26 2:50 UTC (permalink / raw
To: gentoo-commits
commit: 7a6b2d23ec02e75475a6123254ccd44d73827f39
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 26 02:26:36 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 02:26:36 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7a6b2d23
13.2.0: backport split match.pd changes
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21.
This should improve (reduce) the peak RAM usage when building GCC as it builds
gimple-match in smaller chunks (previously was one huge generated file) as well
as speeding up parallel build when used.
i.e. This has benefits for both people building on constrained hardware (because
-j1 is more effective and just means each smaller chunk is built one-at-a-time,
not the massive blob) and also for people building with many jobs, as there's
one less synchronisation point so the build is less serial.
Motivated in particular by the upstream report (PR109927) of this being an issue
on m68k with RAM usage for the single GCC process building gimple-match.
(IIRC immolo and possibly dilfridge had mentioned similar issues when building
some arches in qemu as well.)
Note that upstream are planning on splitting insn-* as well so there are further
improvements in the pipeline (see PR54179, but discussion has occurred far more
recently on IRC about this and tamar is likely to look at it.).
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54179 (old bug for splitting insn-*, will be revisited)
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84402 (tracker bug for parallelisation, interesting discussion)
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927
Bug: https://bugs.gentoo.org/891909 (not the same issue per-se but related to reduced resource usage)
Bug: https://bugs.gentoo.org/894256
Bug: https://bugs.gentoo.org/901317
Signed-off-by: Sam James <sam <AT> gentoo.org>
...l_match.pd-don-t-emit-label-if-not-needed.patch | 114 +
| 41 +
...78_all_match.pd-CSE-the-dump-output-check.patch | 70 +
...lit-shared-code-to-gimple-match-exports.c.patch | 2560 ++++++++++++++++++++
...pd-automatically-partition-match.cc-files.patch | 524 ++++
...e-splits-in-makefile-and-make-configurabl.patch | 258 ++
13.2.0/gentoo/README.history | 10 +
7 files changed, 3577 insertions(+)
diff --git a/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
new file mode 100644
index 0000000..ac9efe6
--- /dev/null
+++ b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
@@ -0,0 +1,114 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From 6894f8e1fafe211a5f14ecbb534c92c2b78beb3a Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:35:17 +0100
+Subject: [PATCH 1/6] match.pd: don't emit label if not needed
+
+This is a small QoL codegen improvement for match.pd to not emit labels when
+they are not needed. The codegen is nice and there is a small (but consistent)
+improvement in compile time.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * genmatch.cc (dt_simplify::gen_1): Only emit labels if used.
+
+(cherry picked from commit 580cda3c2799b1f8323af770e52f1eb0fa204718)
+---
+ gcc/genmatch.cc | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index 4fab4135347..638606b2502 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -3352,6 +3352,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ char local_fail_label[256];
+ snprintf (local_fail_label, 256, "next_after_fail%u", ++fail_label_cnt);
+ fail_label = local_fail_label;
++ bool needs_label = false;
+
+ /* Analyze captures and perform early-outs on the incoming arguments
+ that cover cases we cannot handle. */
+@@ -3366,6 +3367,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ fprintf_indent (f, indent,
+ "if (TREE_SIDE_EFFECTS (_p%d)) goto %s;\n",
+ i, fail_label);
++ needs_label = true;
+ if (verbose >= 1)
+ warning_at (as_a <expr *> (s->match)->ops[i]->location,
+ "forcing toplevel operand to have no "
+@@ -3381,6 +3383,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ fprintf_indent (f, indent,
+ "if (TREE_SIDE_EFFECTS (captures[%d])) "
+ "goto %s;\n", i, fail_label);
++ needs_label = true;
+ if (verbose >= 1)
+ warning_at (cinfo.info[i].c->location,
+ "forcing captured operand to have no "
+@@ -3423,7 +3426,10 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ }
+
+ if (s->kind == simplify::SIMPLIFY)
+- fprintf_indent (f, indent, "if (UNLIKELY (!dbg_cnt (match))) goto %s;\n", fail_label);
++ {
++ fprintf_indent (f, indent, "if (UNLIKELY (!dbg_cnt (match))) goto %s;\n", fail_label);
++ needs_label = true;
++ }
+
+ fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) "
+ "fprintf (dump_file, \"%s ",
+@@ -3496,9 +3502,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ "res_op->resimplify (%s, valueize);\n",
+ !e->force_leaf ? "lseq" : "NULL");
+ if (e->force_leaf)
+- fprintf_indent (f, indent,
+- "if (!maybe_push_res_to_seq (res_op, NULL)) "
+- "goto %s;\n", fail_label);
++ {
++ fprintf_indent (f, indent,
++ "if (!maybe_push_res_to_seq (res_op, NULL)) "
++ "goto %s;\n", fail_label);
++ needs_label = true;
++ }
+ }
+ }
+ else if (result->type == operand::OP_CAPTURE
+@@ -3554,9 +3563,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ continue;
+ if (cinfo.info[i].result_use_count
+ > cinfo.info[i].match_use_count)
+- fprintf_indent (f, indent,
+- "if (! tree_invariant_p (captures[%d])) "
+- "goto %s;\n", i, fail_label);
++ {
++ fprintf_indent (f, indent,
++ "if (! tree_invariant_p (captures[%d])) "
++ "goto %s;\n", i, fail_label);
++ needs_label = true;
++ }
+ }
+ for (unsigned j = 0; j < e->ops.length (); ++j)
+ {
+@@ -3607,6 +3619,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ {
+ fprintf_indent (f, indent, "if (!_r)\n");
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
++ needs_label = true;
+ }
+ }
+ }
+@@ -3647,7 +3660,8 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ }
+ indent -= 2;
+ fprintf_indent (f, indent, "}\n");
+- fprintf (f, "%s:;\n", fail_label);
++ if (needs_label)
++ fprintf (f, "%s:;\n", fail_label);
+ fail_label = NULL;
+ }
+
+--
+2.40.1
+
--git a/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
new file mode 100644
index 0000000..ebf93bc
--- /dev/null
+++ b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
@@ -0,0 +1,41 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From 972d5156126df1241e25e1a66518d4903f9564b3 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:36:01 +0100
+Subject: [PATCH 2/6] match.pd: Remove commented out line pragmas unless -vv is
+ used.
+
+genmatch currently outputs commented out line directives that have no effect
+but the compiler still has to parse only to discard.
+
+They are however handy when debugging genmatch output. As such this moves them
+behind the -vv flag.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * genmatch.cc (output_line_directive): Only emit commented directive
+ when -vv.
+
+(cherry picked from commit e487fcc0f7466ea663a0fea52076337bebd42b8b)
+---
+ gcc/genmatch.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index 638606b2502..2533698bd9e 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
+ else
+ fprintf (f, "%s:%d", file, loc.line);
+ }
+- else
++ else if (verbose >= 2)
+ /* Other gen programs really output line directives here, at least for
+ development it's right now more convenient to have line information
+ from the generated file. Still keep the directives as comment for now
+--
+2.40.1
+
diff --git a/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
new file mode 100644
index 0000000..311493d
--- /dev/null
+++ b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
@@ -0,0 +1,70 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From 43a48baef66cd06d8058668ecb2da6190054c163 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:36:43 +0100
+Subject: [PATCH 3/6] match.pd: CSE the dump output check.
+
+This is a small improvement in QoL codegen for match.pd to save time not
+re-evaluating the condition for printing debug information in every function.
+
+There is a small but consistent runtime and compile time win here. The runtime
+win comes from not having to do the condition over again, and on Arm plaforms
+we now use the new test-and-branch support for booleans to only have a single
+instruction here.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * genmatch.cc (decision_tree::gen, write_predicate): Generate new
+ debug_dump var.
+ (dt_simplify::gen_1): Use it.
+
+(cherry picked from commit c0ce29bc1ce329001b6c02bb3d34bcbb086e1b72)
+---
+ gcc/genmatch.cc | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index 2533698bd9e..b2e01dee2fa 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -3431,7 +3431,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ needs_label = true;
+ }
+
+- fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) "
++ fprintf_indent (f, indent, "if (UNLIKELY (debug_dump)) "
+ "fprintf (dump_file, \"%s ",
+ s->kind == simplify::SIMPLIFY
+ ? "Applying pattern" : "Matching expression");
+@@ -3892,6 +3892,8 @@ decision_tree::gen (FILE *f, bool gimple)
+ }
+
+ fprintf (f, ")\n{\n");
++ fprintf_indent (f, 2, "const bool debug_dump = "
++ "dump_file && (dump_flags & TDF_FOLDING);\n");
+ s->s->gen_1 (f, 2, gimple, s->s->s->result);
+ if (gimple)
+ fprintf (f, " return false;\n");
+@@ -3937,6 +3939,8 @@ decision_tree::gen (FILE *f, bool gimple)
+ fprintf (f, ", tree _p%d", i);
+ fprintf (f, ")\n");
+ fprintf (f, "{\n");
++ fprintf_indent (f, 2, "const bool debug_dump = "
++ "dump_file && (dump_flags & TDF_FOLDING);\n");
+ dop->gen_kids (f, 2, gimple, 0);
+ if (gimple)
+ fprintf (f, " return false;\n");
+@@ -4046,6 +4050,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
+ gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : "");
+ /* Conveniently make 'type' available. */
+ fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n");
++ fprintf_indent (f, 2, "const bool debug_dump = "
++ "dump_file && (dump_flags & TDF_FOLDING);\n");
+
+ if (!gimple)
+ fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n");
+--
+2.40.1
+
diff --git a/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
new file mode 100644
index 0000000..3d011cc
--- /dev/null
+++ b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
@@ -0,0 +1,2560 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From db6e98b2677c4c3e08756902827e922d6da0f80b Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:37:49 +0100
+Subject: [PATCH 4/6] genmatch: split shared code to gimple-match-exports.cc
+
+In preparation for automatically splitting match.pd files I split off the
+non-static helper functions that are shared between the match.pd functions off
+to another file.
+
+This file can be compiled in parallel and also allows us to later avoid
+duplicate symbols errors.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * Makefile.in (OBJS): Add gimple-match-exports.o.
+ * genmatch.cc (decision_tree::gen): Export gimple_gimplify helpers.
+ * gimple-match-head.cc (gimple_simplify, gimple_resimplify1,
+ gimple_resimplify2, gimple_resimplify3, gimple_resimplify4,
+ gimple_resimplify5, constant_for_folding, convert_conditional_op,
+ maybe_resimplify_conditional_op, gimple_match_op::resimplify,
+ maybe_build_generic_op, build_call_internal, maybe_push_res_to_seq,
+ do_valueize, try_conditional_simplification, gimple_extract,
+ gimple_extract_op, canonicalize_code, commutative_binary_op_p,
+ commutative_ternary_op_p, first_commutative_argument,
+ associative_binary_op_p, directly_supported_p,
+ get_conditional_internal_fn): Moved to gimple-match-exports.cc
+ * gimple-match-exports.cc: New file.
+
+(cherry picked from commit 27fcf994c5515e1bbf2ff03d28fd2fa927c7e7b5)
+---
+ gcc/Makefile.in | 4 +-
+ gcc/genmatch.cc | 4 +-
+ gcc/gimple-match-exports.cc | 1253 +++++++++++++++++++++++++++++++++++
+ gcc/gimple-match-head.cc | 1192 +--------------------------------
+ 4 files changed, 1260 insertions(+), 1193 deletions(-)
+ create mode 100644 gcc/gimple-match-exports.cc
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index b8abc9a70b7..f5f189916c1 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -223,6 +223,7 @@ libgcov-util.o-warn = -Wno-error
+ libgcov-driver-tool.o-warn = -Wno-error
+ libgcov-merge-tool.o-warn = -Wno-error
+ gimple-match.o-warn = -Wno-unused
++gimple-match-exports.o-warn = -Wno-unused
+ generic-match.o-warn = -Wno-unused
+ dfp.o-warn = -Wno-strict-aliasing
+
+@@ -1308,6 +1309,7 @@ ANALYZER_OBJS = \
+ # the last objects to finish building.
+ OBJS = \
+ gimple-match.o \
++ gimple-match-exports.o \
+ generic-match.o \
+ insn-attrtab.o \
+ insn-automata.o \
+@@ -2659,7 +2661,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
+ false; \
+ fi
+
+-gimple-match.cc: s-match gimple-match-head.cc ; @true
++gimple-match.cc: s-match gimple-match-head.cc gimple-match-exports.cc ; @true
+ generic-match.cc: s-match generic-match-head.cc ; @true
+
+ s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index b2e01dee2fa..09548bdac29 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -3955,7 +3955,7 @@ decision_tree::gen (FILE *f, bool gimple)
+ if (! has_kids_p)
+ {
+ if (gimple)
+- fprintf (f, "\nstatic bool\n"
++ fprintf (f, "\nbool\n"
+ "gimple_simplify (gimple_match_op*, gimple_seq*,\n"
+ " tree (*)(tree), code_helper,\n"
+ " const tree");
+@@ -3978,7 +3978,7 @@ decision_tree::gen (FILE *f, bool gimple)
+ /* Then generate the main entry with the outermost switch and
+ tail-calls to the split-out functions. */
+ if (gimple)
+- fprintf (f, "\nstatic bool\n"
++ fprintf (f, "\nbool\n"
+ "gimple_simplify (gimple_match_op *res_op, gimple_seq *seq,\n"
+ " tree (*valueize)(tree) ATTRIBUTE_UNUSED,\n"
+ " code_helper code, const tree type");
+diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc
+new file mode 100644
+index 00000000000..7aeb4ddb152
+--- /dev/null
++++ b/gcc/gimple-match-exports.cc
+@@ -0,0 +1,1253 @@
++/* Helpers for the autogenerated gimple-match.cc file.
++ Copyright (C) 2023 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
++<http://www.gnu.org/licenses/>. */
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "backend.h"
++#include "target.h"
++#include "rtl.h"
++#include "tree.h"
++#include "gimple.h"
++#include "ssa.h"
++#include "cgraph.h"
++#include "vec-perm-indices.h"
++#include "fold-const.h"
++#include "fold-const-call.h"
++#include "stor-layout.h"
++#include "gimple-iterator.h"
++#include "gimple-fold.h"
++#include "calls.h"
++#include "tree-dfa.h"
++#include "builtins.h"
++#include "gimple-match.h"
++#include "tree-pass.h"
++#include "internal-fn.h"
++#include "case-cfn-macros.h"
++#include "gimplify.h"
++#include "optabs-tree.h"
++#include "tree-eh.h"
++#include "dbgcnt.h"
++#include "tm.h"
++#include "gimple-range.h"
++#include "langhooks.h"
++
++tree (*mprts_hook) (gimple_match_op *);
++
++extern bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
++ code_helper, tree, tree);
++extern bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
++ code_helper, tree, tree, tree);
++extern bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
++ code_helper, tree, tree, tree, tree);
++extern bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
++ code_helper, tree, tree, tree, tree, tree);
++extern bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
++ code_helper, tree, tree, tree, tree, tree, tree);
++
++/* Functions that are needed by gimple-match but that are exported and used in
++ other places in the compiler. */
++
++tree gimple_simplify (enum tree_code, tree, tree, gimple_seq *,
++ tree (*)(tree));
++tree gimple_simplify (enum tree_code, tree, tree, tree, gimple_seq *,
++ tree (*)(tree));
++tree gimple_simplify (enum tree_code, tree, tree, tree, tree, gimple_seq *,
++ tree (*)(tree));
++tree gimple_simplify (combined_fn, tree, tree, gimple_seq *,
++ tree (*)(tree));
++tree gimple_simplify (combined_fn, tree, tree, tree, gimple_seq *,
++ tree (*)(tree));
++tree gimple_simplify (combined_fn, tree, tree, tree, tree, gimple_seq *,
++ tree (*)(tree));
++
++tree do_valueize (tree, tree (*)(tree), bool &);
++tree do_valueize (tree (*)(tree), tree);
++
++/* Forward declarations of the private auto-generated matchers.
++ They expect valueized operands in canonical order and do not
++ perform simplification of all-constant operands. */
++
++static bool gimple_resimplify1 (gimple_seq *, gimple_match_op *, tree (*)(tree));
++static bool gimple_resimplify2 (gimple_seq *, gimple_match_op *, tree (*)(tree));
++static bool gimple_resimplify3 (gimple_seq *, gimple_match_op *, tree (*)(tree));
++static bool gimple_resimplify4 (gimple_seq *, gimple_match_op *, tree (*)(tree));
++static bool gimple_resimplify5 (gimple_seq *, gimple_match_op *, tree (*)(tree));
++
++/* Match and simplify the toplevel valueized operation THIS.
++ Replaces THIS with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++bool
++gimple_match_op::resimplify (gimple_seq *seq, tree (*valueize)(tree))
++{
++ switch (num_ops)
++ {
++ case 1:
++ return gimple_resimplify1 (seq, this, valueize);
++ case 2:
++ return gimple_resimplify2 (seq, this, valueize);
++ case 3:
++ return gimple_resimplify3 (seq, this, valueize);
++ case 4:
++ return gimple_resimplify4 (seq, this, valueize);
++ case 5:
++ return gimple_resimplify5 (seq, this, valueize);
++ default:
++ gcc_unreachable ();
++ }
++}
++
++/* Return whether T is a constant that we'll dispatch to fold to
++ evaluate fully constant expressions. */
++
++static inline bool
++constant_for_folding (tree t)
++{
++ return (CONSTANT_CLASS_P (t)
++ /* The following is only interesting to string builtins. */
++ || (TREE_CODE (t) == ADDR_EXPR
++ && TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST));
++}
++
++/* Try to convert conditional operation ORIG_OP into an IFN_COND_*
++ operation. Return true on success, storing the new operation in NEW_OP. */
++
++static bool
++convert_conditional_op (gimple_match_op *orig_op,
++ gimple_match_op *new_op)
++{
++ internal_fn ifn;
++ if (orig_op->code.is_tree_code ())
++ ifn = get_conditional_internal_fn ((tree_code) orig_op->code);
++ else
++ {
++ auto cfn = combined_fn (orig_op->code);
++ if (!internal_fn_p (cfn))
++ return false;
++ ifn = get_conditional_internal_fn (as_internal_fn (cfn));
++ }
++ if (ifn == IFN_LAST)
++ return false;
++ unsigned int num_ops = orig_op->num_ops;
++ new_op->set_op (as_combined_fn (ifn), orig_op->type, num_ops + 2);
++ new_op->ops[0] = orig_op->cond.cond;
++ for (unsigned int i = 0; i < num_ops; ++i)
++ new_op->ops[i + 1] = orig_op->ops[i];
++ tree else_value = orig_op->cond.else_value;
++ if (!else_value)
++ else_value = targetm.preferred_else_value (ifn, orig_op->type,
++ num_ops, orig_op->ops);
++ new_op->ops[num_ops + 1] = else_value;
++ return true;
++}
++/* Helper for gimple_simplify valueizing OP using VALUEIZE and setting
++ VALUEIZED to true if valueization changed OP. */
++
++inline tree
++do_valueize (tree op, tree (*valueize)(tree), bool &valueized)
++{
++ if (valueize && TREE_CODE (op) == SSA_NAME)
++ {
++ tree tem = valueize (op);
++ if (tem && tem != op)
++ {
++ op = tem;
++ valueized = true;
++ }
++ }
++ return op;
++}
++
++/* If in GIMPLE the operation described by RES_OP should be single-rhs,
++ build a GENERIC tree for that expression and update RES_OP accordingly. */
++
++void
++maybe_build_generic_op (gimple_match_op *res_op)
++{
++ tree_code code = (tree_code) res_op->code;
++ tree val;
++ switch (code)
++ {
++ case REALPART_EXPR:
++ case IMAGPART_EXPR:
++ case VIEW_CONVERT_EXPR:
++ val = build1 (code, res_op->type, res_op->ops[0]);
++ res_op->set_value (val);
++ break;
++ case BIT_FIELD_REF:
++ val = build3 (code, res_op->type, res_op->ops[0], res_op->ops[1],
++ res_op->ops[2]);
++ REF_REVERSE_STORAGE_ORDER (val) = res_op->reverse;
++ res_op->set_value (val);
++ break;
++ default:;
++ }
++}
++
++/* Try to build RES_OP, which is known to be a call to FN. Return null
++ if the target doesn't support the function. */
++
++static gcall *
++build_call_internal (internal_fn fn, gimple_match_op *res_op)
++{
++ if (direct_internal_fn_p (fn))
++ {
++ tree_pair types = direct_internal_fn_types (fn, res_op->type,
++ res_op->ops);
++ if (!direct_internal_fn_supported_p (fn, types, OPTIMIZE_FOR_BOTH))
++ return NULL;
++ }
++ return gimple_build_call_internal (fn, res_op->num_ops,
++ res_op->op_or_null (0),
++ res_op->op_or_null (1),
++ res_op->op_or_null (2),
++ res_op->op_or_null (3),
++ res_op->op_or_null (4));
++}
++
++/* RES_OP is the result of a simplification. If it is conditional,
++ try to replace it with the equivalent UNCOND form, such as an
++ IFN_COND_* call or a VEC_COND_EXPR. Also try to resimplify the
++ result of the replacement if appropriate, adding any new statements to
++ SEQ and using VALUEIZE as the valueization function. Return true if
++ this resimplification occurred and resulted in at least one change. */
++
++static bool
++maybe_resimplify_conditional_op (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize) (tree))
++{
++ if (!res_op->cond.cond)
++ return false;
++
++ if (!res_op->cond.else_value
++ && res_op->code.is_tree_code ())
++ {
++ /* The "else" value doesn't matter. If the "then" value is a
++ gimple value, just use it unconditionally. This isn't a
++ simplification in itself, since there was no operation to
++ build in the first place. */
++ if (gimple_simplified_result_is_gimple_val (res_op))
++ {
++ res_op->cond.cond = NULL_TREE;
++ return false;
++ }
++
++ /* Likewise if the operation would not trap. */
++ bool honor_trapv = (INTEGRAL_TYPE_P (res_op->type)
++ && TYPE_OVERFLOW_TRAPS (res_op->type));
++ tree_code op_code = (tree_code) res_op->code;
++ bool op_could_trap;
++
++ /* COND_EXPR will trap if, and only if, the condition
++ traps and hence we have to check this. For all other operations, we
++ don't need to consider the operands. */
++ if (op_code == COND_EXPR)
++ op_could_trap = generic_expr_could_trap_p (res_op->ops[0]);
++ else
++ op_could_trap = operation_could_trap_p ((tree_code) res_op->code,
++ FLOAT_TYPE_P (res_op->type),
++ honor_trapv,
++ res_op->op_or_null (1));
++
++ if (!op_could_trap)
++ {
++ res_op->cond.cond = NULL_TREE;
++ return false;
++ }
++ }
++
++ /* If the "then" value is a gimple value and the "else" value matters,
++ create a VEC_COND_EXPR between them, then see if it can be further
++ simplified. */
++ gimple_match_op new_op;
++ if (res_op->cond.else_value
++ && VECTOR_TYPE_P (res_op->type)
++ && gimple_simplified_result_is_gimple_val (res_op))
++ {
++ new_op.set_op (VEC_COND_EXPR, res_op->type,
++ res_op->cond.cond, res_op->ops[0],
++ res_op->cond.else_value);
++ *res_op = new_op;
++ return gimple_resimplify3 (seq, res_op, valueize);
++ }
++
++ /* Otherwise try rewriting the operation as an IFN_COND_* call.
++ Again, this isn't a simplification in itself, since it's what
++ RES_OP already described. */
++ if (convert_conditional_op (res_op, &new_op))
++ *res_op = new_op;
++
++ return false;
++}
++
++/* If RES_OP is a call to a conditional internal function, try simplifying
++ the associated unconditional operation and using the result to build
++ a new conditional operation. For example, if RES_OP is:
++
++ IFN_COND_ADD (COND, A, B, ELSE)
++
++ try simplifying (plus A B) and using the result to build a replacement
++ for the whole IFN_COND_ADD.
++
++ Return true if this approach led to a simplification, otherwise leave
++ RES_OP unchanged (and so suitable for other simplifications). When
++ returning true, add any new statements to SEQ and use VALUEIZE as the
++ valueization function.
++
++ RES_OP is known to be a call to IFN. */
++
++static bool
++try_conditional_simplification (internal_fn ifn, gimple_match_op *res_op,
++ gimple_seq *seq, tree (*valueize) (tree))
++{
++ code_helper op;
++ tree_code code = conditional_internal_fn_code (ifn);
++ if (code != ERROR_MARK)
++ op = code;
++ else
++ {
++ ifn = get_unconditional_internal_fn (ifn);
++ if (ifn == IFN_LAST)
++ return false;
++ op = as_combined_fn (ifn);
++ }
++
++ unsigned int num_ops = res_op->num_ops;
++ gimple_match_op cond_op (gimple_match_cond (res_op->ops[0],
++ res_op->ops[num_ops - 1]),
++ op, res_op->type, num_ops - 2);
++
++ memcpy (cond_op.ops, res_op->ops + 1, (num_ops - 1) * sizeof *cond_op.ops);
++ switch (num_ops - 2)
++ {
++ case 1:
++ if (!gimple_resimplify1 (seq, &cond_op, valueize))
++ return false;
++ break;
++ case 2:
++ if (!gimple_resimplify2 (seq, &cond_op, valueize))
++ return false;
++ break;
++ case 3:
++ if (!gimple_resimplify3 (seq, &cond_op, valueize))
++ return false;
++ break;
++ default:
++ gcc_unreachable ();
++ }
++ *res_op = cond_op;
++ maybe_resimplify_conditional_op (seq, res_op, valueize);
++ return true;
++}
++
++/* Helper for the autogenerated code, valueize OP. */
++
++tree
++do_valueize (tree (*valueize)(tree), tree op)
++{
++ if (valueize && TREE_CODE (op) == SSA_NAME)
++ {
++ tree tem = valueize (op);
++ if (tem)
++ return tem;
++ }
++ return op;
++}
++
++/* Push the exploded expression described by RES_OP as a statement to
++ SEQ if necessary and return a gimple value denoting the value of the
++ expression. If RES is not NULL then the result will be always RES
++ and even gimple values are pushed to SEQ. */
++
++tree
++maybe_push_res_to_seq (gimple_match_op *res_op, gimple_seq *seq, tree res)
++{
++ tree *ops = res_op->ops;
++ unsigned num_ops = res_op->num_ops;
++
++ /* The caller should have converted conditional operations into an UNCOND
++ form and resimplified as appropriate. The conditional form only
++ survives this far if that conversion failed. */
++ if (res_op->cond.cond)
++ return NULL_TREE;
++
++ if (res_op->code.is_tree_code ())
++ {
++ if (!res
++ && gimple_simplified_result_is_gimple_val (res_op))
++ return ops[0];
++ if (mprts_hook)
++ {
++ tree tem = mprts_hook (res_op);
++ if (tem)
++ return tem;
++ }
++ }
++
++ if (!seq)
++ return NULL_TREE;
++
++ /* Play safe and do not allow abnormals to be mentioned in
++ newly created statements. */
++ for (unsigned int i = 0; i < num_ops; ++i)
++ if (TREE_CODE (ops[i]) == SSA_NAME
++ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[i]))
++ return NULL_TREE;
++
++ if (num_ops > 0 && COMPARISON_CLASS_P (ops[0]))
++ for (unsigned int i = 0; i < 2; ++i)
++ if (TREE_CODE (TREE_OPERAND (ops[0], i)) == SSA_NAME
++ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], i)))
++ return NULL_TREE;
++
++ if (res_op->code.is_tree_code ())
++ {
++ auto code = tree_code (res_op->code);
++ if (!res)
++ {
++ if (gimple_in_ssa_p (cfun))
++ res = make_ssa_name (res_op->type);
++ else
++ res = create_tmp_reg (res_op->type);
++ }
++ maybe_build_generic_op (res_op);
++ gimple *new_stmt = gimple_build_assign (res, code,
++ res_op->op_or_null (0),
++ res_op->op_or_null (1),
++ res_op->op_or_null (2));
++ gimple_seq_add_stmt_without_update (seq, new_stmt);
++ return res;
++ }
++ else
++ {
++ gcc_assert (num_ops != 0);
++ auto fn = combined_fn (res_op->code);
++ gcall *new_stmt = NULL;
++ if (internal_fn_p (fn))
++ {
++ /* Generate the given function if we can. */
++ internal_fn ifn = as_internal_fn (fn);
++ new_stmt = build_call_internal (ifn, res_op);
++ if (!new_stmt)
++ return NULL_TREE;
++ }
++ else
++ {
++ /* Find the function we want to call. */
++ tree decl = builtin_decl_implicit (as_builtin_fn (fn));
++ if (!decl)
++ return NULL;
++
++ /* We can't and should not emit calls to non-const functions. */
++ if (!(flags_from_decl_or_type (decl) & ECF_CONST))
++ return NULL;
++
++ new_stmt = gimple_build_call (decl, num_ops,
++ res_op->op_or_null (0),
++ res_op->op_or_null (1),
++ res_op->op_or_null (2),
++ res_op->op_or_null (3),
++ res_op->op_or_null (4));
++ }
++ if (!res)
++ {
++ if (gimple_in_ssa_p (cfun))
++ res = make_ssa_name (res_op->type);
++ else
++ res = create_tmp_reg (res_op->type);
++ }
++ gimple_call_set_lhs (new_stmt, res);
++ gimple_seq_add_stmt_without_update (seq, new_stmt);
++ return res;
++ }
++}
++
++
++/* Public API overloads follow for operation being tree_code or
++ built_in_function and for one to three operands or arguments.
++ They return NULL_TREE if nothing could be simplified or
++ the resulting simplified value with parts pushed to SEQ.
++ If SEQ is NULL then if the simplification needs to create
++ new stmts it will fail. If VALUEIZE is non-NULL then all
++ SSA names will be valueized using that hook prior to
++ applying simplifications. */
++
++/* Unary ops. */
++
++tree
++gimple_simplify (enum tree_code code, tree type,
++ tree op0,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (op0))
++ {
++ tree res = const_unop (code, type, op0);
++ if (res != NULL_TREE
++ && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, code, type, op0))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Binary ops. */
++
++tree
++gimple_simplify (enum tree_code code, tree type,
++ tree op0, tree op1,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (op0) && constant_for_folding (op1))
++ {
++ tree res = const_binop (code, type, op0, op1);
++ if (res != NULL_TREE
++ && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ /* Canonicalize operand order both for matching and fallback stmt
++ generation. */
++ if ((commutative_tree_code (code)
++ || TREE_CODE_CLASS (code) == tcc_comparison)
++ && tree_swap_operands_p (op0, op1))
++ {
++ std::swap (op0, op1);
++ if (TREE_CODE_CLASS (code) == tcc_comparison)
++ code = swap_tree_comparison (code);
++ }
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, code, type, op0, op1))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Ternary ops. */
++
++tree
++gimple_simplify (enum tree_code code, tree type,
++ tree op0, tree op1, tree op2,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (op0) && constant_for_folding (op1)
++ && constant_for_folding (op2))
++ {
++ tree res = fold_ternary/*_to_constant */ (code, type, op0, op1, op2);
++ if (res != NULL_TREE
++ && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ /* Canonicalize operand order both for matching and fallback stmt
++ generation. */
++ if (commutative_ternary_tree_code (code)
++ && tree_swap_operands_p (op0, op1))
++ std::swap (op0, op1);
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, code, type, op0, op1, op2))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Builtin or internal function with one argument. */
++
++tree
++gimple_simplify (combined_fn fn, tree type,
++ tree arg0,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (arg0))
++ {
++ tree res = fold_const_call (fn, type, arg0);
++ if (res && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Builtin or internal function with two arguments. */
++
++tree
++gimple_simplify (combined_fn fn, tree type,
++ tree arg0, tree arg1,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (arg0)
++ && constant_for_folding (arg1))
++ {
++ tree res = fold_const_call (fn, type, arg0, arg1);
++ if (res && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0, arg1))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Builtin or internal function with three arguments. */
++
++tree
++gimple_simplify (combined_fn fn, tree type,
++ tree arg0, tree arg1, tree arg2,
++ gimple_seq *seq, tree (*valueize)(tree))
++{
++ if (constant_for_folding (arg0)
++ && constant_for_folding (arg1)
++ && constant_for_folding (arg2))
++ {
++ tree res = fold_const_call (fn, type, arg0, arg1, arg2);
++ if (res && CONSTANT_CLASS_P (res))
++ return res;
++ }
++
++ gimple_match_op res_op;
++ if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0, arg1, arg2))
++ return NULL_TREE;
++ return maybe_push_res_to_seq (&res_op, seq);
++}
++
++/* Common subroutine of gimple_extract_op and gimple_simplify. Try to
++ describe STMT in RES_OP, returning true on success. Before recording
++ an operand, call:
++
++ - VALUEIZE_CONDITION for a COND_EXPR condition
++ - VALUEIZE_OP for every other top-level operand
++
++ Both routines take a tree argument and returns a tree. */
++
++template<typename ValueizeOp, typename ValueizeCondition>
++inline bool
++gimple_extract (gimple *stmt, gimple_match_op *res_op,
++ ValueizeOp valueize_op,
++ ValueizeCondition valueize_condition)
++{
++ switch (gimple_code (stmt))
++ {
++ case GIMPLE_ASSIGN:
++ {
++ enum tree_code code = gimple_assign_rhs_code (stmt);
++ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
++ switch (gimple_assign_rhs_class (stmt))
++ {
++ case GIMPLE_SINGLE_RHS:
++ if (code == REALPART_EXPR
++ || code == IMAGPART_EXPR
++ || code == VIEW_CONVERT_EXPR)
++ {
++ tree op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
++ res_op->set_op (code, type, valueize_op (op0));
++ return true;
++ }
++ else if (code == BIT_FIELD_REF)
++ {
++ tree rhs1 = gimple_assign_rhs1 (stmt);
++ tree op0 = valueize_op (TREE_OPERAND (rhs1, 0));
++ res_op->set_op (code, type, op0,
++ TREE_OPERAND (rhs1, 1),
++ TREE_OPERAND (rhs1, 2),
++ REF_REVERSE_STORAGE_ORDER (rhs1));
++ return true;
++ }
++ else if (code == SSA_NAME)
++ {
++ tree op0 = gimple_assign_rhs1 (stmt);
++ res_op->set_op (TREE_CODE (op0), type, valueize_op (op0));
++ return true;
++ }
++ break;
++ case GIMPLE_UNARY_RHS:
++ {
++ tree rhs1 = gimple_assign_rhs1 (stmt);
++ res_op->set_op (code, type, valueize_op (rhs1));
++ return true;
++ }
++ case GIMPLE_BINARY_RHS:
++ {
++ tree rhs1 = valueize_op (gimple_assign_rhs1 (stmt));
++ tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt));
++ res_op->set_op (code, type, rhs1, rhs2);
++ return true;
++ }
++ case GIMPLE_TERNARY_RHS:
++ {
++ tree rhs1 = gimple_assign_rhs1 (stmt);
++ if (code == COND_EXPR && COMPARISON_CLASS_P (rhs1))
++ rhs1 = valueize_condition (rhs1);
++ else
++ rhs1 = valueize_op (rhs1);
++ tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt));
++ tree rhs3 = valueize_op (gimple_assign_rhs3 (stmt));
++ res_op->set_op (code, type, rhs1, rhs2, rhs3);
++ return true;
++ }
++ default:
++ gcc_unreachable ();
++ }
++ break;
++ }
++
++ case GIMPLE_CALL:
++ /* ??? This way we can't simplify calls with side-effects. */
++ if (gimple_call_lhs (stmt) != NULL_TREE
++ && gimple_call_num_args (stmt) >= 1
++ && gimple_call_num_args (stmt) <= 5)
++ {
++ combined_fn cfn;
++ if (gimple_call_internal_p (stmt))
++ cfn = as_combined_fn (gimple_call_internal_fn (stmt));
++ else
++ {
++ tree fn = gimple_call_fn (stmt);
++ if (!fn)
++ return false;
++
++ fn = valueize_op (fn);
++ if (TREE_CODE (fn) != ADDR_EXPR
++ || TREE_CODE (TREE_OPERAND (fn, 0)) != FUNCTION_DECL)
++ return false;
++
++ tree decl = TREE_OPERAND (fn, 0);
++ if (DECL_BUILT_IN_CLASS (decl) != BUILT_IN_NORMAL
++ || !gimple_builtin_call_types_compatible_p (stmt, decl))
++ return false;
++
++ cfn = as_combined_fn (DECL_FUNCTION_CODE (decl));
++ }
++
++ unsigned int num_args = gimple_call_num_args (stmt);
++ res_op->set_op (cfn, TREE_TYPE (gimple_call_lhs (stmt)), num_args);
++ for (unsigned i = 0; i < num_args; ++i)
++ res_op->ops[i] = valueize_op (gimple_call_arg (stmt, i));
++ return true;
++ }
++ break;
++
++ case GIMPLE_COND:
++ {
++ tree lhs = valueize_op (gimple_cond_lhs (stmt));
++ tree rhs = valueize_op (gimple_cond_rhs (stmt));
++ res_op->set_op (gimple_cond_code (stmt), boolean_type_node, lhs, rhs);
++ return true;
++ }
++
++ default:
++ break;
++ }
++
++ return false;
++}
++
++/* Try to describe STMT in RES_OP, returning true on success.
++ For GIMPLE_CONDs, describe the condition that is being tested.
++ For GIMPLE_ASSIGNs, describe the rhs of the assignment.
++ For GIMPLE_CALLs, describe the call. */
++
++bool
++gimple_extract_op (gimple *stmt, gimple_match_op *res_op)
++{
++ auto nop = [](tree op) { return op; };
++ return gimple_extract (stmt, res_op, nop, nop);
++}
++
++/* The main STMT based simplification entry. It is used by the fold_stmt
++ and the fold_stmt_to_constant APIs. */
++
++bool
++gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq,
++ tree (*valueize)(tree), tree (*top_valueize)(tree))
++{
++ bool valueized = false;
++ auto valueize_op = [&](tree op)
++ {
++ return do_valueize (op, top_valueize, valueized);
++ };
++ auto valueize_condition = [&](tree op) -> tree
++ {
++ bool cond_valueized = false;
++ tree lhs = do_valueize (TREE_OPERAND (op, 0), top_valueize,
++ cond_valueized);
++ tree rhs = do_valueize (TREE_OPERAND (op, 1), top_valueize,
++ cond_valueized);
++ gimple_match_op res_op2 (res_op->cond, TREE_CODE (op),
++ TREE_TYPE (op), lhs, rhs);
++ if ((gimple_resimplify2 (seq, &res_op2, valueize)
++ || cond_valueized)
++ && res_op2.code.is_tree_code ())
++ {
++ auto code = tree_code (res_op2.code);
++ if (TREE_CODE_CLASS (code) == tcc_comparison)
++ {
++ valueized = true;
++ return build2 (code, TREE_TYPE (op),
++ res_op2.ops[0], res_op2.ops[1]);
++ }
++ else if (code == SSA_NAME
++ || code == INTEGER_CST
++ || code == VECTOR_CST)
++ {
++ valueized = true;
++ return res_op2.ops[0];
++ }
++ }
++ return valueize_op (op);
++ };
++
++ if (!gimple_extract (stmt, res_op, valueize_op, valueize_condition))
++ return false;
++
++ if (res_op->code.is_internal_fn ())
++ {
++ internal_fn ifn = internal_fn (res_op->code);
++ if (try_conditional_simplification (ifn, res_op, seq, valueize))
++ return true;
++ }
++
++ if (!res_op->reverse
++ && res_op->num_ops
++ && res_op->resimplify (seq, valueize))
++ return true;
++
++ return valueized;
++}
++
++/* Helper that matches and simplifies the toplevel result from
++ a gimple_simplify run (where we don't want to build
++ a stmt in case it's used in in-place folding). Replaces
++ RES_OP with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++static bool
++gimple_resimplify1 (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize)(tree))
++{
++ if (constant_for_folding (res_op->ops[0]))
++ {
++ tree tem = NULL_TREE;
++ if (res_op->code.is_tree_code ())
++ {
++ auto code = tree_code (res_op->code);
++ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
++ && TREE_CODE_LENGTH (code) == 1)
++ tem = const_unop (code, res_op->type, res_op->ops[0]);
++ }
++ else
++ tem = fold_const_call (combined_fn (res_op->code), res_op->type,
++ res_op->ops[0]);
++ if (tem != NULL_TREE
++ && CONSTANT_CLASS_P (tem))
++ {
++ if (TREE_OVERFLOW_P (tem))
++ tem = drop_tree_overflow (tem);
++ res_op->set_value (tem);
++ maybe_resimplify_conditional_op (seq, res_op, valueize);
++ return true;
++ }
++ }
++
++ /* Limit recursion, there are cases like PR80887 and others, for
++ example when value-numbering presents us with unfolded expressions
++ that we are really not prepared to handle without eventual
++ oscillation like ((_50 + 0) + 8) where _50 gets mapped to _50
++ itself as available expression. */
++ static unsigned depth;
++ if (depth > 10)
++ {
++ if (dump_file && (dump_flags & TDF_FOLDING))
++ fprintf (dump_file, "Aborting expression simplification due to "
++ "deep recursion\n");
++ return false;
++ }
++
++ ++depth;
++ gimple_match_op res_op2 (*res_op);
++ if (gimple_simplify (&res_op2, seq, valueize,
++ res_op->code, res_op->type, res_op->ops[0]))
++ {
++ --depth;
++ *res_op = res_op2;
++ return true;
++ }
++ --depth;
++
++ if (maybe_resimplify_conditional_op (seq, res_op, valueize))
++ return true;
++
++ return false;
++}
++
++/* Helper that matches and simplifies the toplevel result from
++ a gimple_simplify run (where we don't want to build
++ a stmt in case it's used in in-place folding). Replaces
++ RES_OP with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++static bool
++gimple_resimplify2 (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize)(tree))
++{
++ if (constant_for_folding (res_op->ops[0])
++ && constant_for_folding (res_op->ops[1]))
++ {
++ tree tem = NULL_TREE;
++ if (res_op->code.is_tree_code ())
++ {
++ auto code = tree_code (res_op->code);
++ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
++ && TREE_CODE_LENGTH (code) == 2)
++ tem = const_binop (code, res_op->type,
++ res_op->ops[0], res_op->ops[1]);
++ }
++ else
++ tem = fold_const_call (combined_fn (res_op->code), res_op->type,
++ res_op->ops[0], res_op->ops[1]);
++ if (tem != NULL_TREE
++ && CONSTANT_CLASS_P (tem))
++ {
++ if (TREE_OVERFLOW_P (tem))
++ tem = drop_tree_overflow (tem);
++ res_op->set_value (tem);
++ maybe_resimplify_conditional_op (seq, res_op, valueize);
++ return true;
++ }
++ }
++
++ /* Canonicalize operand order. */
++ bool canonicalized = false;
++ bool is_comparison
++ = (res_op->code.is_tree_code ()
++ && TREE_CODE_CLASS (tree_code (res_op->code)) == tcc_comparison);
++ if ((is_comparison || commutative_binary_op_p (res_op->code, res_op->type))
++ && tree_swap_operands_p (res_op->ops[0], res_op->ops[1]))
++ {
++ std::swap (res_op->ops[0], res_op->ops[1]);
++ if (is_comparison)
++ res_op->code = swap_tree_comparison (tree_code (res_op->code));
++ canonicalized = true;
++ }
++
++ /* Limit recursion, see gimple_resimplify1. */
++ static unsigned depth;
++ if (depth > 10)
++ {
++ if (dump_file && (dump_flags & TDF_FOLDING))
++ fprintf (dump_file, "Aborting expression simplification due to "
++ "deep recursion\n");
++ return false;
++ }
++
++ ++depth;
++ gimple_match_op res_op2 (*res_op);
++ if (gimple_simplify (&res_op2, seq, valueize,
++ res_op->code, res_op->type,
++ res_op->ops[0], res_op->ops[1]))
++ {
++ --depth;
++ *res_op = res_op2;
++ return true;
++ }
++ --depth;
++
++ if (maybe_resimplify_conditional_op (seq, res_op, valueize))
++ return true;
++
++ return canonicalized;
++}
++
++/* Helper that matches and simplifies the toplevel result from
++ a gimple_simplify run (where we don't want to build
++ a stmt in case it's used in in-place folding). Replaces
++ RES_OP with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++static bool
++gimple_resimplify3 (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize)(tree))
++{
++ if (constant_for_folding (res_op->ops[0])
++ && constant_for_folding (res_op->ops[1])
++ && constant_for_folding (res_op->ops[2]))
++ {
++ tree tem = NULL_TREE;
++ if (res_op->code.is_tree_code ())
++ {
++ auto code = tree_code (res_op->code);
++ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
++ && TREE_CODE_LENGTH (code) == 3)
++ tem = fold_ternary/*_to_constant*/ (code, res_op->type,
++ res_op->ops[0], res_op->ops[1],
++ res_op->ops[2]);
++ }
++ else
++ tem = fold_const_call (combined_fn (res_op->code), res_op->type,
++ res_op->ops[0], res_op->ops[1], res_op->ops[2]);
++ if (tem != NULL_TREE
++ && CONSTANT_CLASS_P (tem))
++ {
++ if (TREE_OVERFLOW_P (tem))
++ tem = drop_tree_overflow (tem);
++ res_op->set_value (tem);
++ maybe_resimplify_conditional_op (seq, res_op, valueize);
++ return true;
++ }
++ }
++
++ /* Canonicalize operand order. */
++ bool canonicalized = false;
++ int argno = first_commutative_argument (res_op->code, res_op->type);
++ if (argno >= 0
++ && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
++ {
++ std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
++ canonicalized = true;
++ }
++
++ /* Limit recursion, see gimple_resimplify1. */
++ static unsigned depth;
++ if (depth > 10)
++ {
++ if (dump_file && (dump_flags & TDF_FOLDING))
++ fprintf (dump_file, "Aborting expression simplification due to "
++ "deep recursion\n");
++ return false;
++ }
++
++ ++depth;
++ gimple_match_op res_op2 (*res_op);
++ if (gimple_simplify (&res_op2, seq, valueize,
++ res_op->code, res_op->type,
++ res_op->ops[0], res_op->ops[1], res_op->ops[2]))
++ {
++ --depth;
++ *res_op = res_op2;
++ return true;
++ }
++ --depth;
++
++ if (maybe_resimplify_conditional_op (seq, res_op, valueize))
++ return true;
++
++ return canonicalized;
++}
++
++/* Helper that matches and simplifies the toplevel result from
++ a gimple_simplify run (where we don't want to build
++ a stmt in case it's used in in-place folding). Replaces
++ RES_OP with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++static bool
++gimple_resimplify4 (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize)(tree))
++{
++ /* No constant folding is defined for four-operand functions. */
++
++ /* Canonicalize operand order. */
++ bool canonicalized = false;
++ int argno = first_commutative_argument (res_op->code, res_op->type);
++ if (argno >= 0
++ && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
++ {
++ std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
++ canonicalized = true;
++ }
++
++ /* Limit recursion, see gimple_resimplify1. */
++ static unsigned depth;
++ if (depth > 10)
++ {
++ if (dump_file && (dump_flags & TDF_FOLDING))
++ fprintf (dump_file, "Aborting expression simplification due to "
++ "deep recursion\n");
++ return false;
++ }
++
++ ++depth;
++ gimple_match_op res_op2 (*res_op);
++ if (gimple_simplify (&res_op2, seq, valueize,
++ res_op->code, res_op->type,
++ res_op->ops[0], res_op->ops[1], res_op->ops[2],
++ res_op->ops[3]))
++ {
++ --depth;
++ *res_op = res_op2;
++ return true;
++ }
++ --depth;
++
++ if (maybe_resimplify_conditional_op (seq, res_op, valueize))
++ return true;
++
++ return canonicalized;
++}
++
++/* Helper that matches and simplifies the toplevel result from
++ a gimple_simplify run (where we don't want to build
++ a stmt in case it's used in in-place folding). Replaces
++ RES_OP with a simplified and/or canonicalized result and
++ returns whether any change was made. */
++
++static bool
++gimple_resimplify5 (gimple_seq *seq, gimple_match_op *res_op,
++ tree (*valueize)(tree))
++{
++ /* No constant folding is defined for five-operand functions. */
++
++ /* Canonicalize operand order. */
++ bool canonicalized = false;
++ int argno = first_commutative_argument (res_op->code, res_op->type);
++ if (argno >= 0
++ && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
++ {
++ std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
++ canonicalized = true;
++ }
++
++ gimple_match_op res_op2 (*res_op);
++ if (gimple_simplify (&res_op2, seq, valueize,
++ res_op->code, res_op->type,
++ res_op->ops[0], res_op->ops[1], res_op->ops[2],
++ res_op->ops[3], res_op->ops[4]))
++ {
++ *res_op = res_op2;
++ return true;
++ }
++
++ if (maybe_resimplify_conditional_op (seq, res_op, valueize))
++ return true;
++
++ return canonicalized;
++}
++
++/* Return a canonical form for CODE when operating on TYPE. The idea
++ is to remove redundant ways of representing the same operation so
++ that code_helpers can be hashed and compared for equality.
++
++ The only current canonicalization is to replace built-in functions
++ with internal functions, in cases where internal-fn.def defines
++ such an internal function.
++
++ Note that the new code_helper cannot necessarily be used in place of
++ the original code_helper. For example, the new code_helper might be
++ an internal function that the target does not support. */
++
++code_helper
++canonicalize_code (code_helper code, tree type)
++{
++ if (code.is_fn_code ())
++ return associated_internal_fn (combined_fn (code), type);
++ return code;
++}
++
++/* Return true if CODE is a binary operation and if CODE is commutative when
++ operating on type TYPE. */
++
++bool
++commutative_binary_op_p (code_helper code, tree type)
++{
++ if (code.is_tree_code ())
++ return commutative_tree_code (tree_code (code));
++ auto cfn = combined_fn (code);
++ return commutative_binary_fn_p (associated_internal_fn (cfn, type));
++}
++
++/* Return true if CODE represents a ternary operation and if the first two
++ operands are commutative when CODE is operating on TYPE. */
++
++bool
++commutative_ternary_op_p (code_helper code, tree type)
++{
++ if (code.is_tree_code ())
++ return commutative_ternary_tree_code (tree_code (code));
++ auto cfn = combined_fn (code);
++ return commutative_ternary_fn_p (associated_internal_fn (cfn, type));
++}
++
++/* If CODE is commutative in two consecutive operands, return the
++ index of the first, otherwise return -1. */
++
++int
++first_commutative_argument (code_helper code, tree type)
++{
++ if (code.is_tree_code ())
++ {
++ auto tcode = tree_code (code);
++ if (commutative_tree_code (tcode)
++ || commutative_ternary_tree_code (tcode))
++ return 0;
++ return -1;
++ }
++ auto cfn = combined_fn (code);
++ return first_commutative_argument (associated_internal_fn (cfn, type));
++}
++
++/* Return true if CODE is a binary operation that is associative when
++ operating on type TYPE. */
++
++bool
++associative_binary_op_p (code_helper code, tree type)
++{
++ if (code.is_tree_code ())
++ return associative_tree_code (tree_code (code));
++ auto cfn = combined_fn (code);
++ return associative_binary_fn_p (associated_internal_fn (cfn, type));
++}
++
++/* Return true if the target directly supports operation CODE on type TYPE.
++ QUERY_TYPE acts as for optab_for_tree_code. */
++
++bool
++directly_supported_p (code_helper code, tree type, optab_subtype query_type)
++{
++ if (code.is_tree_code ())
++ {
++ direct_optab optab = optab_for_tree_code (tree_code (code), type,
++ query_type);
++ return (optab != unknown_optab
++ && optab_handler (optab, TYPE_MODE (type)) != CODE_FOR_nothing);
++ }
++ gcc_assert (query_type == optab_default
++ || (query_type == optab_vector && VECTOR_TYPE_P (type))
++ || (query_type == optab_scalar && !VECTOR_TYPE_P (type)));
++ internal_fn ifn = associated_internal_fn (combined_fn (code), type);
++ return (direct_internal_fn_p (ifn)
++ && direct_internal_fn_supported_p (ifn, type, OPTIMIZE_FOR_SPEED));
++}
++
++/* A wrapper around the internal-fn.cc versions of get_conditional_internal_fn
++ for a code_helper CODE operating on type TYPE. */
++
++internal_fn
++get_conditional_internal_fn (code_helper code, tree type)
++{
++ if (code.is_tree_code ())
++ return get_conditional_internal_fn (tree_code (code));
++ auto cfn = combined_fn (code);
++ return get_conditional_internal_fn (associated_internal_fn (cfn, type));
++}
+diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc
+index ec603f9d043..b08cd891a13 100644
+--- a/gcc/gimple-match-head.cc
++++ b/gcc/gimple-match-head.cc
+@@ -48,1089 +48,8 @@ along with GCC; see the file COPYING3. If not see
+ #include "gimple-range.h"
+ #include "langhooks.h"
+
+-/* Forward declarations of the private auto-generated matchers.
+- They expect valueized operands in canonical order and do not
+- perform simplification of all-constant operands. */
+-static bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
+- code_helper, tree, tree);
+-static bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
+- code_helper, tree, tree, tree);
+-static bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
+- code_helper, tree, tree, tree, tree);
+-static bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
+- code_helper, tree, tree, tree, tree, tree);
+-static bool gimple_simplify (gimple_match_op *, gimple_seq *, tree (*)(tree),
+- code_helper, tree, tree, tree, tree, tree, tree);
+-static bool gimple_resimplify1 (gimple_seq *, gimple_match_op *,
+- tree (*)(tree));
+-static bool gimple_resimplify2 (gimple_seq *, gimple_match_op *,
+- tree (*)(tree));
+-static bool gimple_resimplify3 (gimple_seq *, gimple_match_op *,
+- tree (*)(tree));
+-static bool gimple_resimplify4 (gimple_seq *, gimple_match_op *,
+- tree (*)(tree));
+-static bool gimple_resimplify5 (gimple_seq *, gimple_match_op *,
+- tree (*)(tree));
+-
+-const unsigned int gimple_match_op::MAX_NUM_OPS;
+-
+-/* Return whether T is a constant that we'll dispatch to fold to
+- evaluate fully constant expressions. */
+-
+-static inline bool
+-constant_for_folding (tree t)
+-{
+- return (CONSTANT_CLASS_P (t)
+- /* The following is only interesting to string builtins. */
+- || (TREE_CODE (t) == ADDR_EXPR
+- && TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST));
+-}
+-
+-/* Try to convert conditional operation ORIG_OP into an IFN_COND_*
+- operation. Return true on success, storing the new operation in NEW_OP. */
+-
+-static bool
+-convert_conditional_op (gimple_match_op *orig_op,
+- gimple_match_op *new_op)
+-{
+- internal_fn ifn;
+- if (orig_op->code.is_tree_code ())
+- ifn = get_conditional_internal_fn ((tree_code) orig_op->code);
+- else
+- {
+- auto cfn = combined_fn (orig_op->code);
+- if (!internal_fn_p (cfn))
+- return false;
+- ifn = get_conditional_internal_fn (as_internal_fn (cfn));
+- }
+- if (ifn == IFN_LAST)
+- return false;
+- unsigned int num_ops = orig_op->num_ops;
+- new_op->set_op (as_combined_fn (ifn), orig_op->type, num_ops + 2);
+- new_op->ops[0] = orig_op->cond.cond;
+- for (unsigned int i = 0; i < num_ops; ++i)
+- new_op->ops[i + 1] = orig_op->ops[i];
+- tree else_value = orig_op->cond.else_value;
+- if (!else_value)
+- else_value = targetm.preferred_else_value (ifn, orig_op->type,
+- num_ops, orig_op->ops);
+- new_op->ops[num_ops + 1] = else_value;
+- return true;
+-}
+-
+-/* RES_OP is the result of a simplification. If it is conditional,
+- try to replace it with the equivalent UNCOND form, such as an
+- IFN_COND_* call or a VEC_COND_EXPR. Also try to resimplify the
+- result of the replacement if appropriate, adding any new statements to
+- SEQ and using VALUEIZE as the valueization function. Return true if
+- this resimplification occurred and resulted in at least one change. */
+-
+-static bool
+-maybe_resimplify_conditional_op (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize) (tree))
+-{
+- if (!res_op->cond.cond)
+- return false;
+-
+- if (!res_op->cond.else_value
+- && res_op->code.is_tree_code ())
+- {
+- /* The "else" value doesn't matter. If the "then" value is a
+- gimple value, just use it unconditionally. This isn't a
+- simplification in itself, since there was no operation to
+- build in the first place. */
+- if (gimple_simplified_result_is_gimple_val (res_op))
+- {
+- res_op->cond.cond = NULL_TREE;
+- return false;
+- }
+-
+- /* Likewise if the operation would not trap. */
+- bool honor_trapv = (INTEGRAL_TYPE_P (res_op->type)
+- && TYPE_OVERFLOW_TRAPS (res_op->type));
+- tree_code op_code = (tree_code) res_op->code;
+- bool op_could_trap;
+-
+- /* COND_EXPR will trap if, and only if, the condition
+- traps and hence we have to check this. For all other operations, we
+- don't need to consider the operands. */
+- if (op_code == COND_EXPR)
+- op_could_trap = generic_expr_could_trap_p (res_op->ops[0]);
+- else
+- op_could_trap = operation_could_trap_p ((tree_code) res_op->code,
+- FLOAT_TYPE_P (res_op->type),
+- honor_trapv,
+- res_op->op_or_null (1));
+-
+- if (!op_could_trap)
+- {
+- res_op->cond.cond = NULL_TREE;
+- return false;
+- }
+- }
+-
+- /* If the "then" value is a gimple value and the "else" value matters,
+- create a VEC_COND_EXPR between them, then see if it can be further
+- simplified. */
+- gimple_match_op new_op;
+- if (res_op->cond.else_value
+- && VECTOR_TYPE_P (res_op->type)
+- && gimple_simplified_result_is_gimple_val (res_op))
+- {
+- new_op.set_op (VEC_COND_EXPR, res_op->type,
+- res_op->cond.cond, res_op->ops[0],
+- res_op->cond.else_value);
+- *res_op = new_op;
+- return gimple_resimplify3 (seq, res_op, valueize);
+- }
+-
+- /* Otherwise try rewriting the operation as an IFN_COND_* call.
+- Again, this isn't a simplification in itself, since it's what
+- RES_OP already described. */
+- if (convert_conditional_op (res_op, &new_op))
+- *res_op = new_op;
+-
+- return false;
+-}
+-
+-/* Helper that matches and simplifies the toplevel result from
+- a gimple_simplify run (where we don't want to build
+- a stmt in case it's used in in-place folding). Replaces
+- RES_OP with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-static bool
+-gimple_resimplify1 (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize)(tree))
+-{
+- if (constant_for_folding (res_op->ops[0]))
+- {
+- tree tem = NULL_TREE;
+- if (res_op->code.is_tree_code ())
+- {
+- auto code = tree_code (res_op->code);
+- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+- && TREE_CODE_LENGTH (code) == 1)
+- tem = const_unop (code, res_op->type, res_op->ops[0]);
+- }
+- else
+- tem = fold_const_call (combined_fn (res_op->code), res_op->type,
+- res_op->ops[0]);
+- if (tem != NULL_TREE
+- && CONSTANT_CLASS_P (tem))
+- {
+- if (TREE_OVERFLOW_P (tem))
+- tem = drop_tree_overflow (tem);
+- res_op->set_value (tem);
+- maybe_resimplify_conditional_op (seq, res_op, valueize);
+- return true;
+- }
+- }
+-
+- /* Limit recursion, there are cases like PR80887 and others, for
+- example when value-numbering presents us with unfolded expressions
+- that we are really not prepared to handle without eventual
+- oscillation like ((_50 + 0) + 8) where _50 gets mapped to _50
+- itself as available expression. */
+- static unsigned depth;
+- if (depth > 10)
+- {
+- if (dump_file && (dump_flags & TDF_FOLDING))
+- fprintf (dump_file, "Aborting expression simplification due to "
+- "deep recursion\n");
+- return false;
+- }
+-
+- ++depth;
+- gimple_match_op res_op2 (*res_op);
+- if (gimple_simplify (&res_op2, seq, valueize,
+- res_op->code, res_op->type, res_op->ops[0]))
+- {
+- --depth;
+- *res_op = res_op2;
+- return true;
+- }
+- --depth;
+-
+- if (maybe_resimplify_conditional_op (seq, res_op, valueize))
+- return true;
+-
+- return false;
+-}
+-
+-/* Helper that matches and simplifies the toplevel result from
+- a gimple_simplify run (where we don't want to build
+- a stmt in case it's used in in-place folding). Replaces
+- RES_OP with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-static bool
+-gimple_resimplify2 (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize)(tree))
+-{
+- if (constant_for_folding (res_op->ops[0])
+- && constant_for_folding (res_op->ops[1]))
+- {
+- tree tem = NULL_TREE;
+- if (res_op->code.is_tree_code ())
+- {
+- auto code = tree_code (res_op->code);
+- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+- && TREE_CODE_LENGTH (code) == 2)
+- tem = const_binop (code, res_op->type,
+- res_op->ops[0], res_op->ops[1]);
+- }
+- else
+- tem = fold_const_call (combined_fn (res_op->code), res_op->type,
+- res_op->ops[0], res_op->ops[1]);
+- if (tem != NULL_TREE
+- && CONSTANT_CLASS_P (tem))
+- {
+- if (TREE_OVERFLOW_P (tem))
+- tem = drop_tree_overflow (tem);
+- res_op->set_value (tem);
+- maybe_resimplify_conditional_op (seq, res_op, valueize);
+- return true;
+- }
+- }
+-
+- /* Canonicalize operand order. */
+- bool canonicalized = false;
+- bool is_comparison
+- = (res_op->code.is_tree_code ()
+- && TREE_CODE_CLASS (tree_code (res_op->code)) == tcc_comparison);
+- if ((is_comparison || commutative_binary_op_p (res_op->code, res_op->type))
+- && tree_swap_operands_p (res_op->ops[0], res_op->ops[1]))
+- {
+- std::swap (res_op->ops[0], res_op->ops[1]);
+- if (is_comparison)
+- res_op->code = swap_tree_comparison (tree_code (res_op->code));
+- canonicalized = true;
+- }
+-
+- /* Limit recursion, see gimple_resimplify1. */
+- static unsigned depth;
+- if (depth > 10)
+- {
+- if (dump_file && (dump_flags & TDF_FOLDING))
+- fprintf (dump_file, "Aborting expression simplification due to "
+- "deep recursion\n");
+- return false;
+- }
+-
+- ++depth;
+- gimple_match_op res_op2 (*res_op);
+- if (gimple_simplify (&res_op2, seq, valueize,
+- res_op->code, res_op->type,
+- res_op->ops[0], res_op->ops[1]))
+- {
+- --depth;
+- *res_op = res_op2;
+- return true;
+- }
+- --depth;
+-
+- if (maybe_resimplify_conditional_op (seq, res_op, valueize))
+- return true;
+-
+- return canonicalized;
+-}
+-
+-/* Helper that matches and simplifies the toplevel result from
+- a gimple_simplify run (where we don't want to build
+- a stmt in case it's used in in-place folding). Replaces
+- RES_OP with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-static bool
+-gimple_resimplify3 (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize)(tree))
+-{
+- if (constant_for_folding (res_op->ops[0])
+- && constant_for_folding (res_op->ops[1])
+- && constant_for_folding (res_op->ops[2]))
+- {
+- tree tem = NULL_TREE;
+- if (res_op->code.is_tree_code ())
+- {
+- auto code = tree_code (res_op->code);
+- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+- && TREE_CODE_LENGTH (code) == 3)
+- tem = fold_ternary/*_to_constant*/ (code, res_op->type,
+- res_op->ops[0], res_op->ops[1],
+- res_op->ops[2]);
+- }
+- else
+- tem = fold_const_call (combined_fn (res_op->code), res_op->type,
+- res_op->ops[0], res_op->ops[1], res_op->ops[2]);
+- if (tem != NULL_TREE
+- && CONSTANT_CLASS_P (tem))
+- {
+- if (TREE_OVERFLOW_P (tem))
+- tem = drop_tree_overflow (tem);
+- res_op->set_value (tem);
+- maybe_resimplify_conditional_op (seq, res_op, valueize);
+- return true;
+- }
+- }
+-
+- /* Canonicalize operand order. */
+- bool canonicalized = false;
+- int argno = first_commutative_argument (res_op->code, res_op->type);
+- if (argno >= 0
+- && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
+- {
+- std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
+- canonicalized = true;
+- }
+-
+- /* Limit recursion, see gimple_resimplify1. */
+- static unsigned depth;
+- if (depth > 10)
+- {
+- if (dump_file && (dump_flags & TDF_FOLDING))
+- fprintf (dump_file, "Aborting expression simplification due to "
+- "deep recursion\n");
+- return false;
+- }
+-
+- ++depth;
+- gimple_match_op res_op2 (*res_op);
+- if (gimple_simplify (&res_op2, seq, valueize,
+- res_op->code, res_op->type,
+- res_op->ops[0], res_op->ops[1], res_op->ops[2]))
+- {
+- --depth;
+- *res_op = res_op2;
+- return true;
+- }
+- --depth;
+-
+- if (maybe_resimplify_conditional_op (seq, res_op, valueize))
+- return true;
+-
+- return canonicalized;
+-}
+-
+-/* Helper that matches and simplifies the toplevel result from
+- a gimple_simplify run (where we don't want to build
+- a stmt in case it's used in in-place folding). Replaces
+- RES_OP with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-static bool
+-gimple_resimplify4 (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize)(tree))
+-{
+- /* No constant folding is defined for four-operand functions. */
+-
+- /* Canonicalize operand order. */
+- bool canonicalized = false;
+- int argno = first_commutative_argument (res_op->code, res_op->type);
+- if (argno >= 0
+- && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
+- {
+- std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
+- canonicalized = true;
+- }
+-
+- /* Limit recursion, see gimple_resimplify1. */
+- static unsigned depth;
+- if (depth > 10)
+- {
+- if (dump_file && (dump_flags & TDF_FOLDING))
+- fprintf (dump_file, "Aborting expression simplification due to "
+- "deep recursion\n");
+- return false;
+- }
+-
+- ++depth;
+- gimple_match_op res_op2 (*res_op);
+- if (gimple_simplify (&res_op2, seq, valueize,
+- res_op->code, res_op->type,
+- res_op->ops[0], res_op->ops[1], res_op->ops[2],
+- res_op->ops[3]))
+- {
+- --depth;
+- *res_op = res_op2;
+- return true;
+- }
+- --depth;
+-
+- if (maybe_resimplify_conditional_op (seq, res_op, valueize))
+- return true;
+-
+- return canonicalized;
+-}
+-
+-/* Helper that matches and simplifies the toplevel result from
+- a gimple_simplify run (where we don't want to build
+- a stmt in case it's used in in-place folding). Replaces
+- RES_OP with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-static bool
+-gimple_resimplify5 (gimple_seq *seq, gimple_match_op *res_op,
+- tree (*valueize)(tree))
+-{
+- /* No constant folding is defined for five-operand functions. */
+-
+- /* Canonicalize operand order. */
+- bool canonicalized = false;
+- int argno = first_commutative_argument (res_op->code, res_op->type);
+- if (argno >= 0
+- && tree_swap_operands_p (res_op->ops[argno], res_op->ops[argno + 1]))
+- {
+- std::swap (res_op->ops[argno], res_op->ops[argno + 1]);
+- canonicalized = true;
+- }
+-
+- gimple_match_op res_op2 (*res_op);
+- if (gimple_simplify (&res_op2, seq, valueize,
+- res_op->code, res_op->type,
+- res_op->ops[0], res_op->ops[1], res_op->ops[2],
+- res_op->ops[3], res_op->ops[4]))
+- {
+- *res_op = res_op2;
+- return true;
+- }
+-
+- if (maybe_resimplify_conditional_op (seq, res_op, valueize))
+- return true;
+-
+- return canonicalized;
+-}
+-
+-/* Match and simplify the toplevel valueized operation THIS.
+- Replaces THIS with a simplified and/or canonicalized result and
+- returns whether any change was made. */
+-
+-bool
+-gimple_match_op::resimplify (gimple_seq *seq, tree (*valueize)(tree))
+-{
+- switch (num_ops)
+- {
+- case 1:
+- return gimple_resimplify1 (seq, this, valueize);
+- case 2:
+- return gimple_resimplify2 (seq, this, valueize);
+- case 3:
+- return gimple_resimplify3 (seq, this, valueize);
+- case 4:
+- return gimple_resimplify4 (seq, this, valueize);
+- case 5:
+- return gimple_resimplify5 (seq, this, valueize);
+- default:
+- gcc_unreachable ();
+- }
+-}
+-
+-/* If in GIMPLE the operation described by RES_OP should be single-rhs,
+- build a GENERIC tree for that expression and update RES_OP accordingly. */
+-
+-void
+-maybe_build_generic_op (gimple_match_op *res_op)
+-{
+- tree_code code = (tree_code) res_op->code;
+- tree val;
+- switch (code)
+- {
+- case REALPART_EXPR:
+- case IMAGPART_EXPR:
+- case VIEW_CONVERT_EXPR:
+- val = build1 (code, res_op->type, res_op->ops[0]);
+- res_op->set_value (val);
+- break;
+- case BIT_FIELD_REF:
+- val = build3 (code, res_op->type, res_op->ops[0], res_op->ops[1],
+- res_op->ops[2]);
+- REF_REVERSE_STORAGE_ORDER (val) = res_op->reverse;
+- res_op->set_value (val);
+- break;
+- default:;
+- }
+-}
+-
+-tree (*mprts_hook) (gimple_match_op *);
+-
+-/* Try to build RES_OP, which is known to be a call to FN. Return null
+- if the target doesn't support the function. */
+-
+-static gcall *
+-build_call_internal (internal_fn fn, gimple_match_op *res_op)
+-{
+- if (direct_internal_fn_p (fn))
+- {
+- tree_pair types = direct_internal_fn_types (fn, res_op->type,
+- res_op->ops);
+- if (!direct_internal_fn_supported_p (fn, types, OPTIMIZE_FOR_BOTH))
+- return NULL;
+- }
+- return gimple_build_call_internal (fn, res_op->num_ops,
+- res_op->op_or_null (0),
+- res_op->op_or_null (1),
+- res_op->op_or_null (2),
+- res_op->op_or_null (3),
+- res_op->op_or_null (4));
+-}
+-
+-/* Push the exploded expression described by RES_OP as a statement to
+- SEQ if necessary and return a gimple value denoting the value of the
+- expression. If RES is not NULL then the result will be always RES
+- and even gimple values are pushed to SEQ. */
+-
+-tree
+-maybe_push_res_to_seq (gimple_match_op *res_op, gimple_seq *seq, tree res)
+-{
+- tree *ops = res_op->ops;
+- unsigned num_ops = res_op->num_ops;
+-
+- /* The caller should have converted conditional operations into an UNCOND
+- form and resimplified as appropriate. The conditional form only
+- survives this far if that conversion failed. */
+- if (res_op->cond.cond)
+- return NULL_TREE;
+-
+- if (res_op->code.is_tree_code ())
+- {
+- if (!res
+- && gimple_simplified_result_is_gimple_val (res_op))
+- return ops[0];
+- if (mprts_hook)
+- {
+- tree tem = mprts_hook (res_op);
+- if (tem)
+- return tem;
+- }
+- }
+-
+- if (!seq)
+- return NULL_TREE;
+-
+- /* Play safe and do not allow abnormals to be mentioned in
+- newly created statements. */
+- for (unsigned int i = 0; i < num_ops; ++i)
+- if (TREE_CODE (ops[i]) == SSA_NAME
+- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[i]))
+- return NULL_TREE;
+-
+- if (num_ops > 0 && COMPARISON_CLASS_P (ops[0]))
+- for (unsigned int i = 0; i < 2; ++i)
+- if (TREE_CODE (TREE_OPERAND (ops[0], i)) == SSA_NAME
+- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], i)))
+- return NULL_TREE;
+-
+- if (res_op->code.is_tree_code ())
+- {
+- auto code = tree_code (res_op->code);
+- if (!res)
+- {
+- if (gimple_in_ssa_p (cfun))
+- res = make_ssa_name (res_op->type);
+- else
+- res = create_tmp_reg (res_op->type);
+- }
+- maybe_build_generic_op (res_op);
+- gimple *new_stmt = gimple_build_assign (res, code,
+- res_op->op_or_null (0),
+- res_op->op_or_null (1),
+- res_op->op_or_null (2));
+- gimple_seq_add_stmt_without_update (seq, new_stmt);
+- return res;
+- }
+- else
+- {
+- gcc_assert (num_ops != 0);
+- auto fn = combined_fn (res_op->code);
+- gcall *new_stmt = NULL;
+- if (internal_fn_p (fn))
+- {
+- /* Generate the given function if we can. */
+- internal_fn ifn = as_internal_fn (fn);
+- new_stmt = build_call_internal (ifn, res_op);
+- if (!new_stmt)
+- return NULL_TREE;
+- }
+- else
+- {
+- /* Find the function we want to call. */
+- tree decl = builtin_decl_implicit (as_builtin_fn (fn));
+- if (!decl)
+- return NULL;
+-
+- /* We can't and should not emit calls to non-const functions. */
+- if (!(flags_from_decl_or_type (decl) & ECF_CONST))
+- return NULL;
+-
+- new_stmt = gimple_build_call (decl, num_ops,
+- res_op->op_or_null (0),
+- res_op->op_or_null (1),
+- res_op->op_or_null (2),
+- res_op->op_or_null (3),
+- res_op->op_or_null (4));
+- }
+- if (!res)
+- {
+- if (gimple_in_ssa_p (cfun))
+- res = make_ssa_name (res_op->type);
+- else
+- res = create_tmp_reg (res_op->type);
+- }
+- gimple_call_set_lhs (new_stmt, res);
+- gimple_seq_add_stmt_without_update (seq, new_stmt);
+- return res;
+- }
+-}
+-
+-
+-/* Public API overloads follow for operation being tree_code or
+- built_in_function and for one to three operands or arguments.
+- They return NULL_TREE if nothing could be simplified or
+- the resulting simplified value with parts pushed to SEQ.
+- If SEQ is NULL then if the simplification needs to create
+- new stmts it will fail. If VALUEIZE is non-NULL then all
+- SSA names will be valueized using that hook prior to
+- applying simplifications. */
+-
+-/* Unary ops. */
+-
+-tree
+-gimple_simplify (enum tree_code code, tree type,
+- tree op0,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (op0))
+- {
+- tree res = const_unop (code, type, op0);
+- if (res != NULL_TREE
+- && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, code, type, op0))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Binary ops. */
+-
+-tree
+-gimple_simplify (enum tree_code code, tree type,
+- tree op0, tree op1,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (op0) && constant_for_folding (op1))
+- {
+- tree res = const_binop (code, type, op0, op1);
+- if (res != NULL_TREE
+- && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- /* Canonicalize operand order both for matching and fallback stmt
+- generation. */
+- if ((commutative_tree_code (code)
+- || TREE_CODE_CLASS (code) == tcc_comparison)
+- && tree_swap_operands_p (op0, op1))
+- {
+- std::swap (op0, op1);
+- if (TREE_CODE_CLASS (code) == tcc_comparison)
+- code = swap_tree_comparison (code);
+- }
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, code, type, op0, op1))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Ternary ops. */
+-
+-tree
+-gimple_simplify (enum tree_code code, tree type,
+- tree op0, tree op1, tree op2,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (op0) && constant_for_folding (op1)
+- && constant_for_folding (op2))
+- {
+- tree res = fold_ternary/*_to_constant */ (code, type, op0, op1, op2);
+- if (res != NULL_TREE
+- && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- /* Canonicalize operand order both for matching and fallback stmt
+- generation. */
+- if (commutative_ternary_tree_code (code)
+- && tree_swap_operands_p (op0, op1))
+- std::swap (op0, op1);
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, code, type, op0, op1, op2))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Builtin or internal function with one argument. */
+-
+-tree
+-gimple_simplify (combined_fn fn, tree type,
+- tree arg0,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (arg0))
+- {
+- tree res = fold_const_call (fn, type, arg0);
+- if (res && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Builtin or internal function with two arguments. */
+-
+-tree
+-gimple_simplify (combined_fn fn, tree type,
+- tree arg0, tree arg1,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (arg0)
+- && constant_for_folding (arg1))
+- {
+- tree res = fold_const_call (fn, type, arg0, arg1);
+- if (res && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0, arg1))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Builtin or internal function with three arguments. */
+-
+-tree
+-gimple_simplify (combined_fn fn, tree type,
+- tree arg0, tree arg1, tree arg2,
+- gimple_seq *seq, tree (*valueize)(tree))
+-{
+- if (constant_for_folding (arg0)
+- && constant_for_folding (arg1)
+- && constant_for_folding (arg2))
+- {
+- tree res = fold_const_call (fn, type, arg0, arg1, arg2);
+- if (res && CONSTANT_CLASS_P (res))
+- return res;
+- }
+-
+- gimple_match_op res_op;
+- if (!gimple_simplify (&res_op, seq, valueize, fn, type, arg0, arg1, arg2))
+- return NULL_TREE;
+- return maybe_push_res_to_seq (&res_op, seq);
+-}
+-
+-/* Helper for gimple_simplify valueizing OP using VALUEIZE and setting
+- VALUEIZED to true if valueization changed OP. */
+-
+-static inline tree
+-do_valueize (tree op, tree (*valueize)(tree), bool &valueized)
+-{
+- if (valueize && TREE_CODE (op) == SSA_NAME)
+- {
+- tree tem = valueize (op);
+- if (tem && tem != op)
+- {
+- op = tem;
+- valueized = true;
+- }
+- }
+- return op;
+-}
+-
+-/* If RES_OP is a call to a conditional internal function, try simplifying
+- the associated unconditional operation and using the result to build
+- a new conditional operation. For example, if RES_OP is:
+-
+- IFN_COND_ADD (COND, A, B, ELSE)
+-
+- try simplifying (plus A B) and using the result to build a replacement
+- for the whole IFN_COND_ADD.
+-
+- Return true if this approach led to a simplification, otherwise leave
+- RES_OP unchanged (and so suitable for other simplifications). When
+- returning true, add any new statements to SEQ and use VALUEIZE as the
+- valueization function.
+-
+- RES_OP is known to be a call to IFN. */
+-
+-static bool
+-try_conditional_simplification (internal_fn ifn, gimple_match_op *res_op,
+- gimple_seq *seq, tree (*valueize) (tree))
+-{
+- code_helper op;
+- tree_code code = conditional_internal_fn_code (ifn);
+- if (code != ERROR_MARK)
+- op = code;
+- else
+- {
+- ifn = get_unconditional_internal_fn (ifn);
+- if (ifn == IFN_LAST)
+- return false;
+- op = as_combined_fn (ifn);
+- }
+-
+- unsigned int num_ops = res_op->num_ops;
+- gimple_match_op cond_op (gimple_match_cond (res_op->ops[0],
+- res_op->ops[num_ops - 1]),
+- op, res_op->type, num_ops - 2);
+-
+- memcpy (cond_op.ops, res_op->ops + 1, (num_ops - 1) * sizeof *cond_op.ops);
+- switch (num_ops - 2)
+- {
+- case 1:
+- if (!gimple_resimplify1 (seq, &cond_op, valueize))
+- return false;
+- break;
+- case 2:
+- if (!gimple_resimplify2 (seq, &cond_op, valueize))
+- return false;
+- break;
+- case 3:
+- if (!gimple_resimplify3 (seq, &cond_op, valueize))
+- return false;
+- break;
+- default:
+- gcc_unreachable ();
+- }
+- *res_op = cond_op;
+- maybe_resimplify_conditional_op (seq, res_op, valueize);
+- return true;
+-}
+-
+-/* Common subroutine of gimple_extract_op and gimple_simplify. Try to
+- describe STMT in RES_OP, returning true on success. Before recording
+- an operand, call:
+-
+- - VALUEIZE_CONDITION for a COND_EXPR condition
+- - VALUEIZE_OP for every other top-level operand
+-
+- Both routines take a tree argument and returns a tree. */
+-
+-template<typename ValueizeOp, typename ValueizeCondition>
+-inline bool
+-gimple_extract (gimple *stmt, gimple_match_op *res_op,
+- ValueizeOp valueize_op,
+- ValueizeCondition valueize_condition)
+-{
+- switch (gimple_code (stmt))
+- {
+- case GIMPLE_ASSIGN:
+- {
+- enum tree_code code = gimple_assign_rhs_code (stmt);
+- tree type = TREE_TYPE (gimple_assign_lhs (stmt));
+- switch (gimple_assign_rhs_class (stmt))
+- {
+- case GIMPLE_SINGLE_RHS:
+- if (code == REALPART_EXPR
+- || code == IMAGPART_EXPR
+- || code == VIEW_CONVERT_EXPR)
+- {
+- tree op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+- res_op->set_op (code, type, valueize_op (op0));
+- return true;
+- }
+- else if (code == BIT_FIELD_REF)
+- {
+- tree rhs1 = gimple_assign_rhs1 (stmt);
+- tree op0 = valueize_op (TREE_OPERAND (rhs1, 0));
+- res_op->set_op (code, type, op0,
+- TREE_OPERAND (rhs1, 1),
+- TREE_OPERAND (rhs1, 2),
+- REF_REVERSE_STORAGE_ORDER (rhs1));
+- return true;
+- }
+- else if (code == SSA_NAME)
+- {
+- tree op0 = gimple_assign_rhs1 (stmt);
+- res_op->set_op (TREE_CODE (op0), type, valueize_op (op0));
+- return true;
+- }
+- break;
+- case GIMPLE_UNARY_RHS:
+- {
+- tree rhs1 = gimple_assign_rhs1 (stmt);
+- res_op->set_op (code, type, valueize_op (rhs1));
+- return true;
+- }
+- case GIMPLE_BINARY_RHS:
+- {
+- tree rhs1 = valueize_op (gimple_assign_rhs1 (stmt));
+- tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt));
+- res_op->set_op (code, type, rhs1, rhs2);
+- return true;
+- }
+- case GIMPLE_TERNARY_RHS:
+- {
+- tree rhs1 = gimple_assign_rhs1 (stmt);
+- if (code == COND_EXPR && COMPARISON_CLASS_P (rhs1))
+- rhs1 = valueize_condition (rhs1);
+- else
+- rhs1 = valueize_op (rhs1);
+- tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt));
+- tree rhs3 = valueize_op (gimple_assign_rhs3 (stmt));
+- res_op->set_op (code, type, rhs1, rhs2, rhs3);
+- return true;
+- }
+- default:
+- gcc_unreachable ();
+- }
+- break;
+- }
+-
+- case GIMPLE_CALL:
+- /* ??? This way we can't simplify calls with side-effects. */
+- if (gimple_call_lhs (stmt) != NULL_TREE
+- && gimple_call_num_args (stmt) >= 1
+- && gimple_call_num_args (stmt) <= 5)
+- {
+- combined_fn cfn;
+- if (gimple_call_internal_p (stmt))
+- cfn = as_combined_fn (gimple_call_internal_fn (stmt));
+- else
+- {
+- tree fn = gimple_call_fn (stmt);
+- if (!fn)
+- return false;
+-
+- fn = valueize_op (fn);
+- if (TREE_CODE (fn) != ADDR_EXPR
+- || TREE_CODE (TREE_OPERAND (fn, 0)) != FUNCTION_DECL)
+- return false;
+-
+- tree decl = TREE_OPERAND (fn, 0);
+- if (DECL_BUILT_IN_CLASS (decl) != BUILT_IN_NORMAL
+- || !gimple_builtin_call_types_compatible_p (stmt, decl))
+- return false;
+-
+- cfn = as_combined_fn (DECL_FUNCTION_CODE (decl));
+- }
+-
+- unsigned int num_args = gimple_call_num_args (stmt);
+- res_op->set_op (cfn, TREE_TYPE (gimple_call_lhs (stmt)), num_args);
+- for (unsigned i = 0; i < num_args; ++i)
+- res_op->ops[i] = valueize_op (gimple_call_arg (stmt, i));
+- return true;
+- }
+- break;
+-
+- case GIMPLE_COND:
+- {
+- tree lhs = valueize_op (gimple_cond_lhs (stmt));
+- tree rhs = valueize_op (gimple_cond_rhs (stmt));
+- res_op->set_op (gimple_cond_code (stmt), boolean_type_node, lhs, rhs);
+- return true;
+- }
+-
+- default:
+- break;
+- }
+-
+- return false;
+-}
+-
+-/* Try to describe STMT in RES_OP, returning true on success.
+- For GIMPLE_CONDs, describe the condition that is being tested.
+- For GIMPLE_ASSIGNs, describe the rhs of the assignment.
+- For GIMPLE_CALLs, describe the call. */
+-
+-bool
+-gimple_extract_op (gimple *stmt, gimple_match_op *res_op)
+-{
+- auto nop = [](tree op) { return op; };
+- return gimple_extract (stmt, res_op, nop, nop);
+-}
+-
+-/* The main STMT based simplification entry. It is used by the fold_stmt
+- and the fold_stmt_to_constant APIs. */
+-
+-bool
+-gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq,
+- tree (*valueize)(tree), tree (*top_valueize)(tree))
+-{
+- bool valueized = false;
+- auto valueize_op = [&](tree op)
+- {
+- return do_valueize (op, top_valueize, valueized);
+- };
+- auto valueize_condition = [&](tree op) -> tree
+- {
+- bool cond_valueized = false;
+- tree lhs = do_valueize (TREE_OPERAND (op, 0), top_valueize,
+- cond_valueized);
+- tree rhs = do_valueize (TREE_OPERAND (op, 1), top_valueize,
+- cond_valueized);
+- gimple_match_op res_op2 (res_op->cond, TREE_CODE (op),
+- TREE_TYPE (op), lhs, rhs);
+- if ((gimple_resimplify2 (seq, &res_op2, valueize)
+- || cond_valueized)
+- && res_op2.code.is_tree_code ())
+- {
+- auto code = tree_code (res_op2.code);
+- if (TREE_CODE_CLASS (code) == tcc_comparison)
+- {
+- valueized = true;
+- return build2 (code, TREE_TYPE (op),
+- res_op2.ops[0], res_op2.ops[1]);
+- }
+- else if (code == SSA_NAME
+- || code == INTEGER_CST
+- || code == VECTOR_CST)
+- {
+- valueized = true;
+- return res_op2.ops[0];
+- }
+- }
+- return valueize_op (op);
+- };
+-
+- if (!gimple_extract (stmt, res_op, valueize_op, valueize_condition))
+- return false;
+-
+- if (res_op->code.is_internal_fn ())
+- {
+- internal_fn ifn = internal_fn (res_op->code);
+- if (try_conditional_simplification (ifn, res_op, seq, valueize))
+- return true;
+- }
+-
+- if (!res_op->reverse
+- && res_op->num_ops
+- && res_op->resimplify (seq, valueize))
+- return true;
+-
+- return valueized;
+-}
+-
+-/* Helper for the autogenerated code, valueize OP. */
+-
+-inline tree
+-do_valueize (tree (*valueize)(tree), tree op)
+-{
+- if (valueize && TREE_CODE (op) == SSA_NAME)
+- {
+- tree tem = valueize (op);
+- if (tem)
+- return tem;
+- }
+- return op;
+-}
++tree do_valueize (tree, tree (*)(tree), bool &);
++tree do_valueize (tree (*)(tree), tree);
+
+ /* Helper for the autogenerated code, get at the definition of NAME when
+ VALUEIZE allows that. */
+@@ -1305,110 +224,3 @@ optimize_successive_divisions_p (tree divisor, tree inner_div)
+ }
+ return true;
+ }
+-
+-/* Return a canonical form for CODE when operating on TYPE. The idea
+- is to remove redundant ways of representing the same operation so
+- that code_helpers can be hashed and compared for equality.
+-
+- The only current canonicalization is to replace built-in functions
+- with internal functions, in cases where internal-fn.def defines
+- such an internal function.
+-
+- Note that the new code_helper cannot necessarily be used in place of
+- the original code_helper. For example, the new code_helper might be
+- an internal function that the target does not support. */
+-
+-code_helper
+-canonicalize_code (code_helper code, tree type)
+-{
+- if (code.is_fn_code ())
+- return associated_internal_fn (combined_fn (code), type);
+- return code;
+-}
+-
+-/* Return true if CODE is a binary operation and if CODE is commutative when
+- operating on type TYPE. */
+-
+-bool
+-commutative_binary_op_p (code_helper code, tree type)
+-{
+- if (code.is_tree_code ())
+- return commutative_tree_code (tree_code (code));
+- auto cfn = combined_fn (code);
+- return commutative_binary_fn_p (associated_internal_fn (cfn, type));
+-}
+-
+-/* Return true if CODE represents a ternary operation and if the first two
+- operands are commutative when CODE is operating on TYPE. */
+-
+-bool
+-commutative_ternary_op_p (code_helper code, tree type)
+-{
+- if (code.is_tree_code ())
+- return commutative_ternary_tree_code (tree_code (code));
+- auto cfn = combined_fn (code);
+- return commutative_ternary_fn_p (associated_internal_fn (cfn, type));
+-}
+-
+-/* If CODE is commutative in two consecutive operands, return the
+- index of the first, otherwise return -1. */
+-
+-int
+-first_commutative_argument (code_helper code, tree type)
+-{
+- if (code.is_tree_code ())
+- {
+- auto tcode = tree_code (code);
+- if (commutative_tree_code (tcode)
+- || commutative_ternary_tree_code (tcode))
+- return 0;
+- return -1;
+- }
+- auto cfn = combined_fn (code);
+- return first_commutative_argument (associated_internal_fn (cfn, type));
+-}
+-
+-/* Return true if CODE is a binary operation that is associative when
+- operating on type TYPE. */
+-
+-bool
+-associative_binary_op_p (code_helper code, tree type)
+-{
+- if (code.is_tree_code ())
+- return associative_tree_code (tree_code (code));
+- auto cfn = combined_fn (code);
+- return associative_binary_fn_p (associated_internal_fn (cfn, type));
+-}
+-
+-/* Return true if the target directly supports operation CODE on type TYPE.
+- QUERY_TYPE acts as for optab_for_tree_code. */
+-
+-bool
+-directly_supported_p (code_helper code, tree type, optab_subtype query_type)
+-{
+- if (code.is_tree_code ())
+- {
+- direct_optab optab = optab_for_tree_code (tree_code (code), type,
+- query_type);
+- return (optab != unknown_optab
+- && optab_handler (optab, TYPE_MODE (type)) != CODE_FOR_nothing);
+- }
+- gcc_assert (query_type == optab_default
+- || (query_type == optab_vector && VECTOR_TYPE_P (type))
+- || (query_type == optab_scalar && !VECTOR_TYPE_P (type)));
+- internal_fn ifn = associated_internal_fn (combined_fn (code), type);
+- return (direct_internal_fn_p (ifn)
+- && direct_internal_fn_supported_p (ifn, type, OPTIMIZE_FOR_SPEED));
+-}
+-
+-/* A wrapper around the internal-fn.cc versions of get_conditional_internal_fn
+- for a code_helper CODE operating on type TYPE. */
+-
+-internal_fn
+-get_conditional_internal_fn (code_helper code, tree type)
+-{
+- if (code.is_tree_code ())
+- return get_conditional_internal_fn (tree_code (code));
+- auto cfn = combined_fn (code);
+- return get_conditional_internal_fn (associated_internal_fn (cfn, type));
+-}
+--
+2.40.1
+
diff --git a/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
new file mode 100644
index 0000000..4b2fbe9
--- /dev/null
+++ b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
@@ -0,0 +1,524 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From c9477580a0c0cb746aec323407ab6103518b8830 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:38:50 +0100
+Subject: [PATCH 5/6] match.pd: automatically partition *-match.cc files.
+
+Following on from Richi's RFC[1] this is another attempt to split up match.pd
+into multiple gimple-match and generic-match files. This version is fully
+automated and requires no human intervention.
+
+First things first, some perf numbers. The following shows the effect of the
+patch on my desktop doing parallel compilation of gimple-match:
+
++--------+------------------+--------+------------------+
+| splits | rel. improvement | splits | rel. improvement |
++--------+------------------+--------+------------------+
+| 1 | 0.00% | 33 | 91.03% |
+| 2 | 71.77% | 34 | 84.02% |
+| 3 | 100.71% | 35 | 83.42% |
+| 4 | 143.08% | 36 | 78.80% |
+| 5 | 176.18% | 37 | 74.06% |
+| 6 | 174.40% | 38 | 55.76% |
+| 7 | 176.62% | 39 | 66.90% |
+| 8 | 168.35% | 40 | 18.25% |
+| 9 | 189.80% | 41 | 16.55% |
+| 10 | 171.77% | 42 | 47.02% |
+| 11 | 152.82% | 43 | 15.29% |
+| 12 | 112.20% | 44 | 21.63% |
+| 13 | 158.57% | 45 | 41.53% |
+| 14 | 158.57% | 46 | 21.98% |
+| 15 | 152.07% | 47 | -42.74% |
+| 16 | 151.70% | 48 | -32.62% |
+| 17 | 131.52% | 49 | 11.81% |
+| 18 | 133.11% | 50 | 34.07% |
+| 19 | 137.33% | 51 | 2.71% |
+| 20 | 103.83% | 52 | -22.23% |
+| 21 | 132.47% | 53 | 32.30% |
+| 22 | 116.52% | 54 | 21.45% |
+| 23 | 112.73% | 55 | 40.02% |
+| 24 | 111.94% | 56 | 42.83% |
+| 25 | 112.73% | 57 | -9.98% |
+| 26 | 104.07% | 58 | 18.01% |
+| 27 | 113.27% | 59 | -4.91% |
+| 28 | 96.77% | 60 | 22.94% |
+| 29 | 93.42% | 61 | -3.73% |
+| 30 | 87.67% | 62 | -27.43% |
+| 31 | 89.54% | 63 | -1.05% |
+| 32 | 84.42% | 64 | -5.44% |
++--------+------------------+--------+------------------+
+
+As can be seen there seems to be a point of diminishing returns in doing splits.
+This comes from the fact that these match files consume a sizeable amount of
+headers. At a certain point the parsing overhead of the headers dominate and
+you start losing in gains.
+
+As such from this I've made the default 10 splits per file to allow for some
+room for growth in the future without needing changes to the split amount.
+Since 5-10 show roughly the same gains it means we can afford to double the
+file sizes before we need to up the split amount. This can be controlled
+by the configure parameter --with-matchpd-partitions=.
+
+At 10 splits the sizes of the files are:
+
+ 1.2M gimple-match-1.cc
+ 490K gimple-match-2.cc
+ 459K gimple-match-3.cc
+ 462K gimple-match-4.cc
+ 466K gimple-match-5.cc
+ 690K gimple-match-6.cc
+ 517K gimple-match-7.cc
+ 693K gimple-match-8.cc
+1011K gimple-match-9.cc
+ 490K gimple-match-10.cc
+ 210K gimple-match-auto.h
+
+The reason gimple-match-1.cc is so large is because it got allocated a very
+large function: gimple_simplify_NE_EXPR.
+
+Because of these sporadically large functions the allocation to a split happens
+based on the amount of data already written to a split instead of just a simple
+round robin allocation (though the patch supports that too.). This means that
+once gimple_simplify_NE_EXPR is allocated to gimple-match-1.cc nothing uses it
+again until the rest of the files catch up.
+
+To support this split a new header file *-match-auto.h is generated to allow
+the individual files to compile separately.
+
+Lastly for the auto generated files I use pragmas to silence the unused
+predicate warnings instead of the previous Makefile way because I couldn't find
+a way to set them without knowing the number of split files beforehand.
+
+Finally with this change, bootstrap time has dropped 8 minutes on AArch64.
+
+[1] https://gcc.gnu.org/legacy-ml/gcc-patches/2018-04/msg01125.html
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * genmatch.cc (emit_func, SIZED_BASED_CHUNKS, get_out_file): New.
+ (decision_tree::gen): Accept list of files instead of single and update
+ to write function definition to header and main file.
+ (write_predicate): Likewise.
+ (write_header): Emit pragmas and new includes.
+ (main): Create file buffers and cleanup.
+ (showUsage, write_header_includes): New.
+
+(cherry picked from commit 703417a030b3d80f55ba1402adc3f1692d3631e5)
+---
+ gcc/genmatch.cc | 226 ++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 190 insertions(+), 36 deletions(-)
+
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index 09548bdac29..c5938148712 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -183,6 +183,33 @@ fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
+ va_end (ap);
+ }
+
++/* Like fprintf, but print to two files, one header one C implementation. */
++FILE *header_file = NULL;
++
++static void
++#if GCC_VERSION >= 4001
++__attribute__((format (printf, 4, 5)))
++#endif
++emit_func (FILE *f, bool open, bool close, const char *format, ...)
++{
++ va_list ap1, ap2;
++ if (header_file != NULL)
++ {
++ if (open)
++ fprintf (header_file, "extern ");
++ va_start (ap2, format);
++ vfprintf (header_file, format, ap2);
++ va_end (ap2);
++ if (close)
++ fprintf (header_file, ";\n");
++ }
++
++ va_start (ap1, format);
++ vfprintf (f, format, ap1);
++ va_end (ap1);
++ fputc ('\n', f);
++}
++
+ static void
+ output_line_directive (FILE *f, location_t location,
+ bool dumpfile = false, bool fnargs = false)
+@@ -217,6 +244,37 @@ output_line_directive (FILE *f, location_t location,
+ fprintf (f, "/* #line %d \"%s\" */\n", loc.line, loc.file);
+ }
+
++/* Find the file to write into next. We try to evenly distribute the contents
++ over the different files. */
++
++#define SIZED_BASED_CHUNKS 1
++
++int current_file = 0;
++FILE *get_out_file (vec <FILE *> &parts)
++{
++#ifdef SIZED_BASED_CHUNKS
++ if (parts.length () == 1)
++ return parts[0];
++
++ FILE *f = NULL;
++ long min = 0;
++ /* We've started writing all the files at pos 0, so ftell is equivalent
++ to the size and should be much faster. */
++ for (unsigned i = 0; i < parts.length (); i++)
++ {
++ long res = ftell (parts[i]);
++ if (!f || res < min)
++ {
++ min = res;
++ f = parts[i];
++ }
++ }
++ return f;
++#else
++ return parts[current_file++ % parts.length ()];
++#endif
++}
++
+
+ /* Pull in tree codes and builtin function codes from their
+ definition files. */
+@@ -1732,7 +1790,7 @@ public:
+ dt_node *root;
+
+ void insert (class simplify *, unsigned);
+- void gen (FILE *f, bool gimple);
++ void gen (vec <FILE *> &f, bool gimple);
+ void print (FILE *f = stderr);
+
+ decision_tree () { root = new dt_node (dt_node::DT_NODE, NULL); }
+@@ -3830,7 +3888,7 @@ sinfo_hashmap_traits::equal_keys (const key_type &v,
+ tree. */
+
+ void
+-decision_tree::gen (FILE *f, bool gimple)
++decision_tree::gen (vec <FILE *> &files, bool gimple)
+ {
+ sinfo_map_t si;
+
+@@ -3859,11 +3917,14 @@ decision_tree::gen (FILE *f, bool gimple)
+ output_line_directive (stderr, s->s->s->result->location);
+ }
+
++ /* Cycle the file buffers. */
++ FILE *f = get_out_file (files);
++
+ /* Generate a split out function with the leaf transform code. */
+ s->fname = xasprintf ("%s_simplify_%u", gimple ? "gimple" : "generic",
+ fcnt++);
+ if (gimple)
+- fprintf (f, "\nstatic bool\n"
++ emit_func (f, true, false, "\nbool\n"
+ "%s (gimple_match_op *res_op, gimple_seq *seq,\n"
+ " tree (*valueize)(tree) ATTRIBUTE_UNUSED,\n"
+ " const tree ARG_UNUSED (type), tree *ARG_UNUSED "
+@@ -3871,27 +3932,28 @@ decision_tree::gen (FILE *f, bool gimple)
+ s->fname);
+ else
+ {
+- fprintf (f, "\nstatic tree\n"
++ emit_func (f, true, false, "\ntree\n"
+ "%s (location_t ARG_UNUSED (loc), const tree ARG_UNUSED (type),\n",
+ (*iter).second->fname);
+ for (unsigned i = 0;
+ i < as_a <expr *>(s->s->s->match)->ops.length (); ++i)
+- fprintf (f, " tree ARG_UNUSED (_p%d),", i);
+- fprintf (f, " tree *captures\n");
++ emit_func (f, false, false, " tree ARG_UNUSED (_p%d),", i);
++ emit_func (f, false, false, " tree *captures\n");
+ }
+ for (unsigned i = 0; i < s->s->s->for_subst_vec.length (); ++i)
+ {
+ if (! s->s->s->for_subst_vec[i].first->used)
+ continue;
+ if (is_a <operator_id *> (s->s->s->for_subst_vec[i].second))
+- fprintf (f, ", const enum tree_code ARG_UNUSED (%s)",
++ emit_func (f, false, false, ", const enum tree_code ARG_UNUSED (%s)",
+ s->s->s->for_subst_vec[i].first->id);
+ else if (is_a <fn_id *> (s->s->s->for_subst_vec[i].second))
+- fprintf (f, ", const combined_fn ARG_UNUSED (%s)",
++ emit_func (f, false, false, ", const combined_fn ARG_UNUSED (%s)",
+ s->s->s->for_subst_vec[i].first->id);
+ }
+
+- fprintf (f, ")\n{\n");
++ emit_func (f, false, true, ")");
++ fprintf (f, "{\n");
+ fprintf_indent (f, 2, "const bool debug_dump = "
+ "dump_file && (dump_flags & TDF_FOLDING);\n");
+ s->s->gen_1 (f, 2, gimple, s->s->s->result);
+@@ -3921,8 +3983,12 @@ decision_tree::gen (FILE *f, bool gimple)
+ && e->operation->kind != id_base::CODE))
+ continue;
+
++
++ /* Cycle the file buffers. */
++ FILE *f = get_out_file (files);
++
+ if (gimple)
+- fprintf (f, "\nstatic bool\n"
++ emit_func (f, true, false,"\nbool\n"
+ "gimple_simplify_%s (gimple_match_op *res_op,"
+ " gimple_seq *seq,\n"
+ " tree (*valueize)(tree) "
+@@ -3931,13 +3997,13 @@ decision_tree::gen (FILE *f, bool gimple)
+ "ARG_UNUSED (type)\n",
+ e->operation->id);
+ else
+- fprintf (f, "\nstatic tree\n"
++ emit_func (f, true, false, "\ntree\n"
+ "generic_simplify_%s (location_t ARG_UNUSED (loc), enum "
+ "tree_code ARG_UNUSED (code), const tree ARG_UNUSED (type)",
+ e->operation->id);
+ for (unsigned i = 0; i < n; ++i)
+- fprintf (f, ", tree _p%d", i);
+- fprintf (f, ")\n");
++ emit_func (f, false, false,", tree _p%d", i);
++ emit_func (f, false, true, ")");
+ fprintf (f, "{\n");
+ fprintf_indent (f, 2, "const bool debug_dump = "
+ "dump_file && (dump_flags & TDF_FOLDING);\n");
+@@ -3954,18 +4020,22 @@ decision_tree::gen (FILE *f, bool gimple)
+ with compiler warnings, by generating a simple stub. */
+ if (! has_kids_p)
+ {
++
++ /* Cycle the file buffers. */
++ FILE *f = get_out_file (files);
++
+ if (gimple)
+- fprintf (f, "\nbool\n"
++ emit_func (f, true, false, "\nbool\n"
+ "gimple_simplify (gimple_match_op*, gimple_seq*,\n"
+ " tree (*)(tree), code_helper,\n"
+ " const tree");
+ else
+- fprintf (f, "\ntree\n"
++ emit_func (f, true, false,"\ntree\n"
+ "generic_simplify (location_t, enum tree_code,\n"
+ " const tree");
+ for (unsigned i = 0; i < n; ++i)
+- fprintf (f, ", tree");
+- fprintf (f, ")\n");
++ emit_func (f, false, false, ", tree");
++ emit_func (f, false, true, ")");
+ fprintf (f, "{\n");
+ if (gimple)
+ fprintf (f, " return false;\n");
+@@ -3975,20 +4045,24 @@ decision_tree::gen (FILE *f, bool gimple)
+ continue;
+ }
+
++
++ /* Cycle the file buffers. */
++ FILE *f = get_out_file (files);
++
+ /* Then generate the main entry with the outermost switch and
+ tail-calls to the split-out functions. */
+ if (gimple)
+- fprintf (f, "\nbool\n"
++ emit_func (f, true, false, "\nbool\n"
+ "gimple_simplify (gimple_match_op *res_op, gimple_seq *seq,\n"
+ " tree (*valueize)(tree) ATTRIBUTE_UNUSED,\n"
+ " code_helper code, const tree type");
+ else
+- fprintf (f, "\ntree\n"
++ emit_func (f, true, false, "\ntree\n"
+ "generic_simplify (location_t loc, enum tree_code code, "
+ "const tree type ATTRIBUTE_UNUSED");
+ for (unsigned i = 0; i < n; ++i)
+- fprintf (f, ", tree _p%d", i);
+- fprintf (f, ")\n");
++ emit_func (f, false, false, ", tree _p%d", i);
++ emit_func (f, false, true, ")");
+ fprintf (f, "{\n");
+
+ if (gimple)
+@@ -4043,11 +4117,11 @@ decision_tree::gen (FILE *f, bool gimple)
+ void
+ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
+ {
+- fprintf (f, "\nbool\n"
+- "%s%s (tree t%s%s)\n"
+- "{\n", gimple ? "gimple_" : "tree_", p->id,
+- p->nargs > 0 ? ", tree *res_ops" : "",
+- gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : "");
++ emit_func (f, true, true, "\nbool\n%s%s (tree t%s%s)",
++ gimple ? "gimple_" : "tree_", p->id,
++ p->nargs > 0 ? ", tree *res_ops" : "",
++ gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : "");
++ fprintf (f, "{\n");
+ /* Conveniently make 'type' available. */
+ fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n");
+ fprintf_indent (f, 2, "const bool debug_dump = "
+@@ -4068,9 +4142,13 @@ write_header (FILE *f, const char *head)
+ {
+ fprintf (f, "/* Generated automatically by the program `genmatch' from\n");
+ fprintf (f, " a IL pattern matching and simplification description. */\n");
++ fprintf (f, "#pragma GCC diagnostic push\n");
++ fprintf (f, "#pragma GCC diagnostic ignored \"-Wunused-variable\"\n");
++ fprintf (f, "#pragma GCC diagnostic ignored \"-Wunused-function\"\n");
+
+ /* Include the header instead of writing it awkwardly quoted here. */
+- fprintf (f, "\n#include \"%s\"\n", head);
++ if (head)
++ fprintf (f, "\n#include \"%s\"\n", head);
+ }
+
+
+@@ -5213,6 +5291,30 @@ round_alloc_size (size_t s)
+ }
+
+
++/* Construct and display the help menu. */
++
++static void
++showUsage ()
++{
++ fprintf (stderr, "Usage: genmatch [--gimple] [--generic] "
++ "[--header=<filename>] [--include=<filename>] [-v[v]] input "
++ "[<outputfile>...]\n");
++ fprintf (stderr, "\nWhen more then one outputfile is specified --header "
++ "is required.\n");
++}
++
++/* Write out the correct include to the match-head fle containing the helper
++ files. */
++
++static void
++write_header_includes (bool gimple, FILE *header_file)
++{
++ if (gimple)
++ fprintf (header_file, "#include \"gimple-match-head.cc\"\n");
++ else
++ fprintf (header_file, "#include \"generic-match-head.cc\"\n");
++}
++
+ /* The genmatch generator program. It reads from a pattern description
+ and outputs GIMPLE or GENERIC IL matching and simplification routines. */
+
+@@ -5227,25 +5329,44 @@ main (int argc, char **argv)
+ return 1;
+
+ bool gimple = true;
+- char *input = argv[argc-1];
+- for (int i = 1; i < argc - 1; ++i)
++ char *s_header_file = NULL;
++ char *s_include_file = NULL;
++ auto_vec <char *> files;
++ char *input = NULL;
++ int last_file = argc - 1;
++ for (int i = argc - 1; i >= 1; --i)
+ {
+ if (strcmp (argv[i], "--gimple") == 0)
+ gimple = true;
+ else if (strcmp (argv[i], "--generic") == 0)
+ gimple = false;
++ else if (strncmp (argv[i], "--header=", 9) == 0)
++ s_header_file = &argv[i][9];
++ else if (strncmp (argv[i], "--include=", 10) == 0)
++ s_include_file = &argv[i][10];
+ else if (strcmp (argv[i], "-v") == 0)
+ verbose = 1;
+ else if (strcmp (argv[i], "-vv") == 0)
+ verbose = 2;
++ else if (strncmp (argv[i], "--", 2) != 0 && last_file-- == i)
++ files.safe_push (argv[i]);
+ else
+ {
+- fprintf (stderr, "Usage: genmatch "
+- "[--gimple] [--generic] [-v[v]] input\n");
++ showUsage ();
+ return 1;
+ }
+ }
+
++ /* Validate if the combinations are valid. */
++ if ((files.length () > 1 && !s_header_file) || files.is_empty ())
++ showUsage ();
++
++ if (!s_include_file)
++ s_include_file = s_header_file;
++
++ /* Input file is the last in the reverse list. */
++ input = files.pop ();
++
+ line_table = XCNEW (class line_maps);
+ linemap_init (line_table, 0);
+ line_table->reallocator = xrealloc;
+@@ -5292,10 +5413,28 @@ main (int argc, char **argv)
+ /* Parse ahead! */
+ parser p (r, gimple);
+
+- if (gimple)
+- write_header (stdout, "gimple-match-head.cc");
++ /* Create file buffers. */
++ int n_parts = files.is_empty () ? 1 : files.length ();
++ auto_vec <FILE *> parts (n_parts);
++ if (files.is_empty ())
++ {
++ parts.quick_push (stdout);
++ write_header (stdout, s_include_file);
++ write_header_includes (gimple, stdout);
++ }
+ else
+- write_header (stdout, "generic-match-head.cc");
++ {
++ for (char *s_file : files)
++ {
++ parts.quick_push (fopen (s_file, "w"));
++ write_header (parts.last (), s_include_file);
++ }
++
++ header_file = fopen (s_header_file, "w");
++ fprintf (header_file, "#ifndef GCC_GIMPLE_MATCH_AUTO_H\n"
++ "#define GCC_GIMPLE_MATCH_AUTO_H\n");
++ write_header_includes (gimple, header_file);
++ }
+
+ /* Go over all predicates defined with patterns and perform
+ lowering and code generation. */
+@@ -5315,7 +5454,10 @@ main (int argc, char **argv)
+ if (verbose == 2)
+ dt.print (stderr);
+
+- write_predicate (stdout, pred, dt, gimple);
++ /* Cycle the file buffers. */
++ FILE *f = get_out_file (parts);
++
++ write_predicate (f, pred, dt, gimple);
+ }
+
+ /* Lower the main simplifiers and generate code for them. */
+@@ -5332,7 +5474,19 @@ main (int argc, char **argv)
+ if (verbose == 2)
+ dt.print (stderr);
+
+- dt.gen (stdout, gimple);
++ dt.gen (parts, gimple);
++
++ for (FILE *f : parts)
++ {
++ fprintf (f, "#pragma GCC diagnostic pop\n");
++ fclose (f);
++ }
++
++ if (header_file)
++ {
++ fprintf (header_file, "#endif /* GCC_GIMPLE_MATCH_AUTO_H. */\n");
++ fclose (header_file);
++ }
+
+ /* Finalize. */
+ cpp_finish (r, NULL);
+--
+2.40.1
+
diff --git a/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
new file mode 100644
index 0000000..4a8bc46
--- /dev/null
+++ b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
@@ -0,0 +1,258 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From 3da0a672baeb52c5f7b736b47b2cc5f79ada86de Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:42:17 +0100
+Subject: [PATCH 6/6] match.pd: Use splits in makefile and make configurable.
+
+This updates the build system to split up match.pd files into chunks of 10.
+This also introduces a new flag --with-matchpd-partitions which can be used to
+change the number of partitions.
+
+For the analysis of why 10 please look at the previous patch in the series.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * Makefile.in (NUM_MATCH_SPLITS, MATCH_SPLITS_SEQ,
+ GIMPLE_MATCH_PD_SEQ_SRC, GIMPLE_MATCH_PD_SEQ_O,
+ GENERIC_MATCH_PD_SEQ_SRC, GENERIC_MATCH_PD_SEQ_O): New.
+ (OBJS, MOSTLYCLEANFILES, .PRECIOUS): Use them.
+ (s-match): Split into s-generic-match and s-gimple-match.
+ * configure.ac (with-matchpd-partitions,
+ DEFAULT_MATCHPD_PARTITIONS): New.
+ * configure: Regenerate.
+
+(cherry picked from commit 0a85544e1aaeca41133ecfc438cda913dbc0f122)
+---
+ gcc/Makefile.in | 67 +++++++++++++++++++++++++++++++++---------------
+ gcc/configure | 29 +++++++++++++++++++--
+ gcc/configure.ac | 15 +++++++++++
+ 3 files changed, 89 insertions(+), 22 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index f5f189916c1..8e22857ed57 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -214,6 +214,14 @@ rtl-ssa-warn = $(STRICT_WARN)
+ GCC_WARN_CFLAGS = $(LOOSE_WARN) $(C_LOOSE_WARN) $($(@D)-warn) $(if $(filter-out $(STRICT_WARN),$($(@D)-warn)),,$(C_STRICT_WARN)) $(NOCOMMON_FLAG) $($@-warn)
+ GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
+
++# The number of splits to be made for the match.pd files.
++NUM_MATCH_SPLITS = @DEFAULT_MATCHPD_PARTITIONS@
++MATCH_SPLITS_SEQ = $(shell seq 1 $(NUM_MATCH_SPLITS))
++GIMPLE_MATCH_PD_SEQ_SRC = $(patsubst %, gimple-match-%.cc, $(MATCH_SPLITS_SEQ))
++GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
++GENERIC_MATCH_PD_SEQ_SRC = $(patsubst %, generic-match-%.cc, $(MATCH_SPLITS_SEQ))
++GENERIC_MATCH_PD_SEQ_O = $(patsubst %, generic-match-%.o, $(MATCH_SPLITS_SEQ))
++
+ # These files are to have specific diagnostics suppressed, or are not to
+ # be subject to -Werror:
+ # flex output may yield harmless "no previous prototype" warnings
+@@ -222,9 +230,8 @@ gengtype-lex.o-warn = -Wno-error
+ libgcov-util.o-warn = -Wno-error
+ libgcov-driver-tool.o-warn = -Wno-error
+ libgcov-merge-tool.o-warn = -Wno-error
+-gimple-match.o-warn = -Wno-unused
++gimple-match-head.o-warn = -Wno-unused
+ gimple-match-exports.o-warn = -Wno-unused
+-generic-match.o-warn = -Wno-unused
+ dfp.o-warn = -Wno-strict-aliasing
+
+ # All warnings have to be shut off in stage1 if the compiler used then
+@@ -1308,9 +1315,9 @@ ANALYZER_OBJS = \
+ # will build them sooner, because they are large and otherwise tend to be
+ # the last objects to finish building.
+ OBJS = \
+- gimple-match.o \
++ $(GIMPLE_MATCH_PD_SEQ_O) \
+ gimple-match-exports.o \
+- generic-match.o \
++ $(GENERIC_MATCH_PD_SEQ_O) \
+ insn-attrtab.o \
+ insn-automata.o \
+ insn-dfatab.o \
+@@ -1803,7 +1810,8 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
+ insn-output.cc insn-recog.cc insn-emit.cc insn-extract.cc insn-peep.cc \
+ insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
+ insn-latencytab.cc insn-opinit.cc insn-opinit.h insn-preds.cc insn-constants.h \
+- tm-preds.h tm-constrs.h checksum-options gimple-match.cc generic-match.cc \
++ tm-preds.h tm-constrs.h checksum-options $(GIMPLE_MATCH_PD_SEQ_SRC) \
++ $(GENERIC_MATCH_PD_SEQ_SRC) gimple-match-auto.h generic-match-auto.h \
+ tree-check.h min-insn-modes.cc insn-modes.cc insn-modes.h insn-modes-inline.h \
+ genrtl.h gt-*.h gtype-*.h gtype-desc.cc gtyp-input.list \
+ case-cfn-macros.h cfn-operators.pd \
+@@ -2418,7 +2426,8 @@ $(common_out_object_file): $(common_out_file)
+ .PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
+ insn-emit.cc insn-recog.cc insn-extract.cc insn-output.cc insn-peep.cc \
+ insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
+- insn-latencytab.cc insn-preds.cc gimple-match.cc generic-match.cc \
++ insn-latencytab.cc insn-preds.cc $(GIMPLE_MATCH_PD_SEQ_SRC) \
++ $(GENERIC_MATCH_PD_SEQ_SRC) gimple-match-auto.h generic-match-auto.h \
+ insn-target-def.h
+
+ # Dependencies for the md file. The first time through, we just assume
+@@ -2661,19 +2670,36 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
+ false; \
+ fi
+
+-gimple-match.cc: s-match gimple-match-head.cc gimple-match-exports.cc ; @true
+-generic-match.cc: s-match generic-match-head.cc ; @true
+-
+-s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
+- $(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
+- > tmp-gimple-match.cc
+- $(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
+- > tmp-generic-match.cc
+- $(SHELL) $(srcdir)/../move-if-change tmp-gimple-match.cc \
+- gimple-match.cc
+- $(SHELL) $(srcdir)/../move-if-change tmp-generic-match.cc \
+- generic-match.cc
+- $(STAMP) s-match
++$(GIMPLE_MATCH_PD_SEQ_SRC): s-gimple-match gimple-match-head.cc \
++ gimple-match-exports.cc; @true
++gimple-match-auto.h: s-gimple-match gimple-match-head.cc \
++ gimple-match-exports.cc; @true
++$(GENERIC_MATCH_PD_SEQ_SRC): s-generic-match generic-match-head.cc; @true
++generic-match-auto.h: s-generic-match generic-match-head.cc; @true
++
++s-gimple-match: build/genmatch$(build_exeext) \
++ $(srcdir)/match.pd cfn-operators.pd
++ $(RUN_GEN) build/genmatch$(build_exeext) --gimple \
++ --header=tmp-gimple-match-auto.h --include=gimple-match-auto.h \
++ $(srcdir)/match.pd $(patsubst %, tmp-%, $(GIMPLE_MATCH_PD_SEQ_SRC))
++ $(foreach id, $(MATCH_SPLITS_SEQ), \
++ $(SHELL) $(srcdir)/../move-if-change tmp-gimple-match-$(id).cc \
++ gimple-match-$(id).cc;)
++ $(SHELL) $(srcdir)/../move-if-change tmp-gimple-match-auto.h \
++ gimple-match-auto.h
++ $(STAMP) s-gimple-match
++
++s-generic-match: build/genmatch$(build_exeext) \
++ $(srcdir)/match.pd cfn-operators.pd
++ $(RUN_GEN) build/genmatch$(build_exeext) --generic \
++ --header=tmp-generic-match-auto.h --include=generic-match-auto.h \
++ $(srcdir)/match.pd $(patsubst %, tmp-%, $(GENERIC_MATCH_PD_SEQ_SRC))
++ $(foreach id, $(MATCH_SPLITS_SEQ), \
++ $(SHELL) $(srcdir)/../move-if-change tmp-generic-match-$(id).cc \
++ generic-match-$(id).cc;)
++ $(SHELL) $(srcdir)/../move-if-change tmp-generic-match-auto.h \
++ generic-match-auto.h
++ $(STAMP) s-generic-match
+
+ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
+ $(host_xm_file_list) \
+@@ -2808,7 +2834,8 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
+ $(ALL_GTFILES_H) gtype-desc.cc gtype-desc.h version.h \
+ options.h target-hooks-def.h insn-opinit.h \
+ common/common-target-hooks-def.h pass-instances.def \
+- gimple-match.cc generic-match.cc \
++ $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \
++ gimple-match-auto.h generic-match-auto.h \
+ c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
+ case-cfn-macros.h \
+ cfn-operators.pd omp-device-properties.h
+diff --git a/gcc/configure b/gcc/configure
+index c7b26d1927d..843fd5449dd 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -838,6 +838,7 @@ enable_gcov
+ enable_shared
+ enable_fixed_point
+ enable_decimal_float
++DEFAULT_MATCHPD_PARTITIONS
+ with_float
+ with_cpu
+ enable_multiarch
+@@ -965,6 +966,7 @@ enable_valgrind_annotations
+ enable_multilib
+ enable_multiarch
+ with_stack_clash_protection_guard_size
++with_matchpd_partitions
+ enable___cxa_atexit
+ enable_decimal_float
+ enable_fixed_point
+@@ -1826,6 +1828,9 @@ Optional Packages:
+ --with-stack-clash-protection-guard-size=size
+ Set the default stack clash protection guard size
+ for specific targets as a power of two in bytes.
++ --with-matchpd-partitions=num
++ Set the number of partitions to make for gimple and
++ generic when splitting match.pd. [default=10]
+ --with-dwarf2 force the default debug format to be DWARF 2 (or
+ later)
+ --with-specs=SPECS add SPECS to driver command-line processing
+@@ -7889,6 +7894,26 @@ cat >>confdefs.h <<_ACEOF
+ _ACEOF
+
+
++# Specify the number of splits of match.pd to generate.
++
++# Check whether --with-matchpd-partitions was given.
++if test "${with_matchpd_partitions+set}" = set; then :
++ withval=$with_matchpd_partitions; DEFAULT_MATCHPD_PARTITIONS="$with_matchpd_partitions"
++else
++ DEFAULT_MATCHPD_PARTITIONS=10
++fi
++
++if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
++ as_fn_error $? "Invalid value $DEFAULT_MATCHPD_PARTITIONS for --with-matchpd-partitions. Cannot be negative." "$LINENO" 5
++fi
++
++
++cat >>confdefs.h <<_ACEOF
++#define DEFAULT_MATCHPD_PARTITIONS $DEFAULT_MATCHPD_PARTITIONS
++_ACEOF
++
++
++
+ # Enable __cxa_atexit for C++.
+ # Check whether --enable-__cxa_atexit was given.
+ if test "${enable___cxa_atexit+set}" = set; then :
+@@ -19825,7 +19850,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19828 "configure"
++#line 19853 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -19931,7 +19956,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19934 "configure"
++#line 19959 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 09082e8ccae..de5e3aef2c8 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -921,6 +921,21 @@ fi
+ AC_DEFINE_UNQUOTED(DEFAULT_STK_CLASH_GUARD_SIZE, $DEFAULT_STK_CLASH_GUARD_SIZE,
+ [Define to larger than zero set the default stack clash protector size.])
+
++# Specify the number of splits of match.pd to generate.
++AC_ARG_WITH(matchpd-partitions,
++[AS_HELP_STRING([--with-matchpd-partitions=num],
++[Set the number of partitions to make for gimple and generic when splitting match.pd. [default=10]])],
++[DEFAULT_MATCHPD_PARTITIONS="$with_matchpd_partitions"], [DEFAULT_MATCHPD_PARTITIONS=10])
++if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
++ AC_MSG_ERROR(m4_normalize([
++ Invalid value $DEFAULT_MATCHPD_PARTITIONS for --with-matchpd-partitions. \
++ Cannot be negative.]))
++fi
++
++AC_DEFINE_UNQUOTED(DEFAULT_MATCHPD_PARTITIONS, $DEFAULT_MATCHPD_PARTITIONS,
++ [Define to larger than one set the number of match.pd partitions to make.])
++AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
++
+ # Enable __cxa_atexit for C++.
+ AC_ARG_ENABLE(__cxa_atexit,
+ [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
+--
+2.40.1
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 20af64a..be66787 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,4 +1,14 @@
+3 26 May 2023
+
+ + 76_all_match.pd-don-t-emit-label-if-not-needed.patch
+ + 77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
+ + 78_all_match.pd-CSE-the-dump-output-check.patch
+ + 79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
+ + 80_all_match.pd-automatically-partition-match.cc-files.patch
+ + 81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+
2 29 Apr 2023
+
- 75_all_all_PR109573_13_ICE-in-vectorizable_live_operation.patch
- 76_all_all_PR109585_13_rtl-alias-analysis-typo.patch
- 77_all_all_PR109609_13_tail-call-fnspec.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-07-30 19:02 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-07-30 19:02 UTC (permalink / raw
To: gentoo-commits
commit: 5d5b708b7e6f858c3fc2d6a421fb424225efdb04
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 30 17:30:47 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 30 17:30:47 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5d5b708b
13.2.0: backport a few patches, cut patchset 4
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110280
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/31_all_gm2_make_P_var.patch | 16 +-
.../82_all_arm64_PR110280_ICE_fold-const.patch | 53 ++++
...3_all_all_PR110315_crash_large_std_vector.patch | 353 +++++++++++++++++++++
13.2.0/gentoo/README.history | 6 +
4 files changed, 421 insertions(+), 7 deletions(-)
diff --git a/13.2.0/gentoo/31_all_gm2_make_P_var.patch b/13.2.0/gentoo/31_all_gm2_make_P_var.patch
index c977874..ef34288 100644
--- a/13.2.0/gentoo/31_all_gm2_make_P_var.patch
+++ b/13.2.0/gentoo/31_all_gm2_make_P_var.patch
@@ -1,8 +1,8 @@
https://bugs.gentoo.org/904714
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=79c73122fab213f218b85b2c579ffe3cf5e98ad0
-From 79c73122fab213f218b85b2c579ffe3cf5e98ad0 Mon Sep 17 00:00:00 2001
-From: =?utf8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
+From 275c516a40b7044895c4920f52ec19c7bceedd54 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
Date: Fri, 21 Apr 2023 18:07:29 +0200
Subject: [PATCH] gcc/m2: Drop references to $(P)
@@ -14,9 +14,11 @@ gcc/m2/ChangeLog:
* Make-lang.in: Remove references to $(P).
* Make-maintainer.in: Ditto.
+
+(cherry picked from commit 79c73122fab213f218b85b2c579ffe3cf5e98ad0)
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
-@@ -514,7 +514,7 @@ GM2_LIBS_BOOT = m2/gm2-compiler-boot/gm2.a \
+@@ -515,7 +515,7 @@ GM2_LIBS_BOOT = m2/gm2-compiler-boot/gm2.a \
cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
cp -p $< $@
@@ -25,7 +27,7 @@ gcc/m2/ChangeLog:
$(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext)
-test -d $(@D) || $(mkinstalldirs) $(@D)
-@@ -527,7 +527,7 @@ m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(
+@@ -528,7 +528,7 @@ m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(
@$(call LINK_PROGRESS,$(INDEX.m2),end)
m2/stage1/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
@@ -36,14 +38,14 @@ gcc/m2/ChangeLog:
$(m2.prev)
--- a/gcc/m2/Make-maintainer.in
+++ b/gcc/m2/Make-maintainer.in
-@@ -753,7 +753,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
+@@ -848,7 +848,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
gm2.paranoid: m2/m2obj3/cc1gm2$(exeext) gm2.verifyparanoid
m2/m2obj3/cc1gm2$(exeext): m2/m2obj2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
- $(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
+ $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
- m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so m2/gm2-libs-boot/M2LINK.o
+ m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-test -d m2/m2obj3 || $(mkinstalldirs) m2/m2obj3
@$(call LINK_PROGRESS,$(INDEX.m2),start)
--
-2.31.1
+2.41.0
diff --git a/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch b/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch
new file mode 100644
index 0000000..d27ca7a
--- /dev/null
+++ b/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch
@@ -0,0 +1,53 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110280
+https://inbox.sourceware.org/gcc-patches/nycvar.YFH.7.77.849.2307270634430.12935@jbgna.fhfr.qr/T/#t
+
+From 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04 Mon Sep 17 00:00:00 2001
+From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+Date: Fri, 23 Jun 2023 15:27:17 +0530
+Subject: [PATCH] [aarch64/match.pd] Fix ICE observed in PR110280.
+
+gcc/ChangeLog:
+ PR tree-optimization/110280
+ * match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
+ using build_vector_from_val with the element of input operand, and
+ mask's type if operand and mask's types don't match.
+
+gcc/testsuite/ChangeLog:
+ PR tree-optimization/110280
+ * gcc.target/aarch64/sve/pr110280.c: New test.
+
+(cherry picked from commit 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04)
+
+--- a/gcc/match.pd
++++ b/gcc/match.pd
+@@ -8292,7 +8292,14 @@ and,
+
+ (simplify
+ (vec_perm vec_same_elem_p@0 @0 @1)
+- @0)
++ (if (types_match (type, TREE_TYPE (@0)))
++ @0
++ (with
++ {
++ tree elem = uniform_vector_p (@0);
++ }
++ (if (elem)
++ { build_vector_from_val (type, elem); }))))
+
+ /* Push VEC_PERM earlier if that may help FMA perception (PR101895). */
+ (simplify
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
+@@ -0,0 +1,12 @@
++/* { dg-do compile } */
++/* { dg-options "-O3 -fdump-tree-optimized" } */
++
++#include "arm_sve.h"
++
++svuint32_t l()
++{
++ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
++ return svld1rq_u32(svptrue_b8(), lanes);
++}
++
++/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
diff --git a/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch b/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch
new file mode 100644
index 0000000..7c854ff
--- /dev/null
+++ b/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch
@@ -0,0 +1,353 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315 (specifically https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315#c7)
+
+From 777aa930b106fea2dd6ed9fe22b42a2717f1472d Mon Sep 17 00:00:00 2001
+From: Aldy Hernandez <aldyh@redhat.com>
+Date: Mon, 15 May 2023 12:25:58 +0200
+Subject: [PATCH] [GCC13] Add auto-resizing capability to irange's [PR109695]
+
+Backport the following from trunk.
+
+ Note that the patch has been adapted to trees.
+
+ The numbers for various sub-ranges on GCC13 are:
+ < 2> = 64 bytes, -3.02% for VRP.
+ < 3> = 80 bytes, -2.67% for VRP.
+ < 8> = 160 bytes, -2.46% for VRP.
+ <16> = 288 bytes, -2.40% for VRP.
+
+<tldr>
+We can now have int_range<N, RESIZABLE=false> for automatically
+resizable ranges. int_range_max is now int_range<3, true>
+for a 69X reduction in size from current trunk, and 6.9X reduction from
+GCC12. This incurs a 5% performance penalty for VRP that is more than
+covered by our > 13% improvements recently.
+</tldr>
+
+int_range_max is the temporary range object we use in the ranger for
+integers. With the conversion to wide_int, this structure bloated up
+significantly because wide_ints are huge (80 bytes a piece) and are
+about 10 times as big as a plain tree. Since the temporary object
+requires 255 sub-ranges, that's 255 * 80 * 2, plus the control word.
+This means the structure grew from 4112 bytes to 40912 bytes.
+
+This patch adds the ability to resize ranges as needed, defaulting to
+no resizing, while int_range_max now defaults to 3 sub-ranges (instead
+of 255) and grows to 255 when the range being calculated does not fit.
+
+For example:
+
+int_range<1> foo; // 1 sub-range with no resizing.
+int_range<5> foo; // 5 sub-ranges with no resizing.
+int_range<5, true> foo; // 5 sub-ranges with resizing.
+
+I ran some tests and found that 3 sub-ranges cover 99% of cases, so
+I've set the int_range_max default to that:
+
+ typedef int_range<3, /*RESIZABLE=*/true> int_range_max;
+
+We don't bother growing incrementally, since the default covers most
+cases and we have a 255 hard-limit. This hard limit could be reduced
+to 128, since my tests never saw a range needing more than 124, but we
+could do that as a follow-up if needed.
+
+With 3-subranges, int_range_max is now 592 bytes versus 40912 for
+trunk, and versus 4112 bytes for GCC12! The penalty is 5.04% for VRP
+and 3.02% for threading, with no noticeable change in overall
+compilation (0.27%). This is more than covered by our 13.26%
+improvements for the legacy removal + wide_int conversion.
+
+I think this approach is a good alternative, while providing us with
+flexibility going forward. For example, we could try defaulting to a
+8 sub-ranges for a noticeable improvement in VRP. We could also use
+large sub-ranges for switch analysis to avoid resizing.
+
+Another approach I tried was always resizing. With this, we could
+drop the whole int_range<N> nonsense, and have irange just hold a
+resizable range. This simplified things, but incurred a 7% penalty on
+ipa_cp. This was hard to pinpoint, and I'm not entirely convinced
+this wasn't some artifact of valgrind. However, until we're sure,
+let's avoid massive changes, especially since IPA changes are coming
+up.
+
+For the curious, a particular hot spot for IPA in this area was:
+
+ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
+{
+...
+...
+ value_range save (m_vr);
+ m_vr.union_ (*other_vr);
+ return m_vr != save;
+}
+
+The problem isn't the resizing (since we do that at most once) but the
+fact that for some functions with lots of callers we end up a huge
+range that gets copied and compared for every meet operation. Maybe
+the IPA algorithm could be adjusted somehow??.
+
+Anywhooo... for now there is nothing to worry about, since value_range
+still has 2 subranges and is not resizable. But we should probably
+think what if anything we want to do here, as I envision IPA using
+infinite ranges here (well, int_range_max) and handling frange's, etc.
+
+gcc/ChangeLog:
+
+ PR tree-optimization/109695
+ * value-range.cc (irange::operator=): Resize range.
+ (irange::union_): Same.
+ (irange::intersect): Same.
+ (irange::invert): Same.
+ (int_range_max): Default to 3 sub-ranges and resize as needed.
+ * value-range.h (irange::maybe_resize): New.
+ (~int_range): New.
+ (int_range::int_range): Adjust for resizing.
+ (int_range::operator=): Same.
+--- a/gcc/value-range-storage.h
++++ b/gcc/value-range-storage.h
+@@ -184,7 +184,7 @@ vrange_allocator::alloc_irange (unsigned num_pairs)
+ // Allocate the irange and required memory for the vector.
+ void *r = alloc (sizeof (irange));
+ tree *mem = static_cast <tree *> (alloc (nbytes));
+- return new (r) irange (mem, num_pairs);
++ return new (r) irange (mem, num_pairs, /*resizable=*/false);
+ }
+
+ inline frange *
+--- a/gcc/value-range.cc
++++ b/gcc/value-range.cc
+@@ -831,6 +831,10 @@ irange::operator= (const irange &src)
+ copy_to_legacy (src);
+ return *this;
+ }
++
++ int needed = src.num_pairs ();
++ maybe_resize (needed);
++
+ if (src.legacy_mode_p ())
+ {
+ copy_legacy_to_multi_range (src);
+@@ -2506,6 +2510,7 @@ irange::irange_union (const irange &r)
+ // Now it simply needs to be copied, and if there are too many
+ // ranges, merge some. We wont do any analysis as to what the
+ // "best" merges are, simply combine the final ranges into one.
++ maybe_resize (i / 2);
+ if (i > m_max_ranges * 2)
+ {
+ res[m_max_ranges * 2 - 1] = res[i - 1];
+@@ -2605,6 +2610,11 @@ irange::irange_intersect (const irange &r)
+ if (r.irange_contains_p (*this))
+ return intersect_nonzero_bits (r);
+
++ // ?? We could probably come up with something smarter than the
++ // worst case scenario here.
++ int needed = num_pairs () + r.num_pairs ();
++ maybe_resize (needed);
++
+ signop sign = TYPE_SIGN (TREE_TYPE(m_base[0]));
+ unsigned bld_pair = 0;
+ unsigned bld_lim = m_max_ranges;
+@@ -2831,6 +2841,11 @@ irange::invert ()
+ m_num_ranges = 1;
+ return;
+ }
++
++ // At this point, we need one extra sub-range to represent the
++ // inverse.
++ maybe_resize (m_num_ranges + 1);
++
+ // The algorithm is as follows. To calculate INVERT ([a,b][c,d]), we
+ // generate [-MIN, a-1][b+1, c-1][d+1, MAX].
+ //
+--- a/gcc/value-range.h
++++ b/gcc/value-range.h
+@@ -172,7 +172,8 @@ public:
+ bool legacy_verbose_intersect (const irange *); // DEPRECATED
+
+ protected:
+- irange (tree *, unsigned);
++ void maybe_resize (int needed);
++ irange (tree *, unsigned nranges, bool resizable);
+ // potential promotion to public?
+ tree tree_lower_bound (unsigned = 0) const;
+ tree tree_upper_bound (unsigned) const;
+@@ -200,6 +201,8 @@ protected:
+ void copy_to_legacy (const irange &);
+ void copy_legacy_to_multi_range (const irange &);
+
++ // Hard limit on max ranges allowed.
++ static const int HARD_MAX_RANGES = 255;
+ private:
+ friend void gt_ggc_mx (irange *);
+ friend void gt_pch_nx (irange *);
+@@ -214,15 +217,21 @@ private:
+
+ bool intersect (const wide_int& lb, const wide_int& ub);
+ unsigned char m_num_ranges;
++ bool m_resizable;
+ unsigned char m_max_ranges;
+ tree m_nonzero_mask;
++protected:
+ tree *m_base;
+ };
+
+ // Here we describe an irange with N pairs of ranges. The storage for
+ // the pairs is embedded in the class as an array.
++//
++// If RESIZABLE is true, the storage will be resized on the heap when
++// the number of ranges needed goes past N up to a max of
++// HARD_MAX_RANGES. This new storage is freed upon destruction.
+
+-template<unsigned N>
++template<unsigned N, bool RESIZABLE = false>
+ class GTY((user)) int_range : public irange
+ {
+ public:
+@@ -233,7 +242,7 @@ public:
+ int_range (tree type);
+ int_range (const int_range &);
+ int_range (const irange &);
+- virtual ~int_range () = default;
++ virtual ~int_range ();
+ int_range& operator= (const int_range &);
+ private:
+ template <unsigned X> friend void gt_ggc_mx (int_range<X> *);
+@@ -472,6 +481,38 @@ is_a <frange> (vrange &v)
+ return v.m_discriminator == VR_FRANGE;
+ }
+
++// For resizable ranges, resize the range up to HARD_MAX_RANGES if the
++// NEEDED pairs is greater than the current capacity of the range.
++
++inline void
++irange::maybe_resize (int needed)
++{
++ if (!m_resizable || m_max_ranges == HARD_MAX_RANGES)
++ return;
++
++ if (needed > m_max_ranges)
++ {
++ m_max_ranges = HARD_MAX_RANGES;
++ tree *newmem = new tree[m_max_ranges * 2];
++ memcpy (newmem, m_base, sizeof (tree) * num_pairs () * 2);
++ m_base = newmem;
++ }
++}
++
++template<unsigned N, bool RESIZABLE>
++inline
++int_range<N, RESIZABLE>::~int_range ()
++{
++ if (RESIZABLE && m_base != m_ranges)
++ delete m_base;
++}
++
++// This is an "infinite" precision irange for use in temporary
++// calculations. It starts with a sensible default covering 99% of
++// uses, and goes up to HARD_MAX_RANGES when needed. Any allocated
++// storage is freed upon destruction.
++typedef int_range<3, /*RESIZABLE=*/true> int_range_max;
++
+ class vrange_visitor
+ {
+ public:
+@@ -490,10 +531,6 @@ public:
+ // There are copy operators to seamlessly copy to/fro multi-ranges.
+ typedef int_range<1> value_range;
+
+-// This is an "infinite" precision irange for use in temporary
+-// calculations.
+-typedef int_range<255> int_range_max;
+-
+ // This is an "infinite" precision range object for use in temporary
+ // calculations for any of the handled types. The object can be
+ // transparently used as a vrange.
+@@ -872,64 +909,65 @@ gt_pch_nx (int_range<N> *x, gt_pointer_operator op, void *cookie)
+ // Constructors for irange
+
+ inline
+-irange::irange (tree *base, unsigned nranges)
++irange::irange (tree *base, unsigned nranges, bool resizable)
+ {
+ m_discriminator = VR_IRANGE;
+ m_base = base;
+ m_max_ranges = nranges;
++ m_resizable = resizable;
+ set_undefined ();
+ }
+
+ // Constructors for int_range<>.
+
+-template<unsigned N>
++template<unsigned N, bool RESIZABLE>
+ inline
+-int_range<N>::int_range ()
+- : irange (m_ranges, N)
++int_range<N, RESIZABLE>::int_range ()
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ }
+
+-template<unsigned N>
+-int_range<N>::int_range (const int_range &other)
+- : irange (m_ranges, N)
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>::int_range (const int_range &other)
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ irange::operator= (other);
+ }
+
+-template<unsigned N>
+-int_range<N>::int_range (tree min, tree max, value_range_kind kind)
+- : irange (m_ranges, N)
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>::int_range (tree min, tree max, value_range_kind kind)
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ irange::set (min, max, kind);
+ }
+
+-template<unsigned N>
+-int_range<N>::int_range (tree type)
+- : irange (m_ranges, N)
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>::int_range (tree type)
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ set_varying (type);
+ }
+
+-template<unsigned N>
+-int_range<N>::int_range (tree type, const wide_int &wmin, const wide_int &wmax,
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>::int_range (tree type, const wide_int &wmin, const wide_int &wmax,
+ value_range_kind kind)
+- : irange (m_ranges, N)
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ tree min = wide_int_to_tree (type, wmin);
+ tree max = wide_int_to_tree (type, wmax);
+ set (min, max, kind);
+ }
+
+-template<unsigned N>
+-int_range<N>::int_range (const irange &other)
+- : irange (m_ranges, N)
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>::int_range (const irange &other)
++ : irange (m_ranges, N, RESIZABLE)
+ {
+ irange::operator= (other);
+ }
+
+-template<unsigned N>
+-int_range<N>&
+-int_range<N>::operator= (const int_range &src)
++template<unsigned N, bool RESIZABLE>
++int_range<N, RESIZABLE>&
++int_range<N, RESIZABLE>::operator= (const int_range &src)
+ {
+ irange::operator= (src);
+ return *this;
+--
+2.40.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index be66787..998f555 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,9 @@
+4 30 Jul 2023
+
+ U 31_all_gm2_make_P_var.patch
+ + 82_all_arm64_PR110280_ICE_fold-const.patch
+ + 83_all_all_PR110315_crash_large_std_vector.patch
+
3 26 May 2023
+ 76_all_match.pd-don-t-emit-label-if-not-needed.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-08-05 23:13 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-08-05 23:13 UTC (permalink / raw
To: gentoo-commits
commit: 78f6c61007a059d12df76503152c689f5c76dc03
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 5 22:53:05 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 5 22:53:05 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=78f6c610
13.2: drop obsolete upstream patch (82_all_arm64_PR110280_ICE_fold-const.patch)
In latest snapshot.
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../82_all_arm64_PR110280_ICE_fold-const.patch | 53 ----------------------
13.2.0/gentoo/README.history | 3 ++
2 files changed, 3 insertions(+), 53 deletions(-)
diff --git a/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch b/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch
deleted file mode 100644
index d27ca7a..0000000
--- a/13.2.0/gentoo/82_all_arm64_PR110280_ICE_fold-const.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110280
-https://inbox.sourceware.org/gcc-patches/nycvar.YFH.7.77.849.2307270634430.12935@jbgna.fhfr.qr/T/#t
-
-From 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04 Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH] [aarch64/match.pd] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
- PR tree-optimization/110280
- * match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
- using build_vector_from_val with the element of input operand, and
- mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
- PR tree-optimization/110280
- * gcc.target/aarch64/sve/pr110280.c: New test.
-
-(cherry picked from commit 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04)
-
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
-
- (simplify
- (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+ @0
-+ (with
-+ {
-+ tree elem = uniform_vector_p (@0);
-+ }
-+ (if (elem)
-+ { build_vector_from_val (type, elem); }))))
-
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895). */
- (simplify
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+ return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 998f555..769413a 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+5 05 Aug 2023
+ - 82_all_arm64_PR110280_ICE_fold-const.patch
+
4 30 Jul 2023
U 31_all_gm2_make_P_var.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-08-13 0:35 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-08-13 0:35 UTC (permalink / raw
To: gentoo-commits
commit: 7b28599cfed98fc831c16f1b528f15fd99011dae
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 13 00:20:39 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 13 00:20:39 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7b28599c
13.2.0: add patch for Botan miscompilation
Bug: https://github.com/randombit/botan/issues/3637
Bug: https://gcc.gnu.org/PR110792
Signed-off-by: Sam James <sam <AT> gentoo.org>
...110792-Early-clobber-issues-with-rot32di2.patch | 186 +++++++++++++++++++++
13.2.0/gentoo/README.history | 3 +
2 files changed, 189 insertions(+)
diff --git a/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch b/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
new file mode 100644
index 0000000..e3c09cc
--- /dev/null
+++ b/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
@@ -0,0 +1,186 @@
+https://gcc.gnu.org/PR110792
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571
+https://github.com/randombit/botan/issues/3637
+
+From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001
+From: Roger Sayle <roger@nextmovesoftware.com>
+Date: Thu, 3 Aug 2023 07:12:04 +0100
+Subject: [PATCH] PR target/110792: Early clobber issues with
+ rot32di2_doubleword on i386.
+
+This patch is a conservative fix for PR target/110792, a wrong-code
+regression affecting doubleword rotations by BITS_PER_WORD, which
+effectively swaps the highpart and lowpart words, when the source to be
+rotated resides in memory. The issue is that if the register used to
+hold the lowpart of the destination is mentioned in the address of
+the memory operand, the current define_insn_and_split unintentionally
+clobbers it before reading the highpart.
+
+Hence, for the testcase, the incorrectly generated code looks like:
+
+ salq $4, %rdi // calculate address
+ movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr
+ movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart
+
+Traditionally, the textbook way to fix this would be to add an
+explicit early clobber to the instruction's constraints.
+
+ (define_insn_and_split "<insn>32di2_doubleword"
+- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
++ [(set (match_operand:DI 0 "register_operand" "=r,r,&r")
+ (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o")
+ (const_int 32)))]
+
+but unfortunately this currently generates significantly worse code,
+due to a strange choice of reloads (effectively memcpy), which ends up
+looking like:
+
+ salq $4, %rdi // calculate address
+ movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg.
+ movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack
+ movq -8(%rsp), %rdi // load highpart
+ movq -16(%rsp), %rbp // load lowpart
+
+Note that reload's "&" doesn't distinguish between the memory being
+early clobbered, vs the registers used in an addressing mode being
+early clobbered.
+
+The fix proposed in this patch is to remove the third alternative, that
+allowed offsetable memory as an operand, forcing reload to place the
+operand into a register before the rotation. This results in:
+
+ salq $4, %rdi
+ movq WHIRL_S(%rdi), %rax
+ movq WHIRL_S+8(%rdi), %rdi
+ movq %rax, %rbp
+
+I believe there's a more advanced solution, by swapping the order of
+the loads (if first destination register is mentioned in the address),
+or inserting a lea insn (if both destination registers are mentioned
+in the address), but this fix is a minimal "safe" solution, that
+should hopefully be suitable for backporting.
+
+2023-08-03 Roger Sayle <roger@nextmovesoftware.com>
+
+gcc/ChangeLog
+ PR target/110792
+ * config/i386/i386.md (<any_rotate>ti3): For rotations by 64 bits
+ place operand in a register before gen_<insn>64ti2_doubleword.
+ (<any_rotate>di3): Likewise, for rotations by 32 bits, place
+ operand in a register before gen_<insn>32di2_doubleword.
+ (<any_rotate>32di2_doubleword): Constrain operand to be in register.
+ (<any_rotate>64ti2_doubleword): Likewise.
+
+gcc/testsuite/ChangeLog
+ PR target/110792
+ * g++.target/i386/pr110792.C: New 32-bit C++ test case.
+ * gcc.target/i386/pr110792.c: New 64-bit C test case.
+
+(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571)
+---
+ gcc/config/i386/i386.md | 18 ++++++++++++------
+ gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++
+ gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++
+ 3 files changed, 46 insertions(+), 6 deletions(-)
+ create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C
+ create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c
+
+diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
+index f3a3305..a71e837 100644
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -14359,7 +14359,10 @@
+ emit_insn (gen_ix86_<insn>ti3_doubleword
+ (operands[0], operands[1], operands[2]));
+ else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64)
+- emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1]));
++ {
++ operands[1] = force_reg (TImode, operands[1]);
++ emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1]));
++ }
+ else
+ {
+ rtx amount = force_reg (QImode, operands[2]);
+@@ -14394,7 +14397,10 @@
+ emit_insn (gen_ix86_<insn>di3_doubleword
+ (operands[0], operands[1], operands[2]));
+ else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32)
+- emit_insn (gen_<insn>32di2_doubleword (operands[0], operands[1]));
++ {
++ operands[1] = force_reg (DImode, operands[1]);
++ emit_insn (gen_<insn>32di2_doubleword (operands[0], operands[1]));
++ }
+ else
+ FAIL;
+
+@@ -14562,8 +14568,8 @@
+ })
+
+ (define_insn_and_split "<insn>32di2_doubleword"
+- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
+- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o")
++ [(set (match_operand:DI 0 "register_operand" "=r,r")
++ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r")
+ (const_int 32)))]
+ "!TARGET_64BIT"
+ "#"
+@@ -14580,8 +14586,8 @@
+ })
+
+ (define_insn_and_split "<insn>64ti2_doubleword"
+- [(set (match_operand:TI 0 "register_operand" "=r,r,r")
+- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o")
++ [(set (match_operand:TI 0 "register_operand" "=r,r")
++ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r")
+ (const_int 64)))]
+ "TARGET_64BIT"
+ "#"
+diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C
+new file mode 100644
+index 0000000..ce21a7a
+--- /dev/null
++++ b/gcc/testsuite/g++.target/i386/pr110792.C
+@@ -0,0 +1,16 @@
++/* { dg-do compile { target ia32 } } */
++/* { dg-options "-O2" } */
++
++template <int ROT, typename T>
++inline T rotr(T input)
++{
++ return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
++}
++
++unsigned long long WHIRL_S[256] = {0x18186018C07830D8};
++unsigned long long whirl(unsigned char x0)
++{
++ const unsigned long long s4 = WHIRL_S[x0&0xFF];
++ return rotr<32>(s4);
++}
++/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */
+diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c
+new file mode 100644
+index 0000000..b65125c
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/pr110792.c
+@@ -0,0 +1,18 @@
++/* { dg-do compile { target int128 } } */
++/* { dg-options "-O2" } */
++
++static inline unsigned __int128 rotr(unsigned __int128 input)
++{
++ return ((input >> 64) | (input << (64)));
++}
++
++unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8};
++unsigned __int128 whirl(unsigned char x0)
++{
++ register int t __asm("rdi") = x0&0xFF;
++ const unsigned __int128 s4 = WHIRL_S[t];
++ register unsigned __int128 tt __asm("rdi") = rotr(s4);
++ asm("":::"memory");
++ return tt;
++}
++/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */
+--
+2.41.0
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 769413a..2f1fc73 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+6 13 Aug 2023
+ + 84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
+
5 05 Aug 2023
- 82_all_arm64_PR110280_ICE_fold-const.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-08-14 9:31 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-08-14 9:31 UTC (permalink / raw
To: gentoo-commits
commit: d0b55776a4e1d2f293db5ba0e4a04aefed055ec4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 13 00:37:58 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 14 09:30:03 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d0b55776
13.2.0: add extra trivial test fix
Signed-off-by: Sam James <sam <AT> gentoo.org>
...y-clobber-issues-with-rot32di2-test-fixup.patch | 39 ++++++++++++++++++++++
13.2.0/gentoo/README.history | 3 ++
2 files changed, 42 insertions(+)
diff --git a/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch b/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
new file mode 100644
index 0000000..059f68c
--- /dev/null
+++ b/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
@@ -0,0 +1,39 @@
+From 529909f9e92dd3b0ed0383f45a44d2b5f8a58958 Mon Sep 17 00:00:00 2001
+From: Roger Sayle <roger@nextmovesoftware.com>
+Date: Sun, 6 Aug 2023 23:19:10 +0100
+Subject: [PATCH] [Committed] Avoid FAIL of gcc.target/i386/pr110792.c
+
+My apologies (again), I managed to mess up the 64-bit version of the
+test case for PR 110792. Unlike the 32-bit version, the 64-bit case
+contains exactly the same load instructions, just in a different order
+making the correct and incorrect behaviours impossible to distinguish
+with a scan-assembler-not. Somewhere between checking that this test
+failed in a clean tree without the patch, and getting the escaping
+correct, I'd failed to notice that this also FAILs in the patched tree.
+Doh! Instead of removing the test completely, I've left it as a
+compilation test.
+
+The original fix is tested by the 32-bit test case.
+
+Committed to mainline as obvious. Sorry for the incovenience.
+
+2023-08-06 Roger Sayle <roger@nextmovesoftware.com>
+
+gcc/testsuite/ChangeLog
+ PR target/110792
+ * gcc.target/i386/pr110792.c: Remove dg-final scan-assembler-not.
+---
+ gcc/testsuite/gcc.target/i386/pr110792.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c
+index b65125c48b62..eea4e1877dbb 100644
+--- a/gcc/testsuite/gcc.target/i386/pr110792.c
++++ b/gcc/testsuite/gcc.target/i386/pr110792.c
+@@ -15,4 +15,3 @@ unsigned __int128 whirl(unsigned char x0)
+ asm("":::"memory");
+ return tt;
+ }
+-/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */
+--
+2.39.3
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 2f1fc73..24a8367 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+7 13 Aug 2023
+ + 85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
+
6 13 Aug 2023
+ 84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-10-01 2:28 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-10-01 2:28 UTC (permalink / raw
To: gentoo-commits
commit: d10e29b8069920831f8c63a63e58f0dfe46ee3fe
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 1 01:45:42 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 1 02:28:48 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d10e29b8
13.2.0: drop upstreamed 83_all_all_PR110315_crash_large_std_vector.patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
...3_all_all_PR110315_crash_large_std_vector.patch | 353 ---------------------
13.2.0/gentoo/README.history | 3 +
2 files changed, 3 insertions(+), 353 deletions(-)
diff --git a/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch b/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch
deleted file mode 100644
index 7c854ff..0000000
--- a/13.2.0/gentoo/83_all_all_PR110315_crash_large_std_vector.patch
+++ /dev/null
@@ -1,353 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315 (specifically https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315#c7)
-
-From 777aa930b106fea2dd6ed9fe22b42a2717f1472d Mon Sep 17 00:00:00 2001
-From: Aldy Hernandez <aldyh@redhat.com>
-Date: Mon, 15 May 2023 12:25:58 +0200
-Subject: [PATCH] [GCC13] Add auto-resizing capability to irange's [PR109695]
-
-Backport the following from trunk.
-
- Note that the patch has been adapted to trees.
-
- The numbers for various sub-ranges on GCC13 are:
- < 2> = 64 bytes, -3.02% for VRP.
- < 3> = 80 bytes, -2.67% for VRP.
- < 8> = 160 bytes, -2.46% for VRP.
- <16> = 288 bytes, -2.40% for VRP.
-
-<tldr>
-We can now have int_range<N, RESIZABLE=false> for automatically
-resizable ranges. int_range_max is now int_range<3, true>
-for a 69X reduction in size from current trunk, and 6.9X reduction from
-GCC12. This incurs a 5% performance penalty for VRP that is more than
-covered by our > 13% improvements recently.
-</tldr>
-
-int_range_max is the temporary range object we use in the ranger for
-integers. With the conversion to wide_int, this structure bloated up
-significantly because wide_ints are huge (80 bytes a piece) and are
-about 10 times as big as a plain tree. Since the temporary object
-requires 255 sub-ranges, that's 255 * 80 * 2, plus the control word.
-This means the structure grew from 4112 bytes to 40912 bytes.
-
-This patch adds the ability to resize ranges as needed, defaulting to
-no resizing, while int_range_max now defaults to 3 sub-ranges (instead
-of 255) and grows to 255 when the range being calculated does not fit.
-
-For example:
-
-int_range<1> foo; // 1 sub-range with no resizing.
-int_range<5> foo; // 5 sub-ranges with no resizing.
-int_range<5, true> foo; // 5 sub-ranges with resizing.
-
-I ran some tests and found that 3 sub-ranges cover 99% of cases, so
-I've set the int_range_max default to that:
-
- typedef int_range<3, /*RESIZABLE=*/true> int_range_max;
-
-We don't bother growing incrementally, since the default covers most
-cases and we have a 255 hard-limit. This hard limit could be reduced
-to 128, since my tests never saw a range needing more than 124, but we
-could do that as a follow-up if needed.
-
-With 3-subranges, int_range_max is now 592 bytes versus 40912 for
-trunk, and versus 4112 bytes for GCC12! The penalty is 5.04% for VRP
-and 3.02% for threading, with no noticeable change in overall
-compilation (0.27%). This is more than covered by our 13.26%
-improvements for the legacy removal + wide_int conversion.
-
-I think this approach is a good alternative, while providing us with
-flexibility going forward. For example, we could try defaulting to a
-8 sub-ranges for a noticeable improvement in VRP. We could also use
-large sub-ranges for switch analysis to avoid resizing.
-
-Another approach I tried was always resizing. With this, we could
-drop the whole int_range<N> nonsense, and have irange just hold a
-resizable range. This simplified things, but incurred a 7% penalty on
-ipa_cp. This was hard to pinpoint, and I'm not entirely convinced
-this wasn't some artifact of valgrind. However, until we're sure,
-let's avoid massive changes, especially since IPA changes are coming
-up.
-
-For the curious, a particular hot spot for IPA in this area was:
-
-ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
-{
-...
-...
- value_range save (m_vr);
- m_vr.union_ (*other_vr);
- return m_vr != save;
-}
-
-The problem isn't the resizing (since we do that at most once) but the
-fact that for some functions with lots of callers we end up a huge
-range that gets copied and compared for every meet operation. Maybe
-the IPA algorithm could be adjusted somehow??.
-
-Anywhooo... for now there is nothing to worry about, since value_range
-still has 2 subranges and is not resizable. But we should probably
-think what if anything we want to do here, as I envision IPA using
-infinite ranges here (well, int_range_max) and handling frange's, etc.
-
-gcc/ChangeLog:
-
- PR tree-optimization/109695
- * value-range.cc (irange::operator=): Resize range.
- (irange::union_): Same.
- (irange::intersect): Same.
- (irange::invert): Same.
- (int_range_max): Default to 3 sub-ranges and resize as needed.
- * value-range.h (irange::maybe_resize): New.
- (~int_range): New.
- (int_range::int_range): Adjust for resizing.
- (int_range::operator=): Same.
---- a/gcc/value-range-storage.h
-+++ b/gcc/value-range-storage.h
-@@ -184,7 +184,7 @@ vrange_allocator::alloc_irange (unsigned num_pairs)
- // Allocate the irange and required memory for the vector.
- void *r = alloc (sizeof (irange));
- tree *mem = static_cast <tree *> (alloc (nbytes));
-- return new (r) irange (mem, num_pairs);
-+ return new (r) irange (mem, num_pairs, /*resizable=*/false);
- }
-
- inline frange *
---- a/gcc/value-range.cc
-+++ b/gcc/value-range.cc
-@@ -831,6 +831,10 @@ irange::operator= (const irange &src)
- copy_to_legacy (src);
- return *this;
- }
-+
-+ int needed = src.num_pairs ();
-+ maybe_resize (needed);
-+
- if (src.legacy_mode_p ())
- {
- copy_legacy_to_multi_range (src);
-@@ -2506,6 +2510,7 @@ irange::irange_union (const irange &r)
- // Now it simply needs to be copied, and if there are too many
- // ranges, merge some. We wont do any analysis as to what the
- // "best" merges are, simply combine the final ranges into one.
-+ maybe_resize (i / 2);
- if (i > m_max_ranges * 2)
- {
- res[m_max_ranges * 2 - 1] = res[i - 1];
-@@ -2605,6 +2610,11 @@ irange::irange_intersect (const irange &r)
- if (r.irange_contains_p (*this))
- return intersect_nonzero_bits (r);
-
-+ // ?? We could probably come up with something smarter than the
-+ // worst case scenario here.
-+ int needed = num_pairs () + r.num_pairs ();
-+ maybe_resize (needed);
-+
- signop sign = TYPE_SIGN (TREE_TYPE(m_base[0]));
- unsigned bld_pair = 0;
- unsigned bld_lim = m_max_ranges;
-@@ -2831,6 +2841,11 @@ irange::invert ()
- m_num_ranges = 1;
- return;
- }
-+
-+ // At this point, we need one extra sub-range to represent the
-+ // inverse.
-+ maybe_resize (m_num_ranges + 1);
-+
- // The algorithm is as follows. To calculate INVERT ([a,b][c,d]), we
- // generate [-MIN, a-1][b+1, c-1][d+1, MAX].
- //
---- a/gcc/value-range.h
-+++ b/gcc/value-range.h
-@@ -172,7 +172,8 @@ public:
- bool legacy_verbose_intersect (const irange *); // DEPRECATED
-
- protected:
-- irange (tree *, unsigned);
-+ void maybe_resize (int needed);
-+ irange (tree *, unsigned nranges, bool resizable);
- // potential promotion to public?
- tree tree_lower_bound (unsigned = 0) const;
- tree tree_upper_bound (unsigned) const;
-@@ -200,6 +201,8 @@ protected:
- void copy_to_legacy (const irange &);
- void copy_legacy_to_multi_range (const irange &);
-
-+ // Hard limit on max ranges allowed.
-+ static const int HARD_MAX_RANGES = 255;
- private:
- friend void gt_ggc_mx (irange *);
- friend void gt_pch_nx (irange *);
-@@ -214,15 +217,21 @@ private:
-
- bool intersect (const wide_int& lb, const wide_int& ub);
- unsigned char m_num_ranges;
-+ bool m_resizable;
- unsigned char m_max_ranges;
- tree m_nonzero_mask;
-+protected:
- tree *m_base;
- };
-
- // Here we describe an irange with N pairs of ranges. The storage for
- // the pairs is embedded in the class as an array.
-+//
-+// If RESIZABLE is true, the storage will be resized on the heap when
-+// the number of ranges needed goes past N up to a max of
-+// HARD_MAX_RANGES. This new storage is freed upon destruction.
-
--template<unsigned N>
-+template<unsigned N, bool RESIZABLE = false>
- class GTY((user)) int_range : public irange
- {
- public:
-@@ -233,7 +242,7 @@ public:
- int_range (tree type);
- int_range (const int_range &);
- int_range (const irange &);
-- virtual ~int_range () = default;
-+ virtual ~int_range ();
- int_range& operator= (const int_range &);
- private:
- template <unsigned X> friend void gt_ggc_mx (int_range<X> *);
-@@ -472,6 +481,38 @@ is_a <frange> (vrange &v)
- return v.m_discriminator == VR_FRANGE;
- }
-
-+// For resizable ranges, resize the range up to HARD_MAX_RANGES if the
-+// NEEDED pairs is greater than the current capacity of the range.
-+
-+inline void
-+irange::maybe_resize (int needed)
-+{
-+ if (!m_resizable || m_max_ranges == HARD_MAX_RANGES)
-+ return;
-+
-+ if (needed > m_max_ranges)
-+ {
-+ m_max_ranges = HARD_MAX_RANGES;
-+ tree *newmem = new tree[m_max_ranges * 2];
-+ memcpy (newmem, m_base, sizeof (tree) * num_pairs () * 2);
-+ m_base = newmem;
-+ }
-+}
-+
-+template<unsigned N, bool RESIZABLE>
-+inline
-+int_range<N, RESIZABLE>::~int_range ()
-+{
-+ if (RESIZABLE && m_base != m_ranges)
-+ delete m_base;
-+}
-+
-+// This is an "infinite" precision irange for use in temporary
-+// calculations. It starts with a sensible default covering 99% of
-+// uses, and goes up to HARD_MAX_RANGES when needed. Any allocated
-+// storage is freed upon destruction.
-+typedef int_range<3, /*RESIZABLE=*/true> int_range_max;
-+
- class vrange_visitor
- {
- public:
-@@ -490,10 +531,6 @@ public:
- // There are copy operators to seamlessly copy to/fro multi-ranges.
- typedef int_range<1> value_range;
-
--// This is an "infinite" precision irange for use in temporary
--// calculations.
--typedef int_range<255> int_range_max;
--
- // This is an "infinite" precision range object for use in temporary
- // calculations for any of the handled types. The object can be
- // transparently used as a vrange.
-@@ -872,64 +909,65 @@ gt_pch_nx (int_range<N> *x, gt_pointer_operator op, void *cookie)
- // Constructors for irange
-
- inline
--irange::irange (tree *base, unsigned nranges)
-+irange::irange (tree *base, unsigned nranges, bool resizable)
- {
- m_discriminator = VR_IRANGE;
- m_base = base;
- m_max_ranges = nranges;
-+ m_resizable = resizable;
- set_undefined ();
- }
-
- // Constructors for int_range<>.
-
--template<unsigned N>
-+template<unsigned N, bool RESIZABLE>
- inline
--int_range<N>::int_range ()
-- : irange (m_ranges, N)
-+int_range<N, RESIZABLE>::int_range ()
-+ : irange (m_ranges, N, RESIZABLE)
- {
- }
-
--template<unsigned N>
--int_range<N>::int_range (const int_range &other)
-- : irange (m_ranges, N)
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>::int_range (const int_range &other)
-+ : irange (m_ranges, N, RESIZABLE)
- {
- irange::operator= (other);
- }
-
--template<unsigned N>
--int_range<N>::int_range (tree min, tree max, value_range_kind kind)
-- : irange (m_ranges, N)
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>::int_range (tree min, tree max, value_range_kind kind)
-+ : irange (m_ranges, N, RESIZABLE)
- {
- irange::set (min, max, kind);
- }
-
--template<unsigned N>
--int_range<N>::int_range (tree type)
-- : irange (m_ranges, N)
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>::int_range (tree type)
-+ : irange (m_ranges, N, RESIZABLE)
- {
- set_varying (type);
- }
-
--template<unsigned N>
--int_range<N>::int_range (tree type, const wide_int &wmin, const wide_int &wmax,
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>::int_range (tree type, const wide_int &wmin, const wide_int &wmax,
- value_range_kind kind)
-- : irange (m_ranges, N)
-+ : irange (m_ranges, N, RESIZABLE)
- {
- tree min = wide_int_to_tree (type, wmin);
- tree max = wide_int_to_tree (type, wmax);
- set (min, max, kind);
- }
-
--template<unsigned N>
--int_range<N>::int_range (const irange &other)
-- : irange (m_ranges, N)
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>::int_range (const irange &other)
-+ : irange (m_ranges, N, RESIZABLE)
- {
- irange::operator= (other);
- }
-
--template<unsigned N>
--int_range<N>&
--int_range<N>::operator= (const int_range &src)
-+template<unsigned N, bool RESIZABLE>
-+int_range<N, RESIZABLE>&
-+int_range<N, RESIZABLE>::operator= (const int_range &src)
- {
- irange::operator= (src);
- return *this;
---
-2.40.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 24a8367..66e3ed1 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+8 1 Oct 2023
+ - 83_all_all_PR110315_crash_large_std_vector.patch
+
7 13 Aug 2023
+ 85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-10-01 2:28 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-10-01 2:28 UTC (permalink / raw
To: gentoo-commits
commit: a2b85f16e79253103389731d9ac60b6868435b48
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 1 02:02:13 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 1 02:28:48 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a2b85f16
13.2.0: rebase 31_all_gm2_make_P_var.patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/31_all_gm2_make_P_var.patch | 16 +++++++---------
13.2.0/gentoo/README.history | 2 ++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/13.2.0/gentoo/31_all_gm2_make_P_var.patch b/13.2.0/gentoo/31_all_gm2_make_P_var.patch
index ef34288..74b3925 100644
--- a/13.2.0/gentoo/31_all_gm2_make_P_var.patch
+++ b/13.2.0/gentoo/31_all_gm2_make_P_var.patch
@@ -12,33 +12,33 @@ r0-31149-gb8dad04b688e9c.
gcc/m2/ChangeLog:
- * Make-lang.in: Remove references to $(P).
- * Make-maintainer.in: Ditto.
+ * Make-lang.in: Remove references to $(P).
+ * Make-maintainer.in: Ditto.
(cherry picked from commit 79c73122fab213f218b85b2c579ffe3cf5e98ad0)
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
-@@ -515,7 +515,7 @@ GM2_LIBS_BOOT = m2/gm2-compiler-boot/gm2.a \
+@@ -532,7 +532,7 @@ m2_OBJS = $(GM2_C_OBJS) m2/gm2-gcc/rtegraph.o \
cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
cp -p $< $@
-m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(P) \
+m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o \
$(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
- m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext)
+ m2/gm2-gcc/rtegraph.o $(M2RTE_PLUGIN_SO)
-test -d $(@D) || $(mkinstalldirs) $(@D)
-@@ -528,7 +528,7 @@ m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(
+@@ -545,7 +545,7 @@ m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(
@$(call LINK_PROGRESS,$(INDEX.m2),end)
m2/stage1/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
- $(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
+ $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
$(GM2_LIBS_BOOT) $(MC_LIBS) \
- m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) \
+ m2/gm2-gcc/rtegraph.o $(M2RTE_PLUGIN_SO) \
$(m2.prev)
--- a/gcc/m2/Make-maintainer.in
+++ b/gcc/m2/Make-maintainer.in
-@@ -848,7 +848,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
+@@ -852,7 +852,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
gm2.paranoid: m2/m2obj3/cc1gm2$(exeext) gm2.verifyparanoid
m2/m2obj3/cc1gm2$(exeext): m2/m2obj2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
@@ -47,5 +47,3 @@ gcc/m2/ChangeLog:
m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-test -d m2/m2obj3 || $(mkinstalldirs) m2/m2obj3
@$(call LINK_PROGRESS,$(INDEX.m2),start)
---
-2.41.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 449fcee..1ab8e80 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,4 +1,6 @@
8 1 Oct 2023
+
+ U 31_all_gm2_make_P_var.patch
+ 50_all_system_cxx_headers_libcxx.patch
- 83_all_all_PR110315_crash_large_std_vector.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-10-01 2:28 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-10-01 2:28 UTC (permalink / raw
To: gentoo-commits
commit: 9e320b0781c3505e9f6ff49b84f5b35d6016c653
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 1 01:50:47 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 1 02:28:48 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9e320b07
13.2.0: add 50_all_PR111632_system_cxx_headers_libcxx.patch
Bug: https://gcc.gnu.org/PR111632
Bug: https://bugs.gentoo.org/912035
Signed-off-by: Sam James <sam <AT> gentoo.org>
| 134 +++++++++++++++++++++
13.2.0/gentoo/README.history | 1 +
2 files changed, 135 insertions(+)
--git a/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch b/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch
new file mode 100644
index 0000000..af6c286
--- /dev/null
+++ b/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch
@@ -0,0 +1,134 @@
+https://bugs.gentoo.org/912035
+https://inbox.sourceware.org/gcc-patches/0623E896-6B99-49EC-9144-B41BC51089F0@andric.com
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274038
+https://gcc.gnu.org/PR111632
+
+commit 8992952bfa95e769a554bd97581cf332987383d8
+Author: Dimitry Andric <dimitry@andric.com>
+Date: 2023-09-28T17:40:29+02:00
+
+ Include safe-ctype.h after C++ standard headers, to avoid over-poisoning
+
+ When building gcc's C++ sources against recent libc++, the poisoning of
+ the ctype macros due to including safe-ctype.h before including C++
+ standard headers such as <list>, <map>, etc, causes many compilation
+ errors, similar to:
+
+ In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
+ In file included from /home/dim/src/gcc/master/gcc/system.h:233:
+ In file included from /usr/include/c++/v1/vector:321:
+ In file included from
+ /usr/include/c++/v1/__format/formatter_bool.h:20:
+ In file included from
+ /usr/include/c++/v1/__format/formatter_integral.h:32:
+ In file included from /usr/include/c++/v1/locale:202:
+ /usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute
+ only applies to structs, variables, functions, and namespaces
+ 546 | _LIBCPP_INLINE_VISIBILITY
+ | ^
+ /usr/include/c++/v1/__config:813:37: note: expanded from macro
+ '_LIBCPP_INLINE_VISIBILITY'
+ 813 | # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
+ | ^
+ /usr/include/c++/v1/__config:792:26: note: expanded from macro
+ '_LIBCPP_HIDE_FROM_ABI'
+ 792 |
+ __attribute__((__abi_tag__(_LIBCPP_TOSTRING(
+ _LIBCPP_VERSIONED_IDENTIFIER))))
+ | ^
+ In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
+ In file included from /home/dim/src/gcc/master/gcc/system.h:233:
+ In file included from /usr/include/c++/v1/vector:321:
+ In file included from
+ /usr/include/c++/v1/__format/formatter_bool.h:20:
+ In file included from
+ /usr/include/c++/v1/__format/formatter_integral.h:32:
+ In file included from /usr/include/c++/v1/locale:202:
+ /usr/include/c++/v1/__locale:547:37: error: expected ';' at end of
+ declaration list
+ 547 | char_type toupper(char_type __c) const
+ | ^
+ /usr/include/c++/v1/__locale:553:48: error: too many arguments
+ provided to function-like macro invocation
+ 553 | const char_type* toupper(char_type* __low, const
+ char_type* __high) const
+ | ^
+ /home/dim/src/gcc/master/gcc/../include/safe-ctype.h:146:9: note:
+ macro 'toupper' defined here
+ 146 | #define toupper(c) do_not_use_toupper_with_safe_ctype
+ | ^
+
+ This is because libc++ uses different transitive includes than
+ libstdc++, and some of those transitive includes pull in various ctype
+ declarations (typically via <locale>).
+
+ There was already a special case for including <string> before
+ safe-ctype.h, so move the rest of the C++ standard header includes to
+ the same location, to fix the problem.
+
+ Signed-off-by: Dimitry Andric <dimitry@andric.com>
+
+diff --git a/gcc/system.h b/gcc/system.h
+index e924152ad4c..7a516b11438 100644
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...);
+ #undef fread_unlocked
+ #undef fwrite_unlocked
+
+-/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
+- the ctype macros through safe-ctype.h */
+-
+-#ifdef __cplusplus
+-#ifdef INCLUDE_STRING
+-# include <string>
+-#endif
+-#endif
+-
+-/* There are an extraordinary number of issues with <ctype.h>.
+- The last straw is that it varies with the locale. Use libiberty's
+- replacement instead. */
+-#include "safe-ctype.h"
+-
+-#include <sys/types.h>
+-
+-#include <errno.h>
+-
+-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
+-extern int errno;
+-#endif
++/* Include C++ standard headers before "safe-ctype.h" to avoid GCC
++ poisoning the ctype macros through safe-ctype.h */
+
+ #ifdef __cplusplus
+ #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
+@@ -229,6 +210,9 @@ extern int errno;
+ #ifdef INCLUDE_SET
+ # include <set>
+ #endif
++#ifdef INCLUDE_STRING
++# include <string>
++#endif
+ #ifdef INCLUDE_VECTOR
+ # include <vector>
+ #endif
+@@ -245,6 +229,19 @@ extern int errno;
+ # include <type_traits>
+ #endif
+
++/* There are an extraordinary number of issues with <ctype.h>.
++ The last straw is that it varies with the locale. Use libiberty's
++ replacement instead. */
++#include "safe-ctype.h"
++
++#include <sys/types.h>
++
++#include <errno.h>
++
++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
++extern int errno;
++#endif
++
+ /* Some of glibc's string inlines cause warnings. Plus we'd rather
+ rely on (and therefore test) GCC's string builtins. */
+ #define __NO_STRING_INLINES
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 66e3ed1..449fcee 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,4 +1,5 @@
8 1 Oct 2023
+ + 50_all_system_cxx_headers_libcxx.patch
- 83_all_all_PR110315_crash_large_std_vector.patch
7 13 Aug 2023
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-10-16 12:41 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-10-16 12:41 UTC (permalink / raw
To: gentoo-commits
commit: 6e02b91080e891bbc57ced4d3140fcf6ba3d7088
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 16 12:10:48 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 16 12:40:58 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6e02b910
13.2.0: backport insn-emit split patches
This is a continuation of 7a6b2d23ec02e75475a6123254ccd44d73827f39 ('13.2.0: backport split match.pd changes')
in a sense - see that commit for rationale for backporting.
Motivated here again by more reports of OOMs with insn-match.cc.
Bug: https://gcc.gnu.org/PR54179
Bug: https://gcc.gnu.org/PR84402
Bug: https://gcc.gnu.org/PR111600
Signed-off-by: Sam James <sam <AT> gentoo.org>
...ce-seq-for-portability-with-GNU-Make-vari.patch | 72 +
...l_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch | 72 +
....in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch | 66 +
...in-Make-recog.h-depend-on-TREE_H-PR111021.patch | 44 +
...genemit-Split-insn-emit.cc-into-ten-files.patch | 1376 ++++++++++++++++++++
13.2.0/gentoo/README.history | 8 +
6 files changed, 1638 insertions(+)
diff --git a/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch b/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
new file mode 100644
index 0000000..9b88852
--- /dev/null
+++ b/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
@@ -0,0 +1,72 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=319aef8d2fde32be5cfed99f321c7f90e33d1f1d
+
+From 3fd5922104168eb1a88ee6209d84ccc9e72a4bfa Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Sat, 6 May 2023 02:32:17 +0200
+Subject: [PATCH 1/6] build: Replace seq for portability with GNU Make variant
+
+Some hosts like AIX don't have seq command, this patch replaces it
+with something that uses just GNU make features we've been using
+for this already before for the parallel make check.
+
+2023-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.in (check_p_numbers): Rename to one_to_9999, move
+ earlier with helper variables also renamed.
+ (MATCH_SPLUT_SEQ): Use $(wordlist 1,$(NUM_MATCH_SPLITS),$(one_to_9999))
+ instead of $(shell seq 1 $(NUM_MATCH_SPLITS)).
+ (check_p_subdirs): Use $(one_to_9999) instead of $(check_p_numbers).
+
+(cherry picked from commit 319aef8d2fde32be5cfed99f321c7f90e33d1f1d)
+---
+ gcc/Makefile.in | 22 ++++++++++++----------
+ 1 file changed, 12 insertions(+), 10 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index fe3af5c8008..975fbb61ea8 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -214,9 +214,19 @@ rtl-ssa-warn = $(STRICT_WARN)
+ GCC_WARN_CFLAGS = $(LOOSE_WARN) $(C_LOOSE_WARN) $($(@D)-warn) $(if $(filter-out $(STRICT_WARN),$($(@D)-warn)),,$(C_STRICT_WARN)) $(NOCOMMON_FLAG) $($@-warn)
+ GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
+
++# 1 2 3 ... 9999
++one_to_9999_0:=1 2 3 4 5 6 7 8 9
++one_to_9999_1:=0 $(one_to_9999_0)
++one_to_9999_2:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_1)))
++one_to_9999_3:=$(addprefix 0,$(one_to_9999_1)) $(one_to_9999_2)
++one_to_9999_4:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_3)))
++one_to_9999_5:=$(addprefix 0,$(one_to_9999_3)) $(one_to_9999_4)
++one_to_9999_6:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_5)))
++one_to_9999:=$(one_to_9999_0) $(one_to_9999_2) $(one_to_9999_4) $(one_to_9999_6)
++
+ # The number of splits to be made for the match.pd files.
+ NUM_MATCH_SPLITS = @DEFAULT_MATCHPD_PARTITIONS@
+-MATCH_SPLITS_SEQ = $(shell seq 1 $(NUM_MATCH_SPLITS))
++MATCH_SPLITS_SEQ = $(wordlist 1,$(NUM_MATCH_SPLITS),$(one_to_9999))
+ GIMPLE_MATCH_PD_SEQ_SRC = $(patsubst %, gimple-match-%.cc, $(MATCH_SPLITS_SEQ))
+ GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
+ GENERIC_MATCH_PD_SEQ_SRC = $(patsubst %, generic-match-%.cc, $(MATCH_SPLITS_SEQ))
+@@ -4220,18 +4230,10 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
+ check_p_tool=$(firstword $(subst _, ,$*))
+ check_p_count=$(check_$(check_p_tool)_parallelize)
+ check_p_subno=$(word 2,$(subst _, ,$*))
+-check_p_numbers0:=1 2 3 4 5 6 7 8 9
+-check_p_numbers1:=0 $(check_p_numbers0)
+-check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
+-check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
+-check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
+-check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
+-check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
+-check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
+ check_p_subdir=$(subst _,,$*)
+ check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
+ $(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
+- $(check_p_numbers)))
++ $(one_to_9999)))
+
+ # For parallelized check-% targets, this decides whether parallelization
+ # is desirable (if -jN is used). If desirable, recursive make is run with
+--
+2.42.0
+
diff --git a/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
new file mode 100644
index 0000000..5cbeb48
--- /dev/null
+++ b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
@@ -0,0 +1,72 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bc45e18d433f879a02e369d027829f90f9e85724
+
+From f68becb26d43428a8e35ff2528c2bce719a7bb0a Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Mon, 12 Jun 2023 14:06:08 +0100
+Subject: [PATCH 2/6] Remove DEFAULT_MATCHPD_PARTITIONS macro
+
+As Jakub pointed out, DEFAULT_MATCHPD_PARTITIONS
+is now unused and can be removed.
+
+gcc/ChangeLog:
+
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Remove DEFAULT_MATCHPD_PARTITIONS.
+
+(cherry picked from commit bc45e18d433f879a02e369d027829f90f9e85724)
+---
+ gcc/configure | 9 ++-------
+ gcc/configure.ac | 2 --
+ 2 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index 843fd5449dd..3750f77fd03 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -7908,11 +7908,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
+ fi
+
+
+-cat >>confdefs.h <<_ACEOF
+-#define DEFAULT_MATCHPD_PARTITIONS $DEFAULT_MATCHPD_PARTITIONS
+-_ACEOF
+-
+-
+
+ # Enable __cxa_atexit for C++.
+ # Check whether --enable-__cxa_atexit was given.
+@@ -19850,7 +19845,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19853 "configure"
++#line 19848 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -19956,7 +19951,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19959 "configure"
++#line 19954 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index de5e3aef2c8..7f8aa5329c7 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -932,8 +932,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
+ Cannot be negative.]))
+ fi
+
+-AC_DEFINE_UNQUOTED(DEFAULT_MATCHPD_PARTITIONS, $DEFAULT_MATCHPD_PARTITIONS,
+- [Define to larger than one set the number of match.pd partitions to make.])
+ AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
+
+ # Enable __cxa_atexit for C++.
+--
+2.42.0
+
diff --git a/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
new file mode 100644
index 0000000..bd738cb
--- /dev/null
+++ b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
@@ -0,0 +1,66 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8353b9c5f5af0e65cb04fcbb7325d6a566006cd4
+
+From c60ffbdd0b7bee758672d66187b65eaf1a59d4a1 Mon Sep 17 00:00:00 2001
+From: Kewen Lin <linkw@linux.ibm.com>
+Date: Fri, 18 Aug 2023 05:03:40 -0500
+Subject: [PATCH 4/6] Makefile.in: Make TM_P_H depend on $(TREE_H) [PR111021]
+
+As PR111021 shows, the below ${port}-protos.h include tree.h
+for code_helper and tree_code:
+
+ arm/arm-protos.h:#include "tree.h"
+ cris/cris-protos.h:#include "tree.h" (H-P removed this in r14-3218)
+ microblaze/microblaze-protos.h:#include "tree.h"
+ rl78/rl78-protos.h:#include "tree.h"
+ stormy16/stormy16-protos.h:#include "tree.h"
+
+, when compiling build/gencondmd.cc, the include hierarchy
+makes it depend on tm_p.h -> ${port}-protos.h -> tree.h,
+which further includes (depends on) some files that are
+generated during the building, such as: all-tree.def,
+tree-check.h and so on. The previous commit r14-3215
+should already force build/gencondmd.cc to depend on
+${TREE_H}, so the reported build failure should be gone.
+
+But for a long term maintenance, especially one day some
+build/xxx.cc requires tm_p.h but not recog.h, the ${TREE_H}
+dependence could be missed and a build failure will show
+up. So this patch is to make TM_P_H depend on $(TREE_H),
+any new build/xxx.cc depending on tm_p.h will be able to
+consider ${TREE_H}.
+
+It's tested with cross-builds for the affected ports with
+steps:
+ 1) dropped the fix r14-3215;
+ 2) reproduced the build failure with serial build;
+ 3) applied this patch, serial built and verified all passed;
+ 4) added back r14-3215, serial built and verified all passed;
+
+ PR bootstrap/111021
+
+gcc/ChangeLog:
+
+ * Makefile.in (TM_P_H): Add $(TREE_H) as dependence.
+
+(cherry picked from commit 8353b9c5f5af0e65cb04fcbb7325d6a566006cd4)
+---
+ gcc/Makefile.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 975fbb61ea8..115d2a6d9b7 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -886,7 +886,8 @@ OPTIONS_C_EXTRA = $(PRETTY_PRINT_H)
+ BCONFIG_H = bconfig.h $(build_xm_file_list)
+ CONFIG_H = config.h $(host_xm_file_list)
+ TCONFIG_H = tconfig.h $(xm_file_list)
+-TM_P_H = tm_p.h $(tm_p_file_list)
++# Some $(target)-protos.h depends on tree.h
++TM_P_H = tm_p.h $(tm_p_file_list) $(TREE_H)
+ TM_D_H = tm_d.h $(tm_d_file_list)
+ GTM_H = tm.h $(tm_file_list) insn-constants.h
+ TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
+--
+2.42.0
+
diff --git a/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
new file mode 100644
index 0000000..7254215
--- /dev/null
+++ b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
@@ -0,0 +1,44 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ecb95399f43873e1f34119ac260bbea2ef358e53
+
+From 79a97ff760ae66da49dc216260fe94d894962b1d Mon Sep 17 00:00:00 2001
+From: Kewen Lin <linkw@linux.ibm.com>
+Date: Tue, 15 Aug 2023 03:01:20 -0500
+Subject: [PATCH 5/6] Makefile.in: Make recog.h depend on $(TREE_H) [PR111021]
+
+Commit r14-3093 introduced a random build failure on
+build/gencondmd.cc building. Since r14-3093 make recog.h
+include tree.h, which further includes (depends on) some
+files that are generated during the building, such as:
+all-tree.def, tree-check.h etc, when building file
+build/gencondmd.cc, the build can fail if these dependences
+are not ready. So this patch is to teach this dependence.
+
+Thank Jan-Benedict Glaw for testing this!
+
+ PR bootstrap/111021
+
+gcc/ChangeLog:
+
+ * Makefile.in (RECOG_H): Add $(TREE_H) as dependence.
+
+(cherry picked from commit ecb95399f43873e1f34119ac260bbea2ef358e53)
+---
+ gcc/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 115d2a6d9b7..2c16b14ad0f 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -985,7 +985,7 @@ GIMPLE_H = gimple.h gimple.def gsstruct.def $(VEC_H) \
+ $(GGC_H) $(BASIC_BLOCK_H) $(TREE_H) tree-ssa-operands.h \
+ tree-ssa-alias.h $(INTERNAL_FN_H) $(HASH_TABLE_H) is-a.h
+ GCOV_IO_H = gcov-io.h version.h auto-host.h gcov-counter.def
+-RECOG_H = recog.h
++RECOG_H = recog.h $(TREE_H)
+ EMIT_RTL_H = emit-rtl.h
+ FLAGS_H = flags.h flag-types.h $(OPTIONS_H)
+ OPTIONS_H = options.h flag-types.h $(OPTIONS_H_EXTRA)
+--
+2.42.0
+
diff --git a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
new file mode 100644
index 0000000..19352ac
--- /dev/null
+++ b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
@@ -0,0 +1,1376 @@
+https://gcc.gnu.org/PR54179
+https://gcc.gnu.org/PR84402
+https://gcc.gnu.org/PR111600
+https://inbox.sourceware.org/gcc-patches/87il76kgk2.fsf@gentoo.org/T/
+
+From 6b25a6ca295528805d8dedd59e1ed2f1e218a819 Mon Sep 17 00:00:00 2001
+From: Robin Dapp <rdapp.gcc@gmail.com>
+Date: Mon, 16 Oct 2023 12:17:07 +0200
+Subject: [PATCH 6/6] genemit: Split insn-emit.cc into ten files.
+
+Hi,
+
+the attached v2 includes Tamar's suggestion of keeping the current
+stdout behavior. When no output files are passed (via -O) the output
+is written to stdout as before.
+
+Tamar also mentioned off-list that, similar to match.pd, it might make
+sense to balance the partitions in a better way than a fixed number
+of patterns threshold. That's a good idea but I'd rather do that
+separately as the current approach already helps considerably.
+
+Attached v2 was bootstrapped and regtested on power10, aarch64 and
+x86 are still running.
+Stefan also tested v1 on s390 where the partitioning does not help
+but also doesn't slow anything down. insn-emit.cc isn't very large
+to begin with on s390.
+
+Regards
+ Robin
+
+>From 34d05113a4e3c7e83a4731020307e26c1144af69 Mon Sep 17 00:00:00 2001
+From: Robin Dapp <rdapp@ventanamicro.com>
+Date: Thu, 12 Oct 2023 11:23:26 +0200
+Subject: [PATCH v2] genemit: Split insn-emit.cc into several partitions.
+
+On riscv insn-emit.cc has grown to over 1.2 mio lines of code and
+compiling it takes considerable time.
+Therefore, this patch adjust genemit to create several partitions
+(insn-emit-1.cc to insn-emit-n.cc). In order to do so it first counts
+the number of available patterns, calculates the number of patterns per
+file and starts a new file whenever that number is reached.
+
+Similar to match.pd a configure option --with-emitinsn-partitions=num
+is introduced that makes the number of partition configurable.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ PR target/111600
+
+ * Makefile.in: Handle split insn-emit.cc.
+ * configure: Regenerate.
+ * configure.ac: Add --with-insnemit-partitions.
+ * genemit.cc (output_peephole2_scratches): Print to file instead
+ of stdout.
+ (print_code): Ditto.
+ (gen_rtx_scratch): Ditto.
+ (gen_exp): Ditto.
+ (gen_emit_seq): Ditto.
+ (emit_c_code): Ditto.
+ (gen_insn): Ditto.
+ (gen_expand): Ditto.
+ (gen_split): Ditto.
+ (output_add_clobbers): Ditto.
+ (output_added_clobbers_hard_reg_p): Ditto.
+ (print_overload_arguments): Ditto.
+ (print_overload_test): Ditto.
+ (handle_overloaded_code_for): Ditto.
+ (handle_overloaded_gen): Ditto.
+ (print_header): New function.
+ (handle_arg): New function.
+ (main): Split output into 10 files.
+ * gensupport.cc (count_patterns): New function.
+ * gensupport.h (count_patterns): Define.
+ * read-md.cc (md_reader::print_md_ptr_loc): Add file argument.
+ * read-md.h (class md_reader): Change definition.
+
+(cherry picked from commit 646ee18fef30ade65e5ff2e7445e4915a0f9a3ad)
+---
+ gcc/Makefile.in | 38 +++-
+ gcc/configure | 22 +-
+ gcc/configure.ac | 13 ++
+ gcc/genemit.cc | 536 +++++++++++++++++++++++++---------------------
+ gcc/gensupport.cc | 36 ++++
+ gcc/gensupport.h | 1 +
+ gcc/read-md.cc | 4 +-
+ gcc/read-md.h | 2 +-
+ 8 files changed, 398 insertions(+), 254 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 2c16b14ad0f..9152525ec23 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -232,6 +232,13 @@ GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
+ GENERIC_MATCH_PD_SEQ_SRC = $(patsubst %, generic-match-%.cc, $(MATCH_SPLITS_SEQ))
+ GENERIC_MATCH_PD_SEQ_O = $(patsubst %, generic-match-%.o, $(MATCH_SPLITS_SEQ))
+
++# The number of splits to be made for the insn-emit files.
++NUM_INSNEMIT_SPLITS = @DEFAULT_INSNEMIT_PARTITIONS@
++INSNEMIT_SPLITS_SEQ = $(wordlist 1,$(NUM_INSNEMIT_SPLITS),$(one_to_9999))
++INSNEMIT_SEQ_SRC = $(patsubst %, insn-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
++INSNEMIT_SEQ_TMP = $(patsubst %, tmp-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
++INSNEMIT_SEQ_O = $(patsubst %, insn-emit-%.o, $(INSNEMIT_SPLITS_SEQ))
++
+ # These files are to have specific diagnostics suppressed, or are not to
+ # be subject to -Werror:
+ # flex output may yield harmless "no previous prototype" warnings
+@@ -1331,7 +1338,7 @@ OBJS = \
+ insn-attrtab.o \
+ insn-automata.o \
+ insn-dfatab.o \
+- insn-emit.o \
++ $(INSNEMIT_SEQ_O) \
+ insn-extract.o \
+ insn-latencytab.o \
+ insn-modes.o \
+@@ -1817,7 +1824,8 @@ TREECHECKING = @TREECHECKING@
+ FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
+
+ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
+- insn-output.cc insn-recog.cc insn-emit.cc insn-extract.cc insn-peep.cc \
++ insn-output.cc insn-recog.cc $(INSNEMIT_SEQ_SRC) \
++ insn-extract.cc insn-peep.cc \
+ insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
+ insn-latencytab.cc insn-opinit.cc insn-opinit.h insn-preds.cc insn-constants.h \
+ tm-preds.h tm-constrs.h checksum-options $(GIMPLE_MATCH_PD_SEQ_SRC) \
+@@ -2434,11 +2442,11 @@ $(common_out_object_file): $(common_out_file)
+ # and compile them.
+
+ .PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
+- insn-emit.cc insn-recog.cc insn-extract.cc insn-output.cc insn-peep.cc \
+- insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
+- insn-latencytab.cc insn-preds.cc $(GIMPLE_MATCH_PD_SEQ_SRC) \
+- $(GENERIC_MATCH_PD_SEQ_SRC) gimple-match-auto.h generic-match-auto.h \
+- insn-target-def.h
++ $(INSNEMIT_SEQ_SRC) insn-recog.cc insn-extract.cc insn-output.cc \
++ insn-peep.cc insn-attr.h insn-attr-common.h insn-attrtab.cc \
++ insn-dfatab.cc insn-latencytab.cc insn-preds.cc \
++ $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \
++ gimple-match-auto.h generic-match-auto.h insn-target-def.h
+
+ # Dependencies for the md file. The first time through, we just assume
+ # the md file itself and the generated dependency file (in order to get
+@@ -2461,7 +2469,7 @@ s-mddeps: $(md_file) $(MD_INCLUDES) build/genmddeps$(build_exeext)
+ simple_rtl_generated_h = insn-attr.h insn-attr-common.h insn-codes.h \
+ insn-config.h insn-flags.h insn-target-def.h
+
+-simple_rtl_generated_c = insn-automata.cc insn-emit.cc \
++simple_rtl_generated_c = insn-automata.cc \
+ insn-extract.cc insn-output.cc \
+ insn-peep.cc insn-recog.cc
+
+@@ -2490,8 +2498,22 @@ $(simple_generated_c:insn-%.cc=s-%): s-%: build/gen%$(build_exeext)
+ $(SHELL) $(srcdir)/../move-if-change tmp-$*.cc insn-$*.cc
+ $(STAMP) s-$*
+
++# genemit splits its output into different files and doesn't write to
++# stdout. (but rather to tmp-emit-01.cc..tmp-emit-10.cc)
++s-tmp-emit: build/genemit$(build_exeext) insn-conditions.md
++ $(RUN_GEN) build/genemit$(build_exeext) $(md_file) insn-conditions.md \
++ $(addprefix -O,${INSNEMIT_SEQ_TMP})
++ $(STAMP) s-tmp-emit
++
++$(INSNEMIT_SEQ_SRC): insn-emit-%.cc: s-insn-emit-%; @true
++$(INSNEMIT_SEQ_SRC:insn-emit-%.cc=s-insn-emit-%): s-insn-emit-%: s-tmp-emit
++ $(SHELL) $(srcdir)/../move-if-change tmp-emit-$*.cc insn-emit-$*.cc
++ $(STAMP) s-insn-emit-$*
++
+ # gencheck doesn't read the machine description, and the file produced
+ # doesn't use the insn-* convention.
++
++# --> s-check has prerequisite tree-check.h (though nothing to do)
+ tree-check.h: s-check ; @true
+ s-check : build/gencheck$(build_exeext)
+ $(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
+diff --git a/gcc/configure b/gcc/configure
+index 3750f77fd03..9e8febc17b4 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -838,6 +838,7 @@ enable_gcov
+ enable_shared
+ enable_fixed_point
+ enable_decimal_float
++DEFAULT_INSNEMIT_PARTITIONS
+ DEFAULT_MATCHPD_PARTITIONS
+ with_float
+ with_cpu
+@@ -967,6 +968,7 @@ enable_multilib
+ enable_multiarch
+ with_stack_clash_protection_guard_size
+ with_matchpd_partitions
++with_insnemit_partitions
+ enable___cxa_atexit
+ enable_decimal_float
+ enable_fixed_point
+@@ -1831,6 +1833,9 @@ Optional Packages:
+ --with-matchpd-partitions=num
+ Set the number of partitions to make for gimple and
+ generic when splitting match.pd. [default=10]
++ --with-insnemit-partitions=num
++ Set the number of partitions of insn-emit.cc for
++ genemit to create. [default=10]
+ --with-dwarf2 force the default debug format to be DWARF 2 (or
+ later)
+ --with-specs=SPECS add SPECS to driver command-line processing
+@@ -7909,6 +7914,21 @@ fi
+
+
+
++# Specify the number of splits of insn-emit.cc to generate.
++
++# Check whether --with-insnemit-partitions was given.
++if test "${with_insnemit_partitions+set}" = set; then :
++ withval=$with_insnemit_partitions; DEFAULT_INSNEMIT_PARTITIONS="$with_insnemit_partitions"
++else
++ DEFAULT_INSNEMIT_PARTITIONS=10
++fi
++
++if (test $DEFAULT_INSNEMIT_PARTITIONS -lt 1); then
++ as_fn_error $? "Invalid value $DEFAULT_INSNEMIT_PARTITIONS for --with-insnemit-partitions. Cannot be negative." "$LINENO" 5
++fi
++
++
++
+ # Enable __cxa_atexit for C++.
+ # Check whether --enable-__cxa_atexit was given.
+ if test "${enable___cxa_atexit+set}" = set; then :
+@@ -19845,7 +19865,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19848 "configure"
++#line 19946 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 7f8aa5329c7..efbaa0bf6ee 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -934,6 +934,19 @@ fi
+
+ AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
+
++# Specify the number of splits of insn-emit.cc to generate.
++AC_ARG_WITH(insnemit-partitions,
++[AS_HELP_STRING([--with-insnemit-partitions=num],
++[Set the number of partitions of insn-emit.cc for genemit to create. [default=10]])],
++[DEFAULT_INSNEMIT_PARTITIONS="$with_insnemit_partitions"], [DEFAULT_INSNEMIT_PARTITIONS=10])
++if (test $DEFAULT_INSNEMIT_PARTITIONS -lt 1); then
++ AC_MSG_ERROR(m4_normalize([
++ Invalid value $DEFAULT_INSNEMIT_PARTITIONS for --with-insnemit-partitions. \
++ Cannot be negative.]))
++fi
++
++AC_SUBST(DEFAULT_INSNEMIT_PARTITIONS)
++
+ # Enable __cxa_atexit for C++.
+ AC_ARG_ENABLE(__cxa_atexit,
+ [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
+diff --git a/gcc/genemit.cc b/gcc/genemit.cc
+index 33c9ec05d6f..aee69872470 100644
+--- a/gcc/genemit.cc
++++ b/gcc/genemit.cc
+@@ -49,29 +49,29 @@ struct clobber_ent
+ struct clobber_ent *next;
+ };
+
+-static void output_peephole2_scratches (rtx);
++static void output_peephole2_scratches (rtx, FILE*);
+
+ /* True for <X>_optab if that optab isn't allowed to fail. */
+ static bool nofail_optabs[NUM_OPTABS];
+ \f
+ static void
+-print_code (RTX_CODE code)
++print_code (RTX_CODE code, FILE *file)
+ {
+ const char *p1;
+ for (p1 = GET_RTX_NAME (code); *p1; p1++)
+- putchar (TOUPPER (*p1));
++ fprintf (file, "%c", TOUPPER (*p1));
+ }
+
+ static void
+-gen_rtx_scratch (rtx x, enum rtx_code subroutine_type)
++gen_rtx_scratch (rtx x, enum rtx_code subroutine_type, FILE *file)
+ {
+ if (subroutine_type == DEFINE_PEEPHOLE2)
+ {
+- printf ("operand%d", XINT (x, 0));
++ fprintf (file, "operand%d", XINT (x, 0));
+ }
+ else
+ {
+- printf ("gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x)));
++ fprintf (file, "gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x)));
+ }
+ }
+
+@@ -79,7 +79,8 @@ gen_rtx_scratch (rtx x, enum rtx_code subroutine_type)
+ substituting any operand references appearing within. */
+
+ static void
+-gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
++gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info,
++ FILE *file)
+ {
+ RTX_CODE code;
+ int i;
+@@ -89,7 +90,7 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+
+ if (x == 0)
+ {
+- printf ("NULL_RTX");
++ fprintf (file, "NULL_RTX");
+ return;
+ }
+
+@@ -103,67 +104,67 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+ {
+ if (used[XINT (x, 0)])
+ {
+- printf ("copy_rtx (operand%d)", XINT (x, 0));
++ fprintf (file, "copy_rtx (operand%d)", XINT (x, 0));
+ return;
+ }
+ used[XINT (x, 0)] = 1;
+ }
+- printf ("operand%d", XINT (x, 0));
++ fprintf (file, "operand%d", XINT (x, 0));
+ return;
+
+ case MATCH_OP_DUP:
+- printf ("gen_rtx_fmt_");
++ fprintf (file, "gen_rtx_fmt_");
+ for (i = 0; i < XVECLEN (x, 1); i++)
+- printf ("e");
+- printf (" (GET_CODE (operand%d), ", XINT (x, 0));
++ fprintf (file, "e");
++ fprintf (file, " (GET_CODE (operand%d), ", XINT (x, 0));
+ if (GET_MODE (x) == VOIDmode)
+- printf ("GET_MODE (operand%d)", XINT (x, 0));
++ fprintf (file, "GET_MODE (operand%d)", XINT (x, 0));
+ else
+- printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
++ fprintf (file, "%smode", GET_MODE_NAME (GET_MODE (x)));
+ for (i = 0; i < XVECLEN (x, 1); i++)
+ {
+- printf (",\n\t\t");
+- gen_exp (XVECEXP (x, 1, i), subroutine_type, used, info);
++ fprintf (file, ",\n\t\t");
++ gen_exp (XVECEXP (x, 1, i), subroutine_type, used, info, file);
+ }
+- printf (")");
++ fprintf (file, ")");
+ return;
+
+ case MATCH_OPERATOR:
+- printf ("gen_rtx_fmt_");
++ fprintf (file, "gen_rtx_fmt_");
+ for (i = 0; i < XVECLEN (x, 2); i++)
+- printf ("e");
+- printf (" (GET_CODE (operand%d)", XINT (x, 0));
+- printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
++ fprintf (file, "e");
++ fprintf (file, " (GET_CODE (operand%d)", XINT (x, 0));
++ fprintf (file, ", %smode", GET_MODE_NAME (GET_MODE (x)));
+ for (i = 0; i < XVECLEN (x, 2); i++)
+ {
+- printf (",\n\t\t");
+- gen_exp (XVECEXP (x, 2, i), subroutine_type, used, info);
++ fprintf (file, ",\n\t\t");
++ gen_exp (XVECEXP (x, 2, i), subroutine_type, used, info, file);
+ }
+- printf (")");
++ fprintf (file, ")");
+ return;
+
+ case MATCH_PARALLEL:
+ case MATCH_PAR_DUP:
+- printf ("operand%d", XINT (x, 0));
++ fprintf (file, "operand%d", XINT (x, 0));
+ return;
+
+ case MATCH_SCRATCH:
+- gen_rtx_scratch (x, subroutine_type);
++ gen_rtx_scratch (x, subroutine_type, file);
+ return;
+
+ case PC:
+- printf ("pc_rtx");
++ fprintf (file, "pc_rtx");
+ return;
+ case RETURN:
+- printf ("ret_rtx");
++ fprintf (file, "ret_rtx");
+ return;
+ case SIMPLE_RETURN:
+- printf ("simple_return_rtx");
++ fprintf (file, "simple_return_rtx");
+ return;
+ case CLOBBER:
+ if (REG_P (XEXP (x, 0)))
+ {
+- printf ("gen_hard_reg_clobber (%smode, %i)",
++ fprintf (file, "gen_hard_reg_clobber (%smode, %i)",
+ GET_MODE_NAME (GET_MODE (XEXP (x, 0))),
+ REGNO (XEXP (x, 0)));
+ return;
+@@ -172,22 +173,22 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+
+ case CONST_INT:
+ if (INTVAL (x) == 0)
+- printf ("const0_rtx");
++ fprintf (file, "const0_rtx");
+ else if (INTVAL (x) == 1)
+- printf ("const1_rtx");
++ fprintf (file, "const1_rtx");
+ else if (INTVAL (x) == -1)
+- printf ("constm1_rtx");
++ fprintf (file, "constm1_rtx");
+ else if (-MAX_SAVED_CONST_INT <= INTVAL (x)
+ && INTVAL (x) <= MAX_SAVED_CONST_INT)
+- printf ("const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
++ fprintf (file, "const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
+ (int) INTVAL (x));
+ else if (INTVAL (x) == STORE_FLAG_VALUE)
+- printf ("const_true_rtx");
++ fprintf (file, "const_true_rtx");
+ else
+ {
+- printf ("GEN_INT (");
+- printf (HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
+- printf (")");
++ fprintf (file, "GEN_INT (");
++ fprintf (file, HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
++ fprintf (file, ")");
+ }
+ return;
+
+@@ -195,7 +196,7 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+ /* Handle `const_double_zero' rtx. */
+ if (CONST_DOUBLE_REAL_VALUE (x)->cl == rvc_zero)
+ {
+- printf ("CONST_DOUBLE_ATOF (\"0\", %smode)",
++ fprintf (file, "CONST_DOUBLE_ATOF (\"0\", %smode)",
+ GET_MODE_NAME (GET_MODE (x)));
+ return;
+ }
+@@ -210,12 +211,12 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+ break;
+ }
+
+- printf ("gen_rtx_");
+- print_code (code);
+- printf (" (");
++ fprintf (file, "gen_rtx_");
++ print_code (code, file);
++ fprintf (file, " (");
+ if (!always_void_p (code))
+ {
+- printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
++ fprintf (file, "%smode", GET_MODE_NAME (GET_MODE (x)));
+ sep = ",\n\t";
+ }
+
+@@ -225,41 +226,41 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+ {
+ if (fmt[i] == '0')
+ break;
+- fputs (sep, stdout);
++ fputs (sep, file);
+ switch (fmt[i])
+ {
+ case 'e': case 'u':
+- gen_exp (XEXP (x, i), subroutine_type, used, info);
++ gen_exp (XEXP (x, i), subroutine_type, used, info, file);
+ break;
+
+ case 'i':
+- printf ("%u", XINT (x, i));
++ fprintf (file, "%u", XINT (x, i));
+ break;
+
+ case 'r':
+- printf ("%u", REGNO (x));
++ fprintf (file, "%u", REGNO (x));
+ break;
+
+ case 'p':
+ /* We don't have a way of parsing polynomial offsets yet,
+ and hopefully never will. */
+- printf ("%d", SUBREG_BYTE (x).to_constant ());
++ fprintf (file, "%d", SUBREG_BYTE (x).to_constant ());
+ break;
+
+ case 's':
+- printf ("\"%s\"", XSTR (x, i));
++ fprintf (file, "\"%s\"", XSTR (x, i));
+ break;
+
+ case 'E':
+ {
+ int j;
+- printf ("gen_rtvec (%d", XVECLEN (x, i));
++ fprintf (file, "gen_rtvec (%d", XVECLEN (x, i));
+ for (j = 0; j < XVECLEN (x, i); j++)
+ {
+- printf (",\n\t\t");
+- gen_exp (XVECEXP (x, i, j), subroutine_type, used, info);
++ fprintf (file, ",\n\t\t");
++ gen_exp (XVECEXP (x, i, j), subroutine_type, used, info, file);
+ }
+- printf (")");
++ fprintf (file, ")");
+ break;
+ }
+
+@@ -268,14 +269,14 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
+ }
+ sep = ",\n\t";
+ }
+- printf (")");
++ fprintf (file, ")");
+ }
+
+ /* Output code to emit the instruction patterns in VEC, with each element
+ becoming a separate instruction. USED is as for gen_exp. */
+
+ static void
+-gen_emit_seq (rtvec vec, char *used, md_rtx_info *info)
++gen_emit_seq (rtvec vec, char *used, md_rtx_info *info, FILE *file)
+ {
+ for (int i = 0, len = GET_NUM_ELEM (vec); i < len; ++i)
+ {
+@@ -283,17 +284,17 @@ gen_emit_seq (rtvec vec, char *used, md_rtx_info *info)
+ rtx next = RTVEC_ELT (vec, i);
+ if (const char *name = get_emit_function (next))
+ {
+- printf (" %s (", name);
+- gen_exp (next, DEFINE_EXPAND, used, info);
+- printf (");\n");
++ fprintf (file, " %s (", name);
++ gen_exp (next, DEFINE_EXPAND, used, info, file);
++ fprintf (file, ");\n");
+ if (!last_p && needs_barrier_p (next))
+- printf (" emit_barrier ();");
++ fprintf (file, " emit_barrier ();");
+ }
+ else
+ {
+- printf (" emit (");
+- gen_exp (next, DEFINE_EXPAND, used, info);
+- printf (", %s);\n", last_p ? "false" : "true");
++ fprintf (file, " emit (");
++ gen_exp (next, DEFINE_EXPAND, used, info, file);
++ fprintf (file, ", %s);\n", last_p ? "false" : "true");
+ }
+ }
+ }
+@@ -303,27 +304,27 @@ gen_emit_seq (rtvec vec, char *used, md_rtx_info *info)
+ for use in error messages. */
+
+ static void
+-emit_c_code (const char *code, bool can_fail_p, const char *name)
++emit_c_code (const char *code, bool can_fail_p, const char *name, FILE *file)
+ {
+ if (can_fail_p)
+- printf ("#define FAIL return (end_sequence (), _val)\n");
++ fprintf (file, "#define FAIL return (end_sequence (), _val)\n");
+ else
+- printf ("#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
++ fprintf (file, "#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
+ " (void)0\n", name);
+- printf ("#define DONE return (_val = get_insns (), "
++ fprintf (file, "#define DONE return (_val = get_insns (), "
+ "end_sequence (), _val)\n");
+
+- rtx_reader_ptr->print_md_ptr_loc (code);
+- printf ("%s\n", code);
++ rtx_reader_ptr->print_md_ptr_loc (code, file);
++ fprintf (file, "%s\n", code);
+
+- printf ("#undef DONE\n");
+- printf ("#undef FAIL\n");
++ fprintf (file, "#undef DONE\n");
++ fprintf (file, "#undef FAIL\n");
+ }
+ \f
+ /* Generate the `gen_...' function for a DEFINE_INSN. */
+
+ static void
+-gen_insn (md_rtx_info *info)
++gen_insn (md_rtx_info *info, FILE *file)
+ {
+ struct pattern_stats stats;
+ int i;
+@@ -409,7 +410,7 @@ gen_insn (md_rtx_info *info)
+ if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
+ return;
+
+- printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
++ fprintf (file, "/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+
+ /* Find out how many operands this function has. */
+ get_pattern_stats (&stats, XVEC (insn, 1));
+@@ -417,17 +418,17 @@ gen_insn (md_rtx_info *info)
+ fatal_at (info->loc, "match_dup operand number has no match_operand");
+
+ /* Output the function name and argument declarations. */
+- printf ("rtx\ngen_%s (", XSTR (insn, 0));
++ fprintf (file, "rtx\ngen_%s (", XSTR (insn, 0));
+ if (stats.num_generator_args)
+ for (i = 0; i < stats.num_generator_args; i++)
+ if (i)
+- printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
++ fprintf (file, ",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
+ else
+- printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
++ fprintf (file, "rtx operand%d ATTRIBUTE_UNUSED", i);
+ else
+- printf ("void");
+- printf (")\n");
+- printf ("{\n");
++ fprintf (file, "void");
++ fprintf (file, ")\n");
++ fprintf (file, "{\n");
+
+ /* Output code to construct and return the rtl for the instruction body. */
+
+@@ -436,16 +437,16 @@ gen_insn (md_rtx_info *info)
+ char *used = (XVECLEN (insn, 1) == 1
+ ? NULL
+ : XCNEWVEC (char, stats.num_generator_args));
+- printf (" return ");
+- gen_exp (pattern, DEFINE_INSN, used, info);
+- printf (";\n}\n\n");
++ fprintf (file, " return ");
++ gen_exp (pattern, DEFINE_INSN, used, info, file);
++ fprintf (file, ";\n}\n\n");
+ XDELETEVEC (used);
+ }
+ \f
+ /* Generate the `gen_...' function for a DEFINE_EXPAND. */
+
+ static void
+-gen_expand (md_rtx_info *info)
++gen_expand (md_rtx_info *info, FILE *file)
+ {
+ struct pattern_stats stats;
+ int i;
+@@ -466,17 +467,17 @@ gen_expand (md_rtx_info *info)
+ "numbers above all other operands", XSTR (expand, 0));
+
+ /* Output the function name and argument declarations. */
+- printf ("rtx\ngen_%s (", XSTR (expand, 0));
++ fprintf (file, "rtx\ngen_%s (", XSTR (expand, 0));
+ if (stats.num_generator_args)
+ for (i = 0; i < stats.num_generator_args; i++)
+ if (i)
+- printf (",\n\trtx operand%d", i);
++ fprintf (file, ",\n\trtx operand%d", i);
+ else
+- printf ("rtx operand%d", i);
++ fprintf (file, "rtx operand%d", i);
+ else
+- printf ("void");
+- printf (")\n");
+- printf ("{\n");
++ fprintf (file, "void");
++ fprintf (file, ")\n");
++ fprintf (file, "{\n");
+
+ /* If we don't have any C code to write, only one insn is being written,
+ and no MATCH_DUPs are present, we can just return the desired insn
+@@ -485,18 +486,18 @@ gen_expand (md_rtx_info *info)
+ && stats.max_opno >= stats.max_dup_opno
+ && XVECLEN (expand, 1) == 1)
+ {
+- printf (" return ");
+- gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL, info);
+- printf (";\n}\n\n");
++ fprintf (file, " return ");
++ gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL, info, file);
++ fprintf (file, ";\n}\n\n");
+ return;
+ }
+
+ /* For each operand referred to only with MATCH_DUPs,
+ make a local variable. */
+ for (i = stats.num_generator_args; i <= stats.max_dup_opno; i++)
+- printf (" rtx operand%d;\n", i);
+- printf (" rtx_insn *_val = 0;\n");
+- printf (" start_sequence ();\n");
++ fprintf (file, " rtx operand%d;\n", i);
++ fprintf (file, " rtx_insn *_val = 0;\n");
++ fprintf (file, " start_sequence ();\n");
+
+ /* The fourth operand of DEFINE_EXPAND is some code to be executed
+ before the actual construction.
+@@ -506,13 +507,13 @@ gen_expand (md_rtx_info *info)
+ So copy the operand values there before executing it. */
+ if (XSTR (expand, 3) && *XSTR (expand, 3))
+ {
+- printf (" {\n");
++ fprintf (file, " {\n");
+ if (stats.num_operand_vars > 0)
+- printf (" rtx operands[%d];\n", stats.num_operand_vars);
++ fprintf (file, " rtx operands[%d];\n", stats.num_operand_vars);
+
+ /* Output code to copy the arguments into `operands'. */
+ for (i = 0; i < stats.num_generator_args; i++)
+- printf (" operands[%d] = operand%d;\n", i, i);
++ fprintf (file, " operands[%d] = operand%d;\n", i, i);
+
+ /* Output the special code to be executed before the sequence
+ is generated. */
+@@ -524,7 +525,7 @@ gen_expand (md_rtx_info *info)
+ if (nofail_optabs[p.op])
+ can_fail_p = false;
+ }
+- emit_c_code (XSTR (expand, 3), can_fail_p, XSTR (expand, 0));
++ emit_c_code (XSTR (expand, 3), can_fail_p, XSTR (expand, 0), file);
+
+ /* Output code to copy the arguments back out of `operands'
+ (unless we aren't going to use them at all). */
+@@ -532,29 +533,29 @@ gen_expand (md_rtx_info *info)
+ {
+ for (i = 0; i <= MAX (stats.max_opno, stats.max_dup_opno); i++)
+ {
+- printf (" operand%d = operands[%d];\n", i, i);
+- printf (" (void) operand%d;\n", i);
++ fprintf (file, " operand%d = operands[%d];\n", i, i);
++ fprintf (file, " (void) operand%d;\n", i);
+ }
+ }
+- printf (" }\n");
++ fprintf (file, " }\n");
+ }
+
+ used = XCNEWVEC (char, stats.num_operand_vars);
+- gen_emit_seq (XVEC (expand, 1), used, info);
++ gen_emit_seq (XVEC (expand, 1), used, info, file);
+ XDELETEVEC (used);
+
+ /* Call `get_insns' to extract the list of all the
+ insns emitted within this gen_... function. */
+
+- printf (" _val = get_insns ();\n");
+- printf (" end_sequence ();\n");
+- printf (" return _val;\n}\n\n");
++ fprintf (file, " _val = get_insns ();\n");
++ fprintf (file, " end_sequence ();\n");
++ fprintf (file, " return _val;\n}\n\n");
+ }
+
+ /* Like gen_expand, but generates insns resulting from splitting SPLIT. */
+
+ static void
+-gen_split (md_rtx_info *info)
++gen_split (md_rtx_info *info, FILE *file)
+ {
+ struct pattern_stats stats;
+ int i;
+@@ -580,62 +581,62 @@ gen_split (md_rtx_info *info)
+ /* Output the prototype, function name and argument declarations. */
+ if (GET_CODE (split) == DEFINE_PEEPHOLE2)
+ {
+- printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
++ fprintf (file, "extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
+ name, info->index);
+- printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED,"
++ fprintf (file, "rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED,"
+ " rtx *operands%s)\n",
+ name, info->index, unused);
+ }
+ else
+ {
+- printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
++ fprintf (file, "extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
+ info->index);
+- printf ("rtx_insn *\ngen_split_%d "
++ fprintf (file, "rtx_insn *\ngen_split_%d "
+ "(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
+ info->index, unused);
+ }
+- printf ("{\n");
++ fprintf (file, "{\n");
+
+ /* Declare all local variables. */
+ for (i = 0; i < stats.num_operand_vars; i++)
+- printf (" rtx operand%d;\n", i);
+- printf (" rtx_insn *_val = NULL;\n");
++ fprintf (file, " rtx operand%d;\n", i);
++ fprintf (file, " rtx_insn *_val = NULL;\n");
+
+ if (GET_CODE (split) == DEFINE_PEEPHOLE2)
+- output_peephole2_scratches (split);
++ output_peephole2_scratches (split, file);
+
+ const char *fn = info->loc.filename;
+ for (const char *p = fn; *p; p++)
+ if (*p == '/')
+ fn = p + 1;
+
+- printf (" if (dump_file)\n");
+- printf (" fprintf (dump_file, \"Splitting with gen_%s_%d (%s:%d)\\n\");\n",
++ fprintf (file, " if (dump_file)\n");
++ fprintf (file, " fprintf (dump_file, \"Splitting with gen_%s_%d (%s:%d)\\n\");\n",
+ name, info->index, fn, info->loc.lineno);
+
+- printf (" start_sequence ();\n");
++ fprintf (file, " start_sequence ();\n");
+
+ /* The fourth operand of DEFINE_SPLIT is some code to be executed
+ before the actual construction. */
+
+ if (XSTR (split, 3))
+- emit_c_code (XSTR (split, 3), true, name);
++ emit_c_code (XSTR (split, 3), true, name, file);
+
+ /* Output code to copy the arguments back out of `operands' */
+ for (i = 0; i < stats.num_operand_vars; i++)
+ {
+- printf (" operand%d = operands[%d];\n", i, i);
+- printf (" (void) operand%d;\n", i);
++ fprintf (file, " operand%d = operands[%d];\n", i, i);
++ fprintf (file, " (void) operand%d;\n", i);
+ }
+
+- gen_emit_seq (XVEC (split, 2), used, info);
++ gen_emit_seq (XVEC (split, 2), used, info, file);
+
+ /* Call `get_insns' to make a list of all the
+ insns emitted within this gen_... function. */
+
+- printf (" _val = get_insns ();\n");
+- printf (" end_sequence ();\n");
+- printf (" return _val;\n}\n\n");
++ fprintf (file, " _val = get_insns ();\n");
++ fprintf (file, " end_sequence ();\n");
++ fprintf (file, " return _val;\n}\n\n");
+
+ free (used);
+ }
+@@ -645,37 +646,37 @@ gen_split (md_rtx_info *info)
+ the end of the vector. */
+
+ static void
+-output_add_clobbers (md_rtx_info *info)
++output_add_clobbers (md_rtx_info *info, FILE *file)
+ {
+ struct clobber_pat *clobber;
+ struct clobber_ent *ent;
+ int i;
+
+- printf ("\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
+- printf ("{\n");
+- printf (" switch (insn_code_number)\n");
+- printf (" {\n");
++ fprintf (file, "\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
++ fprintf (file, "{\n");
++ fprintf (file, " switch (insn_code_number)\n");
++ fprintf (file, " {\n");
+
+ for (clobber = clobber_list; clobber; clobber = clobber->next)
+ {
+ for (ent = clobber->insns; ent; ent = ent->next)
+- printf (" case %d:\n", ent->code_number);
++ fprintf (file, " case %d:\n", ent->code_number);
+
+ for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
+ {
+- printf (" XVECEXP (pattern, 0, %d) = ", i);
++ fprintf (file, " XVECEXP (pattern, 0, %d) = ", i);
+ gen_exp (XVECEXP (clobber->pattern, 1, i),
+- GET_CODE (clobber->pattern), NULL, info);
+- printf (";\n");
++ GET_CODE (clobber->pattern), NULL, info, file);
++ fprintf (file, ";\n");
+ }
+
+- printf (" break;\n\n");
++ fprintf (file, " break;\n\n");
+ }
+
+- printf (" default:\n");
+- printf (" gcc_unreachable ();\n");
+- printf (" }\n");
+- printf ("}\n");
++ fprintf (file, " default:\n");
++ fprintf (file, " gcc_unreachable ();\n");
++ fprintf (file, " }\n");
++ fprintf (file, "}\n");
+ }
+ \f
+ /* Write a function, `added_clobbers_hard_reg_p' that is given an insn_code
+@@ -684,16 +685,16 @@ output_add_clobbers (md_rtx_info *info)
+ SCRATCH. */
+
+ static void
+-output_added_clobbers_hard_reg_p (void)
++output_added_clobbers_hard_reg_p (FILE *file)
+ {
+ struct clobber_pat *clobber;
+ struct clobber_ent *ent;
+ int clobber_p, used;
+
+- printf ("\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
+- printf ("{\n");
+- printf (" switch (insn_code_number)\n");
+- printf (" {\n");
++ fprintf (file, "\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
++ fprintf (file, "{\n");
++ fprintf (file, " switch (insn_code_number)\n");
++ fprintf (file, " {\n");
+
+ for (clobber_p = 0; clobber_p <= 1; clobber_p++)
+ {
+@@ -702,25 +703,25 @@ output_added_clobbers_hard_reg_p (void)
+ if (clobber->has_hard_reg == clobber_p)
+ for (ent = clobber->insns; ent; ent = ent->next)
+ {
+- printf (" case %d:\n", ent->code_number);
++ fprintf (file, " case %d:\n", ent->code_number);
+ used++;
+ }
+
+ if (used)
+- printf (" return %d;\n\n", clobber_p);
++ fprintf (file, " return %d;\n\n", clobber_p);
+ }
+
+- printf (" default:\n");
+- printf (" gcc_unreachable ();\n");
+- printf (" }\n");
+- printf ("}\n");
++ fprintf (file, " default:\n");
++ fprintf (file, " gcc_unreachable ();\n");
++ fprintf (file, " }\n");
++ fprintf (file, "}\n");
+ }
+ \f
+ /* Generate code to invoke find_free_register () as needed for the
+ scratch registers used by the peephole2 pattern in SPLIT. */
+
+ static void
+-output_peephole2_scratches (rtx split)
++output_peephole2_scratches (rtx split, FILE *file)
+ {
+ int i;
+ int insn_nr = 0;
+@@ -745,12 +746,12 @@ output_peephole2_scratches (rtx split)
+
+ if (first)
+ {
+- printf (" HARD_REG_SET _regs_allocated;\n");
+- printf (" CLEAR_HARD_REG_SET (_regs_allocated);\n");
++ fprintf (file, " HARD_REG_SET _regs_allocated;\n");
++ fprintf (file, " CLEAR_HARD_REG_SET (_regs_allocated);\n");
+ first = false;
+ }
+
+- printf (" if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
++ fprintf (file, " if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
+ return NULL;\n",
+ XINT (elt, 0),
+ insn_nr, last_insn_nr,
+@@ -766,50 +767,50 @@ output_peephole2_scratches (rtx split)
+ /* Print "arg<N>" parameter declarations for each argument N of ONAME. */
+
+ static void
+-print_overload_arguments (overloaded_name *oname)
++print_overload_arguments (overloaded_name *oname, FILE *file)
+ {
+ for (unsigned int i = 0; i < oname->arg_types.length (); ++i)
+- printf ("%s%s arg%d", i == 0 ? "" : ", ", oname->arg_types[i], i);
++ fprintf (file, "%s%s arg%d", i == 0 ? "" : ", ", oname->arg_types[i], i);
+ }
+
+ /* Print code to test whether INSTANCE should be chosen, given that
+ argument N of the overload is available as "arg<N>". */
+
+ static void
+-print_overload_test (overloaded_instance *instance)
++print_overload_test (overloaded_instance *instance, FILE *file)
+ {
+ for (unsigned int i = 0; i < instance->arg_values.length (); ++i)
+- printf ("%sarg%d == %s", i == 0 ? " if (" : "\n && ",
++ fprintf (file, "%sarg%d == %s", i == 0 ? " if (" : "\n && ",
+ i, instance->arg_values[i]);
+- printf (")\n");
++ fprintf (file, ")\n");
+ }
+
+ /* Emit a maybe_code_for_* function for ONAME. */
+
+ static void
+-handle_overloaded_code_for (overloaded_name *oname)
++handle_overloaded_code_for (overloaded_name *oname, FILE *file)
+ {
+ /* Print the function prototype. */
+- printf ("\ninsn_code\nmaybe_code_for_%s (", oname->name);
+- print_overload_arguments (oname);
+- printf (")\n{\n");
++ fprintf (file, "\ninsn_code\nmaybe_code_for_%s (", oname->name);
++ print_overload_arguments (oname, file);
++ fprintf (file, ")\n{\n");
+
+ /* Use a sequence of "if" statements for each instance. */
+ for (overloaded_instance *instance = oname->first_instance;
+ instance; instance = instance->next)
+ {
+- print_overload_test (instance);
+- printf (" return CODE_FOR_%s;\n", instance->name);
++ print_overload_test (instance, file);
++ fprintf (file, " return CODE_FOR_%s;\n", instance->name);
+ }
+
+ /* Return null if no match was found. */
+- printf (" return CODE_FOR_nothing;\n}\n");
++ fprintf (file, " return CODE_FOR_nothing;\n}\n");
+ }
+
+ /* Emit a maybe_gen_* function for ONAME. */
+
+ static void
+-handle_overloaded_gen (overloaded_name *oname)
++handle_overloaded_gen (overloaded_name *oname, FILE *file)
+ {
+ unsigned HOST_WIDE_INT seen = 0;
+ /* All patterns must have the same number of operands. */
+@@ -826,25 +827,25 @@ handle_overloaded_gen (overloaded_name *oname)
+ seen |= mask;
+
+ /* Print the function prototype. */
+- printf ("\nrtx\nmaybe_gen_%s (", oname->name);
+- print_overload_arguments (oname);
++ fprintf (file, "\nrtx\nmaybe_gen_%s (", oname->name);
++ print_overload_arguments (oname, file);
+ for (int i = 0; i < stats.num_generator_args; ++i)
+- printf (", rtx x%d", i);
+- printf (")\n{\n");
++ fprintf (file, ", rtx x%d", i);
++ fprintf (file, ")\n{\n");
+
+ /* Use maybe_code_for_*, instead of duplicating the selection
+ logic here. */
+- printf (" insn_code code = maybe_code_for_%s (", oname->name);
++ fprintf (file, " insn_code code = maybe_code_for_%s (", oname->name);
+ for (unsigned int i = 0; i < oname->arg_types.length (); ++i)
+- printf ("%sarg%d", i == 0 ? "" : ", ", i);
+- printf (");\n"
++ fprintf (file, "%sarg%d", i == 0 ? "" : ", ", i);
++ fprintf (file, ");\n"
+ " if (code != CODE_FOR_nothing)\n"
+ " {\n"
+ " gcc_assert (insn_data[code].n_generator_args == %d);\n"
+ " return GEN_FCN (code) (", stats.num_generator_args);
+ for (int i = 0; i < stats.num_generator_args; ++i)
+- printf ("%sx%d", i == 0 ? "" : ", ", i);
+- printf (");\n"
++ fprintf (file, "%sx%d", i == 0 ? "" : ", ", i);
++ fprintf (file, ");\n"
+ " }\n"
+ " else\n"
+ " return NULL_RTX;\n"
+@@ -852,12 +853,68 @@ handle_overloaded_gen (overloaded_name *oname)
+ }
+ }
+
++void
++print_header (FILE *file)
++{
++ fprintf (file, "/* Generated automatically by the program `genemit'\n\
++from the machine description file `md'. */\n\n");
++
++ fprintf (file, "#define IN_TARGET_CODE 1\n");
++ fprintf (file, "#include \"config.h\"\n");
++ fprintf (file, "#include \"system.h\"\n");
++ fprintf (file, "#include \"coretypes.h\"\n");
++ fprintf (file, "#include \"backend.h\"\n");
++ fprintf (file, "#include \"predict.h\"\n");
++ fprintf (file, "#include \"tree.h\"\n");
++ fprintf (file, "#include \"rtl.h\"\n");
++ fprintf (file, "#include \"alias.h\"\n");
++ fprintf (file, "#include \"varasm.h\"\n");
++ fprintf (file, "#include \"stor-layout.h\"\n");
++ fprintf (file, "#include \"calls.h\"\n");
++ fprintf (file, "#include \"memmodel.h\"\n");
++ fprintf (file, "#include \"tm_p.h\"\n");
++ fprintf (file, "#include \"flags.h\"\n");
++ fprintf (file, "#include \"insn-config.h\"\n");
++ fprintf (file, "#include \"expmed.h\"\n");
++ fprintf (file, "#include \"dojump.h\"\n");
++ fprintf (file, "#include \"explow.h\"\n");
++ fprintf (file, "#include \"emit-rtl.h\"\n");
++ fprintf (file, "#include \"stmt.h\"\n");
++ fprintf (file, "#include \"expr.h\"\n");
++ fprintf (file, "#include \"insn-codes.h\"\n");
++ fprintf (file, "#include \"optabs.h\"\n");
++ fprintf (file, "#include \"dfp.h\"\n");
++ fprintf (file, "#include \"output.h\"\n");
++ fprintf (file, "#include \"recog.h\"\n");
++ fprintf (file, "#include \"df.h\"\n");
++ fprintf (file, "#include \"resource.h\"\n");
++ fprintf (file, "#include \"reload.h\"\n");
++ fprintf (file, "#include \"diagnostic-core.h\"\n");
++ fprintf (file, "#include \"regs.h\"\n");
++ fprintf (file, "#include \"tm-constrs.h\"\n");
++ fprintf (file, "#include \"ggc.h\"\n");
++ fprintf (file, "#include \"target.h\"\n\n");
++}
++
++auto_vec<const char *, 10> output_files;
++
++static bool
++handle_arg (const char *arg)
++{
++ if (arg[1] == 'O')
++ {
++ output_files.safe_push (&arg[2]);
++ return true;
++ }
++ return false;
++}
++
+ int
+ main (int argc, const char **argv)
+ {
+ progname = "genemit";
+
+- if (!init_rtx_reader_args (argc, argv))
++ if (!init_rtx_reader_args_cb (argc, argv, handle_arg))
+ return (FATAL_EXIT_CODE);
+
+ #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
+@@ -867,86 +924,81 @@ main (int argc, const char **argv)
+ /* Assign sequential codes to all entries in the machine description
+ in parallel with the tables in insn-output.cc. */
+
+- printf ("/* Generated automatically by the program `genemit'\n\
+-from the machine description file `md'. */\n\n");
++ int npatterns = count_patterns ();
++ md_rtx_info info;
+
+- printf ("#define IN_TARGET_CODE 1\n");
+- printf ("#include \"config.h\"\n");
+- printf ("#include \"system.h\"\n");
+- printf ("#include \"coretypes.h\"\n");
+- printf ("#include \"backend.h\"\n");
+- printf ("#include \"predict.h\"\n");
+- printf ("#include \"tree.h\"\n");
+- printf ("#include \"rtl.h\"\n");
+- printf ("#include \"alias.h\"\n");
+- printf ("#include \"varasm.h\"\n");
+- printf ("#include \"stor-layout.h\"\n");
+- printf ("#include \"calls.h\"\n");
+- printf ("#include \"memmodel.h\"\n");
+- printf ("#include \"tm_p.h\"\n");
+- printf ("#include \"flags.h\"\n");
+- printf ("#include \"insn-config.h\"\n");
+- printf ("#include \"expmed.h\"\n");
+- printf ("#include \"dojump.h\"\n");
+- printf ("#include \"explow.h\"\n");
+- printf ("#include \"emit-rtl.h\"\n");
+- printf ("#include \"stmt.h\"\n");
+- printf ("#include \"expr.h\"\n");
+- printf ("#include \"insn-codes.h\"\n");
+- printf ("#include \"optabs.h\"\n");
+- printf ("#include \"dfp.h\"\n");
+- printf ("#include \"output.h\"\n");
+- printf ("#include \"recog.h\"\n");
+- printf ("#include \"df.h\"\n");
+- printf ("#include \"resource.h\"\n");
+- printf ("#include \"reload.h\"\n");
+- printf ("#include \"diagnostic-core.h\"\n");
+- printf ("#include \"regs.h\"\n");
+- printf ("#include \"tm-constrs.h\"\n");
+- printf ("#include \"ggc.h\"\n");
+- printf ("#include \"target.h\"\n\n");
++ int npatterns_per_file = npatterns;
++ if (!output_files.is_empty ())
++ npatterns_per_file = npatterns / output_files.length () + 1;
+
+- /* Read the machine description. */
++ gcc_assert (npatterns_per_file > 1);
+
+- md_rtx_info info;
++ /* Reverse so we can pop the first-added element. */
++ output_files.reverse ();
++
++ int count = 0;
++ FILE *file = NULL;
++
++ /* Read the machine description. */
+ while (read_md_rtx (&info))
+- switch (GET_CODE (info.def))
+- {
+- case DEFINE_INSN:
+- gen_insn (&info);
+- break;
++ {
++ if (count == 0 || count == npatterns_per_file)
++ {
++ if (file)
++ if (fclose (file) != 0)
++ return FATAL_EXIT_CODE;
+
+- case DEFINE_EXPAND:
+- printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
+- gen_expand (&info);
+- break;
++ if (!output_files.is_empty ())
++ {
++ const char *const filename = output_files.pop ();
++ file = fopen (filename, "w");
++ }
++ else
++ file = stdout;
+
+- case DEFINE_SPLIT:
+- printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
+- gen_split (&info);
+- break;
++ print_header (file);
++ count = 0;
++ }
+
+- case DEFINE_PEEPHOLE2:
+- printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
+- gen_split (&info);
+- break;
++ switch (GET_CODE (info.def))
++ {
++ case DEFINE_INSN:
++ gen_insn (&info, file);
++ break;
+
+- default:
+- break;
+- }
++ case DEFINE_EXPAND:
++ fprintf (file, "/* %s:%d */\n", info.loc.filename, info.loc.lineno);
++ gen_expand (&info, file);
++ break;
++
++ case DEFINE_SPLIT:
++ fprintf (file, "/* %s:%d */\n", info.loc.filename, info.loc.lineno);
++ gen_split (&info, file);
++ break;
++
++ case DEFINE_PEEPHOLE2:
++ fprintf (file, "/* %s:%d */\n", info.loc.filename, info.loc.lineno);
++ gen_split (&info, file);
++ break;
++
++ default:
++ break;
++ }
++
++ count++;
++ }
+
+ /* Write out the routines to add CLOBBERs to a pattern and say whether they
+ clobber a hard reg. */
+- output_add_clobbers (&info);
+- output_added_clobbers_hard_reg_p ();
++ output_add_clobbers (&info, file);
++ output_added_clobbers_hard_reg_p (file);
+
+ for (overloaded_name *oname = rtx_reader_ptr->get_overloads ();
+ oname; oname = oname->next)
+ {
+- handle_overloaded_code_for (oname);
+- handle_overloaded_gen (oname);
++ handle_overloaded_code_for (oname, file);
++ handle_overloaded_gen (oname, file);
+ }
+
+- fflush (stdout);
+- return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
++ return (fclose (file) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+ }
+diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
+index f9efc6eb757..8ea48ef755d 100644
+--- a/gcc/gensupport.cc
++++ b/gcc/gensupport.cc
+@@ -2631,6 +2631,42 @@ init_rtx_reader_args (int argc, const char **argv)
+ return init_rtx_reader_args_cb (argc, argv, 0);
+ }
+ \f
++/* Count the number of patterns in all queues and return the count. */
++int
++count_patterns ()
++{
++ int count = 0;
++ class queue_elem *cur = define_attr_queue;
++ while (cur != NULL)
++ {
++ count++;
++ cur = cur->next;
++ }
++
++ cur = define_pred_queue;
++ while (cur != NULL)
++ {
++ count++;
++ cur = cur->next;
++ }
++
++ cur = define_insn_queue;
++ while (cur != NULL)
++ {
++ count++;
++ cur = cur->next;
++ }
++
++ cur = other_queue;
++ while (cur != NULL)
++ {
++ count++;
++ cur = cur->next;
++ }
++
++ return count;
++}
++\f
+ /* Try to read a single rtx from the file. Return true on success,
+ describing it in *INFO. */
+
+diff --git a/gcc/gensupport.h b/gcc/gensupport.h
+index a1edfbd7190..510ba19405e 100644
+--- a/gcc/gensupport.h
++++ b/gcc/gensupport.h
+@@ -129,6 +129,7 @@ extern rtx add_implicit_parallel (rtvec);
+ extern rtx_reader *init_rtx_reader_args_cb (int, const char **,
+ bool (*)(const char *));
+ extern rtx_reader *init_rtx_reader_args (int, const char **);
++extern int count_patterns ();
+ extern bool read_md_rtx (md_rtx_info *);
+ extern unsigned int get_num_insn_codes ();
+
+diff --git a/gcc/read-md.cc b/gcc/read-md.cc
+index fd38818e3a3..46ab9065e3e 100644
+--- a/gcc/read-md.cc
++++ b/gcc/read-md.cc
+@@ -132,9 +132,9 @@ md_reader::fprint_md_ptr_loc (FILE *outf, const void *ptr)
+
+ /* Special fprint_md_ptr_loc for writing to STDOUT. */
+ void
+-md_reader::print_md_ptr_loc (const void *ptr)
++md_reader::print_md_ptr_loc (const void *ptr, FILE *file)
+ {
+- fprint_md_ptr_loc (stdout, ptr);
++ fprint_md_ptr_loc (file, ptr);
+ }
+
+ /* Return a condition that satisfies both COND1 and COND2. Either string
+diff --git a/gcc/read-md.h b/gcc/read-md.h
+index b309c9c3deb..2adcb58478f 100644
+--- a/gcc/read-md.h
++++ b/gcc/read-md.h
+@@ -194,7 +194,7 @@ class md_reader
+ const struct ptr_loc *get_md_ptr_loc (const void *ptr);
+ void copy_md_ptr_loc (const void *new_ptr, const void *old_ptr);
+ void fprint_md_ptr_loc (FILE *outf, const void *ptr);
+- void print_md_ptr_loc (const void *ptr);
++ void print_md_ptr_loc (const void *ptr, FILE * = stdout);
+
+ struct enum_type *lookup_enum_type (const char *name);
+ void traverse_enum_types (htab_trav callback, void *info);
+--
+2.42.0
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 1ab8e80..d58550f 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,11 @@
+9 16 Oct 2023
+
+ + 86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
+ + 87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
+ + 88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
+ + 89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
+ + 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+
8 1 Oct 2023
U 31_all_gm2_make_P_var.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-10-27 23:43 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-10-27 23:43 UTC (permalink / raw
To: gentoo-commits
commit: 4e7cf4e3cf83a83932fd23c7dfb6a31903d09dd7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 23:39:42 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 23:39:42 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4e7cf4e3
13.2.0: update 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
...genemit-Split-insn-emit.cc-into-ten-files.patch | 164 ++++++++++++---------
13.2.0/gentoo/README.history | 4 +
2 files changed, 100 insertions(+), 68 deletions(-)
diff --git a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
index 19352ac..6a2f3ed 100644
--- a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+++ b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
@@ -1,44 +1,42 @@
https://gcc.gnu.org/PR54179
-https://gcc.gnu.org/PR84402
-https://gcc.gnu.org/PR111600
-https://inbox.sourceware.org/gcc-patches/87il76kgk2.fsf@gentoo.org/T/
+https://inbox.sourceware.org/gcc-patches/de0f7bdc-d236-4f5b-9504-d5bfb215d023@gmail.com/
-From 6b25a6ca295528805d8dedd59e1ed2f1e218a819 Mon Sep 17 00:00:00 2001
+From a71bcc136fee1c5a5ec6639f802daf1b22a1aab6 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp.gcc@gmail.com>
-Date: Mon, 16 Oct 2023 12:17:07 +0200
-Subject: [PATCH 6/6] genemit: Split insn-emit.cc into ten files.
+Date: Fri, 27 Oct 2023 21:04:25 +0200
+Subject: [PATCH] genemit: Split insn-emit.cc into ten files.
-Hi,
+After working with Sam off-list (thanks) I managed to get hppa to
+build. Initially it looked as if hppa just had a very small number of
+instruction patterns so we wouldn't generate all 10 output files.
+However, the actual issue (which we will only hit with a low
+pattern count) was with counting all the patterns vs only counting
+the patterns that will be output. A wrong pattern count lead to
+prematurely stopping to write output files.
-the attached v2 includes Tamar's suggestion of keeping the current
-stdout behavior. When no output files are passed (via -O) the output
-is written to stdout as before.
+With that corrected, hppa "just works" until I hit linker errors
+due to relocations - most likely unrelated:
-Tamar also mentioned off-list that, similar to match.pd, it might make
-sense to balance the partitions in a better way than a fixed number
-of patterns threshold. That's a good idea but I'd rather do that
-separately as the current approach already helps considerably.
+bin/ld: unwind-dw2-fde-dip_s.o(.data.rel.ro+0): cannot handle
+R_PARISC_FPTR64 for __pthread_key_create@@GLIBC_2.34
-Attached v2 was bootstrapped and regtested on power10, aarch64 and
-x86 are still running.
-Stefan also tested v1 on s390 where the partitioning does not help
-but also doesn't slow anything down. insn-emit.cc isn't very large
-to begin with on s390.
+Attached is v3 that has been bootstrapped and tested on x86 and power10,
+aarch64 bootstrap was ok, testsuite is still running. A riscv build and
+testsuite run was successful as well.
Regards
Robin
->From 34d05113a4e3c7e83a4731020307e26c1144af69 Mon Sep 17 00:00:00 2001
+>From 248744c328440bff9cc339d2bf622852cbaac343 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp@ventanamicro.com>
Date: Thu, 12 Oct 2023 11:23:26 +0200
-Subject: [PATCH v2] genemit: Split insn-emit.cc into several partitions.
+Subject: [PATCH v3] genemit: Split insn-emit.cc into several partitions.
On riscv insn-emit.cc has grown to over 1.2 mio lines of code and
compiling it takes considerable time.
Therefore, this patch adjust genemit to create several partitions
-(insn-emit-1.cc to insn-emit-n.cc). In order to do so it first counts
-the number of available patterns, calculates the number of patterns per
-file and starts a new file whenever that number is reached.
+(insn-emit-1.cc to insn-emit-n.cc). The available patterns are
+written to the given files in a sequential fashion.
Similar to match.pd a configure option --with-emitinsn-partitions=num
is introduced that makes the number of partition configurable.
@@ -74,21 +72,19 @@ gcc/ChangeLog:
* gensupport.h (count_patterns): Define.
* read-md.cc (md_reader::print_md_ptr_loc): Add file argument.
* read-md.h (class md_reader): Change definition.
-
-(cherry picked from commit 646ee18fef30ade65e5ff2e7445e4915a0f9a3ad)
---
- gcc/Makefile.in | 38 +++-
- gcc/configure | 22 +-
+ gcc/Makefile.in | 36 ++-
+ gcc/configure | 24 +-
gcc/configure.ac | 13 ++
- gcc/genemit.cc | 536 +++++++++++++++++++++++++---------------------
- gcc/gensupport.cc | 36 ++++
+ gcc/genemit.cc | 542 +++++++++++++++++++++++++---------------------
+ gcc/gensupport.cc | 55 +++++
gcc/gensupport.h | 1 +
gcc/read-md.cc | 4 +-
gcc/read-md.h | 2 +-
- 8 files changed, 398 insertions(+), 254 deletions(-)
+ 8 files changed, 422 insertions(+), 255 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 2c16b14ad0f..9152525ec23 100644
+index 2c16b14ad0f3..b0c118e6d189 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -232,6 +232,13 @@ GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
@@ -150,31 +146,29 @@ index 2c16b14ad0f..9152525ec23 100644
insn-extract.cc insn-output.cc \
insn-peep.cc insn-recog.cc
-@@ -2490,8 +2498,22 @@ $(simple_generated_c:insn-%.cc=s-%): s-%: build/gen%$(build_exeext)
+@@ -2490,8 +2498,20 @@ $(simple_generated_c:insn-%.cc=s-%): s-%: build/gen%$(build_exeext)
$(SHELL) $(srcdir)/../move-if-change tmp-$*.cc insn-$*.cc
$(STAMP) s-$*
+# genemit splits its output into different files and doesn't write to
+# stdout. (but rather to tmp-emit-01.cc..tmp-emit-10.cc)
-+s-tmp-emit: build/genemit$(build_exeext) insn-conditions.md
++$(INSNEMIT_SEQ_SRC): s-tmp-emit; @true
++s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
+ $(RUN_GEN) build/genemit$(build_exeext) $(md_file) insn-conditions.md \
+ $(addprefix -O,${INSNEMIT_SEQ_TMP})
++ $(foreach id, $(INSNEMIT_SPLITS_SEQ), \
++ $(SHELL) $(srcdir)/../move-if-change tmp-emit-$(id).cc \
++ insn-emit-$(id).cc;)
+ $(STAMP) s-tmp-emit
-+
-+$(INSNEMIT_SEQ_SRC): insn-emit-%.cc: s-insn-emit-%; @true
-+$(INSNEMIT_SEQ_SRC:insn-emit-%.cc=s-insn-emit-%): s-insn-emit-%: s-tmp-emit
-+ $(SHELL) $(srcdir)/../move-if-change tmp-emit-$*.cc insn-emit-$*.cc
-+ $(STAMP) s-insn-emit-$*
+
# gencheck doesn't read the machine description, and the file produced
# doesn't use the insn-* convention.
+
-+# --> s-check has prerequisite tree-check.h (though nothing to do)
tree-check.h: s-check ; @true
s-check : build/gencheck$(build_exeext)
$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
diff --git a/gcc/configure b/gcc/configure
-index 3750f77fd03..9e8febc17b4 100755
+index 3750f77fd037..056d098618b2 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -838,6 +838,7 @@ enable_gcov
@@ -230,12 +224,21 @@ index 3750f77fd03..9e8febc17b4 100755
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19848 "configure"
-+#line 19946 "configure"
++#line 19995 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -19951,7 +19971,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19954 "configure"
++#line 20101 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 7f8aa5329c7..efbaa0bf6ee 100644
+index 7f8aa5329c7f..efbaa0bf6eeb 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -934,6 +934,19 @@ fi
@@ -259,7 +262,7 @@ index 7f8aa5329c7..efbaa0bf6ee 100644
AC_ARG_ENABLE(__cxa_atexit,
[AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
diff --git a/gcc/genemit.cc b/gcc/genemit.cc
-index 33c9ec05d6f..aee69872470 100644
+index 33c9ec05d6fc..18c95e3f6412 100644
--- a/gcc/genemit.cc
+++ b/gcc/genemit.cc
@@ -49,29 +49,29 @@ struct clobber_ent
@@ -1136,7 +1139,7 @@ index 33c9ec05d6f..aee69872470 100644
return (FATAL_EXIT_CODE);
#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
-@@ -867,86 +924,81 @@ main (int argc, const char **argv)
+@@ -867,86 +924,87 @@ main (int argc, const char **argv)
/* Assign sequential codes to all entries in the machine description
in parallel with the tables in insn-output.cc. */
@@ -1144,6 +1147,13 @@ index 33c9ec05d6f..aee69872470 100644
-from the machine description file `md'. */\n\n");
+ int npatterns = count_patterns ();
+ md_rtx_info info;
++
++ bool to_stdout = false;
++ int npatterns_per_file = npatterns;
++ if (!output_files.is_empty ())
++ npatterns_per_file = npatterns / output_files.length () + 1;
++ else
++ to_stdout = true;
- printf ("#define IN_TARGET_CODE 1\n");
- printf ("#include \"config.h\"\n");
@@ -1180,17 +1190,13 @@ index 33c9ec05d6f..aee69872470 100644
- printf ("#include \"tm-constrs.h\"\n");
- printf ("#include \"ggc.h\"\n");
- printf ("#include \"target.h\"\n\n");
-+ int npatterns_per_file = npatterns;
-+ if (!output_files.is_empty ())
-+ npatterns_per_file = npatterns / output_files.length () + 1;
-
-- /* Read the machine description. */
+ gcc_assert (npatterns_per_file > 1);
-- md_rtx_info info;
+- /* Read the machine description. */
+ /* Reverse so we can pop the first-added element. */
+ output_files.reverse ();
-+
+
+- md_rtx_info info;
+ int count = 0;
+ FILE *file = NULL;
+
@@ -1204,7 +1210,8 @@ index 33c9ec05d6f..aee69872470 100644
+ {
+ if (count == 0 || count == npatterns_per_file)
+ {
-+ if (file)
++ bool is_last = !to_stdout && output_files.is_empty ();
++ if (file && !is_last)
+ if (fclose (file) != 0)
+ return FATAL_EXIT_CODE;
@@ -1217,8 +1224,10 @@ index 33c9ec05d6f..aee69872470 100644
+ const char *const filename = output_files.pop ();
+ file = fopen (filename, "w");
+ }
-+ else
++ else if (to_stdout)
+ file = stdout;
++ else
++ break;
- case DEFINE_SPLIT:
- printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
@@ -1284,10 +1293,10 @@ index 33c9ec05d6f..aee69872470 100644
+ return (fclose (file) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
}
diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
-index f9efc6eb757..8ea48ef755d 100644
+index f9efc6eb7572..f941f76a739f 100644
--- a/gcc/gensupport.cc
+++ b/gcc/gensupport.cc
-@@ -2631,6 +2631,42 @@ init_rtx_reader_args (int argc, const char **argv)
+@@ -2631,6 +2631,61 @@ init_rtx_reader_args (int argc, const char **argv)
return init_rtx_reader_args_cb (argc, argv, 0);
}
\f
@@ -1295,32 +1304,51 @@ index f9efc6eb757..8ea48ef755d 100644
+int
+count_patterns ()
+{
-+ int count = 0;
++ int count = 0, truth = 1;
++ rtx def;
+ class queue_elem *cur = define_attr_queue;
-+ while (cur != NULL)
++ while (cur)
+ {
-+ count++;
++ def = cur->data;
++
++ truth = maybe_eval_c_test (get_c_test (def));
++ if (truth || !insn_elision)
++ count++;
+ cur = cur->next;
+ }
+
+ cur = define_pred_queue;
-+ while (cur != NULL)
++ while (cur)
+ {
-+ count++;
++ def = cur->data;
++
++ truth = maybe_eval_c_test (get_c_test (def));
++ if (truth || !insn_elision)
++ count++;
+ cur = cur->next;
+ }
+
+ cur = define_insn_queue;
-+ while (cur != NULL)
++ truth = 1;
++ while (cur)
+ {
-+ count++;
++ def = cur->data;
++
++ truth = maybe_eval_c_test (get_c_test (def));
++ if (truth || !insn_elision)
++ count++;
+ cur = cur->next;
+ }
+
+ cur = other_queue;
-+ while (cur != NULL)
++ truth = 1;
++ while (cur)
+ {
-+ count++;
++ def = cur->data;
++
++ truth = maybe_eval_c_test (get_c_test (def));
++ if (truth || !insn_elision)
++ count++;
+ cur = cur->next;
+ }
+
@@ -1331,7 +1359,7 @@ index f9efc6eb757..8ea48ef755d 100644
describing it in *INFO. */
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
-index a1edfbd7190..510ba19405e 100644
+index a1edfbd71908..510ba19405e4 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -129,6 +129,7 @@ extern rtx add_implicit_parallel (rtvec);
@@ -1343,7 +1371,7 @@ index a1edfbd7190..510ba19405e 100644
extern unsigned int get_num_insn_codes ();
diff --git a/gcc/read-md.cc b/gcc/read-md.cc
-index fd38818e3a3..46ab9065e3e 100644
+index fd38818e3a3e..46ab9065e3e4 100644
--- a/gcc/read-md.cc
+++ b/gcc/read-md.cc
@@ -132,9 +132,9 @@ md_reader::fprint_md_ptr_loc (FILE *outf, const void *ptr)
@@ -1359,7 +1387,7 @@ index fd38818e3a3..46ab9065e3e 100644
/* Return a condition that satisfies both COND1 and COND2. Either string
diff --git a/gcc/read-md.h b/gcc/read-md.h
-index b309c9c3deb..2adcb58478f 100644
+index b309c9c3deb6..2adcb58478fe 100644
--- a/gcc/read-md.h
+++ b/gcc/read-md.h
@@ -194,7 +194,7 @@ class md_reader
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index d58550f..4b18bf0 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+10 28 Oct 2023
+
+ U 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+
9 16 Oct 2023
+ 86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-11-29 20:16 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-11-29 20:16 UTC (permalink / raw
To: gentoo-commits
commit: 27a129d42cd0e4a96d591d5ccadf5d220f441e06
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 29 20:15:37 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 20:15:49 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=27a129d4
13.2.0: rebase patches
U 76_all_match.pd-don-t-emit-label-if-not-needed.patch
U 77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
U 78_all_match.pd-CSE-the-dump-output-check.patch
U 79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
U 80_all_match.pd-automatically-partition-match.cc-files.patch
U 81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+ 82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
...l_match.pd-don-t-emit-label-if-not-needed.patch | 24 ++++-----
| 10 ++--
...78_all_match.pd-CSE-the-dump-output-check.patch | 16 +++---
...lit-shared-code-to-gimple-match-exports.c.patch | 18 +++----
...pd-automatically-partition-match.cc-files.patch | 36 ++++++-------
...e-splits-in-makefile-and-make-configurabl.patch | 28 +++++-----
...in-clean-up-match.pd-related-dependencies.patch | 60 ++++++++++++++++++++++
13.2.0/gentoo/README.history | 10 ++++
8 files changed, 136 insertions(+), 66 deletions(-)
diff --git a/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
index ac9efe6..9d702eb 100644
--- a/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
+++ b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 6894f8e1fafe211a5f14ecbb534c92c2b78beb3a Mon Sep 17 00:00:00 2001
+From 30f78d42a215686cab9c7276076f11e5ea08341d Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:35:17 +0100
-Subject: [PATCH 1/6] match.pd: don't emit label if not needed
+Subject: [PATCH 02/14] match.pd: don't emit label if not needed
This is a small QoL codegen improvement for match.pd to not emit labels when
they are not needed. The codegen is nice and there is a small (but consistent)
@@ -20,10 +20,10 @@ gcc/ChangeLog:
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 4fab4135347..638606b2502 100644
+index 98b429a9d0bb..0c5a19aca8ed 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
-@@ -3352,6 +3352,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3354,6 +3354,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
char local_fail_label[256];
snprintf (local_fail_label, 256, "next_after_fail%u", ++fail_label_cnt);
fail_label = local_fail_label;
@@ -31,7 +31,7 @@ index 4fab4135347..638606b2502 100644
/* Analyze captures and perform early-outs on the incoming arguments
that cover cases we cannot handle. */
-@@ -3366,6 +3367,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3368,6 +3369,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
fprintf_indent (f, indent,
"if (TREE_SIDE_EFFECTS (_p%d)) goto %s;\n",
i, fail_label);
@@ -39,7 +39,7 @@ index 4fab4135347..638606b2502 100644
if (verbose >= 1)
warning_at (as_a <expr *> (s->match)->ops[i]->location,
"forcing toplevel operand to have no "
-@@ -3381,6 +3383,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3383,6 +3385,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
fprintf_indent (f, indent,
"if (TREE_SIDE_EFFECTS (captures[%d])) "
"goto %s;\n", i, fail_label);
@@ -47,7 +47,7 @@ index 4fab4135347..638606b2502 100644
if (verbose >= 1)
warning_at (cinfo.info[i].c->location,
"forcing captured operand to have no "
-@@ -3423,7 +3426,10 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3425,7 +3428,10 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
}
if (s->kind == simplify::SIMPLIFY)
@@ -59,7 +59,7 @@ index 4fab4135347..638606b2502 100644
fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) "
"fprintf (dump_file, \"%s ",
-@@ -3496,9 +3502,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3498,9 +3504,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
"res_op->resimplify (%s, valueize);\n",
!e->force_leaf ? "lseq" : "NULL");
if (e->force_leaf)
@@ -75,7 +75,7 @@ index 4fab4135347..638606b2502 100644
}
}
else if (result->type == operand::OP_CAPTURE
-@@ -3554,9 +3563,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3556,9 +3565,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
continue;
if (cinfo.info[i].result_use_count
> cinfo.info[i].match_use_count)
@@ -91,7 +91,7 @@ index 4fab4135347..638606b2502 100644
}
for (unsigned j = 0; j < e->ops.length (); ++j)
{
-@@ -3607,6 +3619,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3609,6 +3621,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
{
fprintf_indent (f, indent, "if (!_r)\n");
fprintf_indent (f, indent, " goto %s;\n", fail_label);
@@ -99,7 +99,7 @@ index 4fab4135347..638606b2502 100644
}
}
}
-@@ -3647,7 +3660,8 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3649,7 +3662,8 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
}
indent -= 2;
fprintf_indent (f, indent, "}\n");
@@ -110,5 +110,5 @@ index 4fab4135347..638606b2502 100644
}
--
-2.40.1
+2.43.0
--git a/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
index ebf93bc..fb50871 100644
--- a/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
+++ b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
@@ -1,10 +1,10 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 972d5156126df1241e25e1a66518d4903f9564b3 Mon Sep 17 00:00:00 2001
+From 1e714dddc3646b484014ec6636b3d80910536b4b Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:36:01 +0100
-Subject: [PATCH 2/6] match.pd: Remove commented out line pragmas unless -vv is
- used.
+Subject: [PATCH 03/14] match.pd: Remove commented out line pragmas unless -vv
+ is used.
genmatch currently outputs commented out line directives that have no effect
but the compiler still has to parse only to discard.
@@ -24,7 +24,7 @@ gcc/ChangeLog:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 638606b2502..2533698bd9e 100644
+index 0c5a19aca8ed..8937c76369cb 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
@@ -37,5 +37,5 @@ index 638606b2502..2533698bd9e 100644
development it's right now more convenient to have line information
from the generated file. Still keep the directives as comment for now
--
-2.40.1
+2.43.0
diff --git a/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
index 311493d..8dda55a 100644
--- a/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
+++ b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 43a48baef66cd06d8058668ecb2da6190054c163 Mon Sep 17 00:00:00 2001
+From c256e2c80e56c4e015d8d7ca50fa01a6ed98a1eb Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:36:43 +0100
-Subject: [PATCH 3/6] match.pd: CSE the dump output check.
+Subject: [PATCH 04/14] match.pd: CSE the dump output check.
This is a small improvement in QoL codegen for match.pd to save time not
re-evaluating the condition for printing debug information in every function.
@@ -26,10 +26,10 @@ gcc/ChangeLog:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 2533698bd9e..b2e01dee2fa 100644
+index 8937c76369cb..a0643aa37308 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
-@@ -3431,7 +3431,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+@@ -3433,7 +3433,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
needs_label = true;
}
@@ -38,7 +38,7 @@ index 2533698bd9e..b2e01dee2fa 100644
"fprintf (dump_file, \"%s ",
s->kind == simplify::SIMPLIFY
? "Applying pattern" : "Matching expression");
-@@ -3892,6 +3892,8 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3894,6 +3894,8 @@ decision_tree::gen (FILE *f, bool gimple)
}
fprintf (f, ")\n{\n");
@@ -47,7 +47,7 @@ index 2533698bd9e..b2e01dee2fa 100644
s->s->gen_1 (f, 2, gimple, s->s->s->result);
if (gimple)
fprintf (f, " return false;\n");
-@@ -3937,6 +3939,8 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3939,6 +3941,8 @@ decision_tree::gen (FILE *f, bool gimple)
fprintf (f, ", tree _p%d", i);
fprintf (f, ")\n");
fprintf (f, "{\n");
@@ -56,7 +56,7 @@ index 2533698bd9e..b2e01dee2fa 100644
dop->gen_kids (f, 2, gimple, 0);
if (gimple)
fprintf (f, " return false;\n");
-@@ -4046,6 +4050,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
+@@ -4048,6 +4052,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : "");
/* Conveniently make 'type' available. */
fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n");
@@ -66,5 +66,5 @@ index 2533698bd9e..b2e01dee2fa 100644
if (!gimple)
fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n");
--
-2.40.1
+2.43.0
diff --git a/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
index 3d011cc..f52ea7a 100644
--- a/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
+++ b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From db6e98b2677c4c3e08756902827e922d6da0f80b Mon Sep 17 00:00:00 2001
+From d5e12d6bf0a763f37e99eef5d579d9a6417e067c Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:37:49 +0100
-Subject: [PATCH 4/6] genmatch: split shared code to gimple-match-exports.cc
+Subject: [PATCH 05/14] genmatch: split shared code to gimple-match-exports.cc
In preparation for automatically splitting match.pd files I split off the
non-static helper functions that are shared between the match.pd functions off
@@ -39,7 +39,7 @@ gcc/ChangeLog:
create mode 100644 gcc/gimple-match-exports.cc
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index b8abc9a70b7..f5f189916c1 100644
+index 06d192fa9ed8..406856acde1c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -223,6 +223,7 @@ libgcov-util.o-warn = -Wno-error
@@ -68,10 +68,10 @@ index b8abc9a70b7..f5f189916c1 100644
s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index b2e01dee2fa..09548bdac29 100644
+index a0643aa37308..5320d4110082 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
-@@ -3955,7 +3955,7 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3957,7 +3957,7 @@ decision_tree::gen (FILE *f, bool gimple)
if (! has_kids_p)
{
if (gimple)
@@ -80,7 +80,7 @@ index b2e01dee2fa..09548bdac29 100644
"gimple_simplify (gimple_match_op*, gimple_seq*,\n"
" tree (*)(tree), code_helper,\n"
" const tree");
-@@ -3978,7 +3978,7 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3980,7 +3980,7 @@ decision_tree::gen (FILE *f, bool gimple)
/* Then generate the main entry with the outermost switch and
tail-calls to the split-out functions. */
if (gimple)
@@ -91,7 +91,7 @@ index b2e01dee2fa..09548bdac29 100644
" code_helper code, const tree type");
diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc
new file mode 100644
-index 00000000000..7aeb4ddb152
+index 000000000000..7aeb4ddb1524
--- /dev/null
+++ b/gcc/gimple-match-exports.cc
@@ -0,0 +1,1253 @@
@@ -1349,7 +1349,7 @@ index 00000000000..7aeb4ddb152
+ return get_conditional_internal_fn (associated_internal_fn (cfn, type));
+}
diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc
-index ec603f9d043..b08cd891a13 100644
+index ec603f9d043c..b08cd891a13a 100644
--- a/gcc/gimple-match-head.cc
+++ b/gcc/gimple-match-head.cc
@@ -48,1089 +48,8 @@ along with GCC; see the file COPYING3. If not see
@@ -2556,5 +2556,5 @@ index ec603f9d043..b08cd891a13 100644
- return get_conditional_internal_fn (associated_internal_fn (cfn, type));
-}
--
-2.40.1
+2.43.0
diff --git a/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
index 4b2fbe9..6cee0ce 100644
--- a/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
+++ b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From c9477580a0c0cb746aec323407ab6103518b8830 Mon Sep 17 00:00:00 2001
+From 0b9341cec30004016c4a66013882ea983a9e3810 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:38:50 +0100
-Subject: [PATCH 5/6] match.pd: automatically partition *-match.cc files.
+Subject: [PATCH 06/14] match.pd: automatically partition *-match.cc files.
Following on from Richi's RFC[1] this is another attempt to split up match.pd
into multiple gimple-match and generic-match files. This version is fully
@@ -111,7 +111,7 @@ gcc/ChangeLog:
1 file changed, 190 insertions(+), 36 deletions(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 09548bdac29..c5938148712 100644
+index 5320d4110082..6cb05d006e8d 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -183,6 +183,33 @@ fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
@@ -195,7 +195,7 @@ index 09548bdac29..c5938148712 100644
void print (FILE *f = stderr);
decision_tree () { root = new dt_node (dt_node::DT_NODE, NULL); }
-@@ -3830,7 +3888,7 @@ sinfo_hashmap_traits::equal_keys (const key_type &v,
+@@ -3832,7 +3890,7 @@ sinfo_hashmap_traits::equal_keys (const key_type &v,
tree. */
void
@@ -204,7 +204,7 @@ index 09548bdac29..c5938148712 100644
{
sinfo_map_t si;
-@@ -3859,11 +3917,14 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3861,11 +3919,14 @@ decision_tree::gen (FILE *f, bool gimple)
output_line_directive (stderr, s->s->s->result->location);
}
@@ -220,7 +220,7 @@ index 09548bdac29..c5938148712 100644
"%s (gimple_match_op *res_op, gimple_seq *seq,\n"
" tree (*valueize)(tree) ATTRIBUTE_UNUSED,\n"
" const tree ARG_UNUSED (type), tree *ARG_UNUSED "
-@@ -3871,27 +3932,28 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3873,27 +3934,28 @@ decision_tree::gen (FILE *f, bool gimple)
s->fname);
else
{
@@ -255,7 +255,7 @@ index 09548bdac29..c5938148712 100644
fprintf_indent (f, 2, "const bool debug_dump = "
"dump_file && (dump_flags & TDF_FOLDING);\n");
s->s->gen_1 (f, 2, gimple, s->s->s->result);
-@@ -3921,8 +3983,12 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3923,8 +3985,12 @@ decision_tree::gen (FILE *f, bool gimple)
&& e->operation->kind != id_base::CODE))
continue;
@@ -269,7 +269,7 @@ index 09548bdac29..c5938148712 100644
"gimple_simplify_%s (gimple_match_op *res_op,"
" gimple_seq *seq,\n"
" tree (*valueize)(tree) "
-@@ -3931,13 +3997,13 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3933,13 +3999,13 @@ decision_tree::gen (FILE *f, bool gimple)
"ARG_UNUSED (type)\n",
e->operation->id);
else
@@ -286,7 +286,7 @@ index 09548bdac29..c5938148712 100644
fprintf (f, "{\n");
fprintf_indent (f, 2, "const bool debug_dump = "
"dump_file && (dump_flags & TDF_FOLDING);\n");
-@@ -3954,18 +4020,22 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3956,18 +4022,22 @@ decision_tree::gen (FILE *f, bool gimple)
with compiler warnings, by generating a simple stub. */
if (! has_kids_p)
{
@@ -313,7 +313,7 @@ index 09548bdac29..c5938148712 100644
fprintf (f, "{\n");
if (gimple)
fprintf (f, " return false;\n");
-@@ -3975,20 +4045,24 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -3977,20 +4047,24 @@ decision_tree::gen (FILE *f, bool gimple)
continue;
}
@@ -342,7 +342,7 @@ index 09548bdac29..c5938148712 100644
fprintf (f, "{\n");
if (gimple)
-@@ -4043,11 +4117,11 @@ decision_tree::gen (FILE *f, bool gimple)
+@@ -4045,11 +4119,11 @@ decision_tree::gen (FILE *f, bool gimple)
void
write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
{
@@ -359,7 +359,7 @@ index 09548bdac29..c5938148712 100644
/* Conveniently make 'type' available. */
fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n");
fprintf_indent (f, 2, "const bool debug_dump = "
-@@ -4068,9 +4142,13 @@ write_header (FILE *f, const char *head)
+@@ -4070,9 +4144,13 @@ write_header (FILE *f, const char *head)
{
fprintf (f, "/* Generated automatically by the program `genmatch' from\n");
fprintf (f, " a IL pattern matching and simplification description. */\n");
@@ -374,7 +374,7 @@ index 09548bdac29..c5938148712 100644
}
-@@ -5213,6 +5291,30 @@ round_alloc_size (size_t s)
+@@ -5215,6 +5293,30 @@ round_alloc_size (size_t s)
}
@@ -405,7 +405,7 @@ index 09548bdac29..c5938148712 100644
/* The genmatch generator program. It reads from a pattern description
and outputs GIMPLE or GENERIC IL matching and simplification routines. */
-@@ -5227,25 +5329,44 @@ main (int argc, char **argv)
+@@ -5229,25 +5331,44 @@ main (int argc, char **argv)
return 1;
bool gimple = true;
@@ -454,7 +454,7 @@ index 09548bdac29..c5938148712 100644
line_table = XCNEW (class line_maps);
linemap_init (line_table, 0);
line_table->reallocator = xrealloc;
-@@ -5292,10 +5413,28 @@ main (int argc, char **argv)
+@@ -5294,10 +5415,28 @@ main (int argc, char **argv)
/* Parse ahead! */
parser p (r, gimple);
@@ -486,7 +486,7 @@ index 09548bdac29..c5938148712 100644
/* Go over all predicates defined with patterns and perform
lowering and code generation. */
-@@ -5315,7 +5454,10 @@ main (int argc, char **argv)
+@@ -5317,7 +5456,10 @@ main (int argc, char **argv)
if (verbose == 2)
dt.print (stderr);
@@ -498,7 +498,7 @@ index 09548bdac29..c5938148712 100644
}
/* Lower the main simplifiers and generate code for them. */
-@@ -5332,7 +5474,19 @@ main (int argc, char **argv)
+@@ -5334,7 +5476,19 @@ main (int argc, char **argv)
if (verbose == 2)
dt.print (stderr);
@@ -520,5 +520,5 @@ index 09548bdac29..c5938148712 100644
/* Finalize. */
cpp_finish (r, NULL);
--
-2.40.1
+2.43.0
diff --git a/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
index 4a8bc46..8834897 100644
--- a/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+++ b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 3da0a672baeb52c5f7b736b47b2cc5f79ada86de Mon Sep 17 00:00:00 2001
+From 7ad6dc24f067e3ecf608143274c36b1eec51ba93 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:42:17 +0100
-Subject: [PATCH 6/6] match.pd: Use splits in makefile and make configurable.
+Subject: [PATCH 07/14] match.pd: Use splits in makefile and make configurable.
This updates the build system to split up match.pd files into chunks of 10.
This also introduces a new flag --with-matchpd-partitions which can be used to
@@ -31,7 +31,7 @@ gcc/ChangeLog:
3 files changed, 89 insertions(+), 22 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index f5f189916c1..8e22857ed57 100644
+index 406856acde1c..f0c34d00ecbc 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -214,6 +214,14 @@ rtl-ssa-warn = $(STRICT_WARN)
@@ -153,7 +153,7 @@ index f5f189916c1..8e22857ed57 100644
case-cfn-macros.h \
cfn-operators.pd omp-device-properties.h
diff --git a/gcc/configure b/gcc/configure
-index c7b26d1927d..843fd5449dd 100755
+index dec2eca1a453..2c124f1b0337 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -838,6 +838,7 @@ enable_gcov
@@ -172,7 +172,7 @@ index c7b26d1927d..843fd5449dd 100755
enable___cxa_atexit
enable_decimal_float
enable_fixed_point
-@@ -1826,6 +1828,9 @@ Optional Packages:
+@@ -1832,6 +1834,9 @@ Optional Packages:
--with-stack-clash-protection-guard-size=size
Set the default stack clash protection guard size
for specific targets as a power of two in bytes.
@@ -182,7 +182,7 @@ index c7b26d1927d..843fd5449dd 100755
--with-dwarf2 force the default debug format to be DWARF 2 (or
later)
--with-specs=SPECS add SPECS to driver command-line processing
-@@ -7889,6 +7894,26 @@ cat >>confdefs.h <<_ACEOF
+@@ -7895,6 +7900,26 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
@@ -209,26 +209,26 @@ index c7b26d1927d..843fd5449dd 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
if test "${enable___cxa_atexit+set}" = set; then :
-@@ -19825,7 +19850,7 @@ else
+@@ -19848,7 +19873,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19828 "configure"
-+#line 19853 "configure"
+-#line 19851 "configure"
++#line 19876 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19931,7 +19956,7 @@ else
+@@ -19954,7 +19979,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19934 "configure"
-+#line 19959 "configure"
+-#line 19957 "configure"
++#line 19982 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 09082e8ccae..de5e3aef2c8 100644
+index c0d067ec2716..526ce0665a3e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -921,6 +921,21 @@ fi
@@ -254,5 +254,5 @@ index 09082e8ccae..de5e3aef2c8 100644
AC_ARG_ENABLE(__cxa_atexit,
[AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
--
-2.40.1
+2.43.0
diff --git a/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch b/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
new file mode 100644
index 0000000..950bfba
--- /dev/null
+++ b/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
@@ -0,0 +1,60 @@
+From 88d7963056355a28adb9fc1b805752d422c2619e Mon Sep 17 00:00:00 2001
+From: Alexander Monakov <amonakov@ispras.ru>
+Date: Fri, 5 May 2023 19:46:25 +0300
+Subject: [PATCH 08/14] Makefile.in: clean up match.pd-related dependencies
+
+Clean up confusing changes from the recent refactoring for
+parallel match.pd build.
+
+gimple-match-head.o is not built. Remove related flags adjustment.
+
+Autogenerated gimple-match-N.o files do not depend on
+gimple-match-exports.cc.
+
+{gimple,generic)-match-auto.h only depend on the prerequisites of the
+corresponding s-{gimple,generic}-match stamp file, not any .cc file.
+
+gcc/ChangeLog:
+
+ * Makefile.in: (gimple-match-head.o-warn): Remove.
+ (GIMPLE_MATCH_PD_SEQ_SRC): Do not depend on
+ gimple-match-exports.cc.
+ (gimple-match-auto.h): Only depend on s-gimple-match.
+ (generic-match-auto.h): Likewise.
+
+(cherry picked from commit 31c70a7daa368767f0f58e0389deb2c69d9e14fd)
+---
+ gcc/Makefile.in | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index f0c34d00ecbc..fe3af5c8008c 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -230,7 +230,6 @@ gengtype-lex.o-warn = -Wno-error
+ libgcov-util.o-warn = -Wno-error
+ libgcov-driver-tool.o-warn = -Wno-error
+ libgcov-merge-tool.o-warn = -Wno-error
+-gimple-match-head.o-warn = -Wno-unused
+ gimple-match-exports.o-warn = -Wno-unused
+ dfp.o-warn = -Wno-strict-aliasing
+
+@@ -2670,12 +2669,10 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
+ false; \
+ fi
+
+-$(GIMPLE_MATCH_PD_SEQ_SRC): s-gimple-match gimple-match-head.cc \
+- gimple-match-exports.cc; @true
+-gimple-match-auto.h: s-gimple-match gimple-match-head.cc \
+- gimple-match-exports.cc; @true
++$(GIMPLE_MATCH_PD_SEQ_SRC): s-gimple-match gimple-match-head.cc; @true
++gimple-match-auto.h: s-gimple-match; @true
+ $(GENERIC_MATCH_PD_SEQ_SRC): s-generic-match generic-match-head.cc; @true
+-generic-match-auto.h: s-generic-match generic-match-head.cc; @true
++generic-match-auto.h: s-generic-match; @true
+
+ s-gimple-match: build/genmatch$(build_exeext) \
+ $(srcdir)/match.pd cfn-operators.pd
+--
+2.43.0
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 4b18bf0..0e54b6b 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,13 @@
+11 ?? ??? 2023
+
+ U 76_all_match.pd-don-t-emit-label-if-not-needed.patch
+ U 77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
+ U 78_all_match.pd-CSE-the-dump-output-check.patch
+ U 79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
+ U 80_all_match.pd-automatically-partition-match.cc-files.patch
+ U 81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+ + 82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
+
10 28 Oct 2023
U 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-11-29 20:25 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-11-29 20:25 UTC (permalink / raw
To: gentoo-commits
commit: 1e31431a93ba11e6905e7914a9e470b4a3e928ec
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 29 20:24:57 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 20:24:57 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=1e31431a
13.2.0: rebase patches
Signed-off-by: Sam James <sam <AT> gentoo.org>
...l_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch | 24 ++++++++++----------
....in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch | 8 +++----
...in-Make-recog.h-depend-on-TREE_H-PR111021.patch | 9 ++++----
...genemit-Split-insn-emit.cc-into-ten-files.patch | 26 +++++++++++-----------
13.2.0/gentoo/README.history | 4 ++++
5 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
index 5cbeb48..5e6a81d 100644
--- a/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
+++ b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bc45e18d433f879a02e369d027829f90f9e85724
-From f68becb26d43428a8e35ff2528c2bce719a7bb0a Mon Sep 17 00:00:00 2001
+From e351a8c9975b93e3e98e52342cb77b6a2969257f Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Mon, 12 Jun 2023 14:06:08 +0100
-Subject: [PATCH 2/6] Remove DEFAULT_MATCHPD_PARTITIONS macro
+Subject: [PATCH 10/14] Remove DEFAULT_MATCHPD_PARTITIONS macro
As Jakub pointed out, DEFAULT_MATCHPD_PARTITIONS
is now unused and can be removed.
@@ -21,10 +21,10 @@ gcc/ChangeLog:
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/gcc/configure b/gcc/configure
-index 843fd5449dd..3750f77fd03 100755
+index 2c124f1b0337..61c18a13ab7b 100755
--- a/gcc/configure
+++ b/gcc/configure
-@@ -7908,11 +7908,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
+@@ -7914,11 +7914,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
fi
@@ -36,26 +36,26 @@ index 843fd5449dd..3750f77fd03 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
-@@ -19850,7 +19845,7 @@ else
+@@ -19873,7 +19868,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19853 "configure"
-+#line 19848 "configure"
+-#line 19876 "configure"
++#line 19871 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19956,7 +19951,7 @@ else
+@@ -19979,7 +19974,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19959 "configure"
-+#line 19954 "configure"
+-#line 19982 "configure"
++#line 19977 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index de5e3aef2c8..7f8aa5329c7 100644
+index 526ce0665a3e..c15b65367419 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -932,8 +932,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
@@ -68,5 +68,5 @@ index de5e3aef2c8..7f8aa5329c7 100644
# Enable __cxa_atexit for C++.
--
-2.42.0
+2.43.0
diff --git a/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
index bd738cb..aa6a0f3 100644
--- a/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
+++ b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8353b9c5f5af0e65cb04fcbb7325d6a566006cd4
-From c60ffbdd0b7bee758672d66187b65eaf1a59d4a1 Mon Sep 17 00:00:00 2001
+From f9139ea69c23448a874cbb64c2d201cf9f7ece2f Mon Sep 17 00:00:00 2001
From: Kewen Lin <linkw@linux.ibm.com>
Date: Fri, 18 Aug 2023 05:03:40 -0500
-Subject: [PATCH 4/6] Makefile.in: Make TM_P_H depend on $(TREE_H) [PR111021]
+Subject: [PATCH 12/14] Makefile.in: Make TM_P_H depend on $(TREE_H) [PR111021]
As PR111021 shows, the below ${port}-protos.h include tree.h
for code_helper and tree_code:
@@ -48,7 +48,7 @@ gcc/ChangeLog:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 975fbb61ea8..115d2a6d9b7 100644
+index 975fbb61ea8a..115d2a6d9b76 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -886,7 +886,8 @@ OPTIONS_C_EXTRA = $(PRETTY_PRINT_H)
@@ -62,5 +62,5 @@ index 975fbb61ea8..115d2a6d9b7 100644
GTM_H = tm.h $(tm_file_list) insn-constants.h
TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
--
-2.42.0
+2.43.0
diff --git a/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
index 7254215..330503a 100644
--- a/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
+++ b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
@@ -1,9 +1,10 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ecb95399f43873e1f34119ac260bbea2ef358e53
-From 79a97ff760ae66da49dc216260fe94d894962b1d Mon Sep 17 00:00:00 2001
+From fcf952823a3d246e6459ce7454144a96fc1f540b Mon Sep 17 00:00:00 2001
From: Kewen Lin <linkw@linux.ibm.com>
Date: Tue, 15 Aug 2023 03:01:20 -0500
-Subject: [PATCH 5/6] Makefile.in: Make recog.h depend on $(TREE_H) [PR111021]
+Subject: [PATCH 13/14] Makefile.in: Make recog.h depend on $(TREE_H)
+ [PR111021]
Commit r14-3093 introduced a random build failure on
build/gencondmd.cc building. Since r14-3093 make recog.h
@@ -27,7 +28,7 @@ gcc/ChangeLog:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 115d2a6d9b7..2c16b14ad0f 100644
+index 115d2a6d9b76..2c16b14ad0f3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -985,7 +985,7 @@ GIMPLE_H = gimple.h gimple.def gsstruct.def $(VEC_H) \
@@ -40,5 +41,5 @@ index 115d2a6d9b7..2c16b14ad0f 100644
FLAGS_H = flags.h flag-types.h $(OPTIONS_H)
OPTIONS_H = options.h flag-types.h $(OPTIONS_H_EXTRA)
--
-2.42.0
+2.43.0
diff --git a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
index 6a2f3ed..c237e7b 100644
--- a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+++ b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
@@ -1,10 +1,10 @@
https://gcc.gnu.org/PR54179
https://inbox.sourceware.org/gcc-patches/de0f7bdc-d236-4f5b-9504-d5bfb215d023@gmail.com/
-From a71bcc136fee1c5a5ec6639f802daf1b22a1aab6 Mon Sep 17 00:00:00 2001
+From 366eeb9d3b5e861291be112d66940d98e9dc2693 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp.gcc@gmail.com>
Date: Fri, 27 Oct 2023 21:04:25 +0200
-Subject: [PATCH] genemit: Split insn-emit.cc into ten files.
+Subject: [PATCH 14/14] genemit: Split insn-emit.cc into ten files.
After working with Sam off-list (thanks) I managed to get hppa to
build. Initially it looked as if hppa just had a very small number of
@@ -168,7 +168,7 @@ index 2c16b14ad0f3..b0c118e6d189 100644
s-check : build/gencheck$(build_exeext)
$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
diff --git a/gcc/configure b/gcc/configure
-index 3750f77fd037..056d098618b2 100755
+index 61c18a13ab7b..9a8d7ab8b8fa 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -838,6 +838,7 @@ enable_gcov
@@ -187,7 +187,7 @@ index 3750f77fd037..056d098618b2 100755
enable___cxa_atexit
enable_decimal_float
enable_fixed_point
-@@ -1831,6 +1833,9 @@ Optional Packages:
+@@ -1837,6 +1839,9 @@ Optional Packages:
--with-matchpd-partitions=num
Set the number of partitions to make for gimple and
generic when splitting match.pd. [default=10]
@@ -197,7 +197,7 @@ index 3750f77fd037..056d098618b2 100755
--with-dwarf2 force the default debug format to be DWARF 2 (or
later)
--with-specs=SPECS add SPECS to driver command-line processing
-@@ -7909,6 +7914,21 @@ fi
+@@ -7915,6 +7920,21 @@ fi
@@ -219,26 +219,26 @@ index 3750f77fd037..056d098618b2 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
if test "${enable___cxa_atexit+set}" = set; then :
-@@ -19845,7 +19865,7 @@ else
+@@ -19868,7 +19888,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19848 "configure"
-+#line 19995 "configure"
+-#line 19871 "configure"
++#line 19891 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19951,7 +19971,7 @@ else
+@@ -19974,7 +19994,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19954 "configure"
-+#line 20101 "configure"
+-#line 19977 "configure"
++#line 19997 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 7f8aa5329c7f..efbaa0bf6eeb 100644
+index c15b65367419..66b9eaa99e08 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -934,6 +934,19 @@ fi
@@ -1400,5 +1400,5 @@ index b309c9c3deb6..2adcb58478fe 100644
struct enum_type *lookup_enum_type (const char *name);
void traverse_enum_types (htab_trav callback, void *info);
--
-2.42.0
+2.43.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 0e54b6b..e306264 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -6,6 +6,10 @@
U 79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
U 80_all_match.pd-automatically-partition-match.cc-files.patch
U 81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+ U 87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
+ U 88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
+ U 89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
+ U 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+ 82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
10 28 Oct 2023
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2023-12-03 3:18 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2023-12-03 3:18 UTC (permalink / raw
To: gentoo-commits
commit: 4645a0fbda11a783b7545ae92d8a7e1783a7f583
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 3 03:17:22 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 3 03:17:22 2023 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4645a0fb
13.2.0: cut patchset 11
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/README.history | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index e306264..69f7809 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,4 +1,4 @@
-11 ?? ??? 2023
+11 3 Dec 2023
U 76_all_match.pd-don-t-emit-label-if-not-needed.patch
U 77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-01-17 1:06 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-01-17 1:06 UTC (permalink / raw
To: gentoo-commits
commit: 953476b6862099862501b7c2cfed7b91ccb8573c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 17 01:05:33 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 01:05:45 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=953476b6
13.2.0: add 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
This helps some Steam games.
Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7367
Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8133
Bug: https://github.com/ValveSoftware/csgo-osx-linux/issues/2659
Bug: https://gcc.gnu.org/PR113258
Signed-off-by: Sam James <sam <AT> gentoo.org>
...tdc-Prefer-posix_memalign-for-aligned-new.patch | 97 ++++++++++++++++++++++
13.2.0/gentoo/README.history | 4 +
2 files changed, 101 insertions(+)
diff --git a/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch b/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
new file mode 100644
index 0000000..a03f268
--- /dev/null
+++ b/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
@@ -0,0 +1,97 @@
+https://gcc.gnu.org/PR113258
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f50f2efae9fb0965d8ccdb62cfdb698336d5a933
+
+From d17158058fee187e7efb918145c87bdfff9cbfa3 Mon Sep 17 00:00:00 2001
+From: Jonathan Wakely <jwakely@redhat.com>
+Date: Tue, 9 Jan 2024 15:22:46 +0000
+Subject: [PATCH] libstdc++: Prefer posix_memalign for aligned-new [PR113258]
+
+As described in PR libstdc++/113258 there are old versions of tcmalloc
+which replace malloc and related APIs, but do not repalce aligned_alloc
+because it didn't exist at the time they were released. This means that
+when operator new(size_t, align_val_t) uses aligned_alloc to obtain
+memory, it comes from libc's aligned_alloc not from tcmalloc. But when
+operator delete(void*, size_t, align_val_t) uses free to deallocate the
+memory, that goes to tcmalloc's replacement version of free, which
+doesn't know how to free it.
+
+If we give preference to the older posix_memalign instead of
+aligned_alloc then we're more likely to use a function that will be
+compatible with the replacement version of free. Because posix_memalign
+has been around for longer, it's more likely that old third-party malloc
+replacements will also replace posix_memalign alongside malloc and free.
+
+libstdc++-v3/ChangeLog:
+
+ PR libstdc++/113258
+ * libsupc++/new_opa.cc: Prefer to use posix_memalign if
+ available.
+
+(cherry picked from commit f50f2efae9fb0965d8ccdb62cfdb698336d5a933)
+---
+ libstdc++-v3/libsupc++/new_opa.cc | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
+index 6eb136fa8fc7..29767c1cfaad 100644
+--- a/libstdc++-v3/libsupc++/new_opa.cc
++++ b/libstdc++-v3/libsupc++/new_opa.cc
+@@ -46,12 +46,12 @@ using std::bad_alloc;
+ using std::size_t;
+ extern "C"
+ {
+-# if _GLIBCXX_HAVE_ALIGNED_ALLOC
++# if _GLIBCXX_HAVE_POSIX_MEMALIGN
++ void *posix_memalign(void **, size_t alignment, size_t size);
++# elif _GLIBCXX_HAVE_ALIGNED_ALLOC
+ void *aligned_alloc(size_t alignment, size_t size);
+ # elif _GLIBCXX_HAVE__ALIGNED_MALLOC
+ void *_aligned_malloc(size_t size, size_t alignment);
+-# elif _GLIBCXX_HAVE_POSIX_MEMALIGN
+- void *posix_memalign(void **, size_t alignment, size_t size);
+ # elif _GLIBCXX_HAVE_MEMALIGN
+ void *memalign(size_t alignment, size_t size);
+ # else
+@@ -63,13 +63,10 @@ extern "C"
+ #endif
+
+ namespace __gnu_cxx {
+-#if _GLIBCXX_HAVE_ALIGNED_ALLOC
+-using ::aligned_alloc;
+-#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
+-static inline void*
+-aligned_alloc (std::size_t al, std::size_t sz)
+-{ return _aligned_malloc(sz, al); }
+-#elif _GLIBCXX_HAVE_POSIX_MEMALIGN
++// Prefer posix_memalign if available, because it's older than aligned_alloc
++// and so more likely to be provided by replacement malloc libraries that
++// predate the addition of aligned_alloc. See PR libstdc++/113258.
++#if _GLIBCXX_HAVE_POSIX_MEMALIGN
+ static inline void*
+ aligned_alloc (std::size_t al, std::size_t sz)
+ {
+@@ -83,6 +80,12 @@ aligned_alloc (std::size_t al, std::size_t sz)
+ return ptr;
+ return nullptr;
+ }
++#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
++using ::aligned_alloc;
++#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
++static inline void*
++aligned_alloc (std::size_t al, std::size_t sz)
++{ return _aligned_malloc(sz, al); }
+ #elif _GLIBCXX_HAVE_MEMALIGN
+ static inline void*
+ aligned_alloc (std::size_t al, std::size_t sz)
+@@ -128,7 +131,8 @@ operator new (std::size_t sz, std::align_val_t al)
+ if (__builtin_expect (sz == 0, false))
+ sz = 1;
+
+-#if _GLIBCXX_HAVE_ALIGNED_ALLOC
++#if _GLIBCXX_HAVE_POSIX_MEMALIGN
++#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
+ # if defined _AIX || defined __APPLE__
+ /* AIX 7.2.0.0 aligned_alloc incorrectly has posix_memalign's requirement
+ * that alignment is a multiple of sizeof(void*).
+--
+2.43.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 69f7809..3a6ad75 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+12 17 Jan 2024
+
+ + 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
+
11 3 Dec 2023
U 76_all_match.pd-don-t-emit-label-if-not-needed.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-02-12 7:03 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-02-12 7:03 UTC (permalink / raw
To: gentoo-commits
commit: fa67a66af82ec9fd027c01acb862fe6dbd86bf78
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 12 05:56:45 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 12 05:57:09 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fa67a66a
13.2.0: drop 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
Backported upstream.
Signed-off-by: Sam James <sam <AT> gentoo.org>
...tdc-Prefer-posix_memalign-for-aligned-new.patch | 97 ----------------------
13.2.0/gentoo/README.history | 4 +
2 files changed, 4 insertions(+), 97 deletions(-)
diff --git a/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch b/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
deleted file mode 100644
index a03f268..0000000
--- a/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-https://gcc.gnu.org/PR113258
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f50f2efae9fb0965d8ccdb62cfdb698336d5a933
-
-From d17158058fee187e7efb918145c87bdfff9cbfa3 Mon Sep 17 00:00:00 2001
-From: Jonathan Wakely <jwakely@redhat.com>
-Date: Tue, 9 Jan 2024 15:22:46 +0000
-Subject: [PATCH] libstdc++: Prefer posix_memalign for aligned-new [PR113258]
-
-As described in PR libstdc++/113258 there are old versions of tcmalloc
-which replace malloc and related APIs, but do not repalce aligned_alloc
-because it didn't exist at the time they were released. This means that
-when operator new(size_t, align_val_t) uses aligned_alloc to obtain
-memory, it comes from libc's aligned_alloc not from tcmalloc. But when
-operator delete(void*, size_t, align_val_t) uses free to deallocate the
-memory, that goes to tcmalloc's replacement version of free, which
-doesn't know how to free it.
-
-If we give preference to the older posix_memalign instead of
-aligned_alloc then we're more likely to use a function that will be
-compatible with the replacement version of free. Because posix_memalign
-has been around for longer, it's more likely that old third-party malloc
-replacements will also replace posix_memalign alongside malloc and free.
-
-libstdc++-v3/ChangeLog:
-
- PR libstdc++/113258
- * libsupc++/new_opa.cc: Prefer to use posix_memalign if
- available.
-
-(cherry picked from commit f50f2efae9fb0965d8ccdb62cfdb698336d5a933)
----
- libstdc++-v3/libsupc++/new_opa.cc | 26 +++++++++++++++-----------
- 1 file changed, 15 insertions(+), 11 deletions(-)
-
-diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
-index 6eb136fa8fc7..29767c1cfaad 100644
---- a/libstdc++-v3/libsupc++/new_opa.cc
-+++ b/libstdc++-v3/libsupc++/new_opa.cc
-@@ -46,12 +46,12 @@ using std::bad_alloc;
- using std::size_t;
- extern "C"
- {
--# if _GLIBCXX_HAVE_ALIGNED_ALLOC
-+# if _GLIBCXX_HAVE_POSIX_MEMALIGN
-+ void *posix_memalign(void **, size_t alignment, size_t size);
-+# elif _GLIBCXX_HAVE_ALIGNED_ALLOC
- void *aligned_alloc(size_t alignment, size_t size);
- # elif _GLIBCXX_HAVE__ALIGNED_MALLOC
- void *_aligned_malloc(size_t size, size_t alignment);
--# elif _GLIBCXX_HAVE_POSIX_MEMALIGN
-- void *posix_memalign(void **, size_t alignment, size_t size);
- # elif _GLIBCXX_HAVE_MEMALIGN
- void *memalign(size_t alignment, size_t size);
- # else
-@@ -63,13 +63,10 @@ extern "C"
- #endif
-
- namespace __gnu_cxx {
--#if _GLIBCXX_HAVE_ALIGNED_ALLOC
--using ::aligned_alloc;
--#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
--static inline void*
--aligned_alloc (std::size_t al, std::size_t sz)
--{ return _aligned_malloc(sz, al); }
--#elif _GLIBCXX_HAVE_POSIX_MEMALIGN
-+// Prefer posix_memalign if available, because it's older than aligned_alloc
-+// and so more likely to be provided by replacement malloc libraries that
-+// predate the addition of aligned_alloc. See PR libstdc++/113258.
-+#if _GLIBCXX_HAVE_POSIX_MEMALIGN
- static inline void*
- aligned_alloc (std::size_t al, std::size_t sz)
- {
-@@ -83,6 +80,12 @@ aligned_alloc (std::size_t al, std::size_t sz)
- return ptr;
- return nullptr;
- }
-+#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
-+using ::aligned_alloc;
-+#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
-+static inline void*
-+aligned_alloc (std::size_t al, std::size_t sz)
-+{ return _aligned_malloc(sz, al); }
- #elif _GLIBCXX_HAVE_MEMALIGN
- static inline void*
- aligned_alloc (std::size_t al, std::size_t sz)
-@@ -128,7 +131,8 @@ operator new (std::size_t sz, std::align_val_t al)
- if (__builtin_expect (sz == 0, false))
- sz = 1;
-
--#if _GLIBCXX_HAVE_ALIGNED_ALLOC
-+#if _GLIBCXX_HAVE_POSIX_MEMALIGN
-+#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
- # if defined _AIX || defined __APPLE__
- /* AIX 7.2.0.0 aligned_alloc incorrectly has posix_memalign's requirement
- * that alignment is a multiple of sizeof(void*).
---
-2.43.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 3a6ad75..125a634 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+13 12 Feb 2024
+
+ - 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
+
12 17 Jan 2024
+ 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-02-28 0:29 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-02-28 0:29 UTC (permalink / raw
To: gentoo-commits
commit: d5e5f9b252f00c9485c34446efc01bdd2eaaa9b1
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 28 00:28:36 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 00:29:43 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d5e5f9b2
13.2.0: add 91_all_riscv_PR106271-multilib-bootstrap.patch
Fixes prefix bootstrap for riscv.
Bug: https://gcc.gnu.org/PR106271
Bug: https://bugs.gentoo.org/890636
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../91_all_riscv_PR106271-multilib-bootstrap.patch | 37 ++++++++++++++++++++++
13.2.0/gentoo/README.history | 4 +++
2 files changed, 41 insertions(+)
diff --git a/13.2.0/gentoo/91_all_riscv_PR106271-multilib-bootstrap.patch b/13.2.0/gentoo/91_all_riscv_PR106271-multilib-bootstrap.patch
new file mode 100644
index 0000000..2d2933f
--- /dev/null
+++ b/13.2.0/gentoo/91_all_riscv_PR106271-multilib-bootstrap.patch
@@ -0,0 +1,37 @@
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=47f95bc4be4eb14730ab3eaaaf8f6e71fda47690
+https://gcc.gnu.org/PR106271
+https://bugs.gentoo.org/890636
+
+From 976280d3fbfc5c1315befb36cebf07a6f1f0c518 Mon Sep 17 00:00:00 2001
+From: Raphael Moreira Zinsly <rzinsly@ventanamicro.com>
+Date: Tue, 22 Aug 2023 11:37:04 -0600
+Subject: [PATCH] RISC-V: Add multiarch support on riscv-linux-gnu
+
+This adds multiarch support to the RISC-V port so that bootstraps work with
+Debian out-of-the-box. Without this patch the stage1 compiler is unable to
+find headers/libraries when building the stage1 runtime.
+
+This is functionally (and possibly textually) equivalent to Debian's fix for
+the same problem.
+
+gcc/
+ * config/riscv/t-linux: Add MULTIARCH_DIRNAME.
+
+(cherry picked from commit 47f95bc4be4eb14730ab3eaaaf8f6e71fda47690)
+---
+ gcc/config/riscv/t-linux | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
+index 216d2776a183..a6f64f88d25c 100644
+--- a/gcc/config/riscv/t-linux
++++ b/gcc/config/riscv/t-linux
+@@ -1,3 +1,5 @@
+ # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
+ MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
+ MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
++
++MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
+--
+2.44.0
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 125a634..3477e53 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+14 28 Feb 2024
+
+ + 91_all_riscv_PR106271-multilib-bootstrap.patch
+
13 12 Feb 2024
- 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-04-07 23:25 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-04-07 23:25 UTC (permalink / raw
To: gentoo-commits
commit: 81f30ec8c4148cd75cf2aa15744a77b6bc18094a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 7 23:04:32 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 7 23:04:32 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=81f30ec8
13.2.0: drop upstreamed patch, backport riscv gstreamer fix
Bug: https://bugs.gentoo.org/928234
Signed-off-by: Sam James <sam <AT> gentoo.org>
| 134 --------
.../gentoo/92_all_riscv_PR109760-gstreamer.patch | 337 +++++++++++++++++++++
13.2.0/gentoo/README.history | 5 +
3 files changed, 342 insertions(+), 134 deletions(-)
diff --git a/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch b/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch
deleted file mode 100644
index af6c286..0000000
--- a/13.2.0/gentoo/50_all_PR111632_system_cxx_headers_libcxx.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-https://bugs.gentoo.org/912035
-https://inbox.sourceware.org/gcc-patches/0623E896-6B99-49EC-9144-B41BC51089F0@andric.com
-https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274038
-https://gcc.gnu.org/PR111632
-
-commit 8992952bfa95e769a554bd97581cf332987383d8
-Author: Dimitry Andric <dimitry@andric.com>
-Date: 2023-09-28T17:40:29+02:00
-
- Include safe-ctype.h after C++ standard headers, to avoid over-poisoning
-
- When building gcc's C++ sources against recent libc++, the poisoning of
- the ctype macros due to including safe-ctype.h before including C++
- standard headers such as <list>, <map>, etc, causes many compilation
- errors, similar to:
-
- In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
- In file included from /home/dim/src/gcc/master/gcc/system.h:233:
- In file included from /usr/include/c++/v1/vector:321:
- In file included from
- /usr/include/c++/v1/__format/formatter_bool.h:20:
- In file included from
- /usr/include/c++/v1/__format/formatter_integral.h:32:
- In file included from /usr/include/c++/v1/locale:202:
- /usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute
- only applies to structs, variables, functions, and namespaces
- 546 | _LIBCPP_INLINE_VISIBILITY
- | ^
- /usr/include/c++/v1/__config:813:37: note: expanded from macro
- '_LIBCPP_INLINE_VISIBILITY'
- 813 | # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
- | ^
- /usr/include/c++/v1/__config:792:26: note: expanded from macro
- '_LIBCPP_HIDE_FROM_ABI'
- 792 |
- __attribute__((__abi_tag__(_LIBCPP_TOSTRING(
- _LIBCPP_VERSIONED_IDENTIFIER))))
- | ^
- In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
- In file included from /home/dim/src/gcc/master/gcc/system.h:233:
- In file included from /usr/include/c++/v1/vector:321:
- In file included from
- /usr/include/c++/v1/__format/formatter_bool.h:20:
- In file included from
- /usr/include/c++/v1/__format/formatter_integral.h:32:
- In file included from /usr/include/c++/v1/locale:202:
- /usr/include/c++/v1/__locale:547:37: error: expected ';' at end of
- declaration list
- 547 | char_type toupper(char_type __c) const
- | ^
- /usr/include/c++/v1/__locale:553:48: error: too many arguments
- provided to function-like macro invocation
- 553 | const char_type* toupper(char_type* __low, const
- char_type* __high) const
- | ^
- /home/dim/src/gcc/master/gcc/../include/safe-ctype.h:146:9: note:
- macro 'toupper' defined here
- 146 | #define toupper(c) do_not_use_toupper_with_safe_ctype
- | ^
-
- This is because libc++ uses different transitive includes than
- libstdc++, and some of those transitive includes pull in various ctype
- declarations (typically via <locale>).
-
- There was already a special case for including <string> before
- safe-ctype.h, so move the rest of the C++ standard header includes to
- the same location, to fix the problem.
-
- Signed-off-by: Dimitry Andric <dimitry@andric.com>
-
-diff --git a/gcc/system.h b/gcc/system.h
-index e924152ad4c..7a516b11438 100644
---- a/gcc/system.h
-+++ b/gcc/system.h
-@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...);
- #undef fread_unlocked
- #undef fwrite_unlocked
-
--/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
-- the ctype macros through safe-ctype.h */
--
--#ifdef __cplusplus
--#ifdef INCLUDE_STRING
--# include <string>
--#endif
--#endif
--
--/* There are an extraordinary number of issues with <ctype.h>.
-- The last straw is that it varies with the locale. Use libiberty's
-- replacement instead. */
--#include "safe-ctype.h"
--
--#include <sys/types.h>
--
--#include <errno.h>
--
--#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
--extern int errno;
--#endif
-+/* Include C++ standard headers before "safe-ctype.h" to avoid GCC
-+ poisoning the ctype macros through safe-ctype.h */
-
- #ifdef __cplusplus
- #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
-@@ -229,6 +210,9 @@ extern int errno;
- #ifdef INCLUDE_SET
- # include <set>
- #endif
-+#ifdef INCLUDE_STRING
-+# include <string>
-+#endif
- #ifdef INCLUDE_VECTOR
- # include <vector>
- #endif
-@@ -245,6 +229,19 @@ extern int errno;
- # include <type_traits>
- #endif
-
-+/* There are an extraordinary number of issues with <ctype.h>.
-+ The last straw is that it varies with the locale. Use libiberty's
-+ replacement instead. */
-+#include "safe-ctype.h"
-+
-+#include <sys/types.h>
-+
-+#include <errno.h>
-+
-+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
-+extern int errno;
-+#endif
-+
- /* Some of glibc's string inlines cause warnings. Plus we'd rather
- rely on (and therefore test) GCC's string builtins. */
- #define __NO_STRING_INLINES
diff --git a/13.2.0/gentoo/92_all_riscv_PR109760-gstreamer.patch b/13.2.0/gentoo/92_all_riscv_PR109760-gstreamer.patch
new file mode 100644
index 0000000..ef79d70
--- /dev/null
+++ b/13.2.0/gentoo/92_all_riscv_PR109760-gstreamer.patch
@@ -0,0 +1,337 @@
+https://bugs.gentoo.org/928234
+https://gcc.gnu.org/PR109760
+https://gcc.gnu.org/PR110095
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=55914b016de8c8514c58eb59822677a69e44135c
+
+From 55914b016de8c8514c58eb59822677a69e44135c Mon Sep 17 00:00:00 2001
+From: Die Li <lidie@eswincomputing.com>
+Date: Fri, 19 May 2023 23:00:13 -0600
+Subject: [PATCH] Fix riscv_expand_conditional_move.
+
+Two issues have been observed in current riscv_expand_conditional_move
+implementation.
+1. Before introduction of TARGET_XTHEADCONDMOV, op0 of comparision expression
+is used for mode comparision with word_mode, but after TARGET_XTHEADCONDMOV
+megered with TARGET_SFB_ALU, dest of if-then-else is used for mode comparision with
+word_mode, and from md file mode of dest is DI or SI which can be different with
+word_mode in RV64.
+
+2. TARGET_XTHEADCONDMOV cannot be generated when the mode of the comparison is E_VOID.
+
+This patch solves the issues above.
+
+Provide an example from the newly added test case.
+
+Testcase:
+int ConNmv_reg_reg_reg(int x, int y, int z, int n){
+ if (x != y) return z;
+ return n;
+}
+
+Cflags:
+-O2 -march=rv64gc_xtheadcondmov -mabi=lp64d
+
+before patch:
+ConNmv_reg_reg_reg:
+ bne a0,a1,.L23
+ mv a2,a3
+.L23:
+ mv a0,a2
+ ret
+
+after patch:
+ConNmv_reg_reg_reg:
+ sub a1,a0,a1
+ th.mveqz a2,zero,a1
+ th.mvnez a3,zero,a1
+ or a0,a2,a3
+ ret
+
+Co-Authored by: Fei Gao <gaofei@eswincomputing.com>
+Signed-off-by: Die Li <lidie@eswincomputing.com>
+
+gcc/ChangeLog:
+
+ * config/riscv/riscv.cc (riscv_expand_conditional_move): Fix mode
+ checking.
+
+gcc/testsuite/ChangeLog:
+
+ * gcc.target/riscv/xtheadcondmov-indirect-rv32.c: New test.
+ * gcc.target/riscv/xtheadcondmov-indirect-rv64.c: New test.
+---
+ gcc/config/riscv/riscv.cc | 4 +-
+ .../riscv/xtheadcondmov-indirect-rv32.c | 116 ++++++++++++++++++
+ .../riscv/xtheadcondmov-indirect-rv64.c | 116 ++++++++++++++++++
+ 3 files changed, 234 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv32.c
+ create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv64.c
+
+diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
+index 2a7b43849e5..7bb38978261 100644
+--- a/gcc/config/riscv/riscv.cc
++++ b/gcc/config/riscv/riscv.cc
+@@ -3488,7 +3488,7 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
+ && GET_MODE_CLASS (mode) == MODE_INT
+ && reg_or_0_operand (cons, mode)
+ && reg_or_0_operand (alt, mode)
+- && GET_MODE (op) == mode
++ && (GET_MODE (op) == mode || GET_MODE (op) == E_VOIDmode)
+ && GET_MODE (op0) == mode
+ && GET_MODE (op1) == mode
+ && (code == EQ || code == NE))
+@@ -3497,7 +3497,7 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
+ return true;
+ }
+ else if (TARGET_SFB_ALU
+- && mode == word_mode)
++ && GET_MODE (op0) == word_mode)
+ {
+ riscv_emit_int_compare (&code, &op0, &op1);
+ rtx cond = gen_rtx_fmt_ee (code, GET_MODE (op0), op0, op1);
+diff --git a/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv32.c b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv32.c
+new file mode 100644
+index 00000000000..9afdc2eabfd
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv32.c
+@@ -0,0 +1,116 @@
++/* { dg-do compile } */
++/* { dg-options "-O2 -march=rv32gc_xtheadcondmov -mabi=ilp32 -mriscv-attribute" } */
++/* { dg-skip-if "" { *-*-* } { "-O0" "-Os" "-Og" } } */
++/* { dg-final { check-function-bodies "**" "" } } */
++
++/*
++**ConEmv_imm_imm_reg:
++** addi a5,a0,-1000
++** li a0,10
++** th.mvnez a0,zero,a5
++** th.mveqz a1,zero,a5
++** or a0,a0,a1
++** ret
++*/
++int ConEmv_imm_imm_reg(int x, int y){
++ if (x == 1000) return 10;
++ return y;
++}
++
++/*
++**ConEmv_imm_reg_reg:
++** addi a5,a0,-1000
++** th.mvnez a1,zero,a5
++** th.mveqz a2,zero,a5
++** or a0,a1,a2
++** ret
++*/
++int ConEmv_imm_reg_reg(int x, int y, int z){
++ if (x == 1000) return y;
++ return z;
++}
++
++/*
++**ConEmv_reg_imm_reg:
++** sub a1,a0,a1
++** li a0,10
++** th.mvnez a0,zero,a1
++** th.mveqz a2,zero,a1
++** or a0,a0,a2
++** ret
++*/
++int ConEmv_reg_imm_reg(int x, int y, int z){
++ if (x == y) return 10;
++ return z;
++}
++
++/*
++**ConEmv_reg_reg_reg:
++** sub a1,a0,a1
++** th.mvnez a2,zero,a1
++** th.mveqz a3,zero,a1
++** or a0,a2,a3
++** ret
++*/
++int ConEmv_reg_reg_reg(int x, int y, int z, int n){
++ if (x == y) return z;
++ return n;
++}
++
++/*
++**ConNmv_imm_imm_reg:
++** li a5,9998336
++** addi a4,a0,-1000
++** addi a5,a5,1664
++** th.mvnez a1,zero,a4
++** th.mveqz a5,zero,a4
++** or a0,a1,a5
++** ret
++*/
++int ConNmv_imm_imm_reg(int x, int y){
++ if (x != 1000) return 10000000;
++ return y;
++}
++
++/*
++**ConNmv_imm_reg_reg:
++** addi a5,a0,-1000
++** th.mveqz a1,zero,a5
++** th.mvnez a2,zero,a5
++** or a0,a1,a2
++** ret
++*/
++int ConNmv_imm_reg_reg(int x, int y, int z){
++ if (x != 1000) return y;
++ return z;
++}
++
++/*
++**ConNmv_reg_imm_reg:
++** sub a1,a0,a1
++** li a0,10
++** th.mveqz a0,zero,a1
++** th.mvnez a2,zero,a1
++** or a0,a0,a2
++** ret
++*/
++int ConNmv_reg_imm_reg(int x, int y, int z){
++ if (x != y) return 10;
++ return z;
++}
++
++/*
++**ConNmv_reg_reg_reg:
++** sub a1,a0,a1
++** th.mveqz a2,zero,a1
++** th.mvnez a3,zero,a1
++** or a0,a2,a3
++** ret
++*/
++int ConNmv_reg_reg_reg(int x, int y, int z, int n){
++ if (x != y) return z;
++ return n;
++}
++
++
++/* { dg-final { scan-assembler ".attribute arch, \"rv32i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_xtheadcondmov1p0\"" } } */
+diff --git a/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv64.c b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv64.c
+new file mode 100644
+index 00000000000..a1982fd90bd
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect-rv64.c
+@@ -0,0 +1,116 @@
++/* { dg-do compile } */
++/* { dg-options "-O2 -march=rv64gc_xtheadcondmov -mabi=lp64d -mriscv-attribute" } */
++/* { dg-skip-if "" { *-*-* } { "-O0" "-Os" "-Og" } } */
++/* { dg-final { check-function-bodies "**" "" } } */
++
++/*
++**ConEmv_imm_imm_reg:
++** addi a5,a0,-1000
++** li a0,10
++** th.mvnez a0,zero,a5
++** th.mveqz a1,zero,a5
++** or a0,a0,a1
++** ret
++*/
++int ConEmv_imm_imm_reg(int x, int y){
++ if (x == 1000) return 10;
++ return y;
++}
++
++/*
++**ConEmv_imm_reg_reg:
++** addi a5,a0,-1000
++** th.mvnez a1,zero,a5
++** th.mveqz a2,zero,a5
++** or a0,a1,a2
++** ret
++*/
++int ConEmv_imm_reg_reg(int x, int y, int z){
++ if (x == 1000) return y;
++ return z;
++}
++
++/*
++**ConEmv_reg_imm_reg:
++** sub a1,a0,a1
++** li a0,10
++** th.mvnez a0,zero,a1
++** th.mveqz a2,zero,a1
++** or a0,a0,a2
++** ret
++*/
++int ConEmv_reg_imm_reg(int x, int y, int z){
++ if (x == y) return 10;
++ return z;
++}
++
++/*
++**ConEmv_reg_reg_reg:
++** sub a1,a0,a1
++** th.mvnez a2,zero,a1
++** th.mveqz a3,zero,a1
++** or a0,a2,a3
++** ret
++*/
++int ConEmv_reg_reg_reg(int x, int y, int z, int n){
++ if (x == y) return z;
++ return n;
++}
++
++/*
++**ConNmv_imm_imm_reg:
++** li a5,9998336
++** addi a4,a0,-1000
++** addi a5,a5,1664
++** th.mvnez a1,zero,a4
++** th.mveqz a5,zero,a4
++** or a0,a1,a5
++** ret
++*/
++int ConNmv_imm_imm_reg(int x, int y){
++ if (x != 1000) return 10000000;
++ return y;
++}
++
++/*
++**ConNmv_imm_reg_reg:
++** addi a5,a0,-1000
++** th.mveqz a1,zero,a5
++** th.mvnez a2,zero,a5
++** or a0,a1,a2
++** ret
++*/
++int ConNmv_imm_reg_reg(int x, int y, int z){
++ if (x != 1000) return y;
++ return z;
++}
++
++/*
++**ConNmv_reg_imm_reg:
++** sub a1,a0,a1
++** li a0,10
++** th.mveqz a0,zero,a1
++** th.mvnez a2,zero,a1
++** or a0,a0,a2
++** ret
++*/
++int ConNmv_reg_imm_reg(int x, int y, int z){
++ if (x != y) return 10;
++ return z;
++}
++
++/*
++**ConNmv_reg_reg_reg:
++** sub a1,a0,a1
++** th.mveqz a2,zero,a1
++** th.mvnez a3,zero,a1
++** or a0,a2,a3
++** ret
++*/
++int ConNmv_reg_reg_reg(int x, int y, int z, int n){
++ if (x != y) return z;
++ return n;
++}
++
++
++/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_xtheadcondmov1p0\"" } } */
+--
+2.39.3
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 3477e53..bacfe3b 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,8 @@
+15 7 Apr 2024
+
+ - 50_all_PR111632_system_cxx_headers_libcxx.patch
+ + 92_all_riscv_PR109760-gstreamer.patch
+
14 28 Feb 2024
+ 91_all_riscv_PR106271-multilib-bootstrap.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-04-07 23:25 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-04-07 23:25 UTC (permalink / raw
To: gentoo-commits
commit: 0b365302d77dabad96a00c5fe3643d905ec39298
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 7 23:15:56 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 7 23:16:27 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0b365302
13.2.0: rebase patches
Signed-off-by: Sam James <sam <AT> gentoo.org>
...l_match.pd-don-t-emit-label-if-not-needed.patch | 8 ++--
| 8 ++--
...78_all_match.pd-CSE-the-dump-output-check.patch | 8 ++--
...lit-shared-code-to-gimple-match-exports.c.patch | 18 ++++-----
...pd-automatically-partition-match.cc-files.patch | 18 ++++-----
...e-splits-in-makefile-and-make-configurabl.patch | 46 +++++++++++++++-------
...in-clean-up-match.pd-related-dependencies.patch | 6 +--
...ce-seq-for-portability-with-GNU-Make-vari.patch | 9 +++--
...l_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch | 46 +++++++++++++++-------
....in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch | 6 +--
...in-Make-recog.h-depend-on-TREE_H-PR111021.patch | 6 +--
...genemit-Split-insn-emit.cc-into-ten-files.patch | 26 ++++++------
13.2.0/gentoo/README.history | 12 ++++++
13 files changed, 133 insertions(+), 84 deletions(-)
diff --git a/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
index 9d702eb..95da940 100644
--- a/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
+++ b/13.2.0/gentoo/76_all_match.pd-don-t-emit-label-if-not-needed.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 30f78d42a215686cab9c7276076f11e5ea08341d Mon Sep 17 00:00:00 2001
+From 6178fddd3e0957fbb8bcfc443fef172691b7640b Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:35:17 +0100
-Subject: [PATCH 02/14] match.pd: don't emit label if not needed
+Subject: [PATCH 01/15] match.pd: don't emit label if not needed
This is a small QoL codegen improvement for match.pd to not emit labels when
they are not needed. The codegen is nice and there is a small (but consistent)
@@ -20,7 +20,7 @@ gcc/ChangeLog:
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 98b429a9d0bb..0c5a19aca8ed 100644
+index c1023d921fca..9ecd0a462b4f 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -3354,6 +3354,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
@@ -110,5 +110,5 @@ index 98b429a9d0bb..0c5a19aca8ed 100644
}
--
-2.43.0
+2.44.0
--git a/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
index fb50871..ea61987 100644
--- a/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
+++ b/13.2.0/gentoo/77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 1e714dddc3646b484014ec6636b3d80910536b4b Mon Sep 17 00:00:00 2001
+From 2be19327b38b4e3e183d47529871614a3ef0c3ad Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:36:01 +0100
-Subject: [PATCH 03/14] match.pd: Remove commented out line pragmas unless -vv
+Subject: [PATCH 02/15] match.pd: Remove commented out line pragmas unless -vv
is used.
genmatch currently outputs commented out line directives that have no effect
@@ -24,7 +24,7 @@ gcc/ChangeLog:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 0c5a19aca8ed..8937c76369cb 100644
+index 9ecd0a462b4f..45e49c790b6d 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
@@ -37,5 +37,5 @@ index 0c5a19aca8ed..8937c76369cb 100644
development it's right now more convenient to have line information
from the generated file. Still keep the directives as comment for now
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
index 8dda55a..e084c4c 100644
--- a/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
+++ b/13.2.0/gentoo/78_all_match.pd-CSE-the-dump-output-check.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From c256e2c80e56c4e015d8d7ca50fa01a6ed98a1eb Mon Sep 17 00:00:00 2001
+From 2d83fafb3f263544be09bf7dbde036e4a84f6d7c Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:36:43 +0100
-Subject: [PATCH 04/14] match.pd: CSE the dump output check.
+Subject: [PATCH 03/15] match.pd: CSE the dump output check.
This is a small improvement in QoL codegen for match.pd to save time not
re-evaluating the condition for printing debug information in every function.
@@ -26,7 +26,7 @@ gcc/ChangeLog:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 8937c76369cb..a0643aa37308 100644
+index 45e49c790b6d..a17ef8a23ed5 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -3433,7 +3433,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
@@ -66,5 +66,5 @@ index 8937c76369cb..a0643aa37308 100644
if (!gimple)
fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n");
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
index f52ea7a..1f7769f 100644
--- a/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
+++ b/13.2.0/gentoo/79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From d5e12d6bf0a763f37e99eef5d579d9a6417e067c Mon Sep 17 00:00:00 2001
+From 49ed8cead428b48bf46afbbb37a4d043d00702d6 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:37:49 +0100
-Subject: [PATCH 05/14] genmatch: split shared code to gimple-match-exports.cc
+Subject: [PATCH 04/15] genmatch: split shared code to gimple-match-exports.cc
In preparation for automatically splitting match.pd files I split off the
non-static helper functions that are shared between the match.pd functions off
@@ -68,7 +68,7 @@ index 06d192fa9ed8..406856acde1c 100644
s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index a0643aa37308..5320d4110082 100644
+index a17ef8a23ed5..665d7e2106ff 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -3957,7 +3957,7 @@ decision_tree::gen (FILE *f, bool gimple)
@@ -1349,12 +1349,12 @@ index 000000000000..7aeb4ddb1524
+ return get_conditional_internal_fn (associated_internal_fn (cfn, type));
+}
diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc
-index ec603f9d043c..b08cd891a13a 100644
+index 21843d7870b3..3069ff5cb6e1 100644
--- a/gcc/gimple-match-head.cc
+++ b/gcc/gimple-match-head.cc
-@@ -48,1089 +48,8 @@ along with GCC; see the file COPYING3. If not see
- #include "gimple-range.h"
- #include "langhooks.h"
+@@ -50,1089 +50,8 @@ along with GCC; see the file COPYING3. If not see
+ #include "attribs.h"
+ #include "asan.h"
-/* Forward declarations of the private auto-generated matchers.
- They expect valueized operands in canonical order and do not
@@ -2444,7 +2444,7 @@ index ec603f9d043c..b08cd891a13a 100644
/* Helper for the autogenerated code, get at the definition of NAME when
VALUEIZE allows that. */
-@@ -1305,110 +224,3 @@ optimize_successive_divisions_p (tree divisor, tree inner_div)
+@@ -1307,110 +226,3 @@ optimize_successive_divisions_p (tree divisor, tree inner_div)
}
return true;
}
@@ -2556,5 +2556,5 @@ index ec603f9d043c..b08cd891a13a 100644
- return get_conditional_internal_fn (associated_internal_fn (cfn, type));
-}
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
index 6cee0ce..6405bf8 100644
--- a/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
+++ b/13.2.0/gentoo/80_all_match.pd-automatically-partition-match.cc-files.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 0b9341cec30004016c4a66013882ea983a9e3810 Mon Sep 17 00:00:00 2001
+From daac5d2f67656dcf8cc2bbff1c6eaa34f3fb55b9 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:38:50 +0100
-Subject: [PATCH 06/14] match.pd: automatically partition *-match.cc files.
+Subject: [PATCH 05/15] match.pd: automatically partition *-match.cc files.
Following on from Richi's RFC[1] this is another attempt to split up match.pd
into multiple gimple-match and generic-match files. This version is fully
@@ -111,7 +111,7 @@ gcc/ChangeLog:
1 file changed, 190 insertions(+), 36 deletions(-)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
-index 5320d4110082..6cb05d006e8d 100644
+index 665d7e2106ff..f80e4b972288 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -183,6 +183,33 @@ fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
@@ -374,7 +374,7 @@ index 5320d4110082..6cb05d006e8d 100644
}
-@@ -5215,6 +5293,30 @@ round_alloc_size (size_t s)
+@@ -5213,6 +5291,30 @@ round_alloc_size (size_t s)
}
@@ -405,7 +405,7 @@ index 5320d4110082..6cb05d006e8d 100644
/* The genmatch generator program. It reads from a pattern description
and outputs GIMPLE or GENERIC IL matching and simplification routines. */
-@@ -5229,25 +5331,44 @@ main (int argc, char **argv)
+@@ -5227,25 +5329,44 @@ main (int argc, char **argv)
return 1;
bool gimple = true;
@@ -454,7 +454,7 @@ index 5320d4110082..6cb05d006e8d 100644
line_table = XCNEW (class line_maps);
linemap_init (line_table, 0);
line_table->reallocator = xrealloc;
-@@ -5294,10 +5415,28 @@ main (int argc, char **argv)
+@@ -5292,10 +5413,28 @@ main (int argc, char **argv)
/* Parse ahead! */
parser p (r, gimple);
@@ -486,7 +486,7 @@ index 5320d4110082..6cb05d006e8d 100644
/* Go over all predicates defined with patterns and perform
lowering and code generation. */
-@@ -5317,7 +5456,10 @@ main (int argc, char **argv)
+@@ -5315,7 +5454,10 @@ main (int argc, char **argv)
if (verbose == 2)
dt.print (stderr);
@@ -498,7 +498,7 @@ index 5320d4110082..6cb05d006e8d 100644
}
/* Lower the main simplifiers and generate code for them. */
-@@ -5334,7 +5476,19 @@ main (int argc, char **argv)
+@@ -5332,7 +5474,19 @@ main (int argc, char **argv)
if (verbose == 2)
dt.print (stderr);
@@ -520,5 +520,5 @@ index 5320d4110082..6cb05d006e8d 100644
/* Finalize. */
cpp_finish (r, NULL);
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
index 8834897..f525f63 100644
--- a/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+++ b/13.2.0/gentoo/81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
-From 7ad6dc24f067e3ecf608143274c36b1eec51ba93 Mon Sep 17 00:00:00 2001
+From dcfebe060ee266f364bb60f1cdf0cec58818c4f7 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 5 May 2023 13:42:17 +0100
-Subject: [PATCH 07/14] match.pd: Use splits in makefile and make configurable.
+Subject: [PATCH 06/15] match.pd: Use splits in makefile and make configurable.
This updates the build system to split up match.pd files into chunks of 10.
This also introduces a new flag --with-matchpd-partitions which can be used to
@@ -26,9 +26,10 @@ gcc/ChangeLog:
(cherry picked from commit 0a85544e1aaeca41133ecfc438cda913dbc0f122)
---
gcc/Makefile.in | 67 +++++++++++++++++++++++++++++++++---------------
+ gcc/config.in | 6 +++++
gcc/configure | 29 +++++++++++++++++++--
gcc/configure.ac | 15 +++++++++++
- 3 files changed, 89 insertions(+), 22 deletions(-)
+ 4 files changed, 95 insertions(+), 22 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 406856acde1c..f0c34d00ecbc 100644
@@ -152,8 +153,25 @@ index 406856acde1c..f0c34d00ecbc 100644
c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
case-cfn-macros.h \
cfn-operators.pd omp-device-properties.h
+diff --git a/gcc/config.in b/gcc/config.in
+index 5281a12a707c..ea60c5b11fc5 100644
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -67,6 +67,12 @@
+ #endif
+
+
++/* Define to larger than one set the number of match.pd partitions to make. */
++#ifndef USED_FOR_TARGET
++#undef DEFAULT_MATCHPD_PARTITIONS
++#endif
++
++
+ /* Define to larger than zero set the default stack clash protector size. */
+ #ifndef USED_FOR_TARGET
+ #undef DEFAULT_STK_CLASH_GUARD_SIZE
diff --git a/gcc/configure b/gcc/configure
-index dec2eca1a453..2c124f1b0337 100755
+index ade0af23e8cc..542d100c2b73 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -838,6 +838,7 @@ enable_gcov
@@ -182,7 +200,7 @@ index dec2eca1a453..2c124f1b0337 100755
--with-dwarf2 force the default debug format to be DWARF 2 (or
later)
--with-specs=SPECS add SPECS to driver command-line processing
-@@ -7895,6 +7900,26 @@ cat >>confdefs.h <<_ACEOF
+@@ -7918,6 +7923,26 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
@@ -209,29 +227,29 @@ index dec2eca1a453..2c124f1b0337 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
if test "${enable___cxa_atexit+set}" = set; then :
-@@ -19848,7 +19873,7 @@ else
+@@ -19871,7 +19896,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19851 "configure"
-+#line 19876 "configure"
+-#line 19874 "configure"
++#line 19899 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19954,7 +19979,7 @@ else
+@@ -19977,7 +20002,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19957 "configure"
-+#line 19982 "configure"
+-#line 19980 "configure"
++#line 20005 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index c0d067ec2716..526ce0665a3e 100644
+index bf8ff4d63906..31aa8566a3e7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -921,6 +921,21 @@ fi
+@@ -943,6 +943,21 @@ fi
AC_DEFINE_UNQUOTED(DEFAULT_STK_CLASH_GUARD_SIZE, $DEFAULT_STK_CLASH_GUARD_SIZE,
[Define to larger than zero set the default stack clash protector size.])
@@ -254,5 +272,5 @@ index c0d067ec2716..526ce0665a3e 100644
AC_ARG_ENABLE(__cxa_atexit,
[AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch b/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
index 950bfba..2512660 100644
--- a/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
+++ b/13.2.0/gentoo/82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
@@ -1,7 +1,7 @@
-From 88d7963056355a28adb9fc1b805752d422c2619e Mon Sep 17 00:00:00 2001
+From 2c1f550db00c7dd9abede5644a3acd915767e0ad Mon Sep 17 00:00:00 2001
From: Alexander Monakov <amonakov@ispras.ru>
Date: Fri, 5 May 2023 19:46:25 +0300
-Subject: [PATCH 08/14] Makefile.in: clean up match.pd-related dependencies
+Subject: [PATCH 07/15] Makefile.in: clean up match.pd-related dependencies
Clean up confusing changes from the recent refactoring for
parallel match.pd build.
@@ -56,5 +56,5 @@ index f0c34d00ecbc..fe3af5c8008c 100644
s-gimple-match: build/genmatch$(build_exeext) \
$(srcdir)/match.pd cfn-operators.pd
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch b/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
index 9b88852..892adbc 100644
--- a/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
+++ b/13.2.0/gentoo/86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
@@ -1,9 +1,10 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=319aef8d2fde32be5cfed99f321c7f90e33d1f1d
-From 3fd5922104168eb1a88ee6209d84ccc9e72a4bfa Mon Sep 17 00:00:00 2001
+From a18a994030d16f58ebced231e778ec4e06a98abb Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 6 May 2023 02:32:17 +0200
-Subject: [PATCH 1/6] build: Replace seq for portability with GNU Make variant
+Subject: [PATCH 08/15] build: Replace seq for portability with GNU Make
+ variant
Some hosts like AIX don't have seq command, this patch replaces it
with something that uses just GNU make features we've been using
@@ -23,7 +24,7 @@ for this already before for the parallel make check.
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index fe3af5c8008..975fbb61ea8 100644
+index fe3af5c8008c..975fbb61ea8a 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -214,9 +214,19 @@ rtl-ssa-warn = $(STRICT_WARN)
@@ -68,5 +69,5 @@ index fe3af5c8008..975fbb61ea8 100644
# For parallelized check-% targets, this decides whether parallelization
# is desirable (if -jN is used). If desirable, recursive make is run with
--
-2.42.0
+2.44.0
diff --git a/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
index 5e6a81d..1f47154 100644
--- a/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
+++ b/13.2.0/gentoo/87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bc45e18d433f879a02e369d027829f90f9e85724
-From e351a8c9975b93e3e98e52342cb77b6a2969257f Mon Sep 17 00:00:00 2001
+From b60091fe7d22e0cac71461dceeb804e37555b5d3 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Mon, 12 Jun 2023 14:06:08 +0100
-Subject: [PATCH 10/14] Remove DEFAULT_MATCHPD_PARTITIONS macro
+Subject: [PATCH 09/15] Remove DEFAULT_MATCHPD_PARTITIONS macro
As Jakub pointed out, DEFAULT_MATCHPD_PARTITIONS
is now unused and can be removed.
@@ -16,15 +16,33 @@ gcc/ChangeLog:
(cherry picked from commit bc45e18d433f879a02e369d027829f90f9e85724)
---
+ gcc/config.in | 6 ------
gcc/configure | 9 ++-------
gcc/configure.ac | 2 --
- 2 files changed, 2 insertions(+), 9 deletions(-)
+ 3 files changed, 2 insertions(+), 15 deletions(-)
+diff --git a/gcc/config.in b/gcc/config.in
+index ea60c5b11fc5..5281a12a707c 100644
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -67,12 +67,6 @@
+ #endif
+
+
+-/* Define to larger than one set the number of match.pd partitions to make. */
+-#ifndef USED_FOR_TARGET
+-#undef DEFAULT_MATCHPD_PARTITIONS
+-#endif
+-
+-
+ /* Define to larger than zero set the default stack clash protector size. */
+ #ifndef USED_FOR_TARGET
+ #undef DEFAULT_STK_CLASH_GUARD_SIZE
diff --git a/gcc/configure b/gcc/configure
-index 2c124f1b0337..61c18a13ab7b 100755
+index 542d100c2b73..cc8247037569 100755
--- a/gcc/configure
+++ b/gcc/configure
-@@ -7914,11 +7914,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
+@@ -7937,11 +7937,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
fi
@@ -36,29 +54,29 @@ index 2c124f1b0337..61c18a13ab7b 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
-@@ -19873,7 +19868,7 @@ else
+@@ -19896,7 +19891,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19876 "configure"
-+#line 19871 "configure"
+-#line 19899 "configure"
++#line 19894 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19979,7 +19974,7 @@ else
+@@ -20002,7 +19997,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19982 "configure"
-+#line 19977 "configure"
+-#line 20005 "configure"
++#line 20000 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 526ce0665a3e..c15b65367419 100644
+index 31aa8566a3e7..d02ffc22a3a3 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -932,8 +932,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
+@@ -954,8 +954,6 @@ if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
Cannot be negative.]))
fi
@@ -68,5 +86,5 @@ index 526ce0665a3e..c15b65367419 100644
# Enable __cxa_atexit for C++.
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
index aa6a0f3..0a92592 100644
--- a/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
+++ b/13.2.0/gentoo/88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8353b9c5f5af0e65cb04fcbb7325d6a566006cd4
-From f9139ea69c23448a874cbb64c2d201cf9f7ece2f Mon Sep 17 00:00:00 2001
+From 87192b63d3ab56543461cb456c4f8b2f1085fd6c Mon Sep 17 00:00:00 2001
From: Kewen Lin <linkw@linux.ibm.com>
Date: Fri, 18 Aug 2023 05:03:40 -0500
-Subject: [PATCH 12/14] Makefile.in: Make TM_P_H depend on $(TREE_H) [PR111021]
+Subject: [PATCH 11/15] Makefile.in: Make TM_P_H depend on $(TREE_H) [PR111021]
As PR111021 shows, the below ${port}-protos.h include tree.h
for code_helper and tree_code:
@@ -62,5 +62,5 @@ index 975fbb61ea8a..115d2a6d9b76 100644
GTM_H = tm.h $(tm_file_list) insn-constants.h
TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
index 330503a..e0c84ae 100644
--- a/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
+++ b/13.2.0/gentoo/89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
@@ -1,9 +1,9 @@
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ecb95399f43873e1f34119ac260bbea2ef358e53
-From fcf952823a3d246e6459ce7454144a96fc1f540b Mon Sep 17 00:00:00 2001
+From 45b0ac72b82e483ac2b8380ce08cedcfd021afb0 Mon Sep 17 00:00:00 2001
From: Kewen Lin <linkw@linux.ibm.com>
Date: Tue, 15 Aug 2023 03:01:20 -0500
-Subject: [PATCH 13/14] Makefile.in: Make recog.h depend on $(TREE_H)
+Subject: [PATCH 12/15] Makefile.in: Make recog.h depend on $(TREE_H)
[PR111021]
Commit r14-3093 introduced a random build failure on
@@ -41,5 +41,5 @@ index 115d2a6d9b76..2c16b14ad0f3 100644
FLAGS_H = flags.h flag-types.h $(OPTIONS_H)
OPTIONS_H = options.h flag-types.h $(OPTIONS_H_EXTRA)
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
index c237e7b..f6ded53 100644
--- a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+++ b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
@@ -1,10 +1,10 @@
https://gcc.gnu.org/PR54179
https://inbox.sourceware.org/gcc-patches/de0f7bdc-d236-4f5b-9504-d5bfb215d023@gmail.com/
-From 366eeb9d3b5e861291be112d66940d98e9dc2693 Mon Sep 17 00:00:00 2001
+From d63f858f41e2bb0e159d15ed8ee41bf303325ee7 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp.gcc@gmail.com>
Date: Fri, 27 Oct 2023 21:04:25 +0200
-Subject: [PATCH 14/14] genemit: Split insn-emit.cc into ten files.
+Subject: [PATCH 13/15] genemit: Split insn-emit.cc into ten files.
After working with Sam off-list (thanks) I managed to get hppa to
build. Initially it looked as if hppa just had a very small number of
@@ -168,7 +168,7 @@ index 2c16b14ad0f3..b0c118e6d189 100644
s-check : build/gencheck$(build_exeext)
$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
diff --git a/gcc/configure b/gcc/configure
-index 61c18a13ab7b..9a8d7ab8b8fa 100755
+index cc8247037569..c98088bea90d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -838,6 +838,7 @@ enable_gcov
@@ -197,7 +197,7 @@ index 61c18a13ab7b..9a8d7ab8b8fa 100755
--with-dwarf2 force the default debug format to be DWARF 2 (or
later)
--with-specs=SPECS add SPECS to driver command-line processing
-@@ -7915,6 +7920,21 @@ fi
+@@ -7938,6 +7943,21 @@ fi
@@ -219,29 +219,29 @@ index 61c18a13ab7b..9a8d7ab8b8fa 100755
# Enable __cxa_atexit for C++.
# Check whether --enable-__cxa_atexit was given.
if test "${enable___cxa_atexit+set}" = set; then :
-@@ -19868,7 +19888,7 @@ else
+@@ -19891,7 +19911,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19871 "configure"
-+#line 19891 "configure"
+-#line 19894 "configure"
++#line 19914 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-@@ -19974,7 +19994,7 @@ else
+@@ -19997,7 +20017,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
--#line 19977 "configure"
-+#line 19997 "configure"
+-#line 20000 "configure"
++#line 20020 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
-index c15b65367419..66b9eaa99e08 100644
+index d02ffc22a3a3..7021f95da3ee 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -934,6 +934,19 @@ fi
+@@ -956,6 +956,19 @@ fi
AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
@@ -1400,5 +1400,5 @@ index b309c9c3deb6..2adcb58478fe 100644
struct enum_type *lookup_enum_type (const char *name);
void traverse_enum_types (htab_trav callback, void *info);
--
-2.43.0
+2.44.0
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index bacfe3b..26583a8 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,6 +1,18 @@
15 7 Apr 2024
- 50_all_PR111632_system_cxx_headers_libcxx.patch
+ U 76_all_match.pd-don-t-emit-label-if-not-needed.patch
+ U 77_all_match.pd-Remove-commented-out-line-pragmas-unless-vv.patch
+ U 78_all_match.pd-CSE-the-dump-output-check.patch
+ U 79_all_genmatch-split-shared-code-to-gimple-match-exports.c.patch
+ U 80_all_match.pd-automatically-partition-match.cc-files.patch
+ U 81_all_match.pd-Use-splits-in-makefile-and-make-configurabl.patch
+ U 82_all_Makefile.in-clean-up-match.pd-related-dependencies.patch
+ U 86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch
+ U 87_all_Remove-DEFAULT_MATCHPD_PARTITIONS-macro.patch
+ U 88_all_Makefile.in-Make-TM_P_H-depend-on-TREE_H-PR111021.patch
+ U 89_all_Makefile.in-Make-recog.h-depend-on-TREE_H-PR111021.patch
+ U 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+ 92_all_riscv_PR109760-gstreamer.patch
14 28 Feb 2024
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-05-10 22:50 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-05-10 22:50 UTC (permalink / raw
To: gentoo-commits
commit: bc7d81fe2f725b4043ce8b9ffb11d80032ce3f75
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 10 22:47:32 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 10 22:47:32 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bc7d81fe
13.2.0: drop obsolete patches backported upstream
Signed-off-by: Sam James <sam <AT> gentoo.org>
...110792-Early-clobber-issues-with-rot32di2.patch | 186 ---------------------
...y-clobber-issues-with-rot32di2-test-fixup.patch | 39 -----
13.2.0/gentoo/README.history | 5 +
3 files changed, 5 insertions(+), 225 deletions(-)
diff --git a/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch b/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
deleted file mode 100644
index e3c09cc..0000000
--- a/13.2.0/gentoo/84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-https://gcc.gnu.org/PR110792
-https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571
-https://github.com/randombit/botan/issues/3637
-
-From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001
-From: Roger Sayle <roger@nextmovesoftware.com>
-Date: Thu, 3 Aug 2023 07:12:04 +0100
-Subject: [PATCH] PR target/110792: Early clobber issues with
- rot32di2_doubleword on i386.
-
-This patch is a conservative fix for PR target/110792, a wrong-code
-regression affecting doubleword rotations by BITS_PER_WORD, which
-effectively swaps the highpart and lowpart words, when the source to be
-rotated resides in memory. The issue is that if the register used to
-hold the lowpart of the destination is mentioned in the address of
-the memory operand, the current define_insn_and_split unintentionally
-clobbers it before reading the highpart.
-
-Hence, for the testcase, the incorrectly generated code looks like:
-
- salq $4, %rdi // calculate address
- movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr
- movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart
-
-Traditionally, the textbook way to fix this would be to add an
-explicit early clobber to the instruction's constraints.
-
- (define_insn_and_split "<insn>32di2_doubleword"
-- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
-+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r")
- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o")
- (const_int 32)))]
-
-but unfortunately this currently generates significantly worse code,
-due to a strange choice of reloads (effectively memcpy), which ends up
-looking like:
-
- salq $4, %rdi // calculate address
- movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg.
- movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack
- movq -8(%rsp), %rdi // load highpart
- movq -16(%rsp), %rbp // load lowpart
-
-Note that reload's "&" doesn't distinguish between the memory being
-early clobbered, vs the registers used in an addressing mode being
-early clobbered.
-
-The fix proposed in this patch is to remove the third alternative, that
-allowed offsetable memory as an operand, forcing reload to place the
-operand into a register before the rotation. This results in:
-
- salq $4, %rdi
- movq WHIRL_S(%rdi), %rax
- movq WHIRL_S+8(%rdi), %rdi
- movq %rax, %rbp
-
-I believe there's a more advanced solution, by swapping the order of
-the loads (if first destination register is mentioned in the address),
-or inserting a lea insn (if both destination registers are mentioned
-in the address), but this fix is a minimal "safe" solution, that
-should hopefully be suitable for backporting.
-
-2023-08-03 Roger Sayle <roger@nextmovesoftware.com>
-
-gcc/ChangeLog
- PR target/110792
- * config/i386/i386.md (<any_rotate>ti3): For rotations by 64 bits
- place operand in a register before gen_<insn>64ti2_doubleword.
- (<any_rotate>di3): Likewise, for rotations by 32 bits, place
- operand in a register before gen_<insn>32di2_doubleword.
- (<any_rotate>32di2_doubleword): Constrain operand to be in register.
- (<any_rotate>64ti2_doubleword): Likewise.
-
-gcc/testsuite/ChangeLog
- PR target/110792
- * g++.target/i386/pr110792.C: New 32-bit C++ test case.
- * gcc.target/i386/pr110792.c: New 64-bit C test case.
-
-(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571)
----
- gcc/config/i386/i386.md | 18 ++++++++++++------
- gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++
- gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++
- 3 files changed, 46 insertions(+), 6 deletions(-)
- create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C
- create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c
-
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index f3a3305..a71e837 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -14359,7 +14359,10 @@
- emit_insn (gen_ix86_<insn>ti3_doubleword
- (operands[0], operands[1], operands[2]));
- else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64)
-- emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1]));
-+ {
-+ operands[1] = force_reg (TImode, operands[1]);
-+ emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1]));
-+ }
- else
- {
- rtx amount = force_reg (QImode, operands[2]);
-@@ -14394,7 +14397,10 @@
- emit_insn (gen_ix86_<insn>di3_doubleword
- (operands[0], operands[1], operands[2]));
- else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32)
-- emit_insn (gen_<insn>32di2_doubleword (operands[0], operands[1]));
-+ {
-+ operands[1] = force_reg (DImode, operands[1]);
-+ emit_insn (gen_<insn>32di2_doubleword (operands[0], operands[1]));
-+ }
- else
- FAIL;
-
-@@ -14562,8 +14568,8 @@
- })
-
- (define_insn_and_split "<insn>32di2_doubleword"
-- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
-- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o")
-+ [(set (match_operand:DI 0 "register_operand" "=r,r")
-+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r")
- (const_int 32)))]
- "!TARGET_64BIT"
- "#"
-@@ -14580,8 +14586,8 @@
- })
-
- (define_insn_and_split "<insn>64ti2_doubleword"
-- [(set (match_operand:TI 0 "register_operand" "=r,r,r")
-- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o")
-+ [(set (match_operand:TI 0 "register_operand" "=r,r")
-+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r")
- (const_int 64)))]
- "TARGET_64BIT"
- "#"
-diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C
-new file mode 100644
-index 0000000..ce21a7a
---- /dev/null
-+++ b/gcc/testsuite/g++.target/i386/pr110792.C
-@@ -0,0 +1,16 @@
-+/* { dg-do compile { target ia32 } } */
-+/* { dg-options "-O2" } */
-+
-+template <int ROT, typename T>
-+inline T rotr(T input)
-+{
-+ return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
-+}
-+
-+unsigned long long WHIRL_S[256] = {0x18186018C07830D8};
-+unsigned long long whirl(unsigned char x0)
-+{
-+ const unsigned long long s4 = WHIRL_S[x0&0xFF];
-+ return rotr<32>(s4);
-+}
-+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c
-new file mode 100644
-index 0000000..b65125c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/pr110792.c
-@@ -0,0 +1,18 @@
-+/* { dg-do compile { target int128 } } */
-+/* { dg-options "-O2" } */
-+
-+static inline unsigned __int128 rotr(unsigned __int128 input)
-+{
-+ return ((input >> 64) | (input << (64)));
-+}
-+
-+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8};
-+unsigned __int128 whirl(unsigned char x0)
-+{
-+ register int t __asm("rdi") = x0&0xFF;
-+ const unsigned __int128 s4 = WHIRL_S[t];
-+ register unsigned __int128 tt __asm("rdi") = rotr(s4);
-+ asm("":::"memory");
-+ return tt;
-+}
-+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */
---
-2.41.0
-
diff --git a/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch b/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
deleted file mode 100644
index 059f68c..0000000
--- a/13.2.0/gentoo/85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 529909f9e92dd3b0ed0383f45a44d2b5f8a58958 Mon Sep 17 00:00:00 2001
-From: Roger Sayle <roger@nextmovesoftware.com>
-Date: Sun, 6 Aug 2023 23:19:10 +0100
-Subject: [PATCH] [Committed] Avoid FAIL of gcc.target/i386/pr110792.c
-
-My apologies (again), I managed to mess up the 64-bit version of the
-test case for PR 110792. Unlike the 32-bit version, the 64-bit case
-contains exactly the same load instructions, just in a different order
-making the correct and incorrect behaviours impossible to distinguish
-with a scan-assembler-not. Somewhere between checking that this test
-failed in a clean tree without the patch, and getting the escaping
-correct, I'd failed to notice that this also FAILs in the patched tree.
-Doh! Instead of removing the test completely, I've left it as a
-compilation test.
-
-The original fix is tested by the 32-bit test case.
-
-Committed to mainline as obvious. Sorry for the incovenience.
-
-2023-08-06 Roger Sayle <roger@nextmovesoftware.com>
-
-gcc/testsuite/ChangeLog
- PR target/110792
- * gcc.target/i386/pr110792.c: Remove dg-final scan-assembler-not.
----
- gcc/testsuite/gcc.target/i386/pr110792.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c
-index b65125c48b62..eea4e1877dbb 100644
---- a/gcc/testsuite/gcc.target/i386/pr110792.c
-+++ b/gcc/testsuite/gcc.target/i386/pr110792.c
-@@ -15,4 +15,3 @@ unsigned __int128 whirl(unsigned char x0)
- asm("":::"memory");
- return tt;
- }
--/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */
---
-2.39.3
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 26583a8..9d31fc5 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,8 @@
+16 10 May 2024
+
+ - 84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
+ - 85_all_x86_PR110792-Early-clobber-issues-with-rot32di2-test-fixup.patch
+
15 7 Apr 2024
- 50_all_PR111632_system_cxx_headers_libcxx.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-06-08 17:01 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-06-08 17:01 UTC (permalink / raw
To: gentoo-commits
commit: 87f98154a853bf66074d33365aa8b85900f2e857
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 8 16:58:26 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 8 16:58:58 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=87f98154
13.2.0: add 93_all_ppc_PR97367-power7-cell-altivec.patch
Requested by ernsteiswuerfel.
Bug: https://gcc.gnu.org/PR97367
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch | 13 +++++++++++++
13.2.0/gentoo/README.history | 4 ++++
2 files changed, 17 insertions(+)
diff --git a/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch b/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch
new file mode 100644
index 0000000..154dd0f
--- /dev/null
+++ b/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch
@@ -0,0 +1,13 @@
+https://gcc.gnu.org/PR97367
+https://inbox.sourceware.org/gcc-patches/20240308.123342.1112119677226246836.rene@exactcode.de/
+--- a/gcc/config/rs6000/rs6000.cc
++++ b/gcc/config/rs6000/rs6000.cc
+@@ -5869,7 +5869,7 @@ rs6000_machine_from_flags (void)
+ HOST_WIDE_INT flags = rs6000_isa_flags;
+
+ /* Disable the flags that should never influence the .machine selection. */
+- flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
++ flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ALTIVEC | OPTION_MASK_ISEL);
+
+ if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
+ return "power10";
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 9d31fc5..86a0fb1 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+17 8 June 2024
+
+ + 93_all_ppc_PR97367-power7-cell-altivec.patch
+
16 10 May 2024
- 84_all_x86_PR110792-Early-clobber-issues-with-rot32di2.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-07-27 19:47 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-07-27 19:47 UTC (permalink / raw
To: gentoo-commits
commit: d892a97182979c3d430469e60ec9a023e899cfe0
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 27 19:46:31 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 27 19:46:31 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d892a971
13.2.0: drop 93_all_ppc_PR97367-power7-cell-altivec.patch
It's merged upstream.
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch | 13 -------------
13.2.0/gentoo/README.history | 4 ++++
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch b/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch
deleted file mode 100644
index 154dd0f..0000000
--- a/13.2.0/gentoo/93_all_ppc_PR97367-power7-cell-altivec.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-https://gcc.gnu.org/PR97367
-https://inbox.sourceware.org/gcc-patches/20240308.123342.1112119677226246836.rene@exactcode.de/
---- a/gcc/config/rs6000/rs6000.cc
-+++ b/gcc/config/rs6000/rs6000.cc
-@@ -5869,7 +5869,7 @@ rs6000_machine_from_flags (void)
- HOST_WIDE_INT flags = rs6000_isa_flags;
-
- /* Disable the flags that should never influence the .machine selection. */
-- flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
-+ flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ALTIVEC | OPTION_MASK_ISEL);
-
- if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
- return "power10";
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 86a0fb1..17f8d53 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+18 27 June 2024
+
+ - 93_all_ppc_PR97367-power7-cell-altivec.patch
+
17 8 June 2024
+ 93_all_ppc_PR97367-power7-cell-altivec.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-09-29 18:56 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-09-29 18:56 UTC (permalink / raw
To: gentoo-commits
commit: e16cbc8c8ab8993896c951b9b2f25e4611f4dd1c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 29 18:52:32 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 29 18:52:32 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e16cbc8c
13.2.0: add Ada LTO patch
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/93_all_PR115917-ada-lto.patch | 52 +++++++++++++++++++++++++++++
13.2.0/gentoo/README.history | 4 +++
2 files changed, 56 insertions(+)
diff --git a/13.2.0/gentoo/93_all_PR115917-ada-lto.patch b/13.2.0/gentoo/93_all_PR115917-ada-lto.patch
new file mode 100644
index 0000000..023c0d1
--- /dev/null
+++ b/13.2.0/gentoo/93_all_PR115917-ada-lto.patch
@@ -0,0 +1,52 @@
+From f55ac7e8ceabaf54ba9fc3ca4393abeae2ee1c19 Mon Sep 17 00:00:00 2001
+Message-ID: <f55ac7e8ceabaf54ba9fc3ca4393abeae2ee1c19.1727635911.git.sam@gentoo.org>
+From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
+Date: Thu, 15 Aug 2024 19:17:41 +0200
+Subject: [PATCH] gnat: fix lto-type-mismatch between C_Version_String and
+ gnat_version_string [PR115917]
+
+gcc/ada/ChangeLog:
+
+ PR ada/115917
+ * gnatvsn.ads: Add note about the duplication of this value in
+ version.c.
+ * version.c (VER_LEN_MAX): Define to the same value as
+ Gnatvsn.Ver_Len_Max.
+ (gnat_version_string): Use VER_LEN_MAX as bound.
+
+(cherry picked from commit 9cbcf8d1de159e6113fafb5dc2feb4a7e467a302)
+---
+ gcc/ada/gnatvsn.ads | 3 ++-
+ gcc/ada/version.c | 5 ++++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
+index b6edc9dabed9..308986afc182 100644
+--- a/gcc/ada/gnatvsn.ads
++++ b/gcc/ada/gnatvsn.ads
+@@ -83,7 +83,8 @@ package Gnatvsn is
+ -- space to store any possible version string value for checks. This
+ -- value should never be decreased in the future, but it would be
+ -- OK to increase it if absolutely necessary. If it is increased,
+- -- be sure to increase GNAT.Compiler.Version.Ver_Len_Max as well.
++ -- be sure to increase GNAT.Compiler.Version.Ver_Len_Max, and to update
++ -- the VER_LEN_MAX define in version.c as well.
+
+ Ver_Prefix : constant String := "GNAT Version: ";
+ -- Prefix generated by binder. If it is changed, be sure to change
+diff --git a/gcc/ada/version.c b/gcc/ada/version.c
+index 5e64edd0b17d..2fa9b8c2c859 100644
+--- a/gcc/ada/version.c
++++ b/gcc/ada/version.c
+@@ -31,4 +31,7 @@
+
+ #include "version.h"
+
+-char gnat_version_string[] = version_string;
++/* Logically a reference to Gnatvsn.Ver_Len_Max. Please keep in sync. */
++#define VER_LEN_MAX 256
++
++char gnat_version_string[VER_LEN_MAX] = version_string;
+--
+2.46.2
+
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 17f8d53..70e12e8 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+19 29 Sept 2024
+
+ + 93_all_PR115917-ada-lto.patch
+
18 27 June 2024
- 93_all_ppc_PR97367-power7-cell-altivec.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
@ 2024-09-29 18:56 Sam James
0 siblings, 0 replies; 25+ messages in thread
From: Sam James @ 2024-09-29 18:56 UTC (permalink / raw
To: gentoo-commits
commit: f414a5b21681d1668ab975137f168f47aba4a873
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 29 18:56:37 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 29 18:56:37 2024 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f414a5b2
13.2.0: drop Ada patch from here
... as we're putting it in 13.3.0 instead.
Signed-off-by: Sam James <sam <AT> gentoo.org>
13.2.0/gentoo/93_all_PR115917-ada-lto.patch | 52 -----------------------------
13.2.0/gentoo/README.history | 4 ---
2 files changed, 56 deletions(-)
diff --git a/13.2.0/gentoo/93_all_PR115917-ada-lto.patch b/13.2.0/gentoo/93_all_PR115917-ada-lto.patch
deleted file mode 100644
index 023c0d1..0000000
--- a/13.2.0/gentoo/93_all_PR115917-ada-lto.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From f55ac7e8ceabaf54ba9fc3ca4393abeae2ee1c19 Mon Sep 17 00:00:00 2001
-Message-ID: <f55ac7e8ceabaf54ba9fc3ca4393abeae2ee1c19.1727635911.git.sam@gentoo.org>
-From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
-Date: Thu, 15 Aug 2024 19:17:41 +0200
-Subject: [PATCH] gnat: fix lto-type-mismatch between C_Version_String and
- gnat_version_string [PR115917]
-
-gcc/ada/ChangeLog:
-
- PR ada/115917
- * gnatvsn.ads: Add note about the duplication of this value in
- version.c.
- * version.c (VER_LEN_MAX): Define to the same value as
- Gnatvsn.Ver_Len_Max.
- (gnat_version_string): Use VER_LEN_MAX as bound.
-
-(cherry picked from commit 9cbcf8d1de159e6113fafb5dc2feb4a7e467a302)
----
- gcc/ada/gnatvsn.ads | 3 ++-
- gcc/ada/version.c | 5 ++++-
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
-index b6edc9dabed9..308986afc182 100644
---- a/gcc/ada/gnatvsn.ads
-+++ b/gcc/ada/gnatvsn.ads
-@@ -83,7 +83,8 @@ package Gnatvsn is
- -- space to store any possible version string value for checks. This
- -- value should never be decreased in the future, but it would be
- -- OK to increase it if absolutely necessary. If it is increased,
-- -- be sure to increase GNAT.Compiler.Version.Ver_Len_Max as well.
-+ -- be sure to increase GNAT.Compiler.Version.Ver_Len_Max, and to update
-+ -- the VER_LEN_MAX define in version.c as well.
-
- Ver_Prefix : constant String := "GNAT Version: ";
- -- Prefix generated by binder. If it is changed, be sure to change
-diff --git a/gcc/ada/version.c b/gcc/ada/version.c
-index 5e64edd0b17d..2fa9b8c2c859 100644
---- a/gcc/ada/version.c
-+++ b/gcc/ada/version.c
-@@ -31,4 +31,7 @@
-
- #include "version.h"
-
--char gnat_version_string[] = version_string;
-+/* Logically a reference to Gnatvsn.Ver_Len_Max. Please keep in sync. */
-+#define VER_LEN_MAX 256
-+
-+char gnat_version_string[VER_LEN_MAX] = version_string;
---
-2.46.2
-
diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 70e12e8..17f8d53 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,7 +1,3 @@
-19 29 Sept 2024
-
- + 93_all_PR115917-ada-lto.patch
-
18 27 June 2024
- 93_all_ppc_PR97367-power7-cell-altivec.patch
^ permalink raw reply related [flat|nested] 25+ messages in thread
end of thread, other threads:[~2024-09-29 18:57 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 9:31 [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-09-29 18:56 Sam James
2024-09-29 18:56 Sam James
2024-07-27 19:47 Sam James
2024-06-08 17:01 Sam James
2024-05-10 22:50 Sam James
2024-04-07 23:25 Sam James
2024-04-07 23:25 Sam James
2024-02-28 0:29 Sam James
2024-02-12 7:03 Sam James
2024-01-17 1:06 Sam James
2023-12-03 3:18 Sam James
2023-11-29 20:25 Sam James
2023-11-29 20:16 Sam James
2023-10-27 23:43 Sam James
2023-10-16 12:41 Sam James
2023-10-01 2:28 Sam James
2023-10-01 2:28 Sam James
2023-10-01 2:28 Sam James
2023-08-13 0:35 Sam James
2023-08-05 23:13 Sam James
2023-07-30 19:02 Sam James
2023-05-26 2:50 Sam James
2023-04-29 23:28 Sam James
2023-04-26 20:39 Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox