Re: [PATCH 16/56] gcc: Re-add TYPE_METHODS.
> No. Java was removed to reduce the maintenance burden, you can't just > reintroduce the burden and say "hey, I don't want to pay for the burden > so you please do it". There were two sentences there. You appear to only have read the first one. I just took on 6 years of that maintenance burden in 4 months while teaching myself the gcc tree. I can confirm with absolute certainty that the burden would have been pitiful had java been in the tree. Many of the changes were just idiomatic find and replaces that I had to do myself, tracking down the commit that removed or renamed something, in some cases just silently breaking things so I had to bisect 6 years of changes. If Java had been in the tree, it would have introduced a pitiful additional burden. I can think of around 5 changes that I made that would have required something more than just a sed script, and even then those were very simple changes. I am not suggesting that I wish to shift the overall burden of maintenance away from myself, rather that it would be nice if I did not have to track down breaking commits every 3 months, when the author could have very easily included Java in the changes if it was in the tree. > And we are in stage 3 now so it's not possible to merge 50+ patches > (completely not reviewed in stage 1) until GCC 14 stage 1 opens. On a lighter note, this is fair. I was hoping to make the stage 1 window, but with 2 front-ends already in contention I thought my odds of making it in regardless were poor, and I just didn't have the time to fix the last issues. I've sent these patches now so they can get reviewed now, so that they aren't waiting in review limbo when merging is open again.
Re: [PATCH 19/56] Revert "Move void_list_node init to common code". (8ff2a92a0450243e52d3299a13b30f208bafa7e0)
> What happens if you remove end_params_node from the Java front-end and > replace it with void_list_node? Sadly, nothing.
[PATCH] tree-optimization/103356 Add missing (~a) == b folding for _Bool
From: Andrew Pinski The following makes sure to fold (~a) == b to a ^ b for truth values. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski PR 103356 gcc/ChangeLog: * match.pd: ((~a) == b -> a ^ b): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/pr103356-1.c: New test. --- gcc/match.pd | 7 +++ gcc/testsuite/gcc.dg/pr103356-1.c | 9 + 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr103356-1.c diff --git a/gcc/match.pd b/gcc/match.pd index a4d1386fd9f..67a0a682f31 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1999,6 +1999,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && TYPE_PRECISION (TREE_TYPE (@0)) == 1) (convert (eq @0 @1 +/* (~a) == b is a ^ b for truth valued a and b. */ +(simplify + (eq:c (bit_not:s truth_valued_p@0) truth_valued_p@1) + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) + && TYPE_PRECISION (TREE_TYPE (@0)) == 1) + (convert (bit_xor @0 @1 + /* (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x */ (simplify (bit_ior:c (bit_and:cs @0 (bit_not @2)) (bit_and:cs @1 @2)) diff --git a/gcc/testsuite/gcc.dg/pr103356-1.c b/gcc/testsuite/gcc.dg/pr103356-1.c new file mode 100644 index 000..61d0b81da22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr103356-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-forwprop1" } */ + +_Bool foo (_Bool a, _Bool b) +{ + return a == (!b); +} + +/* { dg-final { scan-tree-dump "\[ab\]_\[0-9\]+\\(D\\) \\\^ \[ba\]_\[0-9\]+\\(D\\)" "forwprop1" } } */ -- 2.17.1
Re: [PATCH] tree-optimization/103356 Add missing (~a) == b folding for _Bool
> Am 26.11.2022 um 17:42 schrieb apinski--- via Gcc-patches > : > > From: Andrew Pinski > > The following makes sure to fold (~a) == b to a ^ b for truth > values. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Ok. Richard > Thanks, > Andrew Pinski > >PR 103356 > > gcc/ChangeLog: > >* match.pd: ((~a) == b -> a ^ b): New pattern. > > gcc/testsuite/ChangeLog: > >* gcc.dg/pr103356-1.c: New test. > --- > gcc/match.pd | 7 +++ > gcc/testsuite/gcc.dg/pr103356-1.c | 9 + > 2 files changed, 16 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/pr103356-1.c > > diff --git a/gcc/match.pd b/gcc/match.pd > index a4d1386fd9f..67a0a682f31 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -1999,6 +1999,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > && TYPE_PRECISION (TREE_TYPE (@0)) == 1) > (convert (eq @0 @1 > > +/* (~a) == b is a ^ b for truth valued a and b. */ > +(simplify > + (eq:c (bit_not:s truth_valued_p@0) truth_valued_p@1) > + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) > + && TYPE_PRECISION (TREE_TYPE (@0)) == 1) > + (convert (bit_xor @0 @1 > + > /* (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x */ > (simplify > (bit_ior:c (bit_and:cs @0 (bit_not @2)) (bit_and:cs @1 @2)) > diff --git a/gcc/testsuite/gcc.dg/pr103356-1.c > b/gcc/testsuite/gcc.dg/pr103356-1.c > new file mode 100644 > index 000..61d0b81da22 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr103356-1.c > @@ -0,0 +1,9 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O -fdump-tree-forwprop1" } */ > + > +_Bool foo (_Bool a, _Bool b) > +{ > + return a == (!b); > +} > + > +/* { dg-final { scan-tree-dump "\[ab\]_\[0-9\]+\\(D\\) \\\^ > \[ba\]_\[0-9\]+\\(D\\)" "forwprop1" } } */ > -- > 2.17.1 >
[PATCH] rtl: add predicates for addition, subtraction & multiplication
This is my first contribution to GCC :) one of the beginner projects suggested on the website was to add and use RTL type predicates. I added predicates for addition, subtraction and multiplication. I also went through and used them in the code. I did not add tests because I'm not addding/modifying any behavior. All existings tests did pass. Like I said, this is my first patch. Please let me know if I did anything wrong or if there's anything I can improve for next time. Signed-off-by: Charlie Sale --- gcc/ChangeLog| 43 +++ gcc/alias.cc | 30 +++-- gcc/auto-inc-dec.cc | 11 +- gcc/calls.cc | 8 +- gcc/cfgexpand.cc | 16 +-- gcc/combine-stack-adj.cc | 39 +++ gcc/combine.cc | 241 +-- gcc/compare-elim.cc | 3 +- gcc/cse.cc | 66 +-- gcc/cselib.cc| 37 +++--- gcc/dce.cc | 4 +- gcc/dwarf2cfi.cc | 2 +- gcc/dwarf2out.cc | 11 +- gcc/emit-rtl.cc | 6 +- gcc/explow.cc| 31 ++--- gcc/expr.cc | 23 ++-- gcc/final.cc | 20 ++-- gcc/function.cc | 7 +- gcc/fwprop.cc| 2 +- gcc/haifa-sched.cc | 10 +- gcc/ifcvt.cc | 11 +- gcc/ira.cc | 6 +- gcc/loop-doloop.cc | 70 ++-- gcc/loop-iv.cc | 21 +--- gcc/lra-constraints.cc | 34 +++--- gcc/lra-eliminations.cc | 25 ++-- gcc/lra.cc | 6 +- gcc/modulo-sched.cc | 2 +- gcc/postreload.cc| 25 ++-- gcc/reginfo.cc | 12 +- gcc/reload.cc| 180 + gcc/reload1.cc | 85 ++ gcc/reorg.cc | 12 +- gcc/rtl.cc | 3 +- gcc/rtl.h| 11 ++ gcc/rtlanal.cc | 25 ++-- gcc/sched-deps.cc| 8 +- gcc/simplify-rtx.cc | 143 +-- gcc/var-tracking.cc | 37 +++--- 39 files changed, 595 insertions(+), 731 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f999e2cba43..1fd2c94c873 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,46 @@ +2022-11-26 Charlie Sale + + * rtl.h (PLUS_P): RTL addition predicate + (MINUS_P): RTL subtraction predicate + (MULT_P): RTL multiplication predicate + * alias.cc: use RTL predicates + * auto-inc-dec.cc: use RTL predicates + * calls.cc: use RTL predicates + * cfgexpand.cc: use RTL predicates + * combine-stack-adj.cc: use RTL predicates + * combine.cc: use RTL predicates + * compare-elim.cc: use RTL predicates + * cse.cc: use RTL predicates + * cselib.cc: use RTL predicates + * dce.cc: use RTL predicates + * dwarf2cfi.cc: use RTL predicates + * dwarf2out.cc: use RTL predicates + * emit-rtl.cc: use RTL predicates + * explow.cc: use RTL predicates + * expr.cc: use RTL predicates + * final.cc: use RTL predicates + * function.cc: use RTL predicates + * fwprop.cc: use RTL predicates + * haifa-sched.cc: use RTL predicates + * ifcvt.cc: use RTL predicates + * ira.cc: use RTL predicates + * loop-doloop.cc: use RTL predicates + * loop-iv.cc: use RTL predicates + * lra-constraints.cc: use RTL predicates + * lra-eliminations.cc: use RTL predicates + * lra.cc: use RTL predicates + * modulo-sched.cc: use RTL predicates + * postreload.cc: use RTL predicates + * reginfo.cc: use RTL predicates + * reload.cc: use RTL predicates + * reload1.cc: use RTL predicates + * reorg.cc: use RTL predicates + * rtl.cc: use RTL predicates + * rtlanal.cc: use RTL predicates + * sched-deps.cc: use RTL predicates + * simplify-rtx.cc: use RTL predicates + * var-tracking.cc: use RTL predicates + 2022-11-25 Sandra Loosemore * common.opt (fopenmp-target-simd-clone): New option. diff --git a/gcc/alias.cc b/gcc/alias.cc index c62837dd854..2d9bd79fe21 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -1473,7 +1473,7 @@ find_base_value (rtx src) otherwise. */ if (copying_arguments && (XEXP (src, 0) == arg_pointer_rtx - || (GET_CODE (XEXP (src, 0)) == PLUS + || (PLUS_P (XEXP (src, 0)) && XEXP (XEXP (src, 0), 0) == arg_pointer_rtx))) return arg_base_value; return 0; @@ -1790,7 +1790,7 @@ canon_rtx (rtx x) return canon_rtx (t); } - if (GET_CODE (x) == PLUS) + if (PLUS_P (x)) { rtx x0 = canon_rtx (XEXP (x, 0)); rtx x1 = canon_rtx (XEXP (x, 1)); @@ -2357,19 +2357,17 @@ get_addr (rtx x) if (GET_CODE (x) != VALUE) { - if ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS) - && GET_CODE (XEXP (x, 0)) == VALUE + if ((PLUS_P (x) || MINUS_P (x)) && GET_CODE (XEXP (x, 0)) == VALUE