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

Fix semantics of SHLD_16, SHRD_16, and VPSxLV #520

Merged
merged 2 commits into from
Jul 17, 2023
Merged

Fix semantics of SHLD_16, SHRD_16, and VPSxLV #520

merged 2 commits into from
Jul 17, 2023

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Jul 13, 2023

When the (masked) shift amount is larger than the operand size, the result is undefined. This is soundly approximated in the semantics by throwing a type error.

I still have to check whether SHLD has the same issue.

Found by random testing.

@vbgl vbgl changed the title Fix semantics of SHRD_16 Fix semantics of SHLD_16, SHRD_16, and VPSxLV Jul 13, 2023
@vbgl vbgl marked this pull request as ready for review July 13, 2023 06:34
vbgl added 2 commits July 13, 2023 09:14
When the (masked) shift amount is larger than the operand size, the
result is undefined. This is soundly approximated in the semantics by
throwing a type error.

Note that it is not necessary to fix the EasyCrypt model: it is meant to
be correct for safe executions only.
These instructions are available for vector elements of size 16-bit.
@bgregoir bgregoir merged commit 09de289 into main Jul 17, 2023
1 check passed
@bgregoir bgregoir deleted the fix-shrd branch July 17, 2023 09:47
@vbgl
Copy link
Member Author

vbgl commented Jul 17, 2023

Caveat: the 16-bit variants of VPSLLV and VPSRLV belong to the instruction-set extension AVX-512 byte-and-word instructions (BW).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants