Combine sub 0, csinc X, Y, CC to csinv -X, Y, CC providing that the negation of X is cheap, currently just handling constants. This comes up during the splat of an i1 to a predicate, where we now generate csetm, as opposed to cset; rsb.
I don't have much context, but I'm just wondering if a similar optimization for csneg might be useful ?
sub(0, csneg( X, Y, <cc>) ) = csinv -X, -Y-1, <cc>
Do you think this would be better worded as:
Is the new assembly equivalent to the old one: ie, does this set the condition codes ?
I'm not sure if that will ever come up. LLVM will usually canonicalize to something that is already simpler. The pattern for this patch comes up in splatting i1's to predicates, which is where it is useful.
The condition code isn't used though.