Skip to content
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

Extend left shifts operator to handle non-constant shifts #1478

Closed
Tracked by #1376
kevaundray opened this issue Jun 1, 2023 · 5 comments
Closed
Tracked by #1376

Extend left shifts operator to handle non-constant shifts #1478

kevaundray opened this issue Jun 1, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request refactor ssa

Comments

@kevaundray
Copy link
Contributor

Problem

When the following code is written: lhs << rhs.

In Noir, we convert the code to the following lhs * 2^{rhs}. At the moment, we only allow the rhs to be a constant so that we can compute 2^rhs in the compiler, however it is possible to make this non-constant by doing a sqaure-and-multiply algorithm.

Ideally this algorithm is implemented in the Noir source code and then used in the compiler somehow, but having a builtin initially is also fine. The reason for wanting it to be in the Noir source code is mainly because it involves conditionals and we would be eating our own dog food.

Happy Case

.

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray
Copy link
Contributor Author

This is related to #1265

@kevaundray
Copy link
Contributor Author

kevaundray commented Jul 25, 2023

Important: Completion of this task involves copying over the bit shift runtime end to end test bit_shifts_runtime

@guipublic
Copy link
Contributor

where can I find the bit_shifts_runtime?

@TomAFrench
Copy link
Member

TomAFrench commented Jul 27, 2023

Looks like it was removed in https://github.com/noir-lang/noir/pull/2044/files#diff-5f9d36a0db26fcae53924b92ae5b7e0b4fc595b0764dad759d689264d1584877 without being moved to the new ssa test suite.

@guipublic
Copy link
Contributor

Closing the issue as fixed by #2072

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor ssa
Projects
Archived in project
Development

No branches or pull requests

3 participants