xref: /llvm-project/mlir/test/Dialect/IRDL/cmath.irdl.mlir (revision 69d3ba3db922fca8cfc47b5f115b6bea6a737aab)
1// RUN: mlir-opt %s | mlir-opt | FileCheck %s
2
3module {
4  // CHECK-LABEL: irdl.dialect @cmath {
5  irdl.dialect @cmath {
6
7    // CHECK: irdl.type @complex {
8    // CHECK:   %[[v0:[^ ]*]] = irdl.is f32
9    // CHECK:   %[[v1:[^ ]*]] = irdl.is f64
10    // CHECK:   %[[v2:[^ ]*]] = irdl.any_of(%[[v0]], %[[v1]])
11    // CHECK:   irdl.parameters(elem: %[[v2]])
12    // CHECK: }
13    irdl.type @complex {
14      %0 = irdl.is f32
15      %1 = irdl.is f64
16      %2 = irdl.any_of(%0, %1)
17      irdl.parameters(elem: %2)
18    }
19
20    // CHECK: irdl.operation @norm {
21    // CHECK:   %[[v0:[^ ]*]] = irdl.any
22    // CHECK:   %[[v1:[^ ]*]] = irdl.parametric @cmath::@complex<%[[v0]]>
23    // CHECK:   irdl.operands(complex: %[[v1]])
24    // CHECK:   irdl.results(norm: %[[v0]])
25    // CHECK: }
26    irdl.operation @norm {
27      %0 = irdl.any
28      %1 = irdl.parametric @cmath::@complex<%0>
29      irdl.operands(complex: %1)
30      irdl.results(norm: %0)
31    }
32
33    // CHECK: irdl.operation @mul {
34    // CHECK:   %[[v0:[^ ]*]] = irdl.is f32
35    // CHECK:   %[[v1:[^ ]*]] = irdl.is f64
36    // CHECK:   %[[v2:[^ ]*]] = irdl.any_of(%[[v0]], %[[v1]])
37    // CHECK:   %[[v3:[^ ]*]] = irdl.parametric @cmath::@complex<%[[v2]]>
38    // CHECK:   irdl.operands(lhs: %[[v3]], rhs: %[[v3]])
39    // CHECK:   irdl.results(res: %[[v3]])
40    // CHECK: }
41    irdl.operation @mul {
42      %0 = irdl.is f32
43      %1 = irdl.is f64
44      %2 = irdl.any_of(%0, %1)
45      %3 = irdl.parametric @cmath::@complex<%2>
46      irdl.operands(lhs: %3, rhs: %3)
47      irdl.results(res: %3)
48    }
49
50  }
51}
52