Fix an embarrasing error in m68k which fixes 60 tests.

m68k/cgcpu.pas, tcg68k.g_flags2reg:
  * don't sign extend the flag value which was stored to the register, but instead do a "AND 1" on it to reduce it to 1 bit; afterall Booleans in Pascal are either 0 or 1 and not 0 or $FF

+ added test

git-svn-id: trunk@25598 -
This commit is contained in:
svenbarth 2013-09-28 20:07:57 +00:00
parent 4d6a9137cf
commit 2c93687c5a
3 changed files with 15 additions and 1 deletions

1
.gitattributes vendored
View File

@ -10018,6 +10018,7 @@ tests/tbs/tb0597.pp svneol=native#text/plain
tests/tbs/tb0598.pp svneol=native#text/plain
tests/tbs/tb0599.pp svneol=native#text/plain
tests/tbs/tb0600.pp svneol=native#text/plain
tests/tbs/tb0601.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tbs0594.pp svneol=native#text/pascal
tests/tbs/ub0060.pp svneol=native#text/plain

View File

@ -1480,7 +1480,9 @@ unit cgcpu;
ai.SetCondition(flags_to_cond(f));
list.concat(ai);
list.concat(taicpu.op_reg(A_EXTB,S_L,hreg));
{ Scc stores a complete byte of 1s, but the compiler expects only one
bit set, so ensure this is the case }
list.concat(taicpu.op_const_reg(A_AND,S_L,1,hreg));
if hreg<>reg then
begin

11
tests/tbs/tb0601.pp Normal file
View File

@ -0,0 +1,11 @@
program tb0601;
var
i1, i2, i3: LongWord;
begin
i1 := 42;
i2 := 84;
i3 := LongWord(i1 < i2);
if i3 <> 1 then
Halt(1);
end.