[llvm] [AArch64] Check for negative numbers when adjusting icmps (PR #140999)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 07:24:23 PDT 2025
================
@@ -129,40 +196,54 @@ if.end:
}
define void @test8(i64 %val1, i64 %val2, i64 %val3) {
-; CHECK-LABEL: @test8
+; CHECK-LABEL: test8:
+; CHECK: // %bb.0:
+; CHECK-NEXT: and x8, x0, x1
+; CHECK-NEXT: cmn x8, #1
+; CHECK-NEXT: b.gt .LBB7_3
+; CHECK-NEXT: // %bb.1:
+; CHECK-NEXT: and x8, x1, x2
+; CHECK-NEXT: tbnz x8, #63, .LBB7_3
+; CHECK-NEXT: // %bb.2: // %if.then2
+; CHECK-NEXT: and x8, x0, x1, lsl #63
+; CHECK-NEXT: cmn x8, #1
+; CHECK-NEXT: b.le .LBB7_4
+; CHECK-NEXT: .LBB7_3: // %if.end
+; CHECK-NEXT: ret
+; CHECK-NEXT: .LBB7_4: // %if.then3
+; CHECK-NEXT: tst x0, x1, lsl #62
+; CHECK-NEXT: b.lt .LBB7_3
+; CHECK-NEXT: // %bb.5: // %if.then4
+; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: .cfi_offset w30, -16
+; CHECK-NEXT: bl t
+; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
+; CHECK-NEXT: ret
%and1 = and i64 %val1, %val2
%tst1 = icmp slt i64 %and1, 0
br i1 %tst1, label %if.then1, label %if.end
-; CHECK: tst x0, x1
----------------
AZero13 wrote:
Okay, well I put them together in https://github.com/llvm/llvm-project/pull/141151 as two patches then.
https://github.com/llvm/llvm-project/pull/140999
More information about the llvm-commits
mailing list