[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.
+ }];
+
+ let arguments = (ins CIR_VectorType:$vec, CIR_AnyFundamentalIntType:$index);
+ let results = (outs CIR_AnyType:$result);
+
+ let assemblyFormat = [{
+ $vec `[` $index `:` type($index) `]` attr-dict `:` qualified(type($vec))
+ }];
+
+ let hasVerifier = 0;
----------------
xlauko wrote:
nit: this is implicit
```suggestion
```
https://github.com/llvm/llvm-project/pull/138413
More information about the cfe-commits
mailing list