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
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
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 | ||
---|---|---|
12736 | 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 ? |
Comment Actions
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. |
Do you think this would be better worded as:
Fold (sub 0, ( ARMcsinc X, Y, CC) ) -> (ARMcsinv -X, Y, CC)