Add MIN/MAX folding from fold_cond_expr_with_comparison to match.pd
authorRichard Biener <rguenther@suse.de>
Fri, 13 May 2022 07:35:30 +0000 (09:35 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 16 May 2022 06:23:39 +0000 (08:23 +0200)
commit9a53101caadae1b5c8d791d247b05268ee4f7f92
tree040afa50012036ba4b92a2438df74d3bd7bb2764
parent69c4b5c519f0df37e4903992644cc29682721bc1
Add MIN/MAX folding from fold_cond_expr_with_comparison to match.pd

The following adds MIN/MAX folding from fold_cond_expr_with_comparison
to the part GIMPLE of match.pd, leaving the GENERIC part in
fold-const.cc since that's constrainted on frontend specific things
I did not want to carry to match.pd.

The effect becomes appearant when we no longer can rely on GENERIC
folding of COND_EXPRs in gcc.dg/tree-ssa/pr92834.c and
gcc.dg/tree-ssa/pr94786.c.

2022-05-13  Richard Biener  <rguenther@suse.de>

* match.pd (A cmp B ? A : B -> min/max): New patterns
carried over from fold_cond_expr_with_comparison.
gcc/match.pd