[vector] Missing operations on Mask
Paul Sandoz
paul.sandoz at oracle.com
Fri Mar 16 19:18:30 UTC 2018
Hi,
Perusing the wikipedia page on AVX-512 [1] there are at least three operations we could consider adding to Mask:
KXOR - ma ^ mb
KSHIFTL - logical shift left
KSHIFTR - logical shift left
I believe if C2 is smart we don’t need to expose
KANDN - (NOT ma) & mb
KXNOR - (NOT ma) & mb
since it can compose from the call sequence ma.not().and(mb).
The logical shifts would translate to vector lane shifting or swizzles if masks are represented as vectors.
Further, we could consider counting leading/trailing zero bits even though there are no direct instructions for opmasks. This is useful for say array comparison, but is likely only performance critical for small prefixes.
Still, i would argue it is useful function to support if it's possible to optimize, which i believe might so if the mask can be converted to a 64 bit register containing the packed bits.
Thoughts?
Paul.
[1] https://en.wikipedia.org/wiki/AVX-512 <https://en.wikipedia.org/wiki/AVX-512>
More information about the panama-dev
mailing list