Does mov 0x10(%esp),%esi take more time to complete than mov (%ebx),%esi on a modern CPU?
Does mov 0x10(%esp),%esi take more time to complete than mov (%ebx),%esi on a modern
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to Intel’s optimization manual, table 2-8, on Sandy Bridge the load latency for just a base register or a base plus an offset of less than 2048 is 4 cycles, while for a base plus index plus offset or base plus an offset of 2048 or greater is 5 cycles. So in your example, the two instructions should take an equal amount of time. If you were using an offset of 2048 or greater, that would take longer.
Of course, if the memory isn’t in your L1 cache, this won’t really matter, since the cost of the memory access will dwarf the cost of everything else.