On Mon, Dec 21, 2020 at 02:50:24AM +0000, Maciej W. Rozycki 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. > > This regresses VAX code produced by the cmpelim-eq-notsi.c test case (and > its similar counterparts) with the `vax-netbsdelf' target.
The point of the match.pd changes is to canonicalize GIMPLE on some form when there are several from GIMPLE POV equivalent or better forms of writing the same thing. The advantage of having one canonical way is that ICF, SCCVN etc. optimizations can then understand the different forms are equivalent. If another form is then better for a particular machine, it should be done either during expansion (being able to produce both RTLs and computing their costs), or during combine with either combine splitters or define_insn_and_split in the backend, or, if it can't be done in RTL, during the isel pass. Jakub