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

View File

@ -538,9 +538,16 @@ implementation
result:=getregtype(reg)=R_INTREGISTER;
end;
function fpuregsize: TOpSize; {$ifdef USEINLINE}inline;{$endif USEINLINE}
function fpuregopsize: TOpSize; {$ifdef USEINLINE}inline;{$endif USEINLINE}
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
result:=fpu_regsize[current_settings.fputype = fpu_coldfire];
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);
case right.location.loc of
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:
begin
href:=right.location.reference;
@ -219,7 +219,7 @@ implementation
{ emit compare }
case right.location.loc of
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:
begin
href:=right.location.reference;

View File

@ -176,7 +176,7 @@ implementation
location.loc := LOC_FPUREGISTER;
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
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;
else
internalerror(2015022202);
@ -215,12 +215,12 @@ implementation
LOC_FPUREGISTER:
begin
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;
LOC_CFPUREGISTER:
begin
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;
LOC_REFERENCE,LOC_CREFERENCE:
begin

View File

@ -200,12 +200,12 @@ implementation
LOC_FPUREGISTER:
begin
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;
LOC_CFPUREGISTER:
begin
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;
else
internalerror(200306021);