m68k: do not optimize away fmove fpureg0, intreg0; fmove intreg0; fpureg0; constructs, they're used for rounding to single on FPUs with no resultprecision encoding

git-svn-id: trunk@48413 -
This commit is contained in:
Károly Balogh 2021-01-25 00:12:53 +00:00
parent 0ab4515e58
commit da1746426b

View File

@ -253,26 +253,30 @@ unit aoptcpu;
opstr:=opname(p);
case taicpu(p).oper[0]^.typ of
top_reg:
begin
{ move %reg0, %tmpreg; move %tmpreg, <ea> -> move %reg0, <ea> }
taicpu(p).loadOper(1,taicpu(next).oper[1]^);
asml.remove(next);
next.free;
result:=true;
{ also remove leftover move %reg0, %reg0, which can occur as the result
of the previous optimization, if %reg0 and %tmpreg was different types
(addr vs. data), so these moves were left in by the cg }
if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then
begin
DebugMsg('Optimizer: '+opstr+' + '+opstr+' removed',p);
GetNextInstruction(p,next);
asml.remove(p);
p.free;
p:=next;
end
else
DebugMsg('Optimizer: '+opstr+' + '+opstr+' to '+opstr+' #1',p)
end;
{ do not optimize away FPU to INT to FPU reg moves. These are used for
to-single-rounding on FPUs which have no FSMOVE/FDMOVE. (KB) }
if not ((taicpu(p).opcode = A_FMOVE) and
(getregtype(taicpu(p).oper[0]^.reg) <> getregtype(taicpu(p).oper[1]^.reg))) then
begin
{ move %reg0, %tmpreg; move %tmpreg, <ea> -> move %reg0, <ea> }
taicpu(p).loadOper(1,taicpu(next).oper[1]^);
asml.remove(next);
next.free;
result:=true;
{ also remove leftover move %reg0, %reg0, which can occur as the result
of the previous optimization, if %reg0 and %tmpreg was different types
(addr vs. data), so these moves were left in by the cg }
if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then
begin
DebugMsg('Optimizer: '+opstr+' + '+opstr+' removed',p);
GetNextInstruction(p,next);
asml.remove(p);
p.free;
p:=next;
end
else
DebugMsg('Optimizer: '+opstr+' + '+opstr+' to '+opstr+' #1',p)
end;
top_const:
begin
// DebugMsg('Optimizer: '+opstr+' + '+opstr+' to '+opstr+' #2',p);