File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ===- AffineExprTest.cpp - unit tests for affine expression API ----------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " mlir/IR/AffineExpr.h"
10
+ #include " mlir/IR/Builders.h"
11
+ #include " gtest/gtest.h"
12
+
13
+ using namespace mlir ;
14
+
15
+ // Test creating AffineExprs using the overloaded binary operators.
16
+ TEST (AffineExprTest, constructFromBinaryOperators) {
17
+ MLIRContext ctx;
18
+ OpBuilder b (&ctx);
19
+
20
+ auto d0 = b.getAffineDimExpr (0 );
21
+ auto d1 = b.getAffineDimExpr (1 );
22
+
23
+ auto sum = d0 + d1;
24
+ auto difference = d0 - d1;
25
+ auto product = d0 * d1;
26
+ auto remainder = d0 % d1;
27
+
28
+ ASSERT_EQ (sum.getKind (), AffineExprKind::Add);
29
+ ASSERT_EQ (difference.getKind (), AffineExprKind::Add);
30
+ ASSERT_EQ (product.getKind (), AffineExprKind::Mul);
31
+ ASSERT_EQ (remainder.getKind (), AffineExprKind::Mod);
32
+ }
Original file line number Diff line number Diff line change 1
1
add_mlir_unittest (MLIRIRTests
2
2
AdaptorTest.cpp
3
+ AffineExprTest.cpp
3
4
AffineMapTest.cpp
4
5
AttributeTest.cpp
5
6
DialectTest.cpp
You can’t perform that action at this time.
0 commit comments