From 8471408273798ad9a9d7ea1853beaadc48019ce7 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 4 Aug 2014 20:46:14 -0700 Subject: [PATCH] lhau(x), fixes #110. --- src/alloy/frontend/ppc/ppc_emit_memory.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/alloy/frontend/ppc/ppc_emit_memory.cc b/src/alloy/frontend/ppc/ppc_emit_memory.cc index a7264f50c..9ac067641 100644 --- a/src/alloy/frontend/ppc/ppc_emit_memory.cc +++ b/src/alloy/frontend/ppc/ppc_emit_memory.cc @@ -143,13 +143,25 @@ XEEMITTER(lha, 0xA8000000, D)(PPCHIRBuilder& f, InstrData& i) { } XEEMITTER(lhau, 0xAC000000, D)(PPCHIRBuilder& f, InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; + // EA <- (RA) + EXTS(D) + // RT <- EXTS(MEM(EA, 2)) + // RA <- EA + Value* ea = CalculateEA_i(f, i.D.RA, XEEXTS16(i.D.DS)); + Value* rt = f.SignExtend(f.ByteSwap(f.Load(ea, INT16_TYPE)), INT64_TYPE); + f.StoreGPR(i.D.RT, rt); + f.StoreGPR(i.D.RA, ea); + return 0; } XEEMITTER(lhaux, 0x7C0002EE, X)(PPCHIRBuilder& f, InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; + // EA <- (RA) + (RB) + // RT <- EXTS(MEM(EA, 2)) + // RA <- EA + Value* ea = CalculateEA(f, i.X.RA, i.X.RB); + Value* rt = f.SignExtend(f.ByteSwap(f.Load(ea, INT16_TYPE)), INT64_TYPE); + f.StoreGPR(i.X.RT, rt); + f.StoreGPR(i.X.RA, ea); + return 0; } XEEMITTER(lhax, 0x7C0002AE, X)(PPCHIRBuilder& f, InstrData& i) {