summaryrefslogtreecommitdiff
path: root/avx512-0037785/compiler/m68k/aoptcpu.pas
diff options
context:
space:
mode:
Diffstat (limited to 'avx512-0037785/compiler/m68k/aoptcpu.pas')
-rw-r--r--avx512-0037785/compiler/m68k/aoptcpu.pas44
1 files changed, 24 insertions, 20 deletions
diff --git a/avx512-0037785/compiler/m68k/aoptcpu.pas b/avx512-0037785/compiler/m68k/aoptcpu.pas
index 948bc28ff1..79b4331895 100644
--- a/avx512-0037785/compiler/m68k/aoptcpu.pas
+++ b/avx512-0037785/compiler/m68k/aoptcpu.pas
@@ -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);