[PATCH] D151080: [AArch64][SVE] Add one-use-check to EitherVSelectOrPassthruPatFrags
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 22 05:08:49 PDT 2023
dmgreen created this revision.
dmgreen added reviewers: paulwalker-arm, sdesmalen, david-arm, SjoerdMeijer, efriedma.
Herald added subscribers: psnobl, hiraditya, kristof.beyls, tschuett.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.
As pointed out in D149968 <https://reviews.llvm.org/D149968> vselect predicate patterns could do with a one-use check to prevent multiple operations being created.
https://reviews.llvm.org/D151080
Files:
llvm/lib/Target/AArch64/SVEInstrFormats.td
llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
Index: llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
+++ llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
@@ -177,10 +177,9 @@
; CHECK-LABEL: umin_select_i64_multiuse:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p1.d
-; CHECK-NEXT: movprfx z2, z0
-; CHECK-NEXT: umin z2.d, p1/m, z2.d, z1.d
-; CHECK-NEXT: umin z0.d, p0/m, z0.d, z1.d
-; CHECK-NEXT: st1d { z2.d }, p1, [x0]
+; CHECK-NEXT: umin z1.d, p1/m, z1.d, z0.d
+; CHECK-NEXT: mov z0.d, p0/m, z1.d
+; CHECK-NEXT: st1d { z1.d }, p1, [x0]
; CHECK-NEXT: ret
%sel = call <vscale x 2 x i64> @llvm.umin.nxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b)
store <vscale x 2 x i64> %sel, ptr %p
Index: llvm/lib/Target/AArch64/SVEInstrFormats.td
===================================================================
--- llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -623,7 +623,9 @@
: PatFrags<(ops node:$Pg, node:$Op1, node:$Op2), [
(intrinsic node:$Pg, node:$Op1, node:$Op2),
(vselect node:$Pg, (sdnode (SVEAllActive), node:$Op1, node:$Op2), node:$Op1),
- ]>;
+ ], [{
+ return N->getOpcode() != ISD::VSELECT || N->getOperand(1).hasOneUse();
+ }]>;
//
// Pseudo -> Instruction mappings
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151080.524248.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230522/31e4a5a3/attachment.bin>
More information about the llvm-commits
mailing list