# Patch created by kt # Date: So 29. Jun 20:02:44 CEST 2008 # Repository: libjit # Comments: # # Changes that fixes the issue at least for commutative ops. #### End of Preamble #### #### Patch data follows #### Index: jit/jit-reg-alloc.c =================================================================== RCS file: /cvsroot/dotgnu-pnet/libjit/jit/jit-reg-alloc.c,v retrieving revision 1.58 diff -c -r1.58 jit-reg-alloc.c *** jit/jit-reg-alloc.c 8 May 2008 06:39:51 -0000 1.58 --- jit/jit-reg-alloc.c 29 Jun 2008 18:02:51 -0000 *************** *** 3410,3415 **** --- 3410,3433 ---- printf("_jit_regs_assign()\n"); #endif + /* Normalize the input order values if possible so that */ + /* any involved constant is used as value2 or if any input */ + /* value matches the destination value it will be value1 */ + if(!regs->ternary && regs->commutative) + { + if(regs->descs[1].value && regs->descs[2].value) + { + if(regs->descs[1].value->is_constant) + { + swap_values(®s->descs[1], ®s->descs[2]); + } + else if(regs->descs[0].value == regs->descs[2].value) + { + swap_values(®s->descs[1], ®s->descs[2]); + } + } + } + /* For binary or unary ops with explicitely assigned registers the output always goes to the same register as the first input value unless this is a three-address instruction. */ #### End of Patch data ####