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

   if (flags & MulImmediate) {
      a.mov(a.ecx, sign_extend<16>(instr.simm));
   } else {
      a.mov(a.ecx, a.ppcgpr[instr.rB]);
   }

   a.imul(a.ecx);

   if (flags & MulLow) {
      a.mov(a.ppcgpr[instr.rD], a.eax);

      if (flags & MulCheckRecord) {
         if (instr.rc) {
            updateConditionRegister(a, a.eax, a.ecx, a.edx);
         }
      }
   } else if (flags & MulHigh) {
      a.mov(a.ppcgpr[instr.rD], a.edx);

      if (flags & MulCheckRecord) {
         if (instr.rc) {
            updateConditionRegister(a, a.edx, a.ecx, a.eax);
         }
      }
   } else {
      assert(0);
   }

   return true;
}