}
if(opcode2[i]==0x1A) // DIV
{
- #if 1
+ #if 0
signed char m1l=get_reg(i_regs->regmap,rs1[i]);
signed char m2l=get_reg(i_regs->regmap,rs2[i]);
assert(m1l>=0);
}
if(opcode2[i]==0x1B) // DIVU
{
- signed char d1=get_reg(i_regs->regmap,rs1[i]); // dividend
+ #if 0
+ signed char m1l=get_reg(i_regs->regmap,rs1[i]);
+ signed char m2l=get_reg(i_regs->regmap,rs2[i]);
+ assert(m1l>=0);
+ assert(m2l>=0);
+ save_regs(0x100f);
+ if(m1l!=0) emit_mov(m1l,0);
+ if(m2l<1) emit_readword((int)&dynarec_local,1);
+ else if(m2l>1) emit_mov(m2l,1);
+ emit_call((int)&divu32);
+ restore_regs(0x100f);
+ signed char hil=get_reg(i_regs->regmap,HIREG);
+ if(hil>=0) emit_loadreg(HIREG,hil);
+ signed char lol=get_reg(i_regs->regmap,LOREG);
+ if(lol>=0) emit_loadreg(LOREG,lol);
+ #else
+ signed char d1=get_reg(i_regs->regmap,rs1[i]); // dividend
signed char d2=get_reg(i_regs->regmap,rs2[i]); // divisor
assert(d1>=0);
assert(d2>=0);
emit_adcs(quotient,quotient,quotient);
emit_shrcc_imm(d2,1,d2);
emit_jcc((int)out-16); // -4
+ #endif
}
}
else // 64-bit
//#define DEBUG_CYCLE_COUNT 1
// Uncomment these two lines to generate debug output:
-//#define ASSEM_DEBUG 1
+#//define ASSEM_DEBUG 1
//#define INV_DEBUG 1
// Uncomment this line to output the number of NOTCOMPILED blocks as they occur:
current->uu&=~(1LL<<HIREG);
current->uu&=~(1LL<<LOREG);
alloc_reg64(current,i,HIREG);
+ alloc_reg64(current,i,LOREG);
//if(HOST_REGS>10) alloc_reg64(current,i,LOREG); //*SEB* Why commenting this line? uncommenting make SM64 freeze after title (before mario head and spinning stars)
alloc_reg64(current,i,rs1[i]);
alloc_reg64(current,i,rs2[i]);
// Multiply by zero is zero.
// MIPS does not have a divide by zero exception.
// The result is undefined, we return zero.
- alloc_reg(current,i,HIREG);
- alloc_reg(current,i,LOREG);
- current->is32|=1LL<<HIREG;
- current->is32|=1LL<<LOREG;
+ if((opcode2[i]&4)==0) // 32-bit
+ {
+ alloc_reg(current,i,HIREG);
+ alloc_reg(current,i,LOREG);
+ current->is32|=1LL<<HIREG;
+ current->is32|=1LL<<LOREG;
+ } else {
+ alloc_reg64(current,i,HIREG);
+ alloc_reg64(current,i,LOREG);
+ current->is32&=~(1LL<<HIREG);
+ current->is32&=~(1LL<<LOREG);
+ }
dirty_reg(current,HIREG);
dirty_reg(current,LOREG);
}