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

Some things are UB, because they are UB in regular D, C and C++ too. #56

Open
p0nce opened this issue Nov 1, 2020 · 5 comments
Open

Comments

@p0nce
Copy link
Collaborator

p0nce commented Nov 1, 2020

  • shifting by more bits than the data type size(it's defined in some intel-intrinsic operations, but not sure if legitimate)
  • cast out-of-range float to an integer type that cannot hold it

=> document them

@p0nce
Copy link
Collaborator Author

p0nce commented Nov 3, 2020

The spec classify UB as illegal, say it in the DDoc.

@p0nce
Copy link
Collaborator Author

p0nce commented Nov 3, 2020

intel-intrinsics allows some instruction to shift by more than size in bits, because it has actually no runtime cost in inline optimized code. Not sure how evil that is.

@p0nce p0nce changed the title Some things are UB, because they are UB in D and C and C++ too. Some things are UB, because they are UB in regular D, C and C++ too. Nov 12, 2020
@p0nce
Copy link
Collaborator Author

p0nce commented Nov 23, 2020

The question (with regards to shifting) is that D says it's UB, but the x86 instruction is well defined.
And I've said at Dconf that "intel-intrinsics semantics is always modelled on the instruction they are supposed to emulate" but that may not be true, some instruction are different from their intrinsic (_mm_comieq_ss)
MMMmmmmm...

@p0nce p0nce added the question label Jan 1, 2021
@p0nce
Copy link
Collaborator Author

p0nce commented Jun 11, 2021

Also same question with _mm_alignr_pi8 / _mm_alignr_epi8 with larger counts. If we make this UB, might be better for arm vs x86.

@p0nce
Copy link
Collaborator Author

p0nce commented May 22, 2023

Need to see if the shift instruction agree between arm and x86, making it UB would be more correct in arm perhaps

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