-
Notifications
You must be signed in to change notification settings - Fork 70
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
Ban projecting into repr(simd)
types
#838
Comments
Important This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. Concerns or objections to the proposal should be discussed on Zulip and formally registered here by adding a comment with the following syntax:
Concerns can be lifted with:
See documentation at https://forge.rust-lang.org cc @rust-lang/compiler |
@rustbot second |
…errors Refactor `OperandRef::extract_field` to prep for MCP838 cc rust-lang/compiler-team#838 This still supports exactly the same cases as it did before, just rearranged a bit to better emphasize what doesn't work.
Rollup merge of rust-lang#137361 - scottmcm:mcp-838-prep, r=compiler-errors Refactor `OperandRef::extract_field` to prep for MCP838 cc rust-lang/compiler-team#838 This still supports exactly the same cases as it did before, just rearranged a bit to better emphasize what doesn't work.
Proposal
Projecting into SIMD types is awkward, because the field is an array, which is passed by pointer, but the vector itself is an immediate.
That means it needs special-case code that writes the vector out to an alloca so the pointer can be used, which is awkward at best. It caused rust-lang/rust#105439 and I just noticed today that it's still broken in other cases, see rust-lang/rust#137108. I recall hearing it was awkward for cranelift too.
It not even particularly useful, because the right way to do it is to do something different anyway:
&Simd<T, N>
to&[T; N]
, likeSimd::as(_mut)_array
does, and which bypasses the whole operand representation issue because the&
means it's already in memory anyway.So I propose we just ban field-projecting into
repr(simd)
types altogether -- treat them like integers and pointers as not having fields -- and thus decide to intentionally not fix rust-lang/rust#137108 .Portable SIMD is already not projecting into their types: https://github.com/rust-lang/rust/blob/e72df78268bafbfe28366aa0e382713f55a491e7/library/portable-simd/crates/core_simd/src/vector.rs#L98-L101
Mentors or Reviewers
Most changes here will be fairly-straight-forward changes to
stdarch
tests.Banning the things that aren't used there (like
3 x i32
) and already don't work is pretty simple and can likely be reviewed by anyone, especially sincerepr(simd)
is likely staying internal so per #620 it doesn't need to be reported elegantly.Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
The text was updated successfully, but these errors were encountered: