[PATCH] D122796: [SVE][AArch64] Enable first active true vector combine for INTRINSIC_WO_CHAIN
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 03:15:56 PDT 2022
Allen created this revision.
Allen added reviewers: paulwalker-arm, david-arm.
Herald added subscribers: ctetreau, psnobl, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: All.
Allen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
WHILELO/LS insn is used very important for SVE loop, and itself
is a flag-setting operation, so add it.
https://reviews.llvm.org/D122796
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/sve-cmp-folds.ll
Index: llvm/test/CodeGen/AArch64/sve-cmp-folds.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-cmp-folds.ll
+++ llvm/test/CodeGen/AArch64/sve-cmp-folds.ll
@@ -30,5 +30,16 @@
ret i1 %bit
}
+define i1 @whilelo_first(i64 %next, i64 %end) {
+; CHECK-LABEL: whilelo_first:
+; CHECK: // %bb.0:
+; CHECK-NEXT: whilelo p0.s, x0, x1
+; CHECK-NEXT: cset w0, mi
+; CHECK-NEXT: ret
+ %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64 %next, i64 %end)
+ %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
+ ret i1 %bit
+}
declare i64 @llvm.vscale.i64()
+declare <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64, i64)
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -14513,9 +14513,10 @@
return SDValue();
// Restricted the DAG combine to only cases where we're extracting from a
- // flag-setting operation
- auto *Idx = dyn_cast<ConstantSDNode>(N->getOperand(1));
- if (!Idx || !Idx->isZero() || SetCC.getOpcode() != ISD::SETCC)
+ // flag-setting operation.
+ if (!isNullConstant(N->getOperand(1)) ||
+ (SetCC.getOpcode() != ISD::SETCC &&
+ SetCC.getOpcode() != ISD::INTRINSIC_WO_CHAIN))
return SDValue();
// Extracts of lane 0 for SVE can be expressed as PTEST(Op, FIRST) ? 1 : 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122796.419383.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220331/7dfdc7d6/attachment-0001.bin>
More information about the llvm-commits
mailing list