Closed ghost closed 9 months ago
i think what you want is round_int or fast_round_int? if i follow
Yeah I think that might be it, maybe:
fn blender(a: i32x8, b: i32x8, mask: f32x8) -> i32x8 {
mask.blend(a.round_float(), b.round_float()).round_int()
}
I'll try some bit bashing and see what comes out
another possibility:
fn blender(a: i32x8, b: i32x8, mask: f32x8) -> i32x8 {
cast(mask.blend(cast(a), cast(b)))
}
as _mm256_cast*
is just transmute
under the hood
i32x8 has a blend method without converting to f32x8, probably will have better performance that way
Hi, thanks for this great library. I'm a bit new to SIMD programming, so apologies if the answer is obvious I'm trying to port some possibly fishy intrinsics to
wide
, the operation is:Expressed in
wide
it looks roughly like:Understandably, this doesn't type check. If I try to
cast
with bytemuck, it does compile, but I believe it fails becauseNaN
doesn't get mapped to-1
, so the integer mask doesn't work? Is this an operation that makes sense? I want to use a mask derived from a float operation, to blend two integer vectors. What is the best way to convert between types?Thank you!
EDIT:
Larger context:
wide version