Skip to content

Commit 7521f1a

Browse files
committed
Add CIR_IntArrayAttr and update Op description
1 parent 758e921 commit 7521f1a

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
//===----------------------------------------------------------------------===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -39,4 +38,11 @@ def CIR_AnyIntOrFloatAttr : AnyAttrOf<[CIR_AnyIntAttr, CIR_AnyFPAttr],
3938
string cppType = "::mlir::TypedAttr";
4039
}
4140

42-
#endif // CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD
41+
//===----------------------------------------------------------------------===//
42+
// ArrayAttr constraints
43+
//===----------------------------------------------------------------------===//
44+
45+
def CIR_IntArrayAttr : TypedArrayAttrBase<CIR_AnyIntAttr,
46+
"integer array attribute">;
47+
48+
#endif // CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
include "clang/CIR/Dialect/IR/CIRDialect.td"
1818
include "clang/CIR/Dialect/IR/CIRTypes.td"
1919
include "clang/CIR/Dialect/IR/CIRAttrs.td"
20+
include "clang/CIR/Dialect/IR/CIRAttrConstraints.td"
2021

2122
include "clang/CIR/Interfaces/CIROpInterfaces.td"
2223
include "clang/CIR/Interfaces/CIRLoopOpInterface.td"
@@ -2177,7 +2178,9 @@ def VecShuffleOp : CIR_Op<"vec.shuffle",
21772178
doesn't matter. The result vector, which must have the same element type as
21782179
the input vectors and the same number of elements as the list of integer
21792180
constant indices, is constructed by taking the elements at the given
2180-
indices from the concatenated vector.
2181+
indices from the concatenated vector. The size of the result vector does
2182+
not have to match the size of the individual input vectors or of the
2183+
concatenated vector.
21812184

21822185
```mlir
21832186
%new_vec = cir.vec.shuffle(%vec_1, %vec_2 : !cir.vector<2 x !s32i>)
@@ -2188,7 +2191,7 @@ def VecShuffleOp : CIR_Op<"vec.shuffle",
21882191
let arguments = (ins
21892192
CIR_VectorType:$vec1,
21902193
CIR_VectorType:$vec2,
2191-
TypedArrayAttrBase<IntAttr, "Integer array attribute">:$indices
2194+
CIR_IntArrayAttr:$indices
21922195
);
21932196

21942197
let results = (outs CIR_VectorType:$result);

clang/include/clang/CIR/Dialect/IR/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ mlir_tablegen(CIRTypeConstraints.h.inc -gen-type-constraint-decls)
2525
mlir_tablegen(CIRTypeConstraints.cpp.inc -gen-type-constraint-defs)
2626
add_public_tablegen_target(MLIRCIRTypeConstraintsIncGen)
2727
add_dependencies(mlir-headers MLIRCIRTypeConstraintsIncGen)
28+
29+
set(LLVM_TARGET_DEFINITIONS CIRAttrConstraints.td)
30+
mlir_tablegen(CIRAttrConstraints.h.inc -gen-type-constraint-decls)
31+
mlir_tablegen(CIRAttrConstraints.cpp.inc -gen-type-constraint-defs)
32+
add_public_tablegen_target(MLIRCIRAttrConstraintsIncGen)
33+
add_dependencies(mlir-headers MLIRCIRAttrConstraintsIncGen)

0 commit comments

Comments
 (0)