Hi, I would vote for adding a flag, as it is simpler.
Zoltan On Sat, Aug 9, 2008 at 12:25 AM, Rodrigo Kumpera <[EMAIL PROTECTED]> wrote: > Hey guys, > > I just got myself into a roadblock today while fixing overflow arithmetic > under ARM. The issue is that the emitted IR > cannot be properly translated to native code. > > The ARM ISA has the oddity that carry/borrow works in the opposite way. Add > with carry do a +1 if the carry bit is set, > but Sub with borrow do a -1 if the carry bit is not set. > > Then we have mono_decompose_opcode that use the same condition for both add > and sub: > > case OP_IADD_OVF: > ins->opcode = OP_IADDCC; > MONO_EMIT_NEW_COND_EXC (cfg, IOV, "OverflowException"); > break; > case OP_ISUB_OVF: > ins->opcode = OP_ISUBCC; > MONO_EMIT_NEW_COND_EXC (cfg, IOV, "OverflowException"); > break; > > > I cannot fix that in the arm back-end as it should not reason about previous > instructions. > My idea is to either move the SUB opcodes to arch specific code or add an > #if MONO_ARCH_SUB_INVERTED_CARRY_FLAG. > > What do you guys think about this? > > Cheers, > Rodrigo > > > _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list