29.8.3.1. x86 REP prefix

Repeat a string instruction RCX times:

As the repetitions happen:

  • RCX decreases, until it reaches 0

  • RDI and RSI increase

The variants: REPZ, REPNZ (alias REPE, REPNE) repeat a given instruction until something happens.

REP and REPZ also additionally stop if the comparison operation they repeat fails.

  • REP: INS, OUTS, MOVS, LODS, and STOS

  • REPZ: CMPS and SCAS