Skip to content

Is fallback max, precise_max, min, precise_min implemented correctly? #20

Open
@ajakubowicz-canva

Description

@ajakubowicz-canva

This is a tracking issue that may require no action. I'm just logging it to investigate.

Currently fallback is implemented as (just looking at min):

    #[inline(always)]
    fn min_f32x4(self, a: f32x4<Self>, b: f32x4<Self>) -> f32x4<Self> {
        [
            f32::min(a[0usize], b[0usize]),
            f32::min(a[1usize], b[1usize]),
            f32::min(a[2usize], b[2usize]),
            f32::min(a[3usize], b[3usize]),
        ]
        .simd_into(self)
    }
    #[inline(always)]
    fn min_precise_f32x4(self, a: f32x4<Self>, b: f32x4<Self>) -> f32x4<Self> {
        [
            f32::min(a[0usize], b[0usize]),
            f32::min(a[1usize], b[1usize]),
            f32::min(a[2usize], b[2usize]),
            f32::min(a[3usize], b[3usize]),
        ]
        .simd_into(self)
    }

And wasm is similarly only using f32x4_min for both (although wasm should use pmin for precise_min).

I think we may need to address this so there's a difference between max and max_precise. Otherwise, why have both?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions