[clang] [llvm] [RISCV] Add MC layer support for XSfmm*. (PR #133031)

Philip Reames via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 17 11:09:41 PDT 2025


================
@@ -0,0 +1,276 @@
+//===-- RISCVInstrInfoXsfmm.td - SiFive matrix multiply ----*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file describes the Xsfmm* vendor extensions defined by SiFive.
+//
+//===----------------------------------------------------------------------===//
+
+def XSfmmVTypeAsmOperand : AsmOperandClass {
+  let Name = "XSfmmVType";
+  let ParserMethod = "parseXSfmmVType";
+  let DiagnosticType = "InvalidXSfmmVType";
+  let RenderMethod = "addVTypeIOperands";
+}
+
+def XSfmmVTypeOp : RISCVOp {
+  let ParserMatchClass = XSfmmVTypeAsmOperand;
+  let PrintMethod = "printXSfmmVType";
+  let OperandType = "OPERAND_XSFMM_VTYPE";
+  let MCOperandPredicate = [{
+    int64_t Imm;
+    if (!MCOp.evaluateAsConstantImm(Imm))
+      return false;
+    if (!isUInt<32>(Imm))
+      return false;
+    return RISCVVType::isValidXSfmmVType(Imm);
+  }];
+}
+
+let hasSideEffects = 1, mayLoad = 0, mayStore = 0 in
+class RVInstSetSingle<dag outs, dag ins, bits<5> rs2, string opcodestr,
----------------
preames wrote:

All the classes should be prefixed with Sf

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


More information about the cfe-commits mailing list