https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96685

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ok, so for GENERIC it seems to be the associate: in fold_binary_loc that
converts
~x + y created by this patch into (y - x) + 1, and we don't have an equivalent
for that in GIMPLE.

So, shall I restrict this match.pd optimization to #if GIMPLE only, or shall I
canonicalize not to
~x + y but to (y - x) + 1, or should we implement the associate: optimization
on GIMPLE?  I guess the last one might be too much in stage3.
I guess the middle option wouldn't help for the testcase in the patch, because
we wouldn't canonicalize ~x + y to (y - x) + 1 and the first option would
not consider ~x + y or ~(x - y) equivalent to user-written (y - x) + 1.

Reply via email to