-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
repr(simd) does not align to Intel recs on x86_64 #81931
Comments
For note, here: having done some thought and research, it's not clear using a higher alignment is actually desired in practice. It may be the case that actually the desired alignment for vectors which do not precisely align to the machine's vector sizes is lower, around the element size (as if it were an array), possibly unless it uses a power of 2 element count (as it does here). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code: (Playground). The random inputs are mostly just to keep the compiler fairly "honest" and block optimizing away the instructions it would use.
Thus, I expected to see this happen:
Instead, this happened:
That does not appear to be the correct alignment to report for this type, unless I am misunderstanding something here.
Meta
rustc --version --verbose
:I believe this is related to, but not exactly the same as, #27060. Apologies if this is a total duplicate, or if I am misunderstanding something here about what Rust means by "alignment", but after careful review with @calebzulawski, we started to arrive at the conclusion that something was off.
Here is the generated assembly, as you can see, it uses multiple SSE instructions, including
movaps
, an aligned load, but I haven't exhaustively analyzed it so I can't immediately tell if actual alignment requirements are being adhered to here and I am just spooked by the seemingly misleading information.x86_64 Assembly
The text was updated successfully, but these errors were encountered: