Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1057 Discussions

adding or comapring 8 bit unsigned data in XMM register

biplabraut
Beginner
251 Views

Please can anyone suggest if there is any way to set, compare and add 16 unsigned 8-bit data elements of two XMM __m128i registers. What I am finding isthe signed operations and that everything after 127 is turned around and made to start from negative end. But I wish to do set, add and compare two __m128i registers having unsigned values more than 127.

Any suggestions on this is greatly appreciable.

Thanks.

0 Kudos
3 Replies
biplabraut
Beginner
252 Views
Any help in this regard ??
Thomas_W_Intel
Employee
252 Views

You can use an offset of -128 for all your data. As long as you only add and compare numbers, this will work.

Alternatively, you can convert the 8bit values to 16bit values for processing using pmovzxbw or pshufb. This way, you can only process 8 values in parallel but it is still better than not using SSE at all.

Kind regards

Thomas

biplabraut
Beginner
252 Views
Thanks for ur suggestions.. I have used another alternative... instead of comparing for 16 unsigned 8-bit elements, I subtracted and checked the resultant to be less than the minuend.. If found more, that suggests subrahend is greater than minuend... For my purpose, this trick would do...
Reply