c++ - Check for zeros horizontally across __m128i vector? -


I have several __ m128i vectors with 32-bit signed integers and I would like to check that Is any of the 4 integers zero?

I understand how I can do "Total" multiple __M 128i but in the end I still have a __ M 128i will end with vector, which I need to check again horizontally.

How do I do the last horizontal check for zero in the last vector?

Edit I am using Intel Intrins, not inline assembly

Do not do this. Avoid horizontal operations whenever possible; There is death for the display of vector codes.

Instead, compare the vector to a vector of zero, then use the PMOVMSKB to get a mask in the GPR. If the mask is zero, at least the strings of your vector were zero:

  __ m128i yourVector; __m128i zero-void = _mm_set1_epi32 (0); If (_mm_movemask_epi8 (_mm_cmpeq_epi32 (yourVector, zero vector)) // Your vector has at least one lane zero.}   

If you want to receive SSE4.1 You can also use PTEST.


Take the question at face value, if you really need to do a horizontal and for some reason, it will be movhlps + andps + shufps + andps But do not do this.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -