ldx/ldux.

This commit is contained in:
Ben Vanik 2013-05-26 17:19:13 -07:00
parent 0ca44083e6
commit a6db12b48f
2 changed files with 38 additions and 8 deletions

View File

@ -81,13 +81,19 @@ XEDISASMR(ldu, 0xE8000001, DS )(InstrData& i, InstrDisasm& d) {
} }
XEDISASMR(ldux, 0x7C00006A, X )(InstrData& i, InstrDisasm& d) { XEDISASMR(ldux, 0x7C00006A, X )(InstrData& i, InstrDisasm& d) {
XEINSTRNOTIMPLEMENTED(); d.Init("ldux", "Load Doubleword with Update Indexed", 0);
return 1; d.AddRegOperand(InstrRegister::kGPR, i.X.RT, InstrRegister::kWrite);
d.AddRegOperand(InstrRegister::kGPR, i.X.RA, InstrRegister::kReadWrite);
d.AddRegOperand(InstrRegister::kGPR, i.X.RB, InstrRegister::kRead);
return d.Finish();
} }
XEDISASMR(ldx, 0x7C00002A, X )(InstrData& i, InstrDisasm& d) { XEDISASMR(ldx, 0x7C00002A, X )(InstrData& i, InstrDisasm& d) {
XEINSTRNOTIMPLEMENTED(); d.Init("ldx", "Load Doubleword Indexed", 0);
return 1; d.AddRegOperand(InstrRegister::kGPR, i.X.RT, InstrRegister::kWrite);
d.AddRegOperand(InstrRegister::kGPR, i.X.RA, InstrRegister::kRead);
d.AddRegOperand(InstrRegister::kGPR, i.X.RB, InstrRegister::kRead);
return d.Finish();
} }
XEDISASMR(lha, 0xA8000000, D )(InstrData& i, InstrDisasm& d) { XEDISASMR(lha, 0xA8000000, D )(InstrData& i, InstrDisasm& d) {

View File

@ -132,13 +132,37 @@ XEEMITTER(ldu, 0xE8000001, DS )(X64Emitter& e, X86Compiler& c, InstrDat
} }
XEEMITTER(ldux, 0x7C00006A, X )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(ldux, 0x7C00006A, X )(X64Emitter& e, X86Compiler& c, InstrData& i) {
XEINSTRNOTIMPLEMENTED(); // EA <- (RA) + (RB)
return 1; // RT <- MEM(EA, 8)
// RA <- EA
GpVar ea(c.newGpVar());
c.mov(ea, e.gpr_value(i.X.RA));
c.add(ea, e.gpr_value(i.X.RB));
e.update_gpr_value(i.X.RA, ea);
GpVar v = e.ReadMemory(i.address, ea, 8, false);
e.update_gpr_value(i.X.RT, v);
return 0;
} }
XEEMITTER(ldx, 0x7C00002A, X )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(ldx, 0x7C00002A, X )(X64Emitter& e, X86Compiler& c, InstrData& i) {
XEINSTRNOTIMPLEMENTED(); // if RA = 0 then
return 1; // b <- 0
// else
// b <- (RA)
// EA <- b + (RB)
// RT <- MEM(EA, 8)
GpVar ea(c.newGpVar());
c.mov(ea, e.gpr_value(i.X.RB));
if (i.X.RA) {
c.add(ea, e.gpr_value(i.X.RA));
}
GpVar v = e.ReadMemory(i.address, ea, 8, false);
e.update_gpr_value(i.X.RT, v);
return 0;
} }
XEEMITTER(lha, 0xA8000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(lha, 0xA8000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) {