x86 Assembly Language Reference Manual

String Instructions

The string instructions operate on strings of bytes. Operations include storing strings in memory, loading strings from memory, comparing strings, and scanning strings for substrings.


Note –

The Solaris mnemonics for certain instructions differ slightly from the Intel/AMD mnemonics. Alphabetization of the table below is by the Solaris mnemonic. All string operations default to long (doubleword).


Table 3–8 String Instructions

Solaris Mnemonic 

Intel/AMD Mnemonic 

Description 

Notes 

cmps{q}

CMPS

compare string 

cmpsq valid only under -xarch=amd64

cmpsb

CMPSB

compare byte string 

 

cmpsl

CMPSD

compare doubleword string 

 

cmpsw

CMPSW

compare word string 

 

lods{q}

LODS

load string 

lodsq valid only under -xarch=amd64

lodsb

LODSB

load byte string 

 

lodsl

LODSD

load doubleword string 

 

lodsw

LODSW

load word string 

 

movs{q}

MOVS

move string 

movsq valid only under -xarch=amd64

movsb

MOVSB

move byte string 

movsb is not movsb{wlq}. See Table 3–1

movsl, smovl

MOVSD

move doubleword string 

 

movsw, smovw

MOVSW

move word string 

movsw is not movsw{lq}. See Table 3–1

rep

REP

repeat while %ecx not zero

 

repnz

REPNE

repeat while not equal 

 

repnz

REPNZ

repeat while not zero 

 

repz

REPE

repeat while equal 

 

repz

REPZ

repeat while zero 

 

scas{q}

SCAS

scan string 

scasq valid only under -xarch=amd64

scasb

SCASB

scan byte string 

 

scasl

SCASD

scan doubleword string 

 

scasw

SCASW

scan word string 

 

stos{q}

STOS

store string 

stosq valid only under -xarch=amd64

stosb

STOSB

store byte string 

 

stosl

STOSD

store doubleword string 

 

stosw

STOSW

store word string