Is there a way to subtract packed unsigned doublewords, saturated, on x86, using MMX/SSE?
问题 I've been looking at MMX/SSE and I am wondering. There are instructions for packed, saturated subtraction of unsigned bytes and words, but not doublewords. Is there a way of doing what I want, or if not, why is there none? 回答1: If you have SSE4.1 available, I don't think you can get better than using the pmaxud + psubd approach suggested by @harold. With AVX2, you can of course also use the corresponding 256bit variants. __m128i subs_epu32_sse4(__m128i a, __m128i b){ __m128i mx = _mm_max