[clang] [CIR] Implement Matrix-Insert and do lowering to it for lvalue subscript (PR #230600)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 9 12:53:27 PDT 2026


================
@@ -6628,6 +6628,47 @@ def CIR_MatrixExtractOp : CIR_Op<"matrix.extract", [
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// MatrixInsertOp
+//===----------------------------------------------------------------------===//
+
+def CIR_MatrixInsertOp : CIR_Op<"matrix.insert", [
+  Pure,
+  AllTypesMatch<["matrix", "result"]>,
+  TypesMatchWith<"type of 'value' matches element type of 'matrix'",
+    "matrix", "value", "mlir::cast<cir::MatrixType>($_self).getElementType()">
+]> {
+  let summary = "Insert one element into a matrix object";
+  let description = [{
+    The `cir.matrix.insert` operation returns a copy of a matrix object with
+    the element at the given row and column indices replaced by `value`.
+
+    Currently, the flatten index is a column-based index.
----------------
andykaylor wrote:

https://github.com/llvm/llvm-project/issues/230638

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


More information about the cfe-commits mailing list