[PATCH] D99940: [ARM] Combine sub 0, csinc X, Y, CC -> csinv -X, Y, CC

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 00:49:59 PDT 2021


dmgreen added a comment.

In D99940#2671380 <https://reviews.llvm.org/D99940#2671380>, @malharJ wrote:

> 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>

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.



================
Comment at: llvm/test/CodeGen/Thumb2/mve-vmovimm.ll:523
 ; CHECKLE-NEXT:    mov.w r1, #15
-; CHECKLE-NEXT:    cset r0, eq
-; CHECKLE-NEXT:    rsbs r0, r0, #0
+; CHECKLE-NEXT:    csetm r0, eq
 ; CHECKLE-NEXT:    ands r0, r1
----------------
malharJ wrote:
> Is the new assembly equivalent to the old one: ie, does this set the condition codes ?
The condition code isn't used though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99940/new/

https://reviews.llvm.org/D99940



More information about the llvm-commits mailing list