[llvm] [AArch64][llvm] Redefine some insns as an alias of `SYS` (PR #187004)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 05:57:03 PDT 2026


================
@@ -988,6 +1026,38 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
       Name = std::string(AT->Name);
     }
     break;
+    // GCS aliases.
+    case 7: {
+      if (!(STI.hasFeature(AArch64::FeatureAll) ||
+            STI.hasFeature(AArch64::FeatureGCS)))
+        return false;
+
+      RegSep = "\t";
+      Name = "";
+      if (Op1Val == 0) {
+        NeedsReg = false;
+        if (Op2Val == 4) {
+          Ins = "gcspushx";
+        } else if (Op2Val == 5) {
+          Ins = "gcspopcx";
+        } else if (Op2Val == 6) {
+          Ins = "gcspopx";
+        } else {
+          return false;
+        }
+      } else if (Op1Val == 3) {
+        NeedsReg = true;
+        if (Op2Val == 0) {
+          Ins = "gcspushm";
+        } else if (Op2Val == 2) {
+          Ins = "gcsss1";
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
----------------
kmclaughlin-arm wrote:

Returning early for values not supported would help to simplify this a bit. For example, the `Op1Val == 3` case just needs to be:
```
NeedsReg = true;
if (Op1Val != 0 && Op1Val != 2)
  return false;
Ins = Op2Val == 0 ? "gcspushm" : "gcsss1";
```

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


More information about the llvm-commits mailing list