Good First IssueStandard Library
Repository metrics
- Stars
- (2,930 stars)
- PR merge metrics
- (PR metrics pending)
Description
Doing performance fine tuning, it may be beneficial to have separate code paths if the mask is "all on". Right now there are multiple ways of expressing this paradigm, which are not guaranteed to be optimal on all platforms. Possible ways of checking this are:
__all(__mask). Seem to produces good code on all platforms, but uses builtins (that are not recommended for the use outside of standard library)((1<<TARGET_WIDTH)-1 ^ lanemask()) == 0. Produces same good code, but not an obvious construct.popcnt(lanemask()) == programCount. Does no produce optimal code.
I suggest adding a standard library function, which implement the first case:
inline uniform bool is_mask_all_on() {
return __all(__mask);
}