Check XMM register for all zeroes

前端 未结 2 1201
面向向阳花
面向向阳花 2020-12-06 17:30

Is there a way to check if all bits/bytes/words etc. in a __m128i variable are 0?
In my app I have to check if all integers packed in a in a __m128i variable are zeroes

2条回答
  •  佛祖请我去吃肉
    2020-12-06 18:25

    Like Paul R commented to my original post:

    "You don't need to initialise a dummy argument for the second parameter of PTEST, i.e. instead of _mm_testz_si128(idata, _mm_set1_epi32(0xFFFF)) you can just test a value against itself."

    ptest does the entire job with one instruction.

    This helped.

提交回复
热议问题