How correctly vectorizate loop?

How correctly vectorizate loop?

max-divulskiy's picture

Please rompt how correctly vectorizate this cycle:

_CRT_ALIGN(16) const	UINT8	XorBitsArray[] = {...};
_CRT_ALIGN(16)			UINT8	MassX[] = {...};
_CRT_ALIGN(16)			UINT8	MassR[] = {...};

for (UINT i = 0; i < sPeriodLenth; i++ )
{
	MassR[i] = XorBitsArray[ MassX[i] ];
}

Outputs the following message:

loop was not vectorized: unsupported data type
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Tim Prince's picture

"vectorizing" such a loop (packing operands into an _m128 before storing) would require either SSE4.1 (or newer) instructions or #pragma vector aligned. It may work only with indexing by an int array. In such a simple loop, packing is unlikely to have an advantage, as the hardware packs the operands into a fill buffer anyway before updating cache.

Login to leave a comment.