if bitOp.popc is the only available ptx instruction with bitOp, it’s not possible without popcount
xor + popc counts the number of mismatches between two bitmasks. and + popc would count the matches.
Note that according to the c++ programming guide CUDA C++ Programming Guide , some sub-byte instructions are deprecated and removed in Hopper, for example xor+popc. I don’t know how this affects the lower level ptx instructions.
You can get the full result of ‘and’ by only setting one bit of the same reference mask for each column of a matrix. But you would loose 32x of theoretical computation performance.