Have you considered using pcmpistrm in Ranges mode with bit 6 of imm8 set to avoid the pcmpgtb&#x2F;pcmpgtb&#x2F;pand sequence? I think that would save 6 instructions in your main loop (though pcmpxstrx are slow).<p>Reference: <a href="https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;X86_Assembly&#x2F;SSE#The_Four_Instructions" rel="nofollow">https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;X86_Assembly&#x2F;SSE#The_Four_Inst...</a>