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

VMOV silently drop the size annotation #74

Closed
eponier opened this issue Dec 7, 2021 · 6 comments
Closed

VMOV silently drop the size annotation #74

eponier opened this issue Dec 7, 2021 · 6 comments

Comments

@eponier
Copy link
Contributor

eponier commented Dec 7, 2021

When compiling the following program

export fn main () -> reg u256 {
  reg u256 xmm;
  reg u64 x;
  x = 2;
  xmm = #VMOV_256(x);
  return xmm;
}

we get a typing error because xmm is of type u256 instead of u128. Indeed, the annotation _256 is silently dropped. It would be better to have an error in this case. Maybe it was done like this to avoid another constructor PrimXXX?

@eponier
Copy link
Contributor Author

eponier commented Dec 7, 2021

I discovered that for VMOV, but there are certainly other instructions with the same problem.

@vbgl
Copy link
Member

vbgl commented Dec 7, 2021

The instructions descriptors should be slightly redesigned to explicitly document what sizes they support: currently this information is spread in the instruction syntax, semantics, parsing rules etc. Would it also fix this issue?

@eponier
Copy link
Contributor Author

eponier commented Dec 7, 2021

I guess so. But I think this could also be solved without such a refactoring (probably a tedious work though).

As usual, I am used to creating an issue as soon as I discover a strange behaviour, but this does not mean I care much about the issue being solved. I want to be sure that we have a trace of the issue.

@eponier
Copy link
Contributor Author

eponier commented Dec 7, 2021

Btw, at least from a user perspective, this issue is similar to #69 where another annotation is silently ignored.

@vbgl
Copy link
Member

vbgl commented Sep 5, 2022

In this case, the annotation is not ignored. It qualifies the argument to the intrinsic (here expression “x”). The result is always a u128, hence the error message.

If the failing line is changed to:

xmm = (256u)#VMOV_256(x);

then we get a type-error about the argument:

typing error: can not implicitly cast u64 into u256

I do not deny that there is some UX issue (it is difficult to properly use the MOVD / VMOV intrinsics), but I think that this issue is invalid and should be closed.

@eponier
Copy link
Contributor Author

eponier commented Sep 15, 2022

Indeed, the annotation has an impact only the type of the argument. It's probably better to close this.

@eponier eponier closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2022
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

No branches or pull requests

2 participants