https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115659
--- Comment #10 from Kewen Lin <linkw at gcc dot gnu.org> --- (In reply to Richard Biener from comment #9) > I think the inversion code wants to check invert_tree_comparison and see if > the inverted compare is supported and only if not fall back to inverting the > comparison result (there is of course the multi-use case to consider). OK, for now all/most targets claim to support all comparisons (do swapping and inversion etc. in expanders themselves), it seems that we have to handle this until then we have some generic handlings for them. > I also think that incrementally improving the /* Try to fold x CMP y ? -1 : > 0 to x CMP y. */ is fine we don't have to handle everything in one patch. > > Thanks for working on this. The x86 folks seem to be able to handle most > things within the backend which is also fine, handling common problems in > the middle-end is of course better. Thanks for the suggestions, posted two patches for review and comments. Yes, I realized that with some define_insn_and_split in backend can also catch some pattern and generate expected code.