Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Conversion/StandardToLLVM/invalid.mlir
// RUN: mlir-opt %s -convert-std-to-llvm -verify-diagnostics -split-input-file | // RUN: mlir-opt %s -convert-std-to-llvm -verify-diagnostics -split-input-file | ||||
func @mlir_cast_to_llvm(%0 : index) -> !llvm.i64 { | func @mlir_cast_to_llvm(%0 : index) -> !llvm.i64 { | ||||
// expected-error@+1 {{'llvm.mlir.cast' op type must be non-index integer types, float types, or vector of mentioned types}} | // expected-error@+2 {{'llvm.mlir.cast' op incorrect cast}} | ||||
// expected-note@+1 {{casting is supported for}} | |||||
%1 = llvm.mlir.cast %0 : index to !llvm.i64 | %1 = llvm.mlir.cast %0 : index to !llvm.i64 | ||||
return %1 : !llvm.i64 | return %1 : !llvm.i64 | ||||
} | } | ||||
// ----- | // ----- | ||||
func @mlir_cast_from_llvm(%0 : !llvm.i64) -> index { | func @mlir_cast_from_llvm(%0 : !llvm.i64) -> index { | ||||
// expected-error@+1 {{'llvm.mlir.cast' op type must be non-index integer types, float types, or vector of mentioned types}} | // expected-error@+2 {{'llvm.mlir.cast' op incorrect cast}} | ||||
// expected-note@+1 {{casting is supported for}} | |||||
%1 = llvm.mlir.cast %0 : !llvm.i64 to index | %1 = llvm.mlir.cast %0 : !llvm.i64 to index | ||||
return %1 : index | return %1 : index | ||||
} | } | ||||
// ----- | // ----- | ||||
func @mlir_cast_to_llvm_int(%0 : i32) -> !llvm.i64 { | func @mlir_cast_to_llvm_int(%0 : i32) -> !llvm.i64 { | ||||
// expected-error@+1 {{failed to legalize operation 'llvm.mlir.cast' that was explicitly marked illegal}} | // expected-error@+2 {{'llvm.mlir.cast' op incorrect cast}} | ||||
// expected-note@+1 {{casting is supported for}} | |||||
%1 = llvm.mlir.cast %0 : i32 to !llvm.i64 | %1 = llvm.mlir.cast %0 : i32 to !llvm.i64 | ||||
return %1 : !llvm.i64 | return %1 : !llvm.i64 | ||||
} | } | ||||
// ----- | // ----- | ||||
func @mlir_cast_to_llvm_vec(%0 : vector<1x1xf32>) -> !llvm<"<1 x float>"> { | func @mlir_cast_to_llvm_vec(%0 : vector<1x1xf32>) -> !llvm<"<1 x float>"> { | ||||
// expected-error@+1 {{'llvm.mlir.cast' op only 1-d vector is allowed}} | // expected-error@+1 {{'llvm.mlir.cast' op only 1-d vector is allowed}} | ||||
%1 = llvm.mlir.cast %0 : vector<1x1xf32> to !llvm<"<1 x float>"> | %1 = llvm.mlir.cast %0 : vector<1x1xf32> to !llvm<"<1 x float>"> | ||||
return %1 : !llvm<"<1 x float>"> | return %1 : !llvm<"<1 x float>"> | ||||
} | } |