On Sat, Dec 12, 2020 at 01:25:39PM +0100, Marc Glisse wrote: > On Sat, 12 Dec 2020, Jakub Jelinek via Gcc-patches wrote: > > > This patch adds the ~(X - Y) -> ~X + Y simplification requested > > in the PR (plus also ~(X + C) -> ~X + (-C) for constants C that can > > be safely negated. > > Would it have been wrong to produce ~X - C without caring about negating > (and then extending it to non-constants)?
Extending it to non-constants is what I wanted to avoid. For ~(X + Y), because + is commutative, it wouldn't be a canonicalization as it would pick more-less randomly whether to do ~X + Y or X + ~Y. > I wonder if this makes > /* ~(~X - Y) -> X + Y and ~(~X + Y) -> X - Y. */ > useless. Maybe the former, but not the latter. Jakub