Open
Description
I have a library which wraps SIMD types and it would be a nice feature if users were able to create const values with my wrapper types. There's currently no way of doing this in stable Rust.
It would be convenient if some constructor functions could be made const fn
so we can create SIMD constants.
For example this is not currently possible:
const ONES : __m128 = unsafe { _mm_set1_ps(1.0) };
Internally functions like _mm_set1_ps
are quite straight forward:
pub unsafe fn _mm_set1_ps(a: f32) -> __m128 {
__m128(a, a, a, a)
}
__m128
is a repr(simd)
tuple struct.
I would propose making all of the _mm_set*
functions const fn
and any other construction functions in stdarch
for that matter.
Metadata
Metadata
Assignees
Labels
No labels