[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: i486 base architecture

On Tue, 2004-11-30 at 01:33 -0500, William M. Quarles wrote:
> Arjan van de Ven wrote:
> > On Sun, 2004-11-28 at 19:46 -0500, William M. Quarles wrote:
> > 
> > 
> >>I would, but are there any free ways of doing benchmarks?  Not to 
> >>mention I'm not really much of a programmer, so I don't know what 
> >>oprofile/gprof are.
> > 
> > for what it's worth... cmov isn't faster on newer (pM/pIV/amd64 level)
> > CPUs than the open coded conditional jump anymore....
> > so there no longer really is a reason to use cmov-only code.
> More terminology that I am not aware of... cmov? 

cmov is a conditional move instruction on x86. Basically a C code
construct like this

if (some_condition == 5)
   A = B;

normally gets translated into (pseudo asm)

  compare some_condition, 5
  jump_if_not_equal label;
  move B into A
  ... the rest of the program

the "jump_if_not_equal" instruction is a conditional instruction, which
means that the cpu cannot look ahead and decide what the next
instruction is, until the actual compare is finished. With the current
deeply pipelined cpus that is sort of a problem (the solution is that
the cpu makes a guess what it'll be based on past decisions for this
line of code, and if wrong, it backtracks).

Now with cmov, the code looks like

  compare some_condition, 5
  move_if_equal B into A
  ... the rest of the program

and in theory there is no question about which instructions will be
executed when, so the "cost" of having an empty pipeline until the
decision is known wouldn't be there. And that's mostly true for PPro/PII
level CPUS.

However, newer ones (both AMD and Intel) operate in such a way that the
advantage of this no longer is an advantage, they need to know the
result anyway in effect (and also make a guess about the "if" result)

>  I know that I'm a 
> novice about development, you don't have to further proove it to me.

I absolutely don't mean it in that way.

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]