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

chore(ssa gen): ssa gen truncate instruction #1568

Merged
merged 12 commits into from
Jun 9, 2023
Merged

Conversation

joss-aztec
Copy link
Contributor

@joss-aztec joss-aztec commented Jun 6, 2023

Description

Problem*

Summary*

This PR sets out to code gen truncate instructions

Example

fn main(x : u2) -> pub u2 {
    1 - x
}

compiles to

current witness index : 4
public parameters indices : []
return value indices : [2]
BLACKBOX::RANGE [(_1, num_bits: 2)] [ ]
DIR::QUOTIENT (out : _%EXPR [ (-1, _1) 5 ]%,  (_3, %EXPR [ 4 ]%), _2)
BLACKBOX::RANGE [(_2, num_bits: 2)] [ ]
BLACKBOX::RANGE [(_3, num_bits: 1)] [ ]
EXPR [ (1, _1) (1, _2) (4, _3) -5 ]

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

jfecher
jfecher previously requested changes Jun 7, 2023
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

(In the process of reviewing still, apologies for the delay)

@joss-aztec joss-aztec marked this pull request as ready for review June 8, 2023 10:58
@joss-aztec
Copy link
Contributor Author

Had to address #1624 in order to get brillig_integer_binary_operations test working.

@kevaundray kevaundray changed the base branch from master to kw/brillig-main June 9, 2023 17:58
@kevaundray kevaundray changed the base branch from kw/brillig-main to master June 9, 2023 17:59
@kevaundray kevaundray dismissed jfecher’s stale review June 9, 2023 18:00

spoke internally and we will revisit the topic of whether truncate can be made simpler

@kevaundray kevaundray enabled auto-merge June 9, 2023 18:00
@kevaundray kevaundray added this pull request to the merge queue Jun 9, 2023
Merged via the queue into master with commit eb46566 Jun 9, 2023
@kevaundray kevaundray deleted the joss/ssa-gen-truncate branch June 9, 2023 19:19
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.

3 participants