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

Bad errors with 128/256-bit rotations #854

Open
vbgl opened this issue Jul 2, 2024 · 0 comments
Open

Bad errors with 128/256-bit rotations #854

vbgl opened this issue Jul 2, 2024 · 0 comments

Comments

@vbgl
Copy link
Member

vbgl commented Jul 2, 2024

Pre-typing rejects the following program:

export
fn rot(reg u128 x) -> reg u128 {
  x <<r= 4;
  return x;
}

line 3 (2-11):
typing error: can not implicitly cast u64 into u128

Due to this line, pre-typing infers that the rotation operator is applied to a 64-bit value, thus produces a 64-bit value, which cannot be assigned to the 128-bit variable x.

If the rotation operator is manually annotated as <<r 128u, the error is slightly less cryptic:

typing error: invalid operator <<r128u

Note that the discrepancy with shifts (the type-checker is happy with 128-bit shifts, asm-gen complains) makes the error even more confusing.

Reported by @cos-imo.

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

No branches or pull requests

1 participant