mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 16:49:31 +02:00
m68k: refactoring to use fpu_capabilities at more places instead of hardwiring certain fpu types
git-svn-id: trunk@42925 -
This commit is contained in:
parent
0c6f7321bf
commit
de095c4631
@ -1084,7 +1084,7 @@ unit cgcpu;
|
||||
var
|
||||
ref : treference;
|
||||
begin
|
||||
if use_push(cgpara) and (current_settings.fputype in [fpu_68881,fpu_coldfire]) then
|
||||
if use_push(cgpara) and (FPUM68K_HAS_HARDWARE in fpu_capabilities[current_settings.fputype]) then
|
||||
begin
|
||||
cgpara.check_simple_location;
|
||||
reference_reset_base(ref, NR_STACK_POINTER_REG, 0, ctempposinvalid, cgpara.alignment, []);
|
||||
@ -1117,7 +1117,7 @@ unit cgcpu;
|
||||
inherited a_loadfpu_ref_cgpara(list,size,ref,cgpara);
|
||||
end
|
||||
else
|
||||
if use_push(cgpara) and (current_settings.fputype in [fpu_68881,fpu_coldfire]) then
|
||||
if use_push(cgpara) and (FPUM68K_HAS_HARDWARE in fpu_capabilities[current_settings.fputype]) then
|
||||
begin
|
||||
//list.concat(tai_comment.create(strpnew('a_loadfpu_ref_cgpara copy')));
|
||||
cgpara.check_simple_location;
|
||||
|
@ -186,24 +186,21 @@ implementation
|
||||
procedure t68kinlinenode.second_sqr_real;
|
||||
begin
|
||||
secondpass(left);
|
||||
case current_settings.fputype of
|
||||
fpu_68881,fpu_coldfire:
|
||||
begin
|
||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!')));
|
||||
hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
|
||||
location_copy(location,left.location);
|
||||
if left.location.loc=LOC_CFPUREGISTER then
|
||||
begin
|
||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!: left was cfpuregister!')));
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
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,fpuregopsize,left.location.register,location.register));
|
||||
end;
|
||||
else
|
||||
|
||||
if not (FPUM68K_HAS_HARDWARE in fpu_capabilities[current_settings.fputype]) then
|
||||
internalerror(2015022202);
|
||||
end;
|
||||
|
||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!')));
|
||||
hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
|
||||
location_copy(location,left.location);
|
||||
if left.location.loc=LOC_CFPUREGISTER then
|
||||
begin
|
||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!: left was cfpuregister!')));
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
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,fpuregopsize,left.location.register,location.register));
|
||||
end;
|
||||
|
||||
procedure t68kinlinenode.second_sqrt_real;
|
||||
@ -235,35 +232,32 @@ implementation
|
||||
href: TReference;
|
||||
begin
|
||||
secondpass(left);
|
||||
case current_settings.fputype of
|
||||
fpu_68881,fpu_coldfire:
|
||||
begin
|
||||
location_reset(location,LOC_FPUREGISTER,left.location.size);
|
||||
|
||||
case left.location.loc of
|
||||
LOC_FPUREGISTER:
|
||||
begin
|
||||
location.register:=left.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,fpuregopsize,left.location.register,location.register));
|
||||
end;
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
begin
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
href:=left.location.reference;
|
||||
tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,current_settings.fputype = fpu_coldfire);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,tcgsize2opsize[left.location.size],href,location.register));
|
||||
end;
|
||||
else
|
||||
internalerror(2015022205);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
if not (FPUM68K_HAS_HARDWARE in fpu_capabilities[current_settings.fputype]) then
|
||||
internalerror(2015022204);
|
||||
|
||||
location_reset(location,LOC_FPUREGISTER,left.location.size);
|
||||
|
||||
case left.location.loc of
|
||||
LOC_FPUREGISTER:
|
||||
begin
|
||||
location.register:=left.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,fpuregopsize,left.location.register,location.register));
|
||||
end;
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
begin
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
href:=left.location.reference;
|
||||
tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,current_settings.fputype = fpu_coldfire);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,tcgsize2opsize[left.location.size],href,location.register));
|
||||
end;
|
||||
else
|
||||
internalerror(2015022205);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -273,36 +267,33 @@ implementation
|
||||
hreg: TRegister;
|
||||
begin
|
||||
secondpass(left);
|
||||
case current_settings.fputype of
|
||||
fpu_68881,fpu_coldfire:
|
||||
begin
|
||||
location_reset(location,LOC_FPUREGISTER,left.location.size);
|
||||
|
||||
case left.location.loc of
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
begin
|
||||
hreg:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,left.location.register,hreg));
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
|
||||
end;
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
begin
|
||||
hreg:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
href:=left.location.reference;
|
||||
tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,current_settings.fputype = fpu_coldfire);
|
||||
cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmlist,left.location.size,OS_NO,href,location.register);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,location.register,hreg));
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
|
||||
end;
|
||||
else
|
||||
internalerror(2017052101);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
if not (FPUM68K_HAS_FINTRZ in fpu_capabilities[current_settings.fputype]) then
|
||||
internalerror(2017052102);
|
||||
|
||||
location_reset(location,LOC_FPUREGISTER,left.location.size);
|
||||
|
||||
case left.location.loc of
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
begin
|
||||
hreg:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,left.location.register,hreg));
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
|
||||
end;
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
begin
|
||||
hreg:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||
href:=left.location.reference;
|
||||
tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,current_settings.fputype = fpu_coldfire);
|
||||
cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmlist,left.location.size,OS_NO,href,location.register);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,location.register,hreg));
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
|
||||
end;
|
||||
else
|
||||
internalerror(2017052101);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user