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

Allow shifts with constant signed positive amounts #3303

Merged
merged 3 commits into from
May 13, 2022

Conversation

mihaibudiu
Copy link
Contributor

Signed-off-by: Mihai Budiu [email protected]

I have deleted a test that was rejected originally but now should be fine.

@mihaibudiu mihaibudiu requested a review from fruffy May 9, 2022 20:15
@@ -0,0 +1,4 @@
bit<4> func(in bit<4> l) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function is optimized away, so it is difficult to tell how it is actually transformed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, but previously it was rejected altogether and now it's legal.
The new code will in fact insert a cast for (tt) to make it unsigned - only if tt is constant and positive.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make it so this test is not optimized away?

@mihaibudiu mihaibudiu merged commit 29625f1 into p4lang:main May 13, 2022
@mihaibudiu mihaibudiu deleted the issue3287 branch May 13, 2022 03:25
github-sajan pushed a commit to github-sajan/p4c that referenced this pull request May 26, 2022
* Allow shifts with constant signed positive amounts
Signed-off-by: Mihai Budiu <[email protected]>
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