Skip to content

Add masked expanded loads and compressed stores API #229

@gnzlbg

Description

@gnzlbg

There is an LLVM patch under review (https://reviews.llvm.org/D59180) that adds portable support for masked compressed loads and masked expand stores via llvm.masked.compressstore and llvm.masked.expandload.

We should add two APIs to vector masks:

impl<T, const N: usize> Simd<[T; N]>  
    where Simd<[T; N]>: Mask 
{
    /// Writes the lanes of `value` for which `self` is `true` to 
    /// adjacent memory locations at `ptr`.
    unsafe fn write_compressed<U>(self, value: Simd<[U; N]>, ptr: *mut U);
    /// Reads adjacent `U` values at `ptr` into the result's vector 
    /// lanes for which `self` is `true`, using the values of `defaults` 
    /// otherwise.
    unsafe fn read_expanded<U>(self, defaults: Simd<[U; N]>, ptr: *const U) -> Simd<[U; N]>;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions