...
1// CHECK-LABEL: func @func_with_ops(%arg0: f32) {
2func @func_with_ops(%a : f32) {
3 // CHECK: %0 = "getTensor"() : () -> tensor<4x4x?xf32>
4 %t = "getTensor"() : () -> tensor<4x4x?xvector<10xf32>>>
5
6 %i6 = muli %i2, %i2 : i32
7 %t2 = "std.dim"(%t){index = 2} : (tensor<4x4x?xvector<10xf32>>) -> index
8 %x = "foo"(%a, %a) : (f32,f32) -> (memref<1 x i32, (d0) -> (d0), 4>)
9
10 return
11}
12
13func @count(%x: tensor<i64) -> (i64, i64)
14 attributes {fruit = "banana"} {
15 return %x, %x: i64, i64
16}
17
18func @correct_number_of_regions() {
19 // CHECK: test.two_region_op
20 "test.two_region_op"()(
21 {"work"() : () -> ()},
22 {"work"() : () -> ()}
23 ) : () -> ()
24 return
25}
26
27func @inline_notation() -> i32 {
28 %1 = "foo"() : () -> i32 loc("foo")
29 %1p = "foo"() : () -> i32 loc(fused<"myPass">["abc", "de"])
30
31 // CHECK: constant 4 : index loc(callsite("foo" at "mysource.cc":10:8))
32 %2 = constant 4 : index loc(callsite("foo" at "mysource.cc":10:8))
33
34 affine.for %i0 = 0 to 8 {
35 } loc(fused["foo", "mysource.cc":10:8])
36
37 affine.if #set0(%2) {
38 } loc(fused<"myPass">["foo", "foo2"])
39
40 return %1 : i32 loc(unknown)
41}
42
43func @simple(i64, i1) -> i64 {
44^bb0(%a: i64, %cond: i1): // Code dominated by ^bb0 may refer to %a
45 cond_br %cond, ^bb1, ^bb2
46
47^bb1:
48 br ^bb3(%a: i64) // Branch passes %a as the argument
49
50^bb2:
51 %b = addi %a, %a : i64
52 br ^bb3(%b: i64) // Branch passes %b as the argument
53
54// ^bb3 receives an argument, named %c, from predecessors
55// and passes it on to bb4 twice.
56^bb3(%c: i64):
57 br ^bb4(%c, %c : i64, i64)
58
59^bb4(%d : i64, %e : i64):
60 %0 = addi %d, %e : i64
61 return %0 : i64
62}
63
64// CHECK-LABEL: func @func_with_ops(%arg0: f32) {
65func @func_with_ops(f32) {
66^bb0(%a : f32):
67 %t = "getTensor"() : () -> tensor<4x4x?xf32>
68 %t2 = "std.dim"(%t){index = 2} : (tensor<4x4x?xf32>) -> index
69
70 %x = "std.addf"(%a, %a) : (f32,f32) -> (f32) // help
71
72 return
73}
74
75func @multiblock() {
76 return // CHECK: return
77^bb1: // CHECK: ^bb1: // no predecessors
78 br ^bb4 // CHECK: br ^bb3
79^bb2: // CHECK: ^bb2: // pred: ^bb2
80 br ^bb2 // CHECK: br ^bb2
81^bb4: // CHECK: ^bb3: // pred: ^bb1
82 return // CHECK: return
83}
84
85func @dialect_attribute_with_type() {
86 "foo.unknown_op"() {foo = #foo.attr : i32} : () -> ()
87}
88
89func @inline_notation() -> i32 {
90 %1 = "foo"() : () -> i32 loc("foo")
91
92 %2 = constant 4 : index loc(callsite("foo" at "mysource.cc":10:8))
93
94 affine.for %i0 = 0 to 8 {
95 } loc(fused["foo", "mysource.cc":10:8])
96
97 affine.if #set0(%2) {
98 } loc(fused<"myPass">["foo", "foo2"])
99
100 return %1 : i32 loc(unknown)
101}
102
View as plain text