[clang] [llvm] [AArch64][SME] Improve codegen for aarch64.sme.cnts* when not in streaming mode (PR #154761)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 07:41:00 PDT 2025


================
@@ -156,16 +156,15 @@ let SMETargetGuard = "sme2p1" in {
 ////////////////////////////////////////////////////////////////////////////////
 // SME - Counting elements in a streaming vector
 
-multiclass ZACount<string n_suffix> {
-  def NAME : SInst<"sv" # n_suffix, "nv", "", MergeNone,
-                    "aarch64_sme_" # n_suffix,
-                    [IsOverloadNone, IsStreamingCompatible]>;
+multiclass ZACount<string intr, string n_suffix> {
+  def NAME : SInst<"sv"#n_suffix, "nv", "", MergeNone,
+                   intr, [IsOverloadNone, IsStreamingCompatible]>;
 }
 
-defm SVCNTSB : ZACount<"cntsb">;
-defm SVCNTSH : ZACount<"cntsh">;
-defm SVCNTSW : ZACount<"cntsw">;
-defm SVCNTSD : ZACount<"cntsd">;
+defm SVCNTSB : ZACount<"", "cntsb">;
+defm SVCNTSH : ZACount<"", "cntsh">;
+defm SVCNTSW : ZACount<"", "cntsw">;
+defm SVCNTSD : ZACount<"aarch64_sme_cntsd", "cntsd">;
----------------
paulwalker-arm wrote:

I've changed this code locally several times but it has never ended up in a PR so if you don't mind I'll ask you to do it.  Basically, I hate the `ZACount` class because it offers no value and is inconsistent with how all the other builtins are declared.  Do you mind removing it and just declaring `def SVCNTSB` and friends using `SInst` directly?

https://github.com/llvm/llvm-project/pull/154761


More information about the llvm-commits mailing list