[PATCH] D133894: [AArch64][SME] Add intrinsics for enabling/disabling ZA.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 14:12:08 PDT 2022
sdesmalen created this revision.
sdesmalen added reviewers: aemerson, paulwalker-arm, shruthiashwath, sagarkulkarni19.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This adds the intrinsics:
- void @llvm.aarch64.sme.start.pstateza() -> smstart za
- void @llvm.aarch64.sme.stop.pstateza() -> smstop za
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133894
Files:
llvm/include/llvm/IR/IntrinsicsAArch64.td
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/sme-toggle-pstateza.ll
Index: llvm/test/CodeGen/AArch64/sme-toggle-pstateza.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sme-toggle-pstateza.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64 -mattr=+sme -verify-machineinstrs < %s | FileCheck %s
+
+define void @toggle_pstate_za() {
+; CHECK-LABEL: toggle_pstate_za:
+; CHECK: // %bb.0:
+; CHECK-NEXT: smstart za
+; CHECK-NEXT: smstop za
+; CHECK-NEXT: ret
+ call void @llvm.aarch64.sme.start.pstateza()
+ call void @llvm.aarch64.sme.stop.pstateza()
+ ret void
+}
+
+declare void @llvm.aarch64.sme.start.pstateza()
+declare void @llvm.aarch64.sme.stop.pstateza()
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -1145,6 +1145,9 @@
}
}
+ if (Subtarget->hasSME())
+ setOperationAction(ISD::INTRINSIC_VOID, MVT::Other, Custom);
+
if (Subtarget->hasSVE()) {
for (auto VT : {MVT::nxv16i8, MVT::nxv8i16, MVT::nxv4i32, MVT::nxv2i64}) {
setOperationAction(ISD::BITREVERSE, VT, Custom);
@@ -4554,6 +4557,18 @@
SDValue PStateSM = getPStateSM(DAG, Chain, Attrs, DL, Op.getValueType());
return DAG.getMergeValues({PStateSM, Chain}, DL);
}
+ case Intrinsic::aarch64_sme_start_pstateza:
+ return DAG.getNode(
+ AArch64ISD::SMSTART, DL, MVT::Other,
+ Op->getOperand(0), // Chain
+ DAG.getTargetConstant((int32_t)(AArch64SVCR::SVCRZA), DL, MVT::i32),
+ DAG.getConstant(0, DL, MVT::i64), DAG.getConstant(1, DL, MVT::i64));
+ case Intrinsic::aarch64_sme_stop_pstateza:
+ return DAG.getNode(
+ AArch64ISD::SMSTOP, DL, MVT::Other,
+ Op->getOperand(0), // Chain
+ DAG.getTargetConstant((int32_t)(AArch64SVCR::SVCRZA), DL, MVT::i32),
+ DAG.getConstant(0, DL, MVT::i64), DAG.getConstant(1, DL, MVT::i64));
}
}
@@ -5596,6 +5611,7 @@
return LowerToPredicatedOp(Op, DAG, AArch64ISD::MULHS_PRED);
case ISD::MULHU:
return LowerToPredicatedOp(Op, DAG, AArch64ISD::MULHU_PRED);
+ case ISD::INTRINSIC_VOID:
case ISD::INTRINSIC_W_CHAIN:
return LowerINTRINSIC_W_CHAIN(Op, DAG);
case ISD::INTRINSIC_WO_CHAIN:
Index: llvm/include/llvm/IR/IntrinsicsAArch64.td
===================================================================
--- llvm/include/llvm/IR/IntrinsicsAArch64.td
+++ llvm/include/llvm/IR/IntrinsicsAArch64.td
@@ -2700,6 +2700,12 @@
def int_aarch64_sme_set_tpidr2
: DefaultAttrsIntrinsic<[], [llvm_i64_ty],
[IntrNoMem, IntrHasSideEffects]>;
+
+ def int_aarch64_sme_start_pstateza
+ : DefaultAttrsIntrinsic<[], [], [IntrNoMem, IntrHasSideEffects]>;
+ def int_aarch64_sme_stop_pstateza
+ : DefaultAttrsIntrinsic<[], [], [IntrNoMem, IntrHasSideEffects]>;
+
// Clamp
//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133894.460223.patch
Type: text/x-patch
Size: 3011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/e95c436f/attachment.bin>
More information about the llvm-commits
mailing list