[clang] [CIR] Upstream insert op for VectorType (PR #139146)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri May 9 11:30:54 PDT 2025


================
@@ -1969,6 +1969,43 @@ def VecCreateOp : CIR_Op<"vec.create", [Pure]> {
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// VecInsertOp
+//===----------------------------------------------------------------------===//
+
+def VecInsertOp : CIR_Op<"vec.insert", [Pure,
+  TypesMatchWith<"argument type matches vector element type", "vec", "value",
+                 "cast<VectorType>($_self).getElementType()">,
+  AllTypesMatch<["result", "vec"]>]> {
+
+  let summary = "Insert one element into a vector object";
+  let description = [{
+    The `cir.vec.insert` operation replaces the element of the given vector at
+    the given index with the given value.  The new vector with the inserted
+    element is returned.
----------------
bcardosolopes wrote:

The description in the incubator is confusing: we don't implicitly store. Perhaps rewrite to something like:
```
The `cir.vec.insert` operation produces a new vector by replacing the element of the input vector at `index` with `value`.
```

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


More information about the cfe-commits mailing list