A few typos: On Tue, Jun 30, 2026 at 10:11:47PM -0700, Andrew Pinski wrote: > This finishes up simplifications of most comparisons > outside of reassiocation. Including but not limited to reassociation
> many floating point comparisons. > Instead of Redoig what is done in fold-cost.cc's combine_comparisons, redoing > this reuses combine_comparisons to find the new CMP. > > In the case of `-fno-trapping-math`, this allows to optimize `<=>` > which it was not before. > > Bootstrapped and tested on x86_64-linux-gnu. > > PR tree-optimization/106164 > PR tree-optimization/126042 > PR tree-optimization/94589 > > gcc/ChangeLog: > > * fold-const.cc (combine_comparisons): Split into > 2 versions. Also handle BIT_AND_EXPR and BIT_IOR_EXPR. > * fold-const.h (combine_comparisons): New declaration. > * match.pd (`(a CMP1 b) BITOP (a CMP2 b)`): New pattern. > > gcc/testsuite/ChangeLog: > > * g++.dg/opt/pr94589-5a.C: New test. > > Signed-off-by: Andrew Pinski <[email protected]> > --- > gcc/fold-const.cc | 65 ++++++++++++++++++--------- > gcc/fold-const.h | 2 + > gcc/match.pd | 20 +++++++++ > gcc/testsuite/g++.dg/opt/pr94589-5a.C | 27 +++++++++++ > 4 files changed, 93 insertions(+), 21 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/opt/pr94589-5a.C > > diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc > index 11d1129f125..899212bfdff 100644 > --- a/gcc/fold-const.cc > +++ b/gcc/fold-const.cc > @@ -2935,35 +2935,37 @@ inverse_conditions_p (const_tree cond1, const_tree > cond2) > TREE_OPERAND (cond2, 1), 0)); > } > > -/* Return a tree for the comparison which is the combination of > +/* Return a coide for the comparison which is the combination of code > doing the AND or OR (depending on CODE) of the two operations LCODE > and RCODE on the identical operands LL_ARG and LR_ARG. Take into account > - the possibility of trapping if the mode has NaNs, and return NULL_TREE > - if this makes the transformation invalid. */ > + the possibility of trapping if the mode has NaNs, and return ERROR_MARK > + if this makes the transformation invalid. If the resulting code is > + INTEGER_CST, then *RES will be set to a non-NULL CONSTANT. */
