Explorar o código

m68k: always check the V flag after MUL/DIV overflows, because MUL/DIV never sets the C flag. note that this fix is full 68k only. on CF, MUL doesn't set any of V or C flags

git-svn-id: trunk@36496 -
Károly Balogh %!s(int64=8) %!d(string=hai) anos
pai
achega
e0cbd48785
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      compiler/m68k/cgcpu.pas

+ 9 - 1
compiler/m68k/cgcpu.pas

@@ -1804,7 +1804,15 @@ unit cgcpu;
                                           pasbool8,pasbool16,pasbool32,pasbool64]))) then
           cond:=C_VC
         else
-          cond:=C_CC;
+          begin
+            { MUL/DIV always sets the overflow flag, and never the carry flag }
+            { Note/Fixme: This still doesn't cover the ColdFire, where none of these opcodes
+              set either the overflow or the carry flag. So CF must be handled in other ways. }
+            if taicpu(list.last).opcode in [A_MULU,A_MULS,A_DIVS,A_DIVU,A_DIVUL,A_DIVSL] then
+              cond:=C_VC
+            else
+              cond:=C_CC;
+          end;
         ai:=Taicpu.Op_Sym(A_Bxx,S_NO,hl);
         ai.SetCondition(cond);
         ai.is_jmp:=true;