Skip to content

[mypyc] Expand int ops when operation contains at least one tagged int #9187

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

Merged
merged 4 commits into from
Jul 22, 2020
Merged

[mypyc] Expand int ops when operation contains at least one tagged int #9187

merged 4 commits into from
Jul 22, 2020

Conversation

TH3CHARLie
Copy link
Collaborator

Follow-up of #9108 and #9127, generates the new inlined style ops when there is at least one tagged integer presented(The previous two PRs actually specialized two ints and two short_ints cases). After this and the remaining merge, we will get rid of CPyTagged_IsEq, CPyTagged_IsNe, CPyTagged_IsLt, CPyTagged_IsLe, CPyTagged_IsGt and CPyTagged_IsGe

@TH3CHARLie
Copy link
Collaborator Author

I'll do the IR test updates once const_int has been applied to pretty IR printing, to reduce conflicts.

@TH3CHARLie
Copy link
Collaborator Author

TH3CHARLie commented Jul 22, 2020

should we remove CPyTagged_IsEq from CPy.h and its related test in test_capi.cc? and for CPyTagged_IsNe and CPyTagged_IsLt as well? cc @JukkaL

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 22, 2020

should we remove CPyTagged_IsEq from CPy.h and its related test in test_capi.cc? and for CPyTagged_IsNe and CPyTagged_IsLt as well?

Yeah, we should remove them from CPy.h, since they are no longer used. However, we should consider updating the tests to use the alternative functions with an underscore suffix.

@TH3CHARLie
Copy link
Collaborator Author

should we remove CPyTagged_IsEq from CPy.h and its related test in test_capi.cc? and for CPyTagged_IsNe and CPyTagged_IsLt as well?

Yeah, we should remove them from CPy.h, since they are no longer used. However, we should consider updating the tests to use the alternative functions with an underscore suffix.

then it would make more sense we remove them and update the C++ tests after all merges in the python end have completed.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left one comment about how to make the generated code smaller (in a separate PR).

r3 = 10 & 1
r4 = r3 == 0
r5 = r2 & r4
if r5 goto L2 else goto L3 :: bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this diff: we could simplify this sequence of ops like this:

r1 = n | 10
r2 = r1 & 1
r3 = r2 == 0
if r3 goto ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy