Skip to content

[mypyc] Add BinaryIntOp for low-level integer operations #9108

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 3 commits into from
Jul 7, 2020
Merged

[mypyc] Add BinaryIntOp for low-level integer operations #9108

merged 3 commits into from
Jul 7, 2020

Conversation

TH3CHARLie
Copy link
Collaborator

relates mypyc/mypyc#741

This PR introduces BinaryIntOp to represent all low-level integer binary operations.

The block-like logic described in mypyc/mypyc#743 would be handled differently, BinaryIntOp would be the building block of it.

@TH3CHARLie
Copy link
Collaborator Author

TH3CHARLie commented Jul 7, 2020

One improvement here is to support immediate value(without using registers), so BinaryIntOp would need to not inherit from RegisterOp.

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! I have just one comment.

RIGHT_SHIFT: '>>',
} # type: Final

def __init__(self, type: RType, lhs: Value, rhs: Value, op: int, line: int = -1) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to store the integer type also here, since different code may be generated for 32 bit and 64 bit adds, for example, on non-C back ends.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, it's better to do this in a separate PR, and also update things to more generally store the result type.

@JukkaL JukkaL merged commit b98c47e into python:master Jul 7, 2020
@TH3CHARLie TH3CHARLie deleted the int-binary-add-expriment branch July 22, 2020 10:41
JukkaL pushed a commit that referenced this pull request Jul 22, 2020
#9187)

Follow-up of #9108 and #9127, generates the new inlined style ops when there is at 
least one tagged integer present (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`.
JukkaL pushed a commit that referenced this pull request Aug 7, 2020
This PR cleans up unused int op definitions including unsafe_short_add and 
int_compare_op.

unsafe_short_add's usages have been replaced with low-level integer op in 
#9108 and int_compare_op has no usages since all comparison operators are 
now built in irbuild.
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