Processor instruction prefixes (number of additional clock cycles)

Click For Summary
SUMMARY

The discussion centers on the clock cycle consumption of the Intel 8086 processor when executing the REP MOVSx instruction. The REP prefix incurs an additional 2 clock cycles, but this is only counted once per instruction execution. The execution time for REP MOVSx is calculated as 9 + (17 / number of repetitions), where the 9 clock cycles do not include the REP prefix. Additionally, using a segment override adds 2 clock cycles, applicable only to the first repetition of the instruction.

PREREQUISITES
  • Understanding of Intel 8086 architecture
  • Familiarity with instruction cycle counting
  • Knowledge of assembly language programming
  • Experience with performance optimization techniques
NEXT STEPS
  • Research Intel 8086 instruction set and clock cycle requirements
  • Explore the impact of instruction prefixes on execution time
  • Learn about segment overrides in assembly language
  • Investigate performance optimization strategies for legacy processors
USEFUL FOR

Assembly language programmers, computer architecture students, and performance analysts focused on optimizing code for the Intel 8086 processor.

SMD1990
Messages
46
Reaction score
0
More specifically, this question is oriented towards the Intel 8086.

I have this manual that lists the number of clock cycles the 8086 requires to execute each of its instructions, prefixes, et cetera.

My question is about repeat string instructions. The REP prefix is listed as 2 clocks. MOVSx by itself is 18 clocks. REP MOVSx is 9 + (17 / number of repetitions).

If I wanted to count the number of clock cycles the 8086 would consume executing a REP MOVSx instruction in an instance of my code, would I include the REP prefix's 2 clocks for each repetition? Or, do I count it once, then add 9 + (17 / number of repetitions)? Or, does that 9 include the REP, meaning I should not count the prefix as consuming any clock cycles at all?

And what if I used a segment override with the REP MOVSx? Normally, I add 2 clocks for segment override. So +2 for each repetition? Just the first repetition?

Sorry. I know this is a very esoteric question. "Who cares about the 8086?" Right? I do, and I am curious about this unclear situation. So, if anyone happens to know, could they please enlighten me?



http://matthieu.benoit.free.fr/cross/data_sheets/8086_family_Users_Manual.pdf
 
Computer science news on Phys.org
The prefix instructions only take the 2 extra cycles one time. Note that it takes 4 cycles to read memory (to fetch 16 bits of instruction data), so that 2 cycles may be 4 cycles depending on the instruction boundary, and if previous instructions were fast enough (2 to 3 cycles) to empty the pre-fetch queue. I don't know if the rep movs ... 9 cycles includes the rep overhead or not.
 
Last edited:

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 3 ·
Replies
3
Views
908
  • · Replies 8 ·
Replies
8
Views
14K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
13K