173
|
1 // RUN: mlir-opt %s -mlir-disable-threading=true -test-matchers -o /dev/null 2>&1 | FileCheck %s
|
150
|
2
|
|
3 func @test1(%a: f32, %b: f32, %c: f32) {
|
|
4 %0 = addf %a, %b: f32
|
|
5 %1 = addf %a, %c: f32
|
|
6 %2 = addf %c, %b: f32
|
|
7 %3 = mulf %a, %2: f32
|
|
8 %4 = mulf %3, %1: f32
|
|
9 %5 = mulf %4, %4: f32
|
|
10 %6 = mulf %5, %5: f32
|
|
11 return
|
|
12 }
|
|
13
|
|
14 // CHECK-LABEL: test1
|
|
15 // CHECK: Pattern add(*) matched 3 times
|
|
16 // CHECK: Pattern mul(*) matched 4 times
|
|
17 // CHECK: Pattern add(add(*), *) matched 0 times
|
|
18 // CHECK: Pattern add(*, add(*)) matched 0 times
|
|
19 // CHECK: Pattern mul(add(*), *) matched 0 times
|
|
20 // CHECK: Pattern mul(*, add(*)) matched 2 times
|
|
21 // CHECK: Pattern mul(mul(*), *) matched 3 times
|
|
22 // CHECK: Pattern mul(mul(*), mul(*)) matched 2 times
|
|
23 // CHECK: Pattern mul(mul(mul(*), mul(*)), mul(mul(*), mul(*))) matched 1 times
|
|
24 // CHECK: Pattern mul(mul(mul(mul(*), add(*)), mul(*)), mul(mul(*, add(*)), mul(*, add(*)))) matched 1 times
|
|
25 // CHECK: Pattern add(a, b) matched 1 times
|
|
26 // CHECK: Pattern add(a, c) matched 1 times
|
|
27 // CHECK: Pattern add(b, a) matched 0 times
|
|
28 // CHECK: Pattern add(c, a) matched 0 times
|
|
29 // CHECK: Pattern mul(a, add(c, b)) matched 1 times
|
|
30 // CHECK: Pattern mul(a, add(b, c)) matched 0 times
|
|
31 // CHECK: Pattern mul(mul(a, *), add(a, c)) matched 1 times
|
|
32 // CHECK: Pattern mul(mul(a, *), add(c, b)) matched 0 times
|
|
33
|
|
34 func @test2(%a: f32) -> f32 {
|
|
35 %0 = constant 1.0: f32
|
|
36 %1 = addf %a, %0: f32
|
|
37 %2 = mulf %a, %1: f32
|
|
38 return %2: f32
|
|
39 }
|
|
40
|
|
41 // CHECK-LABEL: test2
|
|
42 // CHECK: Pattern add(add(a, constant), a) matched and bound constant to: 1.000000e+00
|
|
43 // CHECK: Pattern add(add(a, constant), a) matched
|