https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83133
--- Comment #17 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Marc Glisse from comment #15) > Gcc's RTL internal representation sees the same thing for your code and for > > int diff = (unsigned)a - (unsigned)b; > > llvm represents both differently and generates different code for the two. GCC represents unsigned comparison with LTU and signed with LT. This optimization can be implemented by changing condition of *sub<mode>_2 pattern from: ix86_match_ccmode (insn, CCGOCmode) to ix86_match_ccmode (insn, flag_wrapv ? CCGOCmode : CCNOmode)