-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dialect: (builtin) Custom syntax for UnrealizedConversionCastOp #1406
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cfc6db9
dialect: (builtin) Custom syntax for UnrealizedConversionCastOp
kingiler 4ad1145
dialect: (builtin) add test for unrealized_conversion_cast
kingiler d957a4f
misc: better coding style
kingiler e1e8dd0
dialect: (builtin) add print and parsing of attr dict for UnrealizedC…
kingiler eeea90c
Merge branch 'main' into custom_syntax_cast
kingiler 0c5256c
misc: update test
kingiler 46f0fb5
Merge branch 'main' into custom_syntax_cast
kingiler db604eb
tests: Add interop for UnrealizedConversionCastOp
kingiler c86f44c
Merge branch 'main' into custom_syntax_cast
kingiler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 11 additions & 5 deletions
16
tests/filecheck/dialects/builtin/unrealized_conv_cast.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 |
---|---|---|
@@ -1,16 +1,22 @@ | ||
// RUN: xdsl-opt %s | xdsl-opt --print-op-generic | filecheck %s | ||
// RUN: xdsl-opt %s | xdsl-opt --print-op-generic | xdsl-opt | filecheck %s | ||
|
||
// CHECK: module | ||
"builtin.module"() ({ | ||
"func.func"() ({ | ||
// CHECK: %0 = "arith.constant"() {"value" = 0 : i64} : () -> i64 | ||
// CHECK: %0 = arith.constant 0 : i64 | ||
%0 = "arith.constant"() {"value" = 0 : i64} : () -> i64 | ||
// CHECK: %1 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> f32 | ||
// CHECK: %1 = builtin.unrealized_conversion_cast %0 : i64 to f32 | ||
%1 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> f32 | ||
// CHECK: %2 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i32 | ||
// CHECK: %2 = builtin.unrealized_conversion_cast %0 : i64 to i32 | ||
%2 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i32 | ||
// CHECK: %3 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i64 | ||
// CHECK: %3 = builtin.unrealized_conversion_cast %0 : i64 to i64 | ||
%3 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i64 | ||
// CHECK: %4 = builtin.unrealized_conversion_cast to i64 {"comment" = "test"} | ||
%4 = "builtin.unrealized_conversion_cast"() {"comment" = "test"} : () -> i64 | ||
// CHECK: %5 = builtin.unrealized_conversion_cast %0, %0 : i64, i64 to f32 | ||
%5 = "builtin.unrealized_conversion_cast"(%0, %0) : (i64, i64) -> f32 | ||
// CHECK: %6, %7 = builtin.unrealized_conversion_cast %5 : f32 to i64, i64 | ||
%6, %7 = "builtin.unrealized_conversion_cast"(%5) : (f32) -> (i64, i64) | ||
"func.return"() : () -> () | ||
}) {"function_type" = () -> (), "sym_name" = "builtin"} : () -> () | ||
}) : () -> () |
27 changes: 27 additions & 0 deletions
27
tests/filecheck/mlir-conversion/with-mlir/unrealized_conv_cast.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,27 @@ | ||
// RUN: xdsl-opt %s | mlir-opt --allow-unregistered-dialect | filecheck %s | ||
|
||
"builtin.module"() ({ | ||
"func.func"() ({ | ||
%0 = "arith.constant"() {"value" = 0 : i64} : () -> i64 | ||
%1 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> f32 | ||
%2 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i32 | ||
%3 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i64 | ||
%4 = "builtin.unrealized_conversion_cast"() {"comment" = "test"} : () -> i64 | ||
%5 = "builtin.unrealized_conversion_cast"(%0, %0) : (i64, i64) -> f32 | ||
%6, %7 = "builtin.unrealized_conversion_cast"(%5) : (f32) -> (i64, i64) | ||
"func.return"() : () -> () | ||
}) {"function_type" = () -> (), "sym_name" = "builtin"} : () -> () | ||
}) : () -> () | ||
|
||
// CHECK: module { | ||
// CHECK-NEXT: func.func @builtin() { | ||
// CHECK-NEXT: %c0_i64 = arith.constant 0 : i64 | ||
// CHECK-NEXT: %0 = builtin.unrealized_conversion_cast %c0_i64 : i64 to f32 | ||
// CHECK-NEXT: %1 = builtin.unrealized_conversion_cast %c0_i64 : i64 to i32 | ||
// CHECK-NEXT: %2 = builtin.unrealized_conversion_cast %c0_i64 : i64 to i64 | ||
// CHECK-NEXT: %3 = builtin.unrealized_conversion_cast to i64 {comment = "test"} | ||
// CHECK-NEXT: %4 = builtin.unrealized_conversion_cast %c0_i64, %c0_i64 : i64, i64 to f32 | ||
// CHECK-NEXT: %5:2 = builtin.unrealized_conversion_cast %4 : f32 to i64, i64 | ||
// CHECK-NEXT: return | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: } |
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure of the benefit of three
xdsl-opt
sThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For around-tripping printing and parsing of both generic and custom syntax.