* fix abs() intrinsic optimisation, resolves #37301

git-svn-id: trunk@45732 -
This commit is contained in:
florian 2020-07-05 09:19:14 +00:00
parent 5ad02a3799
commit 3caacc529a
3 changed files with 20 additions and 6 deletions

1
.gitattributes vendored
View File

@ -18348,6 +18348,7 @@ tests/webtbs/tw37228.pp svneol=native#text/plain
tests/webtbs/tw37254.pp svneol=native#text/pascal
tests/webtbs/tw37261.pp svneol=native#text/pascal
tests/webtbs/tw37272a.pp svneol=native#text/pascal
tests/webtbs/tw37301.pp svneol=native#text/pascal
tests/webtbs/tw3742.pp svneol=native#text/plain
tests/webtbs/tw3751.pp svneol=native#text/plain
tests/webtbs/tw3758.pp svneol=native#text/plain

View File

@ -4322,14 +4322,14 @@ unit aoptx86;
with taicpu(hp4).oper[OperIdx]^ do
case typ of
top_reg:
if reg = NR_EDX then
reg := NR_EAX;
if getsupreg(reg) = RS_EDX then
reg := newreg(R_INTREGISTER,RS_EAX,getsubreg(reg));
top_ref:
begin
if ref^.base = NR_EDX then
ref^.base := NR_EAX;
if ref^.index = NR_EDX then
ref^.index := NR_EAX;
if getsupreg(reg) = RS_EDX then
ref^.base := newreg(R_INTREGISTER,RS_EAX,getsubreg(reg));
if getsupreg(reg) = RS_EDX then
ref^.index := newreg(R_INTREGISTER,RS_EAX,getsubreg(reg));
end;
else
;

13
tests/webtbs/tw37301.pp Normal file
View File

@ -0,0 +1,13 @@
{ %OPT=-O- -O1 }
program testbug;
{$mode objfpc}{$h+}
var
i: Integer;
b: Byte;
w: Word;
begin
i := 53;
b := 0;
w := abs(i-b);
WriteLn(w);
end.