Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Unsigned narrowing #94

@penzn

Description

@penzn

Widening and narrowing operations were proposed in #21 and added in #89. There is a discussion about what should be the input for unsigned narrowing instructions in #91. The issue is that x86(64) SIMD narrowing instructions treat input as signed, even when output is not. ARM supports both signed-unsigned and unsigned-unsigned narrowing.

I can see value in "signed to unsigned" narrowing for things like RGBA graphics -- results of signed integer arithmetic that would be packed into unsigned RGBA output. For one example, see Sobel operator, other image filters would use it as well. Would "unsigned to unsigned" narrowing be equally useful? Where would it be used?

Another problem is that emulating "unsigned to unsigned" narrowing on x86(64) requires about 4 instructions, which is not a good value proposition for operation that would work on 2*, 4, or 8 lanes, as only the 8-lane version would be faster than scalar.

*if 64 bit lanes are supported

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