Lokathor / wide

A crate to help you go wide. By which I mean use SIMD stuff.
https://docs.rs/wide
zlib License
279 stars 23 forks source link

How to cast i32x4 to u32x4? #68

Closed RazrFalcon closed 3 years ago

Lokathor commented 3 years ago

Do you want value preserving or bit preserving?

for bit preserving, bytemuck::cast does it.

There's not currently anything that will like, convert and do something if the value was out of range.

RazrFalcon commented 3 years ago

Bit preserving. So I have to use bytemuck directly?

Looks like the cast method uses panic. Does it guarantee that it will be optimized out for equal types? Otherwise it's too expensive for my use case.

Lokathor commented 3 years ago

yeah on equal types those checks all const fold away.

RazrFalcon commented 3 years ago

So for f32 to i32 I also have to use bytemuck and not cast_to_m128i_from_m128d/_mm_castps_si128?

UPD: interesting, looks like _mm_castps_si128 is just a dummy.

Lokathor commented 3 years ago

yeah the core::arch bit preserving casts casts are just transmute internally