[vector api] Operations on Mask-s

Tomasz Kowalczewski tomasz.kowalczewski at gmail.com
Wed Jan 2 09:34:16 UTC 2019


Hi,

I was working on implementing a simple sorting algorithm[1] using VectorAPI
and stumbled on something that might be a gap in Mask API. It might be
intentional for this stage of API maturity - please advise.

I need to modify bits of the mask I get from _mm512_cmp_X_mask (e.g.
vector.lessThan(input)) by doing and-s and or-s which can be simulated by
preparing appropriate Mask objects. What I found missing is shift
operations. Example:

( compMask & 0x55 ) | ( ( compMask & 0x55 ) << 1)

I cannot do this using Mask object. Most natural alternative would be to
convert the mask into long, perform these operations and convert it back.
Unfortunately I was unable to find how to convert long back to Mask. Of
course this can be done (via boolean[] array) but that does not seem
efficient :).

Excuse me if I missed some API call.

1. https://hal.inria.fr/hal-01512970v1/document (page 14, Code 1).

-- 
Thanks,
Tomasz Kowalczewski


More information about the panama-dev mailing list