xref: /llvm-project/mlir/test/Dialect/Complex/invalid.mlir (revision 192439db6e3fcccf98c850bda1b970a11c590bbb)
1// RUN: mlir-opt -split-input-file %s -verify-diagnostics
2
3func.func @complex_constant_wrong_array_attribute_length() {
4  // expected-error @+1 {{requires 'value' to be a complex constant, represented as array of two values}}
5  %0 = complex.constant [1.0 : f32] : complex<f32>
6  return
7}
8
9// -----
10
11func.func @complex_constant_wrong_element_types() {
12  // expected-error @+1 {{requires attribute's element types ('f32', 'f32') to match the element type of the op's return type ('f64')}}
13  %0 = complex.constant [1.0 : f32, -1.0 : f32] : complex<f64>
14  return
15}
16
17// -----
18
19func.func @complex_constant_two_different_element_types() {
20  // expected-error @+1 {{requires attribute's element types ('f32', 'f64') to match the element type of the op's return type ('f64')}}
21  %0 = complex.constant [1.0 : f32, -1.0 : f64] : complex<f64>
22  return
23}
24
25// -----
26
27func.func @complex_bitcast_i64(%arg0 : i64) {
28  // expected-error @+1 {{op requires that either input or output has a complex type}}
29  %0 = complex.bitcast %arg0: i64 to f64
30  return
31}
32