© Jo Van Hoey 2019
J. Van HoeyBeginning x64 Assembly Programminghttps://doi.org/10.1007/978-1-4842-5076-1_34

34. SSE String Masks

Jo Van Hoey1 
(1)
Hamme, Belgium
 

Now that we know how to shuffle, we can discuss string masks.

Remember that SSE provides two string manipulation instructions that use a mask: pcmpistrm and pcmpestrm. We will be using implicit length instructions. At first, using masks looks complicated, but once you get the hang of it, you will see how powerful masking can be.

Searching for Characters

Listing 34-1, Listing 34-4, and Listing 34-3 show the example.
; sse_string4.asm
; find a character
extern print16b
extern printf
section .data
      string1      db    "qdacdekkfijlmdoza"
                   db    "becdfgdklkmdddaf"
                   db    "fffffffdedeee",10,0 ...

Get Beginning x64 Assembly Programming: From Novice to AVX Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.