Author: Ed Schröder
Date: 01:34:03 08/27/05
Go up one level in this thread
On August 27, 2005 at 00:43:29, Tony Werten wrote: >On August 26, 2005 at 18:12:30, Ed Schröder wrote: > >>I am no longer up-to-date regarding the newest processors (such as the AMD-64) >>and the internal working concerning speed, hence my question: >> >>Which (similar) code is faster? >> >> test byte ptr xxx,1 | test byte ptr xxx,1 >> je label | mov AL,[ECX] >> mov AL,[ECX] | je label >> mov BL,[EDX] | mov BL,[EDX] >> ... ........ | ... ........ >> ... ........ | ... ........ >>label: | label: >> >>Thanks in advance, > >Hi Ed, Hey Tony, >probably not what you wanted to know, but the code is quite different from each >other. > >If the jump condition is met 50% of the time, then the left code will execute >the 2 moves 50% of the time for an average of 1 move per loop and the right side >100%+50% is 1.5 moves per loop on average. > >Did you mean something else ? Yep :) The background of my question is the processor's capability to do 2 instructions at the same time. Following this logic the code on the right (in principle) is supposed to be faster. >2 BTW's: > >1 Depending on what you do with AL and BL, you might want to use the full >registers by doing movzx eax,[ecx] and movzx ebx,[edx] (No penalty on new >processors) That's good to know, thank you. >2 This kind of code might be helped a lot with conditional moves. (All new >processors support that) It basicly does a "if (cond) move eax,xx" without a >branch, so without the risk if branchmispredictions (very, very expensive on new >processors). I am aware of the cmove instruction but its use is very limited, have there been new extensions lately? Thanks, Ed
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.