[Mono-devel-list] cmove patch

Paolo Molaro lupus at ximian.com
Thu Jun 19 04:52:39 EDT 2003


On 06/18/03 dietmar wrote:
> if (cond) a = x; else a = y;
> 
> which could be translated into 2 conditional movex
> 
> cmove (cond, a, x)
> cmove (!cond, a, y)
> 
> but x and y can be expression, so they can set the EFALGS. Sure, we can
> avoid that if we first compute them, but IMO thats a bit clumsy.

We need to add that kind of info to the machine descriptions: which
instructions modify the flags and so on: with that in place it's easy to
check for this case.

> any better ideas, suggestion?

Note: the use of conditional move instructions needs to be dependent on
the MONO_OPT_CMOV optimization flag.
The main issue with your patch is that we can't do the conditional moves at 
the point you inserted them in the compilation process: it needs to
happen after instruction selection and also probably after local
register allocation, since it would be very complex otherwise to
take into account conditional moves in some optimizations (copy prop,
instruction scheduling, register allocation itself).

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list