Re: Any libraries for vector mask and vector population count?



Dan wrote:


I have some legacy code which includes calls to the CAL2 vector mask
and vector population count instructions. Lacking a nearby Cray, does
anyone know of subroutines that implement these instructions?


Maybe it would help to show some of the code, if it isn't secret like much usage of popcount.
Apparently, GMP supports popcount for those processors which implement it.

The Intel manuals have MMX/SSE{1234} instructions which might work,
and AMD has the "something-now" which are apparently the same, but
I've not seen any demo code emulating the mask and popcount
instructions.

SSE popcount instruction isn't available in currently released hardware, but it will be along soon.

SSE auto-vectorization of conditional operations is often done with vector masks. Fortran MERGE for SSE2 is vectorized with masks; the latest additions to SSE include more direct merge support.
IAND and IEOR support masking operations. If your Fortran doesn't auto-vectorize them in the context you require, there are SSE intrinsic operators, supported by C (and possibly 1 or 2 Fortran) compilers.

.



Relevant Pages