Re: [PATCH v2] MATCH: Add simplification for MAX and MIN to match.pd [PR109878]

2024-07-24 Thread Richard Biener
On Fri, Jul 19, 2024 at 7:19 PM Eikansh Gupta wrote: > > Min and max could be optimized if both operands are defined by > (same) variable restricted by an and(&). For signed types, > optimization can be done when both constant have same sign bit. > The patch also adds optimization for specific cas

Re: [PATCH v2] MATCH: Add simplification for MAX and MIN to match.pd [PR109878]

2024-07-23 Thread Marc Glisse
A few ideas in case you want to generalize the transformation (these are not requirements to get your patch in, and this is not a review): On Fri, 19 Jul 2024, Eikansh Gupta wrote: --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4321,6 +4321,32 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) @0 @2))

[PATCH v2] MATCH: Add simplification for MAX and MIN to match.pd [PR109878]

2024-07-19 Thread Eikansh Gupta
Min and max could be optimized if both operands are defined by (same) variable restricted by an and(&). For signed types, optimization can be done when both constant have same sign bit. The patch also adds optimization for specific case of min/max(a, a&CST). This patch adds match pattern for: max