mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 00:19:19 +02:00
m68k: optimize a few cases of comparisons against inlined realconsts
git-svn-id: trunk@33669 -
This commit is contained in:
parent
7710300c22
commit
2dbfca4e8e
@ -60,6 +60,7 @@ unit aoptcpu;
|
||||
var
|
||||
next: tai;
|
||||
tmpref: treference;
|
||||
tmpsingle: single;
|
||||
begin
|
||||
result:=false;
|
||||
case p.typ of
|
||||
@ -135,6 +136,31 @@ unit aoptcpu;
|
||||
taicpu(p).ops:=1;
|
||||
result:=true;
|
||||
end;
|
||||
A_FCMP:
|
||||
if (taicpu(p).oper[0]^.typ = top_realconst) then
|
||||
begin
|
||||
if (taicpu(p).oper[0]^.val_real = 0.0) then
|
||||
begin
|
||||
DebugMsg('Optimizer: FCMP #0.0 to FTST',p);
|
||||
taicpu(p).opcode:=A_FTST;
|
||||
taicpu(p).opsize:=S_FX;
|
||||
taicpu(p).loadoper(0,taicpu(p).oper[1]^);
|
||||
taicpu(p).clearop(1);
|
||||
taicpu(p).ops:=1;
|
||||
result:=true;
|
||||
end
|
||||
else
|
||||
begin
|
||||
tmpsingle:=taicpu(p).oper[0]^.val_real;
|
||||
if (taicpu(p).opsize = S_FD) and
|
||||
((taicpu(p).oper[0]^.val_real - tmpsingle) = 0.0) then
|
||||
begin
|
||||
DebugMsg('Optimizer: FCMP const to lesser precision',p);
|
||||
taicpu(p).opsize:=S_FS;
|
||||
result:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user