13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 TechnologyTable 1-8.MnemonicREPNE <strong>and</strong> REPNZ Prefix OpcodesOpcodeREPNx CMPS mem8, mem8REPNx CMPSBREPNx CMPS mem16/32/64, mem16/32/64REPNx CMPSWREPNx CMPSDREPNx CMPSQREPNx SCAS mem8REPNx SCASBREPNx SCAS mem16/32/64REPNx SCASWREPNx SCASDREPNx SCASQF2 A6F2 A7F2 AEF2 AF<strong>Instructions</strong> that Cannot Use Repeat Prefixes. In general, the repeatprefixes should only be used in the string instructions listed intables 1-6, 1-7, <strong>and</strong> 1-8, <strong>and</strong> in 128-bit or 64-bit mediainstructions. When used in media instructions, the F2h <strong>and</strong> F3hprefixes act in a special way to modify the opcode rather thancause a repeat operation. The result of using a 66h oper<strong>and</strong>-sizeprefix along with an F2h or F3h prefix in 128-bit or 64-bit mediainstructions is unpredictable.Optimization of Repeats. Depending on the hardware implementation,the repeat prefixes can have a setup overhead. If therepeated count is variable, the overhead can sometimes beavoided by substituting a simple loop to move or store the data.Repeated string instructions can be exp<strong>and</strong>ed into equivalentsequences of inline loads <strong>and</strong> stores or a sequence of stores canbe used to emulate a REP STOS.For repeated string moves, performance can be maximized bymoving the largest possible oper<strong>and</strong> size. For example, use REPMOVSD rather than REP MOVSW <strong>and</strong> REP MOVSW ratherthan REP MOVSB. Use REP STOSD rather than REP STOSW<strong>and</strong> REP STOSW rather than REP MOVSB.Chapter 1: Instruction Formats 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!