On Fri, Oct 28, 2022 at 1:35 AM Eric Botcazou <botca...@adacore.com> wrote: > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0])))) > > > > as > > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (const_int 1) (const_int 0 [0])))) > > > > which leads to incorrect results since LTU on MODE_CC register isn't the > > same as "unsigned less than" in x86 backend. > > That's not specific to the x86 back-end, i.e. it's a generic caveat. > > > PR target/107172 > > * config/i386/i386.md (UNSPEC_CC_NE): New. > > Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns. > > FWIW the SPARC back-end uses a COMPARE instead of an UNSPEC here.
COMPARE may also set CC register to a constant when both operands are known constants. -- H.J.