diff --git a/.gitattributes b/.gitattributes index 07dbd500fa..9c310e6265 100644 --- a/.gitattributes +++ b/.gitattributes @@ -349,6 +349,7 @@ compiler/m68k/m68kreg.dat svneol=native#text/plain compiler/m68k/n68kadd.pas svneol=native#text/plain compiler/m68k/n68kcal.pas svneol=native#text/plain compiler/m68k/n68kcnv.pas svneol=native#text/plain +compiler/m68k/n68kinl.pas svneol=native#text/plain compiler/m68k/n68kmat.pas svneol=native#text/plain compiler/m68k/n68kmem.pas svneol=native#text/plain compiler/m68k/r68kcon.inc svneol=native#text/plain diff --git a/compiler/m68k/cpunode.pas b/compiler/m68k/cpunode.pas index a524da16b9..d956bc9826 100644 --- a/compiler/m68k/cpunode.pas +++ b/compiler/m68k/cpunode.pas @@ -40,11 +40,10 @@ unit cpunode; // nppcflw, n68kmem, // nppcset, -// nppcinl, + n68kinl, // nppcopt, { this not really a node } // nppcobj, -// nppcmat, n68kmat, n68kcnv, { symtable } diff --git a/compiler/m68k/n68kinl.pas b/compiler/m68k/n68kinl.pas new file mode 100644 index 0000000000..3a7ba88ece --- /dev/null +++ b/compiler/m68k/n68kinl.pas @@ -0,0 +1,107 @@ +{ + Copyright (c) 2015 by the Free Pascal Development team + + Generates Motorola 68k inline nodes + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit n68kinl; + +{$i fpcdefs.inc} + +interface + + uses + node,ninl,ncginl; + + type + t68kinlinenode = class(tcgInlineNode) + {function first_abs_real: tnode; override;} + function first_sqr_real: tnode; override; + {function first_sqrt_real: tnode; override; + function first_arctan_real: tnode; override; + function first_ln_real: tnode; override; + function first_cos_real: tnode; override; + function first_sin_real: tnode; override;} + + {procedure second_abs_real; override;} + procedure second_sqr_real; override; + {procedure second_sqrt_real; override; + procedure second_arctan_real; override; + procedure second_ln_real; override; + procedure second_cos_real; override; + procedure second_sin_real; override; + procedure second_prefetch; override; + procedure second_abs_long; override;} + end; + + +implementation + + uses + globtype,verbose,globals,cutils, + cpuinfo,defutil,symdef,aasmdata,aasmcpu,aasmtai, + cgbase,cgutils,pass_1,pass_2, + cpubase,ncgutil,cgobj,cgcpu, hlcgobj; + +{***************************************************************************** + t68kinlinenode +*****************************************************************************} + + function t68kinlinenode.first_sqr_real : tnode; + begin + if (cs_fp_emulation in current_settings.moduleswitches) then + result:=inherited first_sqr_real + else + begin + case current_settings.fputype of + fpu_68881: + expectloc:=LOC_FPUREGISTER; + else + internalerror(2015022201); + end; + first_sqr_real:=nil; + end; + end; + + procedure t68kinlinenode.second_sqr_real; + begin + secondpass(left); + case current_settings.fputype of + fpu_68881: + 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_sr_real called!: left was fpuregister!'))); + 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,S_FX,left.location.register,location.register)); + end; + else + internalerror(2015022202); + end; + end; + + +begin + cinlinenode:=t68kinlinenode; +end.