[clang] [CIR] Upstream extract op for VectorType (PR #138413)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Sat May 3 12:30:29 PDT 2025


================
@@ -1976,4 +1976,28 @@ def VecCreateOp : CIR_Op<"vec.create", [Pure]> {
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// VecExtractOp
+//===----------------------------------------------------------------------===//
+
+def VecExtractOp : CIR_Op<"vec.extract", [Pure,
+  TypesMatchWith<"type of 'result' matches element type of 'vec'", "vec",
+                 "result", "cast<VectorType>($_self).getElementType()">]> {
+
+  let summary = "Extract one element from a vector object";
+  let description = [{
+    The `cir.vec.extract` operation extracts the element at the given index
+    from a vector object.
----------------
xlauko wrote:

nit: can we add some example here?

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


More information about the cfe-commits mailing list