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

MASM arithmetic instructions should accept constants #1299

Open
hackaugusto opened this issue Mar 27, 2024 · 3 comments
Open

MASM arithmetic instructions should accept constants #1299

hackaugusto opened this issue Mar 27, 2024 · 3 comments
Labels
assembly Related to Miden assembly enhancement New feature or request

Comments

@hackaugusto
Copy link
Contributor

The following code snippet doesn't assemble:

const.V=2

begin
    push.1 mul.V
    push.1 div.V
    push.1 sub.V
    push.1 exp.V
end

It fails with:

malformed instruction `mul.V`: parameter 'V' is invalid

All the above instructions should accept a constants.

Motivation:

I want to implement a bitshift to the right with a division, and to make the code more readable I want to write:

const.SHIFT_RIGHT_8=256  # dividing by this constants is equivalent to a >>8

begin
    push.1 div.SHIFT_RIGHT_8
end

@hackaugusto hackaugusto added enhancement New feature or request assembly Related to Miden assembly labels Mar 27, 2024
@hackaugusto
Copy link
Contributor Author

Note: I'm aware the transformation from >>8 to /256 doesn't work for all situations. Nevertheless, for the cases it does work, the constants is best for readability.

@bitwalker
Copy link
Contributor

This is implemented in #1277. Just making a note here so I revisit this issue once that's merged.

@hackaugusto
Copy link
Contributor Author

@bitwalker maybe this can be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assembly Related to Miden assembly enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants