-
Notifications
You must be signed in to change notification settings - Fork 3
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
[FXML-4448] Add EmitC lowering for arith.{trunci,extsi,extui} #177
Conversation
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.
Small comments here and there
How about removing the index casts from here and open a separate PR for them once the size_t/ssize_t types are available? |
@mgehre-amd, that's a good way forward. |
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.
Looks good!
This PR introduces EmitC lowering for various integer casts in the Arith dialect.
Per C++ Reference:
So, truncation is only guaranteed if unsigned casts are performed, or C++20 is used. This implementation sticks to unsigned where we know it is a truncation, like trunci, and index_cast with greater source width than destination. The only issue is when using index types (that don't have a bitwidth) and C++20 isn't used -- the resulting behavior is then implementation-defined.