Re: [GD-Windows] VC8.0 and CMOV
Brought to you by:
vexxed72
From: Jan W. <jan...@gm...> - 2007-11-23 15:59:55
|
Hello, On Fri, 23 Nov 2007 11:45:21 +0100, Alen Ladavac <ale...@cr...> = = wrote: > Is there any way to make MSVC8.0 to generate CMOV instructions? > Allegedly, it is able to do so, Confirmed, I've seen them in VC2005 SP1's output. Not sure whether that = = was due to hand-generated snippets being pasted in by the "optimizer" or= = because the code generator has been improved. Even after quite some experimentation, no reliable way to provoke CMOV w= as = found. One thing that did work (surprisingly enough) is a carry flag-based tric= k: int mask =3D (condition)? ~0 : 0; This actually works out to a SBB, which can be used to select one of two= = values or increment/decrement an index, etc. Whether this is useful = depends on the exact contents of your if() statements. > but /O2 doesn't seem to help Code Generation -> Enhanced Instruction Set will probably be necessary a= s = well. On Fri, 23 Nov 2007 16:13:21 +0100, Andrew Finkenstadt <pb...@gm...= > = wrote: > Does using "__asm" help? You could hand-code the instructions, then. Unfortunately this approach suffers from VC's inability to = peephole-optimize the 'boundaries' of asm code. You'll see back-to-back = = stores and loads of variables you pass to/from asm, which often eats awa= y = any gains attained. CPUs have forwarding hardware for this, but it still= = hurts. HTH+HAND Jan Wassenberg |