Re: VC8.0 and CMOV

"Jan Wassenberg" <[email protected]> Fri, 23 Nov 2007 16:59:58 +0100
Newsgroups gmane.games.devel.windows
Message-ID <op.t185d8qd3of9b6@h509>
Hello,

On Fri, 23 Nov 2007 11:45:21 +0100, Alen Ladavac <[email protected]>  
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 was  
found.

One thing that did work (surprisingly enough) is a carry flag-based trick:
int mask = (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 as  
well.


On Fri, 23 Nov 2007 16:13:21 +0100, Andrew Finkenstadt <[email protected]>  
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 away  
any gains attained. CPUs have forwarding hardware for this, but it still  
hurts.

HTH+HAND
Jan Wassenberg

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555