lkml.org 
[lkml]   [2002]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Q] Looking for an emulation for CMOV* instructions.
On Wed, 16 Jan 2002, Jamie Lokier wrote:

> Alan Cox wrote:
> > > What's the point of optimizing an IF to a cmov if I have
> > > to insert another IF to see if I can use cmov?
> >
> > I've always wondered. Intel made the instruction optional yet there isnt
> > an obvious way to do runtime fixups on it
>
> Yes there is -- emulation! :-)
>

It's just as bad, probably worse! You trap on an invalid op-code. The
trap-handler checks the op-code and if it's emulated, it emulates it
and returns to the executing task. This takes many instruction cycles,
certainly more than `if(cmov) doit; else do_something_else;` --which,
itself, takes many more instruction cycles than cmov is supposed to
reduce. It's a no-win situation. The only way to win is a compile-time
choice. This means customizing for your CPU IFF it has the cmov
instruction.
Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:23    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site