m68k: when saving/restoring FPU registers, use the right FPU register size on ColdFire to calculate the stored size

git-svn-id: trunk@33614 -
This commit is contained in:
Károly Balogh 2016-05-02 14:18:30 +00:00
parent ba0a4a78f3
commit 92b2cf917d
5 changed files with 25 additions and 18 deletions

View File

@ -879,7 +879,7 @@ unit cgcpu;
var var
instr : taicpu; instr : taicpu;
begin begin
instr:=taicpu.op_reg_reg(A_FMOVE,fpuregsize,reg1,reg2); instr:=taicpu.op_reg_reg(A_FMOVE,fpuregopsize,reg1,reg2);
add_move_instruction(instr); add_move_instruction(instr);
list.concat(instr); list.concat(instr);
end; end;
@ -1754,7 +1754,7 @@ unit cgcpu;
if saved_fpu_registers[r] in rg[R_FPUREGISTER].used_in_proc then if saved_fpu_registers[r] in rg[R_FPUREGISTER].used_in_proc then
begin begin
hfreg:=newreg(R_FPUREGISTER,saved_fpu_registers[r],R_SUBNONE); hfreg:=newreg(R_FPUREGISTER,saved_fpu_registers[r],R_SUBNONE);
inc(fsize,12{sizeof(extended)}); inc(fsize,fpuregsize);
fpuregs:=fpuregs + [saved_fpu_registers[r]]; fpuregs:=fpuregs + [saved_fpu_registers[r]];
end; end;
@ -1787,10 +1787,10 @@ unit cgcpu;
begin begin
{ size is always longword aligned, while fsize is not } { size is always longword aligned, while fsize is not }
inc(href.offset,size); inc(href.offset,size);
if fsize = 12{sizeof(extended)} then if fsize = fpuregsize then
list.concat(taicpu.op_reg_ref(A_FMOVE,fpuregsize,hfreg,href)) list.concat(taicpu.op_reg_ref(A_FMOVE,fpuregopsize,hfreg,href))
else else
list.concat(taicpu.op_regset_ref(A_FMOVEM,fpuregsize,[],[],fpuregs,href)); list.concat(taicpu.op_regset_ref(A_FMOVEM,fpuregopsize,[],[],fpuregs,href));
end; end;
end; end;
end; end;
@ -1845,7 +1845,7 @@ unit cgcpu;
for r:=low(saved_fpu_registers) to high(saved_fpu_registers) do for r:=low(saved_fpu_registers) to high(saved_fpu_registers) do
if saved_fpu_registers[r] in rg[R_FPUREGISTER].used_in_proc then if saved_fpu_registers[r] in rg[R_FPUREGISTER].used_in_proc then
begin begin
inc(fsize,12{sizeof(extended)}); inc(fsize,fpuregsize);
hfreg:=newreg(R_FPUREGISTER,saved_fpu_registers[r],R_SUBNONE); hfreg:=newreg(R_FPUREGISTER,saved_fpu_registers[r],R_SUBNONE);
{ Allocate register so the optimizer does not remove the load } { Allocate register so the optimizer does not remove the load }
a_reg_alloc(list,hfreg); a_reg_alloc(list,hfreg);
@ -1875,10 +1875,10 @@ unit cgcpu;
begin begin
{ size is always longword aligned, while fsize is not } { size is always longword aligned, while fsize is not }
inc(href.offset,size); inc(href.offset,size);
if fsize = 12{sizeof(extended)} then if fsize = fpuregsize then
list.concat(taicpu.op_ref_reg(A_FMOVE,fpuregsize,href,hfreg)) list.concat(taicpu.op_ref_reg(A_FMOVE,fpuregopsize,href,hfreg))
else else
list.concat(taicpu.op_ref_regset(A_FMOVEM,fpuregsize,href,[],[],fpuregs)); list.concat(taicpu.op_ref_regset(A_FMOVEM,fpuregopsize,href,[],[],fpuregs));
end; end;
tg.UnGetTemp(list,current_procinfo.save_regs_ref); tg.UnGetTemp(list,current_procinfo.save_regs_ref);

View File

@ -538,9 +538,16 @@ implementation
result:=getregtype(reg)=R_INTREGISTER; result:=getregtype(reg)=R_INTREGISTER;
end; end;
function fpuregsize: TOpSize; {$ifdef USEINLINE}inline;{$endif USEINLINE} function fpuregopsize: TOpSize; {$ifdef USEINLINE}inline;{$endif USEINLINE}
const const
fpu_regsize: array[boolean] of TOpSize = ( S_FX, S_FD ); fpu_regopsize: array[boolean] of TOpSize = ( S_FX, S_FD );
begin
result:=fpu_regopsize[current_settings.fputype = fpu_coldfire];
end;
function fpuregsize: aint; {$ifdef USEINLINE}inline;{$endif USEINLINE}
const
fpu_regsize: array[boolean] of aint = ( 12, 8 ); { S_FX is 12 bytes on '881 }
begin begin
result:=fpu_regsize[current_settings.fputype = fpu_coldfire]; result:=fpu_regsize[current_settings.fputype = fpu_coldfire];
end; end;

View File

@ -182,7 +182,7 @@ implementation
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register); cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
case right.location.loc of case right.location.loc of
LOC_FPUREGISTER,LOC_CFPUREGISTER: LOC_FPUREGISTER,LOC_CFPUREGISTER:
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,fpuregsize,right.location.register,location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,fpuregopsize,right.location.register,location.register));
LOC_REFERENCE,LOC_CREFERENCE: LOC_REFERENCE,LOC_CREFERENCE:
begin begin
href:=right.location.reference; href:=right.location.reference;
@ -219,7 +219,7 @@ implementation
{ emit compare } { emit compare }
case right.location.loc of case right.location.loc of
LOC_FPUREGISTER,LOC_CFPUREGISTER: LOC_FPUREGISTER,LOC_CFPUREGISTER:
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCMP,fpuregsize,right.location.register,left.location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCMP,fpuregopsize,right.location.register,left.location.register));
LOC_REFERENCE,LOC_CREFERENCE: LOC_REFERENCE,LOC_CREFERENCE:
begin begin
href:=right.location.reference; href:=right.location.reference;

View File

@ -176,7 +176,7 @@ implementation
location.loc := LOC_FPUREGISTER; location.loc := LOC_FPUREGISTER;
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register); cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
end; end;
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FMUL,fpuregsize,left.location.register,location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FMUL,fpuregopsize,left.location.register,location.register));
end; end;
else else
internalerror(2015022202); internalerror(2015022202);
@ -215,12 +215,12 @@ implementation
LOC_FPUREGISTER: LOC_FPUREGISTER:
begin begin
location.register:=left.location.register; location.register:=left.location.register;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(op,fpuregsize,location.register)) current_asmdata.CurrAsmList.concat(taicpu.op_reg(op,fpuregopsize,location.register))
end; end;
LOC_CFPUREGISTER: LOC_CFPUREGISTER:
begin begin
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,fpuregsize,left.location.register,location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,fpuregopsize,left.location.register,location.register));
end; end;
LOC_REFERENCE,LOC_CREFERENCE: LOC_REFERENCE,LOC_CREFERENCE:
begin begin

View File

@ -200,12 +200,12 @@ implementation
LOC_FPUREGISTER: LOC_FPUREGISTER:
begin begin
location.register:=left.location.register; location.register:=left.location.register;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_FNEG,fpuregsize,location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_FNEG,fpuregopsize,location.register));
end; end;
LOC_CFPUREGISTER: LOC_CFPUREGISTER:
begin begin
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FNEG,fpuregsize,left.location.register,location.register)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FNEG,fpuregopsize,left.location.register,location.register));
end; end;
else else
internalerror(200306021); internalerror(200306021);