Skip to content

Semantics of simd_select_bitmask for "out-of-bounds" mask? #269

@RalfJung

Description

@RalfJung

What should the semantics of the simd_select_bitmask intrinsic be when the bitmask has "out-of-bounds" bit set? This can happen when the vector length is less than 8, and the bitmask is stored as a u8.

  • This could be just declared UB, so codegen does not have to worry about this case. That's what implement simd bitmask intrinsics miri#2029 implements for Miri. However, then this is unsound, as a user can pass an arbitrary u8 to that function. So, we'd have to mask out the extra bits before passing them to simd_select_bitmask.
  • Or we could just say that these extra bits are ignored, and then codegen backends will have to make sure they handle that case properly.

The portable-simd test suite currently does not hit this case at all.

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