1 // RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s
3 // CHECK-DAG: #set{{[0-9]*}} = affine_set<() : (0 == 0)>
4 #set0 = affine_set<() : ()>
6 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 == 0)>
7 #set1 = affine_set<(i) : (i == 0)>
9 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 >= 0)>
10 #set2 = affine_set<(i) : (i >= 0)>
12 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1) : (d0 >= 0, d1 >= 0)>
13 #set3 = affine_set<(i, j) : (i >= 0, j >= 0)>
15 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
16 #set4 = affine_set<(i, j) : (i == 0, j >= 0)>
18 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (d0 * 2 + s0 >= 0, d1 * 2 + s1 >= 0, d0 >= 0, d1 >= 0, s0 == 0, s1 == 0)>
19 #set5 = affine_set<(i, j)[N, M] : (i * 2 + N >= 0, j * 2 + M >= 0, i >= 0, j >= 0, N == 0, M == 0)>
21 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-d0 + s0 >= 0, -d1 + s1 >= 0, d0 >= 0, d1 >= 0)>
22 #set6 = affine_set<(i, j)[N, M] : (N - i >= 0, M - j >= 0, i >= 0, j >= 0)>
24 // Check if affine constraints with affine exprs on RHS can be parsed.
26 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 - 1 == 0)>
27 #set7 = affine_set<(i) : (i == 1)>
29 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)>
30 #set8 = affine_set<(i)[N, M] : (i >= 0, N >= i, N == 5, M + 1 >= i)>
32 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, d0 - d1 >= 0)>
33 #set9 = affine_set<(i, j)[N] : (i >= 0, N >= i, j >= 0, i >= j)>
35 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) == 0, d0 + d1 - (s0 + s1) == 0)>
36 #set10 = affine_set<(i0, i1)[N, M] : (0 == i0 + i1 + N + M, i0 + i1 == N + M)>
38 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) >= 0, d0 + d1 - (s0 + s1) >= 0)>
39 #set11 = affine_set<(i0, i1)[N, M] : (0 >= i0 + i1 + N + M, i0 + i1 >= N + M)>
41 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1, d2, d3) : ((d0 + d1) mod 2 - (d2 + d3) floordiv 2 == 0, d0 mod 2 + d1 mod 2 - (d2 + d3 + d2) >= 0)>
42 #set12 = affine_set<(d0, d1, r0, r1) : ((d0 + d1) mod 2 == (r0 + r1) floordiv 2, ((d0) mod 2) + ((d1) mod 2) >= (r0 + r1) + r0)>
44 // Check if affine constraints with <= can be parsed.
46 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (-d0 >= 0)>
47 #set13 = affine_set<(i) : (i <= 0)>
49 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 >= 0, -d0 + 10 >= 0)>
50 #set14 = affine_set<(i) : (i >= 0, i <= 10)>
52 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, -d1 + s1 >= 0)>
53 #set15 = affine_set<(i, j)[N, M] : (i >= 0, i <= N, j >= 0, j <= M)>
55 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0] : (d0 >= 0, -d0 + s0 >= 0, -d0 + s0 floordiv 2 >= 0)>
56 #set16 = affine_set<(i)[N] : (i >= 0, i <= N, i <= N floordiv 2)>
58 // CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1, d2, d3, d4) : (-d0 >= 0, -d1 >= 0, -d2 >= 0, -d3 >= 0, -d4 >= 0)>
59 #set17 = affine_set<(i0, i1, i2, i3, i4)[] : (i0 <= 0, i1 <= 0, i2 <= 0, i3 <= 0, i4 <= 0)>
61 // CHECK-DAG: "testset0"() {set = #set{{[0-9]*}}} : () -> ()
62 "testset0"() {set = #set0} : () -> ()
64 // CHECK-DAG: "testset1"() {set = #set{{[0-9]*}}} : () -> ()
65 "testset1"() {set = #set1} : () -> ()
67 // CHECK-DAG: "testset2"() {set = #set{{[0-9]*}}} : () -> ()
68 "testset2"() {set = #set2} : () -> ()
70 // CHECK-DAG: "testset3"() {set = #set{{[0-9]*}}} : () -> ()
71 "testset3"() {set = #set3} : () -> ()
73 // CHECK-DAG: "testset4"() {set = #set{{[0-9]*}}} : () -> ()
74 "testset4"() {set = #set4} : () -> ()
76 // CHECK-DAG: "testset5"() {set = #set{{[0-9]*}}} : () -> ()
77 "testset5"() {set = #set5} : () -> ()
79 // CHECK-DAG: "testset6"() {set = #set{{[0-9]*}}} : () -> ()
80 "testset6"() {set = #set6} : () -> ()
82 // CHECK-DAG: "testset7"() {set = #set{{[0-9]*}}} : () -> ()
83 "testset7"() {set = #set7} : () -> ()
85 // CHECK-DAG: "testset8"() {set = #set{{[0-9]*}}} : () -> ()
86 "testset8"() {set = #set8} : () -> ()
88 // CHECK-DAG: "testset9"() {set = #set{{[0-9]*}}} : () -> ()
89 "testset9"() {set = #set9} : () -> ()
91 // CHECK-DAG: "testset10"() {set = #set{{[0-9]*}}} : () -> ()
92 "testset10"() {set = #set10} : () -> ()
94 // CHECK-DAG: "testset11"() {set = #set{{[0-9]*}}} : () -> ()
95 "testset11"() {set = #set11} : () -> ()
97 // CHECK-DAG: "testset12"() {set = #set{{[0-9]*}}} : () -> ()
98 "testset12"() {set = #set12} : () -> ()
100 // CHECK-DAG: "testset13"() {set = #set{{[0-9]*}}} : () -> ()
101 "testset13"() {set = #set13} : () -> ()
103 // CHECK-DAG: "testset14"() {set = #set{{[0-9]*}}} : () -> ()
104 "testset14"() {set = #set14} : () -> ()
106 // CHECK-DAG: "testset15"() {set = #set{{[0-9]*}}} : () -> ()
107 "testset15"() {set = #set15} : () -> ()
109 // CHECK-DAG: "testset16"() {set = #set{{[0-9]*}}} : () -> ()
110 "testset16"() {set = #set16} : () -> ()
112 // CHECK-DAG: "testset17"() {set = #set{{[0-9]*}}} : () -> ()
113 "testset17"() {set = #set17} : () -> ()