[llvm] [AArch64] Use isKnownNonZero to optimize eligible compares to cmn (PR #96349)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 10:26:54 PDT 2024
================
@@ -258,3 +258,34 @@ define i32 @neg_range_int(i32 %a, i32 %b, i32 %c) {
ret i32 %retval.0
}
+; (b > -3 || a < -(c | 1))
+define i32 @neg_range_int_cmn(i32 %a, i32 %b, i32 %c) {
----------------
AtariDreams wrote:
> In the new code in this test:
>
> ```
> define i32 @or_neg(i32 %x, i32 %y) {
> ; CHECK-LABEL: or_neg:
> ; CHECK: // %bb.0:
> ; CHECK-NEXT: orr w8, w0, #0x1
> ; CHECK-NEXT: cmn w8, w1
> ; CHECK-NEXT: cset w0, gt
> ; CHECK-NEXT: ret
> %3 = or i32 %x, 1
> %4 = sub i32 0, %3
> %5 = icmp sgt i32 %4, %y
> %6 = zext i1 %5 to i32
> ret i32 %6
> }
> ```
>
> If, say, x==0, y==0 then is the result not backwards?
Fixed
https://github.com/llvm/llvm-project/pull/96349
More information about the llvm-commits
mailing list