> 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.
It is a big win in the situation where you have only a binary for i686
and want or better must execute it e.g. on a i586. This was the reason
why I asked initially.
ron
-- /\/\ Dipl.-Inf. Ronald Wahl /\/\ C S N /\/\ \/\/ ronald.wahl@informatik.tu-chemnitz.de \/\/ ------------------ \/\/ /\/\ http://www.tu-chemnitz.de/~row/ /\/\ network and system /\/\ \/\/ GnuPG/PGP key available \/\/ administration \/\/ - 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/