-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Index argument for simd_insert no longer a const #85105
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
Comments
I worked around this in bjorn3/rustc_codegen_cranelift@bcc68c2 by walking the MIR to find a single defining use of the local that should contain the constant argument. |
I guess we should give simd_insert some generic const arguments? So instead of
we would have
does that fit how that index works? cc @lqd does SIMD have a team to ping? |
There is a zulip stream for stdarch but it's pretty much inactive (opening issues in https://github.com/rust-lang/stdarch does work). For pings, I believe @Amanieu would be the main person to contact for For this issue in particular, I do wonder if |
Using transmute(simd_insert(a.as_i16x8(), const { IMM8 as u32 }, i as i16)) |
I think we should still enforce this at the signature level by making it a const generic parameter. If anyone wants to be mentored on this, I'd be happy to do that. We'd roll it out with minimum annoyance by creating a extern "rust-intrinsic" {
fn simd_insert_new<T, U, const N: u32>(t: T, u: U) -> T
} that we can then add incrementally to all use sites (mostly the stdsimd submodule). Updating the submodule at the same time as the intrinsic would be super annoying to do, so let's not ^^ |
@oli-obk will it be possible to cast the |
we could just make the |
I'm not sure, I thought |
there is no direct calls anywhere. We are generating the llvm intrinsic call during codegen. We can pick whatever signature we need from the Rust side and translate during LLVM codegen. |
For all |
I tried this code:
I expected to see this happen: The index argument 9 is given as direct constant to the
simd_insert
intrinsic.Instead, this happened: The cast of the index argument to u32 is stored in a local and then this local is passed to
simd_insert
. This causes cg_clif to error out as it requires a constant.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: