Hi, > It seems to me this ought to work when the min/max reversed as well, > or >    am I missing something?
Yes, it should work when min/max are reversed. Regards, Eikansh ________________________________ From: Jeff Law <jeffreya...@gmail.com> Sent: Tuesday, November 12, 2024 12:55 AM To: Eikansh Gupta (QUIC) <quic_eikag...@quicinc.com>; gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org> Subject: Re: [PATCH v2] MATCH: Simplify `min(a, b) op max(a, b)` to `a op b` [PR109401] WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros. On 11/11/24 4:55 AM, Eikansh Gupta wrote: > This patch simplify `min(a,b) op max(a,b)` to `a op b`. This optimization > will work for all the binary commutative operations. So, the `op` here can > be one of {plus, mult, bit_and, bit_xor, bit_ior, eq, ne, min, max}. > > PR tree-optimization/109878 > PR 109401 > > gcc/ChangeLog: > > * match.pd (min(a,b) op max(a,b) -> a op b): New pattern. > > gcc/testsuite/ChangeLog: > > * gcc.dg/tree-ssa/pr109401.c: New test. > * gcc.dg/tree-ssa/pr109401-1.c: New test. It seems to me this ought to work when the min/max reversed as well, or am I missing something? jeff