1 // RUN: mlir-opt %s | mlir-opt | FileCheck %s
2 // RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
5 // CHECK-LABEL: func @ops(
6 // CHECK-SAME: %[[F:.*]]: f32) {
7 func.func @ops(%f: f32) {
8 // CHECK: complex.constant [1.{{.*}}, -1.{{.*}}] : complex<f64>
9 %cst_f64 = complex.constant [0.1, -1.0] : complex<f64>
11 // CHECK: complex.constant [1.{{.*}} : f32, -1.{{.*}} : f32] : complex<f32>
12 %cst_f32 = complex.constant [0.1 : f32, -1.0 : f32] : complex<f32>
14 // CHECK: complex.constant [true, false] : complex<i1>
15 %cst_i1 = complex.constant [1 : i1, 0 : i1] : complex<i1>
17 // CHECK: %[[C:.*]] = complex.create %[[F]], %[[F]] : complex<f32>
18 %complex = complex.create %f, %f : complex<f32>
20 // CHECK: complex.re %[[C]] : complex<f32>
21 %real = complex.re %complex : complex<f32>
23 // CHECK: complex.im %[[C]] : complex<f32>
24 %imag = complex.im %complex : complex<f32>
26 // CHECK: complex.abs %[[C]] : complex<f32>
27 %abs = complex.abs %complex : complex<f32>
29 // CHECK: complex.add %[[C]], %[[C]] : complex<f32>
30 %sum = complex.add %complex, %complex : complex<f32>
32 // CHECK: complex.cos %[[C]] : complex<f32>
33 %cos = complex.cos %complex : complex<f32>
35 // CHECK: complex.div %[[C]], %[[C]] : complex<f32>
36 %div = complex.div %complex, %complex : complex<f32>
38 // CHECK: complex.eq %[[C]], %[[C]] : complex<f32>
39 %eq = complex.eq %complex, %complex : complex<f32>
41 // CHECK: complex.exp %[[C]] : complex<f32>
42 %exp = complex.exp %complex : complex<f32>
44 // CHECK: complex.expm1 %[[C]] : complex<f32>
45 %expm1 = complex.expm1 %complex : complex<f32>
47 // CHECK: complex.log %[[C]] : complex<f32>
48 %log = complex.log %complex : complex<f32>
50 // CHECK: complex.log1p %[[C]] : complex<f32>
51 %log1p = complex.log1p %complex : complex<f32>
53 // CHECK: complex.mul %[[C]], %[[C]] : complex<f32>
54 %prod = complex.mul %complex, %complex : complex<f32>
56 // CHECK: complex.neg %[[C]] : complex<f32>
57 %neg = complex.neg %complex : complex<f32>
59 // CHECK: complex.neq %[[C]], %[[C]] : complex<f32>
60 %neq = complex.neq %complex, %complex : complex<f32>
62 // CHECK: complex.sign %[[C]] : complex<f32>
63 %sign = complex.sign %complex : complex<f32>
65 // CHECK: complex.sin %[[C]] : complex<f32>
66 %sin = complex.sin %complex : complex<f32>
68 // CHECK: complex.sub %[[C]], %[[C]] : complex<f32>
69 %diff = complex.sub %complex, %complex : complex<f32>
71 // CHECK: complex.tanh %[[C]] : complex<f32>
72 %tanh = complex.tanh %complex : complex<f32>
74 // CHECK: complex.pow %[[C]], %[[C]] : complex<f32>
75 %pow = complex.pow %complex, %complex : complex<f32>
77 // CHECK: complex.sqrt %[[C]] : complex<f32>
78 %sqrt = complex.sqrt %complex : complex<f32>
80 // CHECK: complex.rsqrt %[[C]] : complex<f32>
81 %rsqrt = complex.rsqrt %complex : complex<f32>
83 // CHECK: complex.atan2 %[[C]], %[[C]] : complex<f32>
84 %atan2 = complex.atan2 %complex, %complex : complex<f32>
86 // CHECK: complex.tan %[[C]] : complex<f32>
87 %tan = complex.tan %complex : complex<f32>
89 // CHECK: complex.bitcast %[[C]]
90 %i64 = complex.bitcast %complex : complex<f32> to i64