[Mono-devel-list] StringBuilder patch

Torstensson, Patrik patrik.torstensson at intel.com
Mon Jan 12 15:51:54 EST 2004


>'GCC -O3' doesn't do this? You gotta be kidding me! (the JIT <i>can</i>
>shift this, right?)

JIT is shifting it, Paolo's point is that we can avoid that pass in
cfolding :)

>- who's up for guessing the best x86 asm for this:
>    int foo (int i) { return (i == 0) ? 3 : 7; }
>    <hint> no branches </hint>

cmov is a nice instruction....

>- how common is this construct?

Don't really know, I tested a implementation for Math.Max/Math.Min for
that purpose, with cmov (we uses float version of cmov for float comp
operations)

>- how easy would it be to implement support for this kind of
optimization in
>the current JIT framework.

Depends, it's not to hard to scan looking for the asm, I was extending
the window of peephole to support cmov instructions, just to check if a
compare has two bb jumps and the bb only contains one ins and that's a
move, replace with cmov. I started working on that but now I'm focusing
on getting the local reg allocator to accept 3 reg operations like long
shl/shr without using helper functions.

Cheers,
 Patrik Torstensson



More information about the Mono-devel-list mailing list