-
Notifications
You must be signed in to change notification settings - Fork 164
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
Support floor division as intrinsic function #2372
Support floor division as intrinsic function #2372
Conversation
So it can be used in intrinsic_function_registry
b247454
to
4b917cf
Compare
8e80b97
to
235117b
Compare
Ready. |
|
||
ASR::expr_t* perform_casting(ASR::expr_t* expr, ASR::ttype_t* src, | ||
ASR::ttype_t* dest, Allocator& al, | ||
const Location& loc); |
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.
What is the idea behind these? I think we do not want to do any kind of automatic casting in ASR, nor be responsible for determining what proper casting must be done.
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 think we do not want to do any kind of automatic casting in ASR
It is actually not for automatic casting. The floordiv intrinsic we defined in this PR is generalized so that it can work on any type (from the supported types of int, unsigned int, real, logical
). The casting function is used to cast the intermediate temporary variable to the appropriate return type.
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.
It is also used to cast the function arguments to the needed intermediate type.
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.
Is this a helper function to make make_Cast_t_value
more convenient, but you still tell the initial and final type explicitly?
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.
Is this a helper function to make make_Cast_t_value more convenient, but you still tell the initial and final type explicitly?
Yes. The way it helps is we need not worry about what type it currently is and just specify what type we want it to be.
In general the change is good I think, but I want to have good clarity on the casting situation. We should document this in comments, once I understand it. |
Sure, I clarified your queries above. |
Please let me know if you have further doubts in the implementation. I will be happy to clarify them. |
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 think that this is fine. Would you mind submitting this PR against LFortran as well?
Thank you so much for the review.
Sure. Is it fine to merge this PR currently? |
Yes, you can merge it. |
fixes #2349