/// Pass to enable Armv9 Streaming SVE mode.
std::unique_ptr<Pass>
-createEnableArmStreamingPass(const ArmStreaming mode = ArmStreaming::Default);
+createEnableArmStreamingPass(const ArmStreaming mode = ArmStreaming::Default,
+ const bool enableZA = false);
//===----------------------------------------------------------------------===//
// Registration
"Streaming mode is internal to the function, callee "
"manages PSTATE.SM on entry/exit.")
)}]>,
+ Option<"enableZA", "enable-za", "bool", /*default=*/"false",
+ "Enable ZA storage array.">,
];
let dependentDialects = ["func::FuncDialect"];
}
// * 'arm_streaming' (default)
// * 'arm_locally_streaming'
//
+// It can also optionally enable the ZA storage array.
+//
// Streaming-mode is part of the interface (ABI) for functions with the
// first attribute and it's the responsibility of the caller to manage
// PSTATE.SM on entry/exit to functions with this attribute [3]. The LLVM
static constexpr char kArmStreamingAttr[] = "arm_streaming";
static constexpr char kArmLocallyStreamingAttr[] = "arm_locally_streaming";
+static constexpr char kArmZAAttr[] = "arm_za";
namespace {
struct EnableArmStreamingPass
: public arm_sme::impl::EnableArmStreamingBase<EnableArmStreamingPass> {
- EnableArmStreamingPass(ArmStreaming mode) { this->mode = mode; }
+ EnableArmStreamingPass(ArmStreaming mode, bool enableZA) {
+ this->mode = mode;
+ this->enableZA = enableZA;
+ }
void runOnOperation() override {
std::string attr;
switch (mode) {
break;
}
getOperation()->setAttr(attr, UnitAttr::get(&getContext()));
+
+ // The pass currently only supports enabling ZA when in streaming-mode, but
+ // ZA can be accessed by the SME LDR, STR and ZERO instructions when not in
+ // streaming-mode (see section B1.1.1, IDGNQM of spec [1]). It may be worth
+ // supporting this later.
+ if (enableZA)
+ getOperation()->setAttr(kArmZAAttr, UnitAttr::get(&getContext()));
}
};
} // namespace
std::unique_ptr<Pass>
-mlir::arm_sme::createEnableArmStreamingPass(const ArmStreaming mode) {
- return std::make_unique<EnableArmStreamingPass>(mode);
+mlir::arm_sme::createEnableArmStreamingPass(const ArmStreaming mode,
+ const bool enableZA) {
+ return std::make_unique<EnableArmStreamingPass>(mode, enableZA);
}
// RUN: mlir-opt %s -enable-arm-streaming -verify-diagnostics | FileCheck %s
// RUN: mlir-opt %s -enable-arm-streaming=mode=locally -verify-diagnostics | FileCheck %s -check-prefix=CHECK-LOCALLY
+// RUN: mlir-opt %s -enable-arm-streaming=enable-za -verify-diagnostics | FileCheck %s -check-prefix=CHECK-ENABLE-ZA
// CHECK-LABEL: @arm_streaming
// CHECK-SAME: attributes {arm_streaming}
// CHECK-LOCALLY-LABEL: @arm_streaming
// CHECK-LOCALLY-SAME: attributes {arm_locally_streaming}
+// CHECK-ENABLE-ZA-LABEL: @arm_streaming
+// CHECK-ENABLE-ZA-SAME: attributes {arm_streaming, arm_za}
func.func @arm_streaming() { return }