llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.6k stars 11.82k forks source link

[Clang] Add a builtin for masked stores of vectors #107753

Open philnik777 opened 1 month ago

philnik777 commented 1 month ago

LLVM has an overloaded llvm.masked.store intrinsic, but there is no generic way to do a masked store from C/C++ code. AFAICT it's only exposed via target-specific intrinsics. It would be great if there could be a __builtin_masked_store or something like that to make it easier to write generic code.

llvmbot commented 1 month ago

@llvm/issue-subscribers-clang-frontend

Author: Nikolas Klauser (philnik777)

LLVM has an overloaded `llvm.masked.store` intrinsic, but there is no generic way to do a masked store from C/C++ code. AFAICT it's only exposed via target-specific intrinsics. It would be great if there could be a `__builtin_masked_store` or something like that to make it easier to write generic code.
pinskia commented 1 month ago

Seems like there should be one for masked load too. For masked load, you might want a _z (zero) and a _m (merge) version or just have a merge version which will be optimized when the merge vector is zero.