-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir][emitc] Arith to EmitC: handle FP<->Integer conversions
- Loading branch information
1 parent
4d7f3d9
commit bf83b3f
Showing
3 changed files
with
177 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
mlir/test/Conversion/ArithToEmitC/arith-to-emitc-unsupported.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// RUN: mlir-opt -split-input-file -convert-arith-to-emitc -verify-diagnostics %s | ||
|
||
func.func @arith_cast_tensor(%arg0: tensor<5xf32>) -> tensor<5xi32> { | ||
// expected-error @+1 {{failed to legalize operation 'arith.fptosi'}} | ||
%t = arith.fptosi %arg0 : tensor<5xf32> to tensor<5xi32> | ||
return %t: tensor<5xi32> | ||
} | ||
|
||
// ----- | ||
|
||
func.func @arith_cast_vector(%arg0: vector<5xf32>) -> vector<5xi32> { | ||
// expected-error @+1 {{failed to legalize operation 'arith.fptosi'}} | ||
%t = arith.fptosi %arg0 : vector<5xf32> to vector<5xi32> | ||
return %t: vector<5xi32> | ||
} | ||
|
||
// ----- | ||
|
||
func.func @arith_cast_bf16(%arg0: bf16) -> i32 { | ||
// expected-error @+1 {{failed to legalize operation 'arith.fptosi'}} | ||
%t = arith.fptosi %arg0 : bf16 to i32 | ||
return %t: i32 | ||
} | ||
|
||
// ----- | ||
|
||
func.func @arith_cast_f16(%arg0: f16) -> i32 { | ||
// expected-error @+1 {{failed to legalize operation 'arith.fptosi'}} | ||
%t = arith.fptosi %arg0 : f16 to i32 | ||
return %t: i32 | ||
} | ||
|
||
|
||
// ----- | ||
|
||
func.func @arith_cast_to_bf16(%arg0: i32) -> bf16 { | ||
// expected-error @+1 {{failed to legalize operation 'arith.sitofp'}} | ||
%t = arith.sitofp %arg0 : i32 to bf16 | ||
return %t: bf16 | ||
} | ||
|
||
// ----- | ||
|
||
func.func @arith_cast_to_f16(%arg0: i32) -> f16 { | ||
// expected-error @+1 {{failed to legalize operation 'arith.sitofp'}} | ||
%t = arith.sitofp %arg0 : i32 to f16 | ||
return %t: f16 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters