You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When translating routines from C intrinsics to Rust, conceptually boolean vectors are freely mixed with non-boolean ones.
To get back from boolean to its representation you currently have to do b.select(splat(-1), splat(0)) or similar while on the instruction level it's a no-op. It already optimizes back to a no-op, but would it make sense to have a shorthand for coding it?
The text was updated successfully, but these errors were encountered:
I ran into something similar porting some code from C. Another common pattern is doing bitwise operations on floating point values, such as XOR-ing each lane with 0x80000000 in order to flip the sign bit.
It's not clear from the documentation what to_u32, to_i32 and to_f32 do, they just say they lanes are "converted". Looking at the code it uses the simd_cast intrinsic, which is also ambiguous. It was only through experiment and/or looking at the disassembly that you can see what is actually happening.
It seems like the work currently done by these to_ methods would be more idiomatic if they were implemented using the From and Into traits. Then a direct cast without conversion could be implemented as as_f32, as_i32, etc methods at perform an unsafe mem::transmute.
When translating routines from C intrinsics to Rust, conceptually boolean vectors are freely mixed with non-boolean ones.
To get back from boolean to its representation you currently have to do
b.select(splat(-1), splat(0))
or similar while on the instruction level it's a no-op. It already optimizes back to a no-op, but would it make sense to have a shorthand for coding it?The text was updated successfully, but these errors were encountered: