[gcc r15-4862] c++/modules: Propagate TYPE_CANONICAL for partial specialisations [PR113814]
https://gcc.gnu.org/g:815e48e3d42231b675bae1dec5fa26890f048ef1 commit r15-4862-g815e48e3d42231b675bae1dec5fa26890f048ef1 Author: Nathaniel Shead Date: Thu Oct 31 20:05:16 2024 +1100 c++/modules: Propagate TYPE_CANONICAL for partial specialisations [PR113814] In some cases, when we go to import a partial specialisation there might already be an incomplete implicit instantiation in the specialisation table. This causes ICEs described in the linked PR as we now have two separate matching specialisations for this same arguments with different TYPE_CANONICAL. We already support multiple specialisations with the same args however, as they may be differently constrained. So we can solve this by simply ensuring that the TYPE_CANONICAL of the new partial specialisation matches the existing specialisation. PR c++/113814 gcc/cp/ChangeLog: * pt.cc (add_mergeable_specialization): Propagate TYPE_CANONICAL. gcc/testsuite/ChangeLog: * g++.dg/modules/partial-6.h: New test. * g++.dg/modules/partial-6_a.H: New test. * g++.dg/modules/partial-6_b.H: New test. * g++.dg/modules/partial-6_c.C: New test. Signed-off-by: Nathaniel Shead Co-authored-by: Jason Merrill Diff: --- gcc/cp/pt.cc | 14 +- gcc/testsuite/g++.dg/modules/partial-6.h | 7 +++ gcc/testsuite/g++.dg/modules/partial-6_a.H | 11 +++ gcc/testsuite/g++.dg/modules/partial-6_b.H | 21 + gcc/testsuite/g++.dg/modules/partial-6_c.C | 12 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 334dbb3c39aa..f4213f88b99f 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -31731,12 +31731,16 @@ add_mergeable_specialization (bool decl_p, spec_entry *elt, tree decl, auto *slot = type_specializations->find_slot (elt, INSERT); /* We don't distinguish different constrained partial type -specializations, so there could be duplicates. Everything else -must be new. */ - if (!(flags & 2 && *slot)) +specializations, so there could be duplicates. In that case we +must propagate TYPE_CANONICAL so that they are treated as the +same type. Everything else must be new. */ + if (*slot) + { + gcc_checking_assert (flags & 2); + TYPE_CANONICAL (elt->spec) = TYPE_CANONICAL ((*slot)->spec); + } + else { - gcc_checking_assert (!*slot); - auto entry = ggc_alloc (); *entry = *elt; *slot = entry; diff --git a/gcc/testsuite/g++.dg/modules/partial-6.h b/gcc/testsuite/g++.dg/modules/partial-6.h new file mode 100644 index ..702c9a1b7ec8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/partial-6.h @@ -0,0 +1,7 @@ +// PR c++/113814 + +template struct A {}; +template A f(); + +template typename, typename> struct B; +template typename TT> B g(); diff --git a/gcc/testsuite/g++.dg/modules/partial-6_a.H b/gcc/testsuite/g++.dg/modules/partial-6_a.H new file mode 100644 index ..6e0d5ddcaf0d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/partial-6_a.H @@ -0,0 +1,11 @@ +// PR c++/113814 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +#include "partial-6.h" + +template +struct A { int a; }; + +template typename TT> +struct B { int b; }; diff --git a/gcc/testsuite/g++.dg/modules/partial-6_b.H b/gcc/testsuite/g++.dg/modules/partial-6_b.H new file mode 100644 index ..569959b4f038 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/partial-6_b.H @@ -0,0 +1,21 @@ +// PR c++/113814 +// { dg-additional-options "-fmodules-ts -fdump-lang-module-alias" } +// { dg-module-cmi {} } + +#include "partial-6.h" +import "partial-6_a.H"; + +template +struct TestTTP; + +inline void test() { + int a = f().a; + int b = g().b; +} + +// { dg-final { scan-lang-dump {Read:-[0-9]*'s partial merge key \(new\) template_decl:'::template A'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s partial merge key \(new\) template_decl:'::template B'} module } } + +// Don't need to write the partial specialisations +// { dg-final { scan-lang-dump-not {Wrote declaration entity:[0-9]* template_decl:'::template A<#null#>'} module } } +// { dg-final { scan-lang-dump-not {Wrote declaration entity:[0-9]* template_decl:'::template B'} module } } diff --git a/gcc/testsuite/g++.dg/modules/partial-6_c.C b/gcc/testsuite/g++.dg/modules/partial-6_c.C new file mode 100644 index ..2a34457f5aff --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/partial-6_c.C @@ -0,0 +1,12 @@ +// PR c++/113814 +// { dg-additional-options "-fmodules-ts" } + +import "partial-6_b.H"; + +template +struct TestTTP2; + +int main() { + int a = f().a; + int b = g().b; +}
[gcc r15-4861] c++/modules: Fix recursive dependencies [PR116317]
https://gcc.gnu.org/g:4a99443c5dd9a235022652ba0fb143c6370ea99d commit r15-4861-g4a99443c5dd9a235022652ba0fb143c6370ea99d Author: Nathaniel Shead Date: Thu Oct 31 20:54:29 2024 +1100 c++/modules: Fix recursive dependencies [PR116317] In cases like the linked PR we sometimes get mutually recursive dependencies that both rely on the other to have been streamed as part of their merge key information. In the linked PR, this causes an ICE. The root cause is that 'sort_cluster' is not correctly ordering the dependencies; both the element_t specialisation and the reverse_adaptor::first function decl depend on each other, but by streaming element_t first it ends up trying to stream itself recursively as part of calculating its own merge key, which apart from the checking ICE will also cause issues on stream-in, as the merge key will not properly stream. There is a comment already in 'sort_cluster' describing this issue, but it says: Finding the single cluster entry dep is very tricky and expensive. Let's just not do that. It's harmless in this case anyway. However in this case it was not harmless: it's just somewhat luck that the sorting happened to work for the existing cases in the testsuite. This patch solves the issue by noting any declarations that rely on deps first seen within their own merge key. This declaration gets marked as an "entry" dep; any of these deps that end up recursively referring back to that entry dep as part of their own merge key do not. Then within sort_cluster we can ensure that the entry dep is written to be streamed first of its cluster; this will ensure that any other deps are just emitted as back-references, and the mergeable dep itself will structurally decompose. PR c++/116317 gcc/cp/ChangeLog: * module.cc (depset::DB_MAYBE_RECURSIVE_BIT): New flag. (depset::DB_ENTRY_BIT): New flag. (depset::is_maybe_recursive): New accessor. (depset::is_entry): New accessor. (depset::hash::writing_merge_key): New field. (trees_out::decl_value): Inform dep_hash while we're writing the merge key information for a decl. (depset::hash::add_dependency): Find recursive deps and mark the entry point. (sort_cluster): Ensure that the entry dep is streamed first. gcc/testsuite/ChangeLog: * g++.dg/modules/late-ret-4_a.H: New test. * g++.dg/modules/late-ret-4_b.C: New test. Signed-off-by: Nathaniel Shead Diff: --- gcc/cp/module.cc| 88 + gcc/testsuite/g++.dg/modules/late-ret-4_a.H | 22 gcc/testsuite/g++.dg/modules/late-ret-4_b.C | 4 ++ 3 files changed, 89 insertions(+), 25 deletions(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 9323023ff7fd..dde7e5f6dbf2 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -2336,6 +2336,8 @@ private: entity. */ DB_IMPORTED_BIT, /* An imported entity. */ DB_UNREACHED_BIT, /* A yet-to-be reached entity. */ +DB_MAYBE_RECURSIVE_BIT,/* An entity maybe in a recursive cluster. */ +DB_ENTRY_BIT, /* The first reached recursive dep. */ DB_HIDDEN_BIT, /* A hidden binding. */ /* The following bits are not independent, but enumerating them is awkward. */ @@ -2437,6 +2439,14 @@ public: { return get_flag_bit (); } + bool is_maybe_recursive () const + { +return get_flag_bit (); + } + bool is_entry () const + { +return get_flag_bit (); + } bool is_type_spec () const { return get_flag_bit (); @@ -2548,11 +2558,12 @@ public: depset *current; /* Current depset being depended. */ unsigned section; /* When writing out, the section. */ bool reached_unreached; /* We reached an unreached entity. */ +bool writing_merge_key; /* We're writing merge key information. */ public: hash (size_t size, hash *c = NULL) : parent (size), chain (c), current (NULL), section (0), - reached_unreached (false) + reached_unreached (false), writing_merge_key (false) { worklist.create (size); } @@ -7934,21 +7945,24 @@ trees_out::decl_value (tree decl, depset *dep) /* Stream the container, we want it correctly canonicalized before we start emitting keys for this decl. */ tree container = decl_container (decl); - unsigned tpl_levels = 0; - if (decl != inner) -tpl_header (decl, &tpl_levels); - if (TREE_CODE (inner) == FUNCTION_DECL) -fn_parms_init (inner); - /* Now write out the merging information, and then really - install the tag values. */ - key_mergeable (tag, mk, decl, inner, container, dep);
[gcc(refs/users/aoliva/heads/testme)] limit ifcombine stmt moving and adjust flow info
https://gcc.gnu.org/g:199a5862c8974cfc1092f7a877fc6bf6e4b1a16d commit 199a5862c8974cfc1092f7a877fc6bf6e4b1a16d Author: Alexandre Oliva Date: Sat Nov 2 04:26:51 2024 -0300 limit ifcombine stmt moving and adjust flow info It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info and avoid introducing undefined behavior when moving stmts from under guarding conditions. Finally, rework the preexisting reset of flow sensitive info and avoidance of undefined behavior to be done when needed on all affected inner blocks: reset flow info whenever enclosing conditions change, and avoid undefined behavior whenever enclosing conditions become laxer. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_rewrite_to_defined_overflow): New. (ifcombine_replace_cond): Reject conds that would require moving too many stmts. Reset flow sensitive info and avoid undefined behavior in moved stmts. Reset flow sensitive info in all inner blocks when the outer condition changes, and avoid undefined behavior whenever the outer condition becomes laxer, adapted and moved from... (pass_tree_ifcombine::execute): ... here. Diff: --- gcc/tree-ssa-ifcombine.cc | 114 -- 1 file changed, 89 insertions(+), 25 deletions(-) diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index ac4811e42e08..ae1b039335a8 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -508,6 +508,25 @@ ifcombine_mark_ssa_name_walk (tree *t, int *, void *data_) return NULL; } +/* Rewrite a stmt, that presumably used to be guarded by conditions that could + avoid undefined overflow, into one that has well-defined overflow, so that + it won't invoke undefined behavior once the guarding conditions change. */ + +static inline void +ifcombine_rewrite_to_defined_overflow (gimple_stmt_iterator gsi) +{ + gassign *ass = dyn_cast (gsi_stmt (gsi)); + if (!ass) +return; + tree lhs = gimple_assign_lhs (ass); + if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && arith_code_with_undefined_signed_overflow + (gimple_assign_rhs_code (ass))) +rewrite_to_defined_overflow (&gsi); +} + + /* Replace the conditions in INNER_COND and OUTER_COND with COND and COND2. COND and COND2 are computed for insertion at INNER_COND, with OUTER_COND replaced with a constant, but if there are intervening blocks, it's best to @@ -518,6 +537,7 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, gcond *outer_cond, bool outer_inv, tree cond, bool must_canon, tree cond2) { + bool split_single_cond = false; /* Split cond into cond2 if they're contiguous. ??? We might be able to handle ORIF as well, inverting both conditions, but it's not clear that this would be enough, and it never comes up. */ @@ -527,11 +547,13 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, { cond2 = TREE_OPERAND (cond, 1); cond = TREE_OPERAND (cond, 0); + split_single_cond = true; } bool outer_p = cond2 || (single_pred (gimple_bb (inner_cond)) != gimple_bb (outer_cond)); bool result_inv = outer_p ? outer_inv : inner_inv; + bool strictening_outer_cond = !split_single_cond && outer_p; if (result_inv) cond = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond); @@ -558,9 +580,11 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!bitmap_empty_p (used)) { + const int max_stmts = 6; + auto_vec stmts; + /* Iterate up from inner_cond, moving DEFs identified as used by cond, and marking USEs in the DEFs for moving as well. */ - gimple_stmt_iterator gsins = gsi_for_stmt (outer_cond); for (basic_block bb = gimple_bb (inner_cond); bb != outer_bb; bb = single_pred (bb)) { @@ -582,11 +606,14 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!move) continue; + if (stmts.length () < max_stmts) + stmts.quick_push (stmt); + else + return false; + /* Mark uses in STMT before moving it. */ FOR_EACH_SSA_TREE_OPERAND (t, stmt, it, SSA_OP_USE) ifcombine_mark_ssa_name (used, t, outer_bb); - - gsi_move_before (&gsitr, &gsins, GSI_NEW_STMT); }
[gcc(refs/users/aoliva/heads/testme)] limit ifcombine stmt moving and adjust flow info
https://gcc.gnu.org/g:2f42671215e5f064d331bc3d6f7052e2c45eed11 commit 2f42671215e5f064d331bc3d6f7052e2c45eed11 Author: Alexandre Oliva Date: Sat Nov 2 04:26:51 2024 -0300 limit ifcombine stmt moving and adjust flow info It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info and avoid introducing undefined behavior when moving stmts from under guarding conditions. Finally, rework the preexisting reset of flow sensitive info and avoidance of undefined behavior to be done when needed on all affected inner blocks: reset flow info whenever enclosing conditions change, and avoid undefined behavior whenever enclosing conditions become laxer. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_rewrite_to_defined_overflow): New. (ifcombine_replace_cond): Reject conds that would require moving too many stmts. Reset flow sensitive info and avoid undefined behavior in moved stmts. Reset flow sensitive info in all inner blocks when the outer condition changes, and avoid undefined behavior whenever the outer condition becomes laxer, adapted and moved from... (pass_tree_ifcombine::execute): ... here. Diff: --- gcc/tree-ssa-ifcombine.cc | 113 -- 1 file changed, 88 insertions(+), 25 deletions(-) diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index ac4811e42e08..865ddf6ad4eb 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -508,6 +508,25 @@ ifcombine_mark_ssa_name_walk (tree *t, int *, void *data_) return NULL; } +/* Rewrite a stmt, that presumably used to be guarded by conditions that could + avoid undefined overflow, into one that has well-defined overflow, so that + it won't invoke undefined behavior once the guarding conditions change. */ + +static void +ifcombine_rewrite_to_defined_overflow (gimple_stmt_iterator gsi) +{ + gassign *ass = dyn_cast (gsi_stmt (gsi)); + if (!ass) +continue; + tree lhs = gimple_assign_lhs (ass); + if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && arith_code_with_undefined_signed_overflow + (gimple_assign_rhs_code (ass))) +rewrite_to_defined_overflow (&gsi); +} + + /* Replace the conditions in INNER_COND and OUTER_COND with COND and COND2. COND and COND2 are computed for insertion at INNER_COND, with OUTER_COND replaced with a constant, but if there are intervening blocks, it's best to @@ -518,6 +537,7 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, gcond *outer_cond, bool outer_inv, tree cond, bool must_canon, tree cond2) { + bool split_single_cond = false; /* Split cond into cond2 if they're contiguous. ??? We might be able to handle ORIF as well, inverting both conditions, but it's not clear that this would be enough, and it never comes up. */ @@ -527,11 +547,13 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, { cond2 = TREE_OPERAND (cond, 1); cond = TREE_OPERAND (cond, 0); + split_single_cond = true; } bool outer_p = cond2 || (single_pred (gimple_bb (inner_cond)) != gimple_bb (outer_cond)); bool result_inv = outer_p ? outer_inv : inner_inv; + bool strictening_outer_cond = !split_single_cond && outer_p; if (result_inv) cond = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond); @@ -558,9 +580,11 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!bitmap_empty_p (used)) { + const int max_stmts = 6; + auto_vec stmts; + /* Iterate up from inner_cond, moving DEFs identified as used by cond, and marking USEs in the DEFs for moving as well. */ - gimple_stmt_iterator gsins = gsi_for_stmt (outer_cond); for (basic_block bb = gimple_bb (inner_cond); bb != outer_bb; bb = single_pred (bb)) { @@ -582,11 +606,14 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!move) continue; + if (stmts.length () < max_stmts) + stmts.push (stmt); + else + return false; + /* Mark uses in STMT before moving it. */ FOR_EACH_SSA_TREE_OPERAND (t, stmt, it, SSA_OP_USE) ifcombine_mark_ssa_name (used, t, outer_bb); - - gsi_move_before (&gsitr, &gsins, GSI_NEW_STMT); } /* Sur
[gcc/aoliva/heads/testme] limit ifcombine stmt moving and adjust flow info
The branch 'aoliva/heads/testme' was updated to point to: 2f42671215e5... limit ifcombine stmt moving and adjust flow info It previously pointed to: df85b7a8a21b... limit ifcombine stmt moving and adjust flow info Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- df85b7a... limit ifcombine stmt moving and adjust flow info Summary of changes (added commits): --- 2f42671... limit ifcombine stmt moving and adjust flow info
[gcc(refs/users/aoliva/heads/testme)] limit ifcombine stmt moving and adjust flow info
https://gcc.gnu.org/g:c1e8741ee403001107ae1edefdd55d6ec2f7e3ce commit c1e8741ee403001107ae1edefdd55d6ec2f7e3ce Author: Alexandre Oliva Date: Sat Nov 2 04:26:51 2024 -0300 limit ifcombine stmt moving and adjust flow info It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info and avoid introducing undefined behavior when moving stmts from under guarding conditions. Finally, rework the preexisting reset of flow sensitive info and avoidance of undefined behavior to be done when needed on all affected inner blocks: reset flow info whenever enclosing conditions change, and avoid undefined behavior whenever enclosing conditions become laxer. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_rewrite_to_defined_overflow): New. (ifcombine_replace_cond): Reject conds that would require moving too many stmts. Reset flow sensitive info and avoid undefined behavior in moved stmts. Reset flow sensitive info in all inner blocks when the outer condition changes, and avoid undefined behavior whenever the outer condition becomes laxer, adapted and moved from... (pass_tree_ifcombine::execute): ... here. Diff: --- gcc/tree-ssa-ifcombine.cc | 114 -- 1 file changed, 89 insertions(+), 25 deletions(-) diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index ac4811e42e08..70d3dca07198 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -508,6 +508,25 @@ ifcombine_mark_ssa_name_walk (tree *t, int *, void *data_) return NULL; } +/* Rewrite a stmt, that presumably used to be guarded by conditions that could + avoid undefined overflow, into one that has well-defined overflow, so that + it won't invoke undefined behavior once the guarding conditions change. */ + +static inline void +ifcombine_rewrite_to_defined_overflow (gimple_stmt_iterator gsi) +{ + gassign *ass = dyn_cast (gsi_stmt (gsi)); + if (!ass) +return; + tree lhs = gimple_assign_lhs (ass); + if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && arith_code_with_undefined_signed_overflow + (gimple_assign_rhs_code (ass))) +rewrite_to_defined_overflow (&gsi); +} + + /* Replace the conditions in INNER_COND and OUTER_COND with COND and COND2. COND and COND2 are computed for insertion at INNER_COND, with OUTER_COND replaced with a constant, but if there are intervening blocks, it's best to @@ -518,6 +537,7 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, gcond *outer_cond, bool outer_inv, tree cond, bool must_canon, tree cond2) { + bool split_single_cond = false; /* Split cond into cond2 if they're contiguous. ??? We might be able to handle ORIF as well, inverting both conditions, but it's not clear that this would be enough, and it never comes up. */ @@ -527,11 +547,13 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, { cond2 = TREE_OPERAND (cond, 1); cond = TREE_OPERAND (cond, 0); + split_single_cond = true; } bool outer_p = cond2 || (single_pred (gimple_bb (inner_cond)) != gimple_bb (outer_cond)); bool result_inv = outer_p ? outer_inv : inner_inv; + bool strictening_outer_cond = !split_single_cond && outer_p; if (result_inv) cond = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond); @@ -558,9 +580,11 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!bitmap_empty_p (used)) { + const int max_stmts = 6; + auto_vec stmts; + /* Iterate up from inner_cond, moving DEFs identified as used by cond, and marking USEs in the DEFs for moving as well. */ - gimple_stmt_iterator gsins = gsi_for_stmt (outer_cond); for (basic_block bb = gimple_bb (inner_cond); bb != outer_bb; bb = single_pred (bb)) { @@ -582,11 +606,14 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!move) continue; + if (stmts.length () < max_stmts) + stmts.quick_push (stmt); + else + return false; + /* Mark uses in STMT before moving it. */ FOR_EACH_SSA_TREE_OPERAND (t, stmt, it, SSA_OP_USE) ifcombine_mark_ssa_name (used, t, outer_bb); - - gsi_move_before (&gsitr, &gsins, GSI_NEW_STMT); }
[gcc/aoliva/heads/testme] limit ifcombine stmt moving and adjust flow info
The branch 'aoliva/heads/testme' was updated to point to: e432e6c87403... limit ifcombine stmt moving and adjust flow info It previously pointed to: c1e8741ee403... limit ifcombine stmt moving and adjust flow info Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- c1e8741... limit ifcombine stmt moving and adjust flow info Summary of changes (added commits): --- e432e6c... limit ifcombine stmt moving and adjust flow info
[gcc/aoliva/heads/testme] limit ifcombine stmt moving and adjust flow info
The branch 'aoliva/heads/testme' was updated to point to: c1e8741ee403... limit ifcombine stmt moving and adjust flow info It previously pointed to: 2f42671215e5... limit ifcombine stmt moving and adjust flow info Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 2f42671... limit ifcombine stmt moving and adjust flow info Summary of changes (added commits): --- c1e8741... limit ifcombine stmt moving and adjust flow info
[gcc(refs/users/aoliva/heads/testme)] limit ifcombine stmt moving and adjust flow info
https://gcc.gnu.org/g:e432e6c8740362ebaa39a5c5c714875ee327e23c commit e432e6c8740362ebaa39a5c5c714875ee327e23c Author: Alexandre Oliva Date: Sat Nov 2 04:26:51 2024 -0300 limit ifcombine stmt moving and adjust flow info It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info and avoid introducing undefined behavior when moving stmts from under guarding conditions. Finally, rework the preexisting reset of flow sensitive info and avoidance of undefined behavior to be done when needed on all affected inner blocks: reset flow info whenever enclosing conditions change, and avoid undefined behavior whenever enclosing conditions become laxer. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_rewrite_to_defined_overflow): New. (ifcombine_replace_cond): Reject conds that would require moving too many stmts. Reset flow sensitive info and avoid undefined behavior in moved stmts. Reset flow sensitive info in all inner blocks when the outer condition changes, and avoid undefined behavior whenever the outer condition becomes laxer, adapted and moved from... (pass_tree_ifcombine::execute): ... here. Diff: --- gcc/tree-ssa-ifcombine.cc | 114 -- 1 file changed, 89 insertions(+), 25 deletions(-) diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index ac4811e42e08..365c5333a102 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -508,6 +508,25 @@ ifcombine_mark_ssa_name_walk (tree *t, int *, void *data_) return NULL; } +/* Rewrite a stmt, that presumably used to be guarded by conditions that could + avoid undefined overflow, into one that has well-defined overflow, so that + it won't invoke undefined behavior once the guarding conditions change. */ + +static inline void +ifcombine_rewrite_to_defined_overflow (gimple_stmt_iterator gsi) +{ + gassign *ass = dyn_cast (gsi_stmt (gsi)); + if (!ass) +return; + tree lhs = gimple_assign_lhs (ass); + if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && arith_code_with_undefined_signed_overflow + (gimple_assign_rhs_code (ass))) +rewrite_to_defined_overflow (&gsi); +} + + /* Replace the conditions in INNER_COND and OUTER_COND with COND and COND2. COND and COND2 are computed for insertion at INNER_COND, with OUTER_COND replaced with a constant, but if there are intervening blocks, it's best to @@ -518,6 +537,7 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, gcond *outer_cond, bool outer_inv, tree cond, bool must_canon, tree cond2) { + bool split_single_cond = false; /* Split cond into cond2 if they're contiguous. ??? We might be able to handle ORIF as well, inverting both conditions, but it's not clear that this would be enough, and it never comes up. */ @@ -527,11 +547,13 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, { cond2 = TREE_OPERAND (cond, 1); cond = TREE_OPERAND (cond, 0); + split_single_cond = true; } bool outer_p = cond2 || (single_pred (gimple_bb (inner_cond)) != gimple_bb (outer_cond)); bool result_inv = outer_p ? outer_inv : inner_inv; + bool strictening_outer_cond = !split_single_cond && outer_p; if (result_inv) cond = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond); @@ -558,9 +580,11 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!bitmap_empty_p (used)) { + const int max_stmts = 6; + auto_vec stmts; + /* Iterate up from inner_cond, moving DEFs identified as used by cond, and marking USEs in the DEFs for moving as well. */ - gimple_stmt_iterator gsins = gsi_for_stmt (outer_cond); for (basic_block bb = gimple_bb (inner_cond); bb != outer_bb; bb = single_pred (bb)) { @@ -582,11 +606,14 @@ ifcombine_replace_cond (gcond *inner_cond, bool inner_inv, if (!move) continue; + if (stmts.length () < max_stmts) + stmts.quick_push (stmt); + else + return false; + /* Mark uses in STMT before moving it. */ FOR_EACH_SSA_TREE_OPERAND (t, stmt, it, SSA_OP_USE) ifcombine_mark_ssa_name (used, t, outer_bb); - - gsi_move_before (&gsitr, &gsins, GSI_NEW_STMT); }
[gcc/aoliva/heads/testme] limit ifcombine stmt moving and adjust flow info
The branch 'aoliva/heads/testme' was updated to point to: 199a5862c897... limit ifcombine stmt moving and adjust flow info It previously pointed to: e432e6c87403... limit ifcombine stmt moving and adjust flow info Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- e432e6c... limit ifcombine stmt moving and adjust flow info Summary of changes (added commits): --- 199a586... limit ifcombine stmt moving and adjust flow info
[gcc r15-4863] gimplify: Fix up RAW_DATA_CST related ICE [PR117384]
https://gcc.gnu.org/g:1fb467dbcc2cdd3bb89fa860a1f86b7e334e0ce3 commit r15-4863-g1fb467dbcc2cdd3bb89fa860a1f86b7e334e0ce3 Author: Jakub Jelinek Date: Sat Nov 2 18:47:27 2024 +0100 gimplify: Fix up RAW_DATA_CST related ICE [PR117384] Apparently tree_output_constant_def doesn't strictly guarantee that the returned VAR_DECL will have the same or uselessly convertible type as the type of the constant passed to it, compare_constants says: /* For arrays, check that mode, size and storage order match. */ /* For record and union constructors, require exact type equality. */ The older use of tree_output_constant_def in gimplify.cc was already handling this right: ctor = tree_output_constant_def (ctor); if (!useless_type_conversion_p (type, TREE_TYPE (ctor))) ctor = build1 (VIEW_CONVERT_EXPR, type, ctor); but the spot I've added for RAW_DATA_CST missed this. So, the following patch adds that. 2024-11-02 Jakub Jelinek PR middle-end/117384 * gimplify.cc (gimplify_init_ctor_eval): Add VIEW_CONVERT_EXPR around rctor if it doesn't have expected type. * c-c++-common/init-7.c: New test. Diff: --- gcc/gimplify.cc | 2 ++ gcc/testsuite/c-c++-common/init-7.c | 39 + 2 files changed, 41 insertions(+) diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index fd18d8be4e66..827941b24db2 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -5420,6 +5420,8 @@ gimplify_init_ctor_eval (tree object, vec *elts, cref = build2 (MEM_REF, rtype, addr, build_int_cst (ptr_type_node, 0)); rctor = tree_output_constant_def (rctor); + if (!useless_type_conversion_p (rtype, TREE_TYPE (rctor))) + rctor = build1 (VIEW_CONVERT_EXPR, rtype, rctor); if (gimplify_expr (&cref, pre_p, NULL, is_gimple_lvalue, fb_lvalue) != GS_ERROR) gimplify_seq_add_stmt (pre_p, diff --git a/gcc/testsuite/c-c++-common/init-7.c b/gcc/testsuite/c-c++-common/init-7.c new file mode 100644 index ..8df387c91764 --- /dev/null +++ b/gcc/testsuite/c-c++-common/init-7.c @@ -0,0 +1,39 @@ +/* PR middle-end/117384 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void baz (signed char *, unsigned char *); + +void +foo (void) +{ + signed char b[] = { +44, 28, 12, 96, 80, 64, 48, 32, 1, 2, 3, 4, 5, 6, 7, 8, +9, 24, 39, 54, 69, 84, 99, 114, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36 + }; + baz (b, 0); +} + +void +bar (void) +{ + unsigned char b[] = { +44, 28, 12, 96, 80, 64, 48, 32, 1, 2, 3, 4, 5, 6, 7, 8, +9, 24, 39, 54, 69, 84, 99, 114, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36, +53, 36, 19, 102, 85, 68, 51, 34, 17, 34, 51, 68, 85, 102, 19, 36 + }; + baz (0, b); +}
[gcc r15-4864] libstdc++: Fix up std::{, b}float16_t std::{ilogb, l{, l}r{ound, int}} [PR117406]
https://gcc.gnu.org/g:36a9e2b22596711455e702ea5a5a3f26e145321c commit r15-4864-g36a9e2b22596711455e702ea5a5a3f26e145321c Author: Jakub Jelinek Date: Sat Nov 2 18:48:54 2024 +0100 libstdc++: Fix up std::{,b}float16_t std::{ilogb,l{,l}r{ound,int}} [PR117406] These overloads incorrectly cast the result of the float __builtin_* to _Float or __gnu_cxx::__bfloat16_t. For std::ilogb that changes behavior for the INT_MAX return because that isn't representable in either of the floating point formats, for the others it is I think just a very inefficient hop from int/long/long long to std::{,b}float16_t and back. I mean for the round/rint cases, either the argument is small and then the return value should be representable in the floating point format too, or it is too large that the argument is already integral and then it should just return the argument with the round trips. Too large value is unspecified unlike ilogb. 2024-11-02 Jakub Jelinek PR libstdc++/117406 * include/c_global/cmath (std::ilogb(_Float16), std::llrint(_Float16), std::llround(_Float16), std::lrint(_Float16), std::lround(_Float16)): Don't cast __builtin_* return to _Float16. (std::ilogb(__gnu_cxx::__bfloat16_t), std::llrint(__gnu_cxx::__bfloat16_t), std::llround(__gnu_cxx::__bfloat16_t), std::lrint(__gnu_cxx::__bfloat16_t), std::lround(__gnu_cxx::__bfloat16_t)): Don't cast __builtin_* return to __gnu_cxx::__bfloat16_t. * testsuite/26_numerics/headers/cmath/117406.cc: New test. Diff: --- libstdc++-v3/include/c_global/cmath| 20 .../testsuite/26_numerics/headers/cmath/117406.cc | 59 ++ 2 files changed, 69 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index 5c568c703135..09b4d0d543e4 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -2838,7 +2838,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr int ilogb(_Float16 __x) - { return _Float16(__builtin_ilogbf(__x)); } + { return __builtin_ilogbf(__x); } constexpr _Float16 lgamma(_Float16 __x) @@ -2846,11 +2846,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr long long llrint(_Float16 __x) - { return _Float16(__builtin_llrintf(__x)); } + { return __builtin_llrintf(__x); } constexpr long long llround(_Float16 __x) - { return _Float16(__builtin_llroundf(__x)); } + { return __builtin_llroundf(__x); } constexpr _Float16 log1p(_Float16 __x) @@ -2867,11 +2867,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr long lrint(_Float16 __x) - { return _Float16(__builtin_lrintf(__x)); } + { return __builtin_lrintf(__x); } constexpr long lround(_Float16 __x) - { return _Float16(__builtin_lroundf(__x)); } + { return __builtin_lroundf(__x); } constexpr _Float16 nearbyint(_Float16 __x) @@ -3560,7 +3560,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr int ilogb(__gnu_cxx::__bfloat16_t __x) - { return __gnu_cxx::__bfloat16_t(__builtin_ilogbf(__x)); } + { return __builtin_ilogbf(__x); } constexpr __gnu_cxx::__bfloat16_t lgamma(__gnu_cxx::__bfloat16_t __x) @@ -3568,11 +3568,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr long long llrint(__gnu_cxx::__bfloat16_t __x) - { return __gnu_cxx::__bfloat16_t(__builtin_llrintf(__x)); } + { return __builtin_llrintf(__x); } constexpr long long llround(__gnu_cxx::__bfloat16_t __x) - { return __gnu_cxx::__bfloat16_t(__builtin_llroundf(__x)); } + { return __builtin_llroundf(__x); } constexpr __gnu_cxx::__bfloat16_t log1p(__gnu_cxx::__bfloat16_t __x) @@ -3589,11 +3589,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr long lrint(__gnu_cxx::__bfloat16_t __x) - { return __gnu_cxx::__bfloat16_t(__builtin_lrintf(__x)); } + { return __builtin_lrintf(__x); } constexpr long lround(__gnu_cxx::__bfloat16_t __x) - { return __gnu_cxx::__bfloat16_t(__builtin_lroundf(__x)); } + { return __builtin_lroundf(__x); } constexpr __gnu_cxx::__bfloat16_t nearbyint(__gnu_cxx::__bfloat16_t __x) diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/117406.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/117406.cc new file mode 100644 index ..8966c71ecdcb --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/117406.cc @@ -0,0 +1,59 @@ +// Copyright (C) 2024 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY
[gcc/aoliva/heads/testme] limit ifcombine stmt moving and adjust flow info
The branch 'aoliva/heads/testme' was updated to point to: df85b7a8a21b... limit ifcombine stmt moving and adjust flow info It previously pointed to: 858cf33bbac2... check ifcombine bitmap count Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 858cf33... check ifcombine bitmap count Summary of changes (added commits): --- df85b7a... limit ifcombine stmt moving and adjust flow info
[gcc(refs/users/aoliva/heads/testme)] limit ifcombine stmt moving and adjust flow info
https://gcc.gnu.org/g:df85b7a8a21b69066f25fb89fa8f6b9d23d04c4f commit df85b7a8a21b69066f25fb89fa8f6b9d23d04c4f Author: Alexandre Oliva Date: Sat Nov 2 04:26:51 2024 -0300 limit ifcombine stmt moving and adjust flow info Diff:
[gcc r15-4866] testsuite: Require trampoline support for pr117245.c
https://gcc.gnu.org/g:5e40dcf2458aab0441221f89af10f4c5682a8f63 commit r15-4866-g5e40dcf2458aab0441221f89af10f4c5682a8f63 Author: Dimitar Dimitrov Date: Sat Nov 2 20:20:56 2024 +0200 testsuite: Require trampoline support for pr117245.c Test case pr117245.c is using trampolines, so mark it as such. With this patch the test is now properly marked as unsupported for pru-unknown-elf. Test still passes for x86_64-pc-linux-gnu. gcc/testsuite/ChangeLog: * gcc.dg/pr117245.c: Require effective target with trampolines. Signed-off-by: Dimitar Dimitrov Diff: --- gcc/testsuite/gcc.dg/pr117245.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/gcc.dg/pr117245.c b/gcc/testsuite/gcc.dg/pr117245.c index ebcc60b898fc..bf2baad82f34 100644 --- a/gcc/testsuite/gcc.dg/pr117245.c +++ b/gcc/testsuite/gcc.dg/pr117245.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target trampolines } */ /* { dg-options "" } */ void a() {
[gcc r15-4867] testsuite: Require fpic support for pr116887.c
https://gcc.gnu.org/g:af5a62ee88fbfbf5d60872bff2be5c2c0345dcf7 commit r15-4867-gaf5a62ee88fbfbf5d60872bff2be5c2c0345dcf7 Author: Dimitar Dimitrov Date: Sat Nov 2 20:23:19 2024 +0200 testsuite: Require fpic support for pr116887.c Test case pr116887.c is passing -fpic, so mark it as such. With this patch the test is now properly marked as unsupported for pru-unknown-elf. Test still passes for x86_64-pc-linux-gnu. gcc/testsuite/ChangeLog: * gcc.dg/pr116887.c: Require effective target fpic. Signed-off-by: Dimitar Dimitrov Diff: --- gcc/testsuite/gcc.dg/pr116887.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/gcc.dg/pr116887.c b/gcc/testsuite/gcc.dg/pr116887.c index b7255e09a18a..e22b944eade7 100644 --- a/gcc/testsuite/gcc.dg/pr116887.c +++ b/gcc/testsuite/gcc.dg/pr116887.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target fpic } */ /* { dg-options "-fpic" } */ struct link_map
[gcc r15-4865] Add UMASKR and UMASKL intrinsics.
https://gcc.gnu.org/g:10c75e2a2a15e35bd6e70503ef7e3e119ae90775 commit r15-4865-g10c75e2a2a15e35bd6e70503ef7e3e119ae90775 Author: Thomas Koenig Date: Tue Oct 29 21:08:59 2024 +0100 Add UMASKR and UMASKL intrinsics. gcc/fortran/ChangeLog: * check.cc (gfc_check_mask): Handle BT_INSIGNED. * gfortran.h (enum gfc_isym_id): Add GFC_ISYM_UMASKL and GFC_ISYM_UMASKR. * gfortran.texi: List UMASKL and UMASKR, remove unsigned future unsigned arguments for MASKL and MASKR. * intrinsic.cc (add_functions): Add UMASKL and UMASKR. * intrinsic.h (gfc_simplify_umaskl): New function. (gfc_simplify_umaskr): New function. (gfc_resolve_umasklr): New function. * intrinsic.texi: Document UMASKL and UMASKR. * iresolve.cc (gfc_resolve_umasklr): New function. * simplify.cc (gfc_simplify_umaskr): New function. (gfc_simplify_umaskl): New function. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_39.f90: New test. Diff: --- gcc/fortran/check.cc | 9 +++- gcc/fortran/gfortran.h| 2 + gcc/fortran/gfortran.texi | 9 +--- gcc/fortran/intrinsic.cc | 16 +++ gcc/fortran/intrinsic.h | 3 ++ gcc/fortran/intrinsic.texi| 75 + gcc/fortran/iresolve.cc | 14 ++ gcc/fortran/simplify.cc | 78 +++ gcc/testsuite/gfortran.dg/unsigned_39.f90 | 29 9 files changed, 226 insertions(+), 9 deletions(-) diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index 304ca1b9ae82..2d4af8e7df33 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -4466,7 +4466,12 @@ gfc_check_mask (gfc_expr *i, gfc_expr *kind) { int k; - if (!type_check (i, 0, BT_INTEGER)) + if (flag_unsigned) +{ + if (!type_check2 (i, 0, BT_INTEGER, BT_UNSIGNED)) + return false; +} + else if (!type_check (i, 0, BT_INTEGER)) return false; if (!nonnegative_check ("I", i)) @@ -4478,7 +4483,7 @@ gfc_check_mask (gfc_expr *i, gfc_expr *kind) if (kind) gfc_extract_int (kind, &k); else -k = gfc_default_integer_kind; +k = i->ts.type == BT_UNSIGNED ? gfc_default_unsigned_kind : gfc_default_integer_kind; if (!less_than_bitsizekind ("I", i, k)) return false; diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index dd599bc97a26..309095d74d5c 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -699,6 +699,8 @@ enum gfc_isym_id GFC_ISYM_UBOUND, GFC_ISYM_UCOBOUND, GFC_ISYM_UMASK, + GFC_ISYM_UMASKL, + GFC_ISYM_UMASKR, GFC_ISYM_UNLINK, GFC_ISYM_UNPACK, GFC_ISYM_VERIFY, diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 3b2691649b0e..429d8461f8f7 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -2825,16 +2825,11 @@ The following intrinsics take unsigned arguments: The following intinsics are enabled with @option{-funsigned}: @itemize @bullet @item @code{UINT}, @pxref{UINT} +@item @code{UMASKL}, @pxref{UMASKL} +@item @code{UMASKR}, @pxref{UMASKR} @item @code{SELECTED_UNSIGNED_KIND}, @pxref{SELECTED_UNSIGNED_KIND} @end itemize -The following intrinsics will take unsigned arguments -in the future: -@itemize @bullet -@item @code{MASKL}, @pxref{MASKL} -@item @code{MASKR}, @pxref{MASKR} -@end itemize - The following intrinsics are not yet implemented in GNU Fortran, but will take unsigned arguments once they have been: @itemize @bullet diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc index 83b65d34e433..3fb1c63bbd42 100644 --- a/gcc/fortran/intrinsic.cc +++ b/gcc/fortran/intrinsic.cc @@ -2568,6 +2568,22 @@ add_functions (void) make_generic ("maskr", GFC_ISYM_MASKR, GFC_STD_F2008); + add_sym_2 ("umaskl", GFC_ISYM_UMASKL, CLASS_ELEMENTAL, ACTUAL_NO, +BT_INTEGER, di, GFC_STD_F2008, +gfc_check_mask, gfc_simplify_umaskl, gfc_resolve_umasklr, +i, BT_INTEGER, di, REQUIRED, +kind, BT_INTEGER, di, OPTIONAL); + + make_generic ("umaskl", GFC_ISYM_UMASKL, GFC_STD_F2008); + + add_sym_2 ("umaskr", GFC_ISYM_UMASKR, CLASS_ELEMENTAL, ACTUAL_NO, +BT_INTEGER, di, GFC_STD_F2008, +gfc_check_mask, gfc_simplify_umaskr, gfc_resolve_umasklr, +i, BT_INTEGER, di, REQUIRED, +kind, BT_INTEGER, di, OPTIONAL); + + make_generic ("umaskr", GFC_ISYM_UMASKR, GFC_STD_F2008); + add_sym_2 ("matmul", GFC_ISYM_MATMUL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, gfc_check_matmul, gfc_simplify_matmul, gfc_resolve_matmul, ma, BT_REAL, dr, REQUIRED, mb, BT_REAL, dr, REQUIRED); diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h index ea29219819d3..61d85eedc693 100644 --- a/gcc/fortran
[gcc/egallager/heads/master] (808 commits) Merge branch 'gcc-mirror:master' into me/master
The branch 'egallager/heads/master' was updated to point to: 535ac86b3388... Merge branch 'gcc-mirror:master' into me/master It previously pointed to: 2e9f317e1fd9... Merge branch 'gcc-mirror:master' into me/master Diff: Summary of changes (added commits): --- 535ac86... Merge branch 'gcc-mirror:master' into me/master e175fb3... Daily bump. (*) d77f073... c++: free garbage vec in coerce_template_parms (*) 547219f... Aarch64: Define WIDEST_HARDWARE_FP_SIZE (*) fe33530... Revert "c++: free garbage vec in coerce_template_parms" (*) dca2b47... c++: -Wdeprecated enables later standard deprecations (*) b6ff52a... c++: add -Wdeprecated-literal-operator [CWG2521] (*) 5b08ae5... c++: free garbage vec in coerce_template_parms (*) 8d63d87... AVR: Make gcc.dg/c23-stdarg-9.c work. (*) 0d9d687... libstdc++: Make Unicode utils work with Parallel Mode (*) 7754a8b... libstdc++: Fix -Wdeprecated-declarations warning for Parall (*) 28911f6... libstdc++: Fix some warnings seen during bootstrap (*) 34670de... Restore aarch64 bootstrap (*) edec4bf... aarch64: Fix early ra for -fno-delete-dead-exceptions [PR11 (*) ccb6e08... libstdc++: [_Hashtable] Fix some implementation inconsisten (*) caef700... diagnostics: support SARIF 2.2 output, undocumented for now (*) 1d09117... Daily bump. (*) 1f619fe... phiopt: Fix VCE moving by rewriting it into cast [PR116098] (*) 77c3ef0... testsuite/52641 - Make gcc.dg/strict-flex-array-3.c work on (*) 524b9c2... AVR: Make gcc.dg/pr113596.c work. (*) 5bf78cf... testsuite/52641 - Require int32 for gcc.dg/pr93820-2.c. (*) 875a1df... testsuite/52641 - Fix gcc.dg/signbit-6.c for int != 32-bit (*) 4d9e473... middle-end: Fix ifcvt predicate generation for masked funct (*) 4e11ad7... arm: Prevent ICE when doloop dec_set is not PLUS expr (*) 3a52838... c++: Fix regression introduced by r15-3796 [PR116722] (*) dafbfdb... Replace another missed iterative_hash_object (*) ffc389c... gimple ssa: Don't use __builtin_popcount in switch exp tran (*) 842fbfa... Speedup iterative_hash_template_arg (*) 77c5e4a... Adjust gcc.dg/vect/slp-12a.c (*) 32b99da... Adjust expectation for gcc.dg/vect/slp-19c.c (*) 71896a8... un-XFAIL gcc.dg/vect/vect-double-reduc-5.c (*) 61d87f2... testsuite/116596 - fix gcc.dg/vect/slp-11a.c (*) 02f4efe... tree-optimization/113197 - bougs assert in PTA (*) 4ba4165... tree-optimiztation/114855 - profile prediction slowness (*) c534e37... libstdc++: Populate std::time_get::get's %c format for C lo (*) 5cf26f2... libstdc++: Fix rounding in chrono::parse (*) 05b7ab8... libstdc++: Fix -Wlong-long warning in (*) 79ea0aa... testsuite/116660 - adjust testcases unexpectedly failing on (*) ba76326... tree-optimization/116566 - single lane SLP for VLA inductio (*) 56d0ee7... doc: Drop h8300-hms reference to binaries downloads (*) 5943a2f... libcpp: Implement clang -Wheader-guard warning [PR96842] (*) ba53cca... opts: Fix up regenerate-opt-urls dependencies (*) cea87c8... backprop: Fix deleting of a phi node [PR116922] (*) 9175d08... Fix gcc.dg/pr116905.c (*) eb0698a... testsuite/116654 - adjust gcc.target/powerpc/p9-vec-length- (*) b56dc0a... testsuite/116654 - adjust gcc.dg/vect/costmodel/ppc/costmod (*) e592ea8... tree-optimization/116654 - missed dr_explicit_realign[_opti (*) ed7b3e7... RISC-V: Add testcases for form 2 of scalar signed SAT_SUB (*) 3809b4d... Match: Support form 2 for scalar signed integer SAT_SUB (*) 60f1fed... Daily bump. (*) 1c9b440... c++: don't advertise C++20 concepts in C++14 (*) f72b1a4... AVR: avr.cc - Drop a superfluous sub-condition in avr_out_c (*) 5e41e8f... AVR: avr-passes.cc - Fix a build warning. (*) ac4cdf5... aarch64: Introduce new unspecs for smax/smin (*) 9dd9a06... Implement MAXVAL and MINVAL for UNSIGNED. (*) be2f7a1... Fix wrong code out of NRV + RSO + inlining (*) 97fd777... [PATCH] RISC-V/libgcc: Fix incorrect and missing .cfi_offse (*) 1b7cfa7... c++: introduce __builtin_is_virtual_base_of (*) 698e0ec... phi-opt: Improve factor heurstic with constants and convers (*) 8273e31... modula2: Add FindIndice to library module gm2-libs/Indexing (*) fda30a3... PR modula2/116918 -fswig correct syntax (*) 35dd5cf... aarch64: Add fp8 scalar types (*) 27ddda8... tree-optimization/116902 - vectorizer load hosting breaks U (*) 60fa7f5... tree-optimization/116905 - ICE with bogus range ops (*) 3e1bd64... tree-optimization/116906 - unsafe PRE with never executed e (*) de25f17... range-cache: Fix ranger ICE if number of bbs increases [PR1 (*) bdbd060... range-cache: Fix ICE on SSA_NAME with def_stmt not yet in t (*) 0939c8c... Daily bump. (*) b1696ff... libstdc++-v3: Fix signed-overflow warning for newlib/ctype_ (*) ab07db3... [testcase] Fix-absfloat16.c-testcase (*) 4bcfaae... c++: concept in default argument [PR109859] (*) 65073a5... Fix internal error during inlining after ICF pass (*) 9
[gcc/egallager/heads/PR58312] (1272 commits) rs6000: Correct the function code for _AMO_LD_DEC_BOUNDED
The branch 'egallager/heads/PR58312' was updated to point to: 1a4c5643a591... rs6000: Correct the function code for _AMO_LD_DEC_BOUNDED It previously pointed to: 3cde331e9590... RISC-V: Add missing mode_idx for vrol and vror Diff: Summary of changes (added commits): --- 1a4c564... rs6000: Correct the function code for _AMO_LD_DEC_BOUNDED (*) f132c00... i386: Refactor get_intel_cpu (*) 6128122... RISC-V: Skip flag -flto for all saturated arithmetic test c (*) 3ad0f67... [testsuite] [arm] add effective target and options for pacb (*) 5259d39... Refine splitters related to "combine vpcmpuw + zero_extend (*) 0ceb5cc... Daily bump. (*) 01f50eb... Revert "[PATCH 7/7] RISC-V: Disable by pieces for vector se (*) 961c023... modula2: M2MetaError.{def,mod} and P2SymBuild.mod further c (*) 2553983... Daily bump. (*) 65c5bbe... diagnostics: libcpp: Improve locations for _Pragma lexing d (*) 7fa9fd4... modula2: Tidyup gm2-compiler/M2MetaError.mod (*) 8d6d6d5... phiopt: do factor_out_conditional_operation for all phis [P (*) f298931... [PATCH][v5] RISC-V: add option -m(no-)autovec-segment (*) a8f36de... Add missing dg-error to unsigned_38.f90. (*) 72ceddb... [PATCH 7/7] RISC-V: Disable by pieces for vector setmem len (*) 12dedde... [PATCH 5/7] RISC-V: Move vector memcpy decision making to s (*) b5aa63b... [PATCH 4/7] RISC-V: Honour -mrvv-max-lmul in riscv_vector:: (*) e751639... PR modula2/115328 The FORWARD keyword is not implemented (*) efae253... Fortran: Fix translatability of diagnostic strings (*) ffdfc5b... Fortran: Add range-based diagnostic (*) 4f9b173... Fix an ICE with UNSIGNED in match_sym_complex_part. (*) 04b4a5e... runtime/testdata: fix for C23 nullptr keyword (*) 83abdb0... diagnostics: remove forward decl of json::value from diagno (*) 2ca19d4... diagnostics: add debug dump functions (*) d277ded... c: Fix -std=gnu23 -Wtraditional for () in function definiti (*) de14559... Daily bump. (*) c886eb3... gcc/: Merge definitions of array_type_nelts_top (*) 1157765... gcc/: Rename array_type_nelts => array_type_nelts_minus_one (*) f8687bc... libbacktrace: don't get confused by overlapping address ran (*) aaa855f... hppa: Fix up pa.opt.urls (*) 1f07dea... Handle GFC_STD_UNSIGNED like a standard in error messages. (*) 44a81aa... hppa: Add LRA support (*) b039d06... [PATCH 3/7] RISC-V: Fix vector memcpy smaller LMUL generati (*) 212d868... [PATCH 2/7] RISC-V: Fix uninitialized reg in memcpy (*) f244492... [PATCH 1/7] RISC-V: Fix indentation in riscv_vector::expand (*) 3a12ac4... i386: Fix the order of operands in andn3 [PR (*) d0a9ae1... libstdc++: Reuse std::__assign_one in ( (*) 4d8373f... RISC-V: Add testcases for form 4 of vector signed SAT_SUB (*) b976292... RISC-V: Add testcases for form 3 of vector signed SAT_SUB (*) 5920bc8... Match: Support form 3 for vector signed integer SAT_SUB (*) 72d24d2... RISC-V: Add testcases for form 2 of vector signed SAT_SUB (*) 5667400... tree-optimization/116290 - fix compare-debug issue in ldist (*) b717c46... SH: Fix cost estimation of mem load/store (*) 7ec8b4b... SH: Add -fno-math-errno to fsca,fsrra tests. (*) c21402e... Daily bump. (*) 90a4851... libstdc++: testsuite: adjust name_fortify test for pre-defi (*) 27f6b37... libstdc++: Fix ranges::copy_backward for a single memcpyabl (*) 2ef62aa... MAINTAINERS: Add myself to write after approval (*) a4eec6c... Revert "c++: Fix overeager Woverloaded-virtual with convers (*) f0f1155... m68k: replace reload_in_progress by reload_in_progress || l (*) 1506027... tree-optimization/116481 - avoid building function_type[] (*) 3269a72... Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' _ (*) c38385d... [RISC-V] Avoid unnecessary extensions when value is already (*) f08af08... Daily bump. (*) d09131e... Unsigned constants for ISO_FORTRAN_ENV and ISO_C_BINDING. (*) a9173a5... vect: Fix inconsistency in fully-masked lane-reducing op ge (*) f54d42e... tree-optimization/117104 - add missed guards to max(a,b) != (*) ba773a8... RISC-V] Slightly improve broadcasting small constants into (*) 34b77d1... Fortran/OpenMP: Warn when mapping polymorphic variables (*) 5cf85a2... bootstrap: Fix genmatch build where system gcc defaults to (*) c1034d7... gcc.target/i386/pr55583.c: Use long long for 64-bit integer (*) 80d0e10... gcc.target/i386/pr115749.c: Use word_mode integer (*) a4ce868... gcc.target/i386/invariant-ternlog-1.c: Also scan (%edx) (*) c397a8c... libcpp, genmatch: Use gcc_diag instead of printf for libcpp (*) c20c9d8... Fortran: Unify gfc_get_location handling; fix expr->ts bug (*) a564261... testsuite/i386: Add vector sat_sub testcases [PR112600] (*) 2a865ad... MAINTAINERS: Add myself to write after approval (*) 60163c8... c++: Fix overeager Woverloaded-virtual with conversion oper (*) c4af4fe... RISC-V: Add testcases for form 1 of vector signed SAT_
[gcc/egallager/heads/CI] (808 commits) Merge branch 'gcc-mirror:master' into me/CI
The branch 'egallager/heads/CI' was updated to point to: 87e32a7718e8... Merge branch 'gcc-mirror:master' into me/CI It previously pointed to: 67ccb9e6f837... Merge branch 'gcc-mirror:master' into me/CI Diff: Summary of changes (added commits): --- 87e32a7... Merge branch 'gcc-mirror:master' into me/CI e175fb3... Daily bump. (*) d77f073... c++: free garbage vec in coerce_template_parms (*) 547219f... Aarch64: Define WIDEST_HARDWARE_FP_SIZE (*) fe33530... Revert "c++: free garbage vec in coerce_template_parms" (*) dca2b47... c++: -Wdeprecated enables later standard deprecations (*) b6ff52a... c++: add -Wdeprecated-literal-operator [CWG2521] (*) 5b08ae5... c++: free garbage vec in coerce_template_parms (*) 8d63d87... AVR: Make gcc.dg/c23-stdarg-9.c work. (*) 0d9d687... libstdc++: Make Unicode utils work with Parallel Mode (*) 7754a8b... libstdc++: Fix -Wdeprecated-declarations warning for Parall (*) 28911f6... libstdc++: Fix some warnings seen during bootstrap (*) 34670de... Restore aarch64 bootstrap (*) edec4bf... aarch64: Fix early ra for -fno-delete-dead-exceptions [PR11 (*) ccb6e08... libstdc++: [_Hashtable] Fix some implementation inconsisten (*) caef700... diagnostics: support SARIF 2.2 output, undocumented for now (*) 1d09117... Daily bump. (*) 1f619fe... phiopt: Fix VCE moving by rewriting it into cast [PR116098] (*) 77c3ef0... testsuite/52641 - Make gcc.dg/strict-flex-array-3.c work on (*) 524b9c2... AVR: Make gcc.dg/pr113596.c work. (*) 5bf78cf... testsuite/52641 - Require int32 for gcc.dg/pr93820-2.c. (*) 875a1df... testsuite/52641 - Fix gcc.dg/signbit-6.c for int != 32-bit (*) 4d9e473... middle-end: Fix ifcvt predicate generation for masked funct (*) 4e11ad7... arm: Prevent ICE when doloop dec_set is not PLUS expr (*) 3a52838... c++: Fix regression introduced by r15-3796 [PR116722] (*) dafbfdb... Replace another missed iterative_hash_object (*) ffc389c... gimple ssa: Don't use __builtin_popcount in switch exp tran (*) 842fbfa... Speedup iterative_hash_template_arg (*) 77c5e4a... Adjust gcc.dg/vect/slp-12a.c (*) 32b99da... Adjust expectation for gcc.dg/vect/slp-19c.c (*) 71896a8... un-XFAIL gcc.dg/vect/vect-double-reduc-5.c (*) 61d87f2... testsuite/116596 - fix gcc.dg/vect/slp-11a.c (*) 02f4efe... tree-optimization/113197 - bougs assert in PTA (*) 4ba4165... tree-optimiztation/114855 - profile prediction slowness (*) c534e37... libstdc++: Populate std::time_get::get's %c format for C lo (*) 5cf26f2... libstdc++: Fix rounding in chrono::parse (*) 05b7ab8... libstdc++: Fix -Wlong-long warning in (*) 79ea0aa... testsuite/116660 - adjust testcases unexpectedly failing on (*) ba76326... tree-optimization/116566 - single lane SLP for VLA inductio (*) 56d0ee7... doc: Drop h8300-hms reference to binaries downloads (*) 5943a2f... libcpp: Implement clang -Wheader-guard warning [PR96842] (*) ba53cca... opts: Fix up regenerate-opt-urls dependencies (*) cea87c8... backprop: Fix deleting of a phi node [PR116922] (*) 9175d08... Fix gcc.dg/pr116905.c (*) eb0698a... testsuite/116654 - adjust gcc.target/powerpc/p9-vec-length- (*) b56dc0a... testsuite/116654 - adjust gcc.dg/vect/costmodel/ppc/costmod (*) e592ea8... tree-optimization/116654 - missed dr_explicit_realign[_opti (*) ed7b3e7... RISC-V: Add testcases for form 2 of scalar signed SAT_SUB (*) 3809b4d... Match: Support form 2 for scalar signed integer SAT_SUB (*) 60f1fed... Daily bump. (*) 1c9b440... c++: don't advertise C++20 concepts in C++14 (*) f72b1a4... AVR: avr.cc - Drop a superfluous sub-condition in avr_out_c (*) 5e41e8f... AVR: avr-passes.cc - Fix a build warning. (*) ac4cdf5... aarch64: Introduce new unspecs for smax/smin (*) 9dd9a06... Implement MAXVAL and MINVAL for UNSIGNED. (*) be2f7a1... Fix wrong code out of NRV + RSO + inlining (*) 97fd777... [PATCH] RISC-V/libgcc: Fix incorrect and missing .cfi_offse (*) 1b7cfa7... c++: introduce __builtin_is_virtual_base_of (*) 698e0ec... phi-opt: Improve factor heurstic with constants and convers (*) 8273e31... modula2: Add FindIndice to library module gm2-libs/Indexing (*) fda30a3... PR modula2/116918 -fswig correct syntax (*) 35dd5cf... aarch64: Add fp8 scalar types (*) 27ddda8... tree-optimization/116902 - vectorizer load hosting breaks U (*) 60fa7f5... tree-optimization/116905 - ICE with bogus range ops (*) 3e1bd64... tree-optimization/116906 - unsafe PRE with never executed e (*) de25f17... range-cache: Fix ranger ICE if number of bbs increases [PR1 (*) bdbd060... range-cache: Fix ICE on SSA_NAME with def_stmt not yet in t (*) 0939c8c... Daily bump. (*) b1696ff... libstdc++-v3: Fix signed-overflow warning for newlib/ctype_ (*) ab07db3... [testcase] Fix-absfloat16.c-testcase (*) 4bcfaae... c++: concept in default argument [PR109859] (*) 65073a5... Fix internal error during inlining after ICF pass (*) 9c14f9a... diagno