From e0cbd487859d3d19d1ba75a8533be95c415cbfa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Mon, 12 Jun 2017 23:56:05 +0000 Subject: [PATCH] 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 - --- compiler/m68k/cgcpu.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas index b6cebaa9a3..369210d875 100644 --- a/compiler/m68k/cgcpu.pas +++ b/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;