This commit is contained in:
Ben Vanik 2013-05-24 21:54:04 -07:00
parent 9883f32fb7
commit 2586c10cc5
1 changed files with 16 additions and 11 deletions

View File

@ -99,7 +99,7 @@ XEEMITTER(addis, 0x3C000000, D )(X64Emitter& e, X86Compiler& c, InstrDat
// else // else
// RT <- (RA) + EXTS(SI) || i16.0 // RT <- (RA) + EXTS(SI) || i16.0
GpVar v = e.get_uint64(XEEXTS16(i.D.DS) << 16); GpVar v(e.get_uint64(XEEXTS16(i.D.DS) << 16));
if (i.D.RA) { if (i.D.RA) {
c.add(v, e.gpr_value(i.D.RA)); c.add(v, e.gpr_value(i.D.RA));
} }
@ -113,18 +113,24 @@ XEEMITTER(addmex, 0x7C0001D4, XO )(X64Emitter& e, X86Compiler& c, InstrDat
return 1; return 1;
} }
#if 0
XEEMITTER(addzex, 0x7C000194, XO )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(addzex, 0x7C000194, XO )(X64Emitter& e, X86Compiler& c, InstrData& i) {
// RT <- (RA) + CA // RT <- (RA) + CA
// TODO(benvanik): handle overflow exception. // Add in carry flag from XER, only if needed.
jit_value_t ca = jit_insn_and(f, // It may be possible to do this much more efficiently.
jit_insn_ushr(f, e.xer_value(), e.get_uint32(29)), GpVar xer(c.newGpVar());
e.get_uint64(0x1)); c.mov(xer, e.xer_value());
jit_value_t v = jit_insn_add_ovf(f, c.shr(xer, imm(29));
e.make_signed(e.gpr_value(i.XO.RA)), c.and_(xer, imm(1));
e.make_signed(ca)); GpVar v(c.newGpVar());
c.mov(v, e.gpr_value(i.XO.RA));
c.add(v, xer);
GpVar cc(c.newGpVar());
c.setc(cc);
e.update_gpr_value(i.XO.RT, v); e.update_gpr_value(i.XO.RT, v);
e.update_xer_with_carry(cc);
if (i.XO.OE) { if (i.XO.OE) {
// With XER[SO] update too. // With XER[SO] update too.
//e.update_xer_with_overflow_and_carry(b.CreateExtractValue(v, 1)); //e.update_xer_with_overflow_and_carry(b.CreateExtractValue(v, 1));
@ -140,7 +146,6 @@ XEEMITTER(addzex, 0x7C000194, XO )(X64Emitter& e, X86Compiler& c, InstrDat
return 0; return 0;
} }
#endif
XEEMITTER(divdx, 0x7C0003D2, XO )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(divdx, 0x7C0003D2, XO )(X64Emitter& e, X86Compiler& c, InstrData& i) {
XEINSTRNOTIMPLEMENTED(); XEINSTRNOTIMPLEMENTED();
@ -1069,7 +1074,7 @@ void X64RegisterEmitCategoryALU() {
XEREGISTERINSTR(addicx, 0x34000000); XEREGISTERINSTR(addicx, 0x34000000);
XEREGISTERINSTR(addis, 0x3C000000); XEREGISTERINSTR(addis, 0x3C000000);
XEREGISTERINSTR(addmex, 0x7C0001D4); XEREGISTERINSTR(addmex, 0x7C0001D4);
// XEREGISTERINSTR(addzex, 0x7C000194); XEREGISTERINSTR(addzex, 0x7C000194);
XEREGISTERINSTR(divdx, 0x7C0003D2); XEREGISTERINSTR(divdx, 0x7C0003D2);
XEREGISTERINSTR(divdux, 0x7C000392); XEREGISTERINSTR(divdux, 0x7C000392);
// XEREGISTERINSTR(divwx, 0x7C0003D6); // XEREGISTERINSTR(divwx, 0x7C0003D6);