[PATCH] D125190: [AArch64] Improve multi-precision subtractions
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 8 11:32:57 PDT 2022
kazu created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch improves multi-precision subtractions by stripping away:
cset w_, lo
cmp wzr, w_
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125190
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/i256-math.ll
Index: llvm/test/CodeGen/AArch64/i256-math.ll
===================================================================
--- llvm/test/CodeGen/AArch64/i256-math.ll
+++ llvm/test/CodeGen/AArch64/i256-math.ll
@@ -98,11 +98,7 @@
; CHECK: // %bb.0:
; CHECK-NEXT: subs x0, x0, x4
; CHECK-NEXT: sbcs x1, x1, x5
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x2, x2, x6
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x3, x3, x7
; CHECK-NEXT: cset w8, lo
; CHECK-NEXT: eor w4, w8, #0x1
@@ -122,11 +118,7 @@
; CHECK: // %bb.0:
; CHECK-NEXT: subs x0, x0, x4
; CHECK-NEXT: sbcs x1, x1, x5
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x2, x2, x6
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x3, x3, x7
; CHECK-NEXT: cset w4, lo
; CHECK-NEXT: ret
@@ -244,11 +236,7 @@
; CHECK: // %bb.0:
; CHECK-NEXT: subs x0, x0, x4
; CHECK-NEXT: sbcs x1, x1, x5
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x2, x2, x6
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x3, x3, x7
; CHECK-NEXT: cset w8, vs
; CHECK-NEXT: eor w4, w8, #0x1
@@ -268,11 +256,7 @@
; CHECK: // %bb.0:
; CHECK-NEXT: subs x0, x0, x4
; CHECK-NEXT: sbcs x1, x1, x5
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x2, x2, x6
-; CHECK-NEXT: cset w8, lo
-; CHECK-NEXT: cmp wzr, w8
; CHECK-NEXT: sbcs x3, x3, x7
; CHECK-NEXT: cset w4, vs
; CHECK-NEXT: ret
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -15536,6 +15536,11 @@
}
SDValue CsetOp = CmpOp->getOperand(IsAdd ? 0 : 1);
+
+ // Strip away AND with 1.
+ if (CsetOp.getOpcode() == ISD::AND && isOneConstant(CsetOp.getOperand(1)))
+ CsetOp = CsetOp.getOperand(0);
+
auto CC = getCSETCondCode(CsetOp);
if (CC != (IsAdd ? AArch64CC::HS : AArch64CC::LO))
return SDValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125190.427951.patch
Type: text/x-patch
Size: 2219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220508/09c24c73/attachment.bin>
More information about the llvm-commits
mailing list