Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Dialect/LLVMIR/invalid.mlir
Show First 20 Lines • Show All 607 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
// ----- | // ----- | ||||
func @invalid_ordering_in_fence() { | func @invalid_ordering_in_fence() { | ||||
// expected-error @+1 {{can be given only acquire, release, acq_rel, and seq_cst orderings}} | // expected-error @+1 {{can be given only acquire, release, acq_rel, and seq_cst orderings}} | ||||
llvm.fence syncscope("agent") monotonic | llvm.fence syncscope("agent") monotonic | ||||
} | } | ||||
// ----- | |||||
// Check dialect cast operation verifier. | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (index) | |||||
// expected-error @+2 {{incorrect cast}} | |||||
// expected-note @+1 {{casting is supported for}} | |||||
%1 = llvm.mlir.cast %0 : index to !llvm.i64 | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (f32) | |||||
// expected-error @+1 {{incorrect cast between two non-LLVM types}} | |||||
%1 = llvm.mlir.cast %0 : f32 to f16 | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (!llvm.i32) | |||||
// expected-error @+1 {{incorrect cast between two different LLVM types}} | |||||
%1 = llvm.mlir.cast %0 : !llvm.i32 to !llvm.float | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (f32) | |||||
// expected-error @+2 {{incorrect cast}} | |||||
// expected-note @+1 {{casting is supported for}} | |||||
%1 = llvm.mlir.cast %0 : f32 to !llvm.half | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (vector<2x3xf32>) | |||||
// expected-error @+1 {{only 1-d vector is allowed}} | |||||
%1 = llvm.mlir.cast %0 : vector<2x3xf32> to !llvm<"[2 x <3 x float>]"> | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (vector<2xf32>) | |||||
// expected-error @+1 {{incorrect cast between vector and non-vector types}} | |||||
%1 = llvm.mlir.cast %0 : vector<2xf32> to !llvm.float | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (vector<2xf32>) | |||||
// expected-error @+1 {{vector elements must have matching non-index integer types or float types}} | |||||
%1 = llvm.mlir.cast %0 : vector<2xf32> to !llvm<"<2 x i32>"> | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (memref<2xf32>) | |||||
// expected-error @+1 {{memref can be cast only from/to memref decriptor struct type}} | |||||
%1 = llvm.mlir.cast %0 : memref<2xf32> to !llvm.float | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (memref<2xf32>) | |||||
// expected-error @+1 {{incorrect number of elements in memref descriptor struct}} | |||||
%1 = llvm.mlir.cast %0 : memref<2xf32> to !llvm<"{float*, float*, i64}"> | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (memref<2xf32>) | |||||
// expected-error @+1 {{first and second element of memref descriptor must have pointer type}} | |||||
%1 = llvm.mlir.cast %0 : memref<2xf32> to !llvm<"{float, float*, i64, [2 x i64], [2 x i64]}"> | |||||
} | |||||
// ----- | |||||
func @invaild_dialect_cast() { | |||||
%0 = "op"() : () -> (memref<2xf32>) | |||||
// expected-error @+1 {{first and second element of memref descriptor must have same types, that is pointer to type convertible to memref's element type}} | |||||
%1 = llvm.mlir.cast %0 : memref<2xf32> to !llvm<"{half*, half*, i64, [2 x i64], [2 x i64]}"> | |||||
} |