mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-20 13:15:57 +02:00
m68k: implemented sqrt_real and abs_real inlines
git-svn-id: trunk@29805 -
This commit is contained in:
parent
bd467adf52
commit
c72f58bcc5
@ -496,6 +496,15 @@ type
|
|||||||
// FPU opcodes
|
// FPU opcodes
|
||||||
A_FSXX, A_FSEQ, A_FSNE, A_FSLT, A_FSLE, A_FSGT, A_FSGE:
|
A_FSXX, A_FSEQ, A_FSNE, A_FSLT, A_FSLE, A_FSGT, A_FSGE:
|
||||||
result:=operand_write;
|
result:=operand_write;
|
||||||
|
A_FABS,A_FSQRT:
|
||||||
|
if ops = 1 then
|
||||||
|
begin
|
||||||
|
if opnr = 0 then
|
||||||
|
result:=operand_readwrite;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if opnr = 1 then
|
||||||
|
result:=operand_write;
|
||||||
A_FMOVE:
|
A_FMOVE:
|
||||||
if opnr=1 then
|
if opnr=1 then
|
||||||
result:=operand_write;
|
result:=operand_write;
|
||||||
|
@ -26,27 +26,29 @@ unit n68kinl;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
node,ninl,ncginl;
|
node,ninl,ncginl,cpubase;
|
||||||
|
|
||||||
type
|
type
|
||||||
t68kinlinenode = class(tcgInlineNode)
|
t68kinlinenode = class(tcgInlineNode)
|
||||||
{function first_abs_real: tnode; override;}
|
function first_abs_real: tnode; override;
|
||||||
function first_sqr_real: tnode; override;
|
function first_sqr_real: tnode; override;
|
||||||
{function first_sqrt_real: tnode; override;
|
function first_sqrt_real: tnode; override;
|
||||||
function first_arctan_real: tnode; override;
|
{function first_arctan_real: tnode; override;
|
||||||
function first_ln_real: tnode; override;
|
function first_ln_real: tnode; override;
|
||||||
function first_cos_real: tnode; override;
|
function first_cos_real: tnode; override;
|
||||||
function first_sin_real: tnode; override;}
|
function first_sin_real: tnode; override;}
|
||||||
|
|
||||||
{procedure second_abs_real; override;}
|
procedure second_abs_real; override;
|
||||||
procedure second_sqr_real; override;
|
procedure second_sqr_real; override;
|
||||||
{procedure second_sqrt_real; override;
|
procedure second_sqrt_real; override;
|
||||||
procedure second_arctan_real; override;
|
{procedure second_arctan_real; override;
|
||||||
procedure second_ln_real; override;
|
procedure second_ln_real; override;
|
||||||
procedure second_cos_real; override;
|
procedure second_cos_real; override;
|
||||||
procedure second_sin_real; override;
|
procedure second_sin_real; override;
|
||||||
procedure second_prefetch; override;
|
procedure second_prefetch; override;
|
||||||
procedure second_abs_long; override;}
|
procedure second_abs_long; override;}
|
||||||
|
private
|
||||||
|
procedure second_do_operation(op: TAsmOp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -56,12 +58,28 @@ implementation
|
|||||||
globtype,verbose,globals,cutils,
|
globtype,verbose,globals,cutils,
|
||||||
cpuinfo,defutil,symdef,aasmdata,aasmcpu,aasmtai,
|
cpuinfo,defutil,symdef,aasmdata,aasmcpu,aasmtai,
|
||||||
cgbase,cgutils,pass_1,pass_2,
|
cgbase,cgutils,pass_1,pass_2,
|
||||||
cpubase,ncgutil,cgobj,cgcpu, hlcgobj;
|
ncgutil,cgobj,cgcpu,hlcgobj;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
t68kinlinenode
|
t68kinlinenode
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
|
function t68kinlinenode.first_abs_real : tnode;
|
||||||
|
begin
|
||||||
|
if (cs_fp_emulation in current_settings.moduleswitches) then
|
||||||
|
result:=inherited first_abs_real
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
case current_settings.fputype of
|
||||||
|
fpu_68881:
|
||||||
|
expectloc:=LOC_FPUREGISTER;
|
||||||
|
else
|
||||||
|
internalerror(2015022206);
|
||||||
|
end;
|
||||||
|
first_abs_real:=nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function t68kinlinenode.first_sqr_real : tnode;
|
function t68kinlinenode.first_sqr_real : tnode;
|
||||||
begin
|
begin
|
||||||
if (cs_fp_emulation in current_settings.moduleswitches) then
|
if (cs_fp_emulation in current_settings.moduleswitches) then
|
||||||
@ -78,6 +96,28 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function t68kinlinenode.first_sqrt_real : tnode;
|
||||||
|
begin
|
||||||
|
if (cs_fp_emulation in current_settings.moduleswitches) then
|
||||||
|
result:=inherited first_sqrt_real
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
case current_settings.fputype of
|
||||||
|
fpu_68881:
|
||||||
|
expectloc:=LOC_FPUREGISTER;
|
||||||
|
else
|
||||||
|
internalerror(2015022203);
|
||||||
|
end;
|
||||||
|
first_sqrt_real:=nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure t68kinlinenode.second_abs_real;
|
||||||
|
begin
|
||||||
|
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_abs_real called!')));
|
||||||
|
second_do_operation(A_FABS);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure t68kinlinenode.second_sqr_real;
|
procedure t68kinlinenode.second_sqr_real;
|
||||||
begin
|
begin
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
@ -89,7 +129,7 @@ implementation
|
|||||||
location_copy(location,left.location);
|
location_copy(location,left.location);
|
||||||
if left.location.loc=LOC_CFPUREGISTER then
|
if left.location.loc=LOC_CFPUREGISTER then
|
||||||
begin
|
begin
|
||||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sr_real called!: left was fpuregister!')));
|
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_srq_real called!: left was cfpuregister!')));
|
||||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||||
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);
|
||||||
@ -101,6 +141,48 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure t68kinlinenode.second_sqrt_real;
|
||||||
|
begin
|
||||||
|
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqrt_real called!')));
|
||||||
|
second_do_operation(A_FSQRT);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure t68kinlinenode.second_do_operation(op: TAsmOp);
|
||||||
|
var
|
||||||
|
href: TReference;
|
||||||
|
begin
|
||||||
|
secondpass(left);
|
||||||
|
case current_settings.fputype of
|
||||||
|
fpu_68881:
|
||||||
|
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,S_FX,location.register))
|
||||||
|
end;
|
||||||
|
LOC_CFPUREGISTER:
|
||||||
|
begin
|
||||||
|
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||||
|
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_FX,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_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,tcgsize2opsize[left.location.size],href,location.register));
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2015022205);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2015022204);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
cinlinenode:=t68kinlinenode;
|
cinlinenode:=t68kinlinenode;
|
||||||
|
Loading…
Reference in New Issue
Block a user