Closed
Description
I tried this code:
let a = u32x4::from_array([0, 1, 0, 1]);
let b = u32x4::from_array([1, 0, 1, 0]);
print!("{:x?} ", a.min(b));
let a = f32x4::from_array([0., 1., 0., 1.]);
let b = f32x4::from_array([1., 0., 1., 0.]);
print!("{:x?}\n", a.min(b));
I expected to see this happen: [0, 0, 0, 0] [0.0, 0.0, 0.0, 0.0]
.
[0, 1, 0, 1] [0.0, 1.0, 0.0, 1.0]
would be a little surprising, because that isn't commonly available as native SIMD instruction.
Instead, this happened: [0, 1, 0, 1] [0.0, 0.0, 0.0, 0.0]
This is inconsistent. I expected either min or lanes_min (like in lanes_eq) to get the minimum for each lane.
Also, when you search min(
in https://rust-lang.github.io/portable-simd/core_simd/simd/struct.Simd.html#method.min-1, where it says "Returns the minimum of each lane.", you have to scroll up quite a bit to see it is for floats only and the documentation of min and max for integers is very generic, doesn't explicitly mention that this isn't per lane.
Metadata
Metadata
Assignees
Labels
No labels