void PPCXEmitter::SaveFloatSwap(PPCReg FRt, PPCReg Base, PPCReg offset) { // used for swapping float ... u32 tmp; // Save Value in tmp MOVI2R(R7, (u32)&tmp); SFS(FRt, R7, 0); // Load the value in R6 LWZ(R6, R7); // Save the final value STWBRX(R6, Base, offset); }
void Assembler::asm_load32(LIns *ins) { LIns* base = ins->oprnd1(); int d = ins->disp(); Register rr = prepResultReg(ins, GpRegs); Register ra = getBaseReg(ins->opcode(), base, d, GpRegs); switch(ins->opcode()) { case LIR_ldzb: case LIR_ldcb: if (isS16(d)) { LBZ(rr, d, ra); } else { LBZX(rr, ra, R0); // rr = [ra+R0] asm_li(R0,d); } return; case LIR_ldzs: case LIR_ldcs: // these are expected to be 2 or 4-byte aligned if (isS16(d)) { LHZ(rr, d, ra); } else { LHZX(rr, ra, R0); // rr = [ra+R0] asm_li(R0,d); } return; case LIR_ld: case LIR_ldc: // these are expected to be 4-byte aligned if (isS16(d)) { LWZ(rr, d, ra); } else { LWZX(rr, ra, R0); // rr = [ra+R0] asm_li(R0,d); } return; case LIR_ldsb: case LIR_ldss: case LIR_ldcsb: case LIR_ldcss: NanoAssertMsg(0, "NJ_EXPANDED_LOADSTORE_SUPPORTED not yet supported for this architecture"); return; default: NanoAssertMsg(0, "asm_load32 should never receive this LIR opcode"); return; } }
void PPCXEmitter::Epilogue() { u32 regSize = 8; // 4 in 32bit system u32 stackFrameSize = 32*32;//(35 - 12) * regSize; // Write Epilogue (restore stack frame, return) // free stack ADDI(R1, R1, stackFrameSize); // Restore regs for(int i = 14; i < 32; i ++) { LD((PPCReg)i, R1, -((33 - i) * regSize)); } // recover r12 (LR saved register) LWZ (R12, R1, -0x8); // Restore Lr MTLR(R12); }
void Assembler::asm_ld(LIns *ins) { LIns* base = ins->oprnd1(); int d = ins->disp(); Register rr = prepResultReg(ins, GpRegs); Register ra = getBaseReg(ins->opcode(), base, d, GpRegs); #if !PEDANTIC if (isS16(d)) { if (ins->isop(LIR_ldcb)) { LBZ(rr, d, ra); } else { LWZ(rr, d, ra); } return; } #endif // general case underrunProtect(12); LWZX(rr, ra, R0); // rr = [ra+R0] asm_li(R0,d); }
void PPCXEmitter::Epilogue() { u32 regSize = 8; // 4 in 32bit system u32 stackFrameSize = 0x1F0; //Break(); // Write Epilogue (restore stack frame, return) // free stack ADDI(R1, R1, stackFrameSize); #if 0 ADDI(R12, R1, -0x98); // Restore fpr for(int i = 14; i < 32; i ++) { LFD((PPCReg)i, R1, -((32 - i) * regSize)); } #endif // Restore gpr for(int i = 14; i < 32; i ++) { LD((PPCReg)i, R1, -((33 - i) * regSize)); } // recover r12 (LR saved register) LWZ (R12, R1, -0x8); // Restore Lr MTLR(R12); #if 1 // load fpr buff MOVI2R(R5, (u32)&_fprTmp); // Load fpr for(int i = 14; i < 32; i ++) { LFD((PPCReg)i, R5, i * regSize); } #endif }