Example #1
0
// Negate
static bool
neg(PPCEmuAssembler& a, Instruction instr)
{
   a.mov(a.eax, a.ppcgpr[instr.rA]);
   a.neg(a.eax);
   a.mov(a.ppcgpr[instr.rD], a.eax);

   if (instr.oe) {
      a.mov(a.ecx, 0);
      a.seto(a.ecx.r8());

      // Reset overflow
      a.mov(a.edx, a.ppcxer);
      a.and_(a.edx, ~XERegisterBits::Overflow);

      a.shiftTo(a.ecx, 0, XERegisterBits::Overflow);
      a.or_(a.edx, a.ecx);
      a.shiftTo(a.ecx, XERegisterBits::Overflow, XERegisterBits::StickyOV);
      a.or_(a.edx, a.ecx);

      a.mov(a.ppcxer, a.edx);
   }

   if (instr.rc) {
      updateConditionRegister(a, a.eax, a.ecx, a.edx);
   }

   return true;
}