The SSE intrinsic
_mm_setzero_si128
is very handy to initialize a register with all zeroes and it translates to the single
PXOR
opcode taking twice the same register. It is the only SSE intrinsic taking no argument.
The similar
_mm_setones_si128
intrinsic would be equivalently handy to initialize a register to all ones and it could translate to the single
PCMPEQB
opcode.
Unfortunately, this intrinsic does not exist and it is problematic to emulate it with
_mm_cmpeq_epi8
: code like
__m128i AllOnes= _mm_cmpeq_epi8(AllOnes, AllOnes);
raises an unintialized variable warning at compile-time, and worse, raises a condition at run-time in a debug build.
Alternatives are to first initialize the variable with
_mm_setzero_si128
, use one of the
_mm_set_epi...
intrinsics or apply
_mm_cmpeq_epi8
to another variable. None of these options please me as they will not translate to a single opcode.
Can I work around this by clever tricks ?
Can I hack some compiler files to achieve this effect ?
Can I contact the right person in the MSVC Developers Team to let them add this trivial but useful feature ?