[PATCH] D118054: [AArch64][SVE] Mark PFALSE as side-effect free.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 04:20:45 PST 2022
sdesmalen updated this revision to Diff 402842.
sdesmalen added a comment.
Implement with AArch64ISD::PFALSE and patterns.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118054/new/
https://reviews.llvm.org/D118054
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
llvm/lib/Target/AArch64/SVEInstrFormats.td
llvm/test/CodeGen/AArch64/sve-pfalse-machine-cse.mir
Index: llvm/test/CodeGen/AArch64/sve-pfalse-machine-cse.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-pfalse-machine-cse.mir
@@ -0,0 +1,26 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -run-pass=machine-cse -mtriple=aarch64 -mattr=+sve -o - %s | FileCheck %s
+---
+name: pfalse
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $p0
+
+ ; CHECK-LABEL: name: pfalse
+ ; CHECK: liveins: $p0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:ppr = COPY $p0
+ ; CHECK-NEXT: [[PFALSE:%[0-9]+]]:ppr = PFALSE
+ ; CHECK-NEXT: [[UZP1_PPP_B:%[0-9]+]]:ppr = UZP1_PPP_B [[COPY]], [[PFALSE]]
+ ; CHECK-NEXT: [[UZP1_PPP_B1:%[0-9]+]]:ppr = UZP1_PPP_B killed [[UZP1_PPP_B]], [[PFALSE]]
+ ; CHECK-NEXT: $p0 = COPY [[UZP1_PPP_B1]]
+ ; CHECK-NEXT: RET_ReallyLR implicit $p0
+ %0:ppr = COPY $p0
+ %2:ppr = PFALSE
+ %3:ppr = UZP1_PPP_B %0, %2
+ %4:ppr = PFALSE
+ %5:ppr = UZP1_PPP_B killed %3, %4
+ $p0 = COPY %5
+ RET_ReallyLR implicit $p0
+...
Index: llvm/lib/Target/AArch64/SVEInstrFormats.td
===================================================================
--- llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -334,6 +334,8 @@
def SDT_AArch64PTrue : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVT<1, i32>]>;
def AArch64ptrue : SDNode<"AArch64ISD::PTRUE", SDT_AArch64PTrue>;
+def SDT_AArch64PFalse : SDTypeProfile<1, 0, [SDTCisVec<0>, SDTCVecEltisVT<0, i1>]>;
+def AArch64pfalse : SDNode<"AArch64ISD::PFALSE", SDT_AArch64PFalse>;
let Predicates = [HasSVEorStreamingSVE] in {
defm PTRUE : sve_int_ptrue<0b000, "ptrue", AArch64ptrue>;
@@ -609,6 +611,15 @@
let isReMaterializable = 1;
}
+multiclass sve_int_pfalse<bits<6> opc, string asm> {
+ def NAME : sve_int_pfalse<opc, asm>;
+
+ def : Pat<(nxv16i1 (AArch64pfalse)), (!cast<Instruction>(NAME))>;
+ def : Pat<(nxv8i1 (AArch64pfalse)), (!cast<Instruction>(NAME))>;
+ def : Pat<(nxv4i1 (AArch64pfalse)), (!cast<Instruction>(NAME))>;
+ def : Pat<(nxv2i1 (AArch64pfalse)), (!cast<Instruction>(NAME))>;
+}
+
class sve_int_ptest<bits<6> opc, string asm>
: I<(outs), (ins PPRAny:$Pg, PPR8:$Pn),
asm, "\t$Pg, $Pn",
Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
===================================================================
--- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -726,7 +726,7 @@
defm BRKBS_PPzP : sve_int_break_z<0b110, "brkbs", null_frag>;
def PTEST_PP : sve_int_ptest<0b010000, "ptest">;
- def PFALSE : sve_int_pfalse<0b000000, "pfalse">;
+ defm PFALSE : sve_int_pfalse<0b000000, "pfalse">;
defm PFIRST : sve_int_pfirst<0b00000, "pfirst", int_aarch64_sve_pfirst>;
defm PNEXT : sve_int_pnext<0b00110, "pnext", int_aarch64_sve_pnext>;
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -321,6 +321,7 @@
INSR,
PTEST,
PTRUE,
+ PFALSE,
BITREVERSE_MERGE_PASSTHRU,
BSWAP_MERGE_PASSTHRU,
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9976,7 +9976,7 @@
// lowering code.
if (auto *ConstVal = dyn_cast<ConstantSDNode>(SplatVal)) {
if (ConstVal->isZero())
- return SDValue(DAG.getMachineNode(AArch64::PFALSE, dl, VT), 0);
+ return DAG.getNode(AArch64ISD::PFALSE, dl, VT);
if (ConstVal->isOne())
return getPTrue(DAG, dl, VT, AArch64SVEPredPattern::all);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118054.402842.patch
Type: text/x-patch
Size: 3879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/089a75d8/attachment.bin>
More information about the llvm-commits
mailing list