Lines Matching +full:build +full:- +full:std
1 //===- OpBuildGen.cpp - TableGen OpBuildGen Tests -------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Test TableGen generated build() methods on Operations.
11 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
26 //===----------------------------------------------------------------------===//
50 void verifyOp(OpTy &&concreteOp, std::vector<Type> resultTypes, in verifyOp()
51 std::vector<Value> operands, in verifyOp()
52 std::vector<NamedAttribute> attrs) { in verifyOp()
56 EXPECT_EQ(op->getNumResults(), resultTypes.size()); in verifyOp()
57 for (unsigned idx : llvm::seq(0U, op->getNumResults())) in verifyOp()
58 EXPECT_EQ(op->getResult(idx).getType(), resultTypes[idx]); in verifyOp()
60 EXPECT_EQ(op->getNumOperands(), operands.size()); in verifyOp()
61 for (unsigned idx : llvm::seq(0U, op->getNumOperands())) in verifyOp()
62 EXPECT_EQ(op->getOperand(idx), operands[idx]); in verifyOp()
64 EXPECT_EQ(op->getAttrs().size(), attrs.size()); in verifyOp()
66 EXPECT_EQ(op->getAttr(attrs[idx].first.strref()), attrs[idx].second); in verifyOp()
75 // Test separate arg, separate param build method. in testSingleVariadicInputInferredType()
77 verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs); in testSingleVariadicInputInferredType()
79 // Test collective params build method. in testSingleVariadicInputInferredType()
82 verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs); in testSingleVariadicInputInferredType()
84 // Test build method with no result types, default value of attributes. in testSingleVariadicInputInferredType()
86 verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs); in testSingleVariadicInputInferredType()
88 // Test build method with no result types and supplied attributes. in testSingleVariadicInputInferredType()
90 verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, attrs); in testSingleVariadicInputInferredType()
103 std::vector<NamedAttribute> attrStorage;
107 /// Test basic build methods.
109 // Test separate args, separate results build method. in TEST_F()
113 // Test separate args, collective results build method. in TEST_F()
117 // Test collective args, collective params build method. in TEST_F()
122 // Test collective args, collective results, non-empty attributes in TEST_F()
128 /// The following 3 tests exercise build methods generated for operations
132 /// {single variadic result, non-variadic result, multiple variadic results}
135 /// build() methods that fail to compile.
137 /// Test build methods for an Op with a single varadic arg and a single
143 verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs); in TEST_F()
149 verifyOp(std::move(op), {i32Ty}, {cstI32}, attrs); in TEST_F()
154 verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32, cstF32}, noAttrs); in TEST_F()
160 verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32, cstF32}, attrs); in TEST_F()
163 /// Test build methods for an Op with a single varadic arg and a non-variadic
166 // Test separate arg, separate param build method. in TEST_F()
169 verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs); in TEST_F()
171 // Test collective params build method, no attributes. in TEST_F()
174 verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs); in TEST_F()
176 // Test collective params build method no attributes, 2 inputs. in TEST_F()
179 verifyOp(std::move(op), {i32Ty}, {cstI32, cstF32}, noAttrs); in TEST_F()
181 // Test collective params build method, non-empty attributes. in TEST_F()
184 verifyOp(std::move(op), {i32Ty}, {cstI32, cstF32}, attrs); in TEST_F()
187 /// Test build methods for an Op with a single varadic arg and multiple variadic
191 // Test separate arg, separate param build method. in TEST_F()
194 verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, noAttrs); in TEST_F()
196 // Test collective params build method, no attributes. in TEST_F()
199 verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, noAttrs); in TEST_F()
201 // Test collective params build method, with attributes. in TEST_F()
204 verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, attrs); in TEST_F()
207 // The next 2 tests test supression of ambiguous build methods for ops that
208 // have a single variadic input, and single non-variadic result, and which
211 // build methods with no result types as they are inferred from the input types.