River Riddle 480cd4cb85 [mlir] Move the complex support of std.constant to a new complex.constant operation
This is part of splitting up the standard dialect.

Differential Revision: https://reviews.llvm.org/D118182
2022-01-26 11:52:00 -08:00

24 lines
827 B
MLIR

// RUN: mlir-opt -split-input-file %s -verify-diagnostics
func @complex_constant_wrong_array_attribute_length() {
// expected-error @+1 {{requires 'value' to be a complex constant, represented as array of two values}}
%0 = complex.constant [1.0 : f32] : complex<f32>
return
}
// -----
func @complex_constant_wrong_element_types() {
// expected-error @+1 {{requires attribute's element types ('f32', 'f32') to match the element type of the op's return type ('f64')}}
%0 = complex.constant [1.0 : f32, -1.0 : f32] : complex<f64>
return
}
// -----
func @complex_constant_two_different_element_types() {
// expected-error @+1 {{requires attribute's element types ('f32', 'f64') to match the element type of the op's return type ('f64')}}
%0 = complex.constant [1.0 : f32, -1.0 : f64] : complex<f64>
return
}