Do pointer offsets take any extra time? Which is preferable?
mov rcx, length
dec rcx
mov rax, qword ptr [rsi+rcx*8]
or
mov rcx, length
mov rax, qword ptr [rsi+rcx*8-8]
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.
Using an offest should be preferred, on a modern architecture this can be faster, but never slower.
On the other hand there is a chance the the decrement will be reordered to be executed earlier, so that is won’t make a difference speed wise.
See more background information at http://www.agner.org/optimize/#manuals .