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.
Details
Diff Detail
Unit Tests
Event Timeline
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>
llvm/lib/Target/ARM/ARMISelLowering.cpp | ||
---|---|---|
12824 | Do you think this would be better worded as: | |
llvm/test/CodeGen/Thumb2/mve-vmovimm.ll | ||
523 | 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.
llvm/test/CodeGen/Thumb2/mve-vmovimm.ll | ||
---|---|---|
523 | The condition code isn't used though. |
clang-tidy: warning: invalid case style for function 'PerformSubCSINCCombine' [readability-identifier-naming]
not useful