From 4c7f75c93bacde5f4db347ae21a78b4c61e1d9a9 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Mon, 23 Feb 2015 22:50:54 +0000 Subject: [PATCH] + round/trunc/int for AArch64 git-svn-id: trunk@29881 - --- .gitattributes | 1 + rtl/aarch64/math.inc | 86 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 rtl/aarch64/math.inc diff --git a/.gitattributes b/.gitattributes index 596b7c746b..9e9f6ac567 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7869,6 +7869,7 @@ rtl/Makefile svneol=native#text/plain rtl/Makefile.fpc svneol=native#text/plain rtl/README.txt svneol=native#text/plain rtl/aarch64/int64p.inc svneol=native#text/plain +rtl/aarch64/math.inc svneol=native#text/plain rtl/aarch64/mathu.inc svneol=native#text/plain rtl/aix/Makefile svneol=native#text/plain rtl/aix/Makefile.fpc svneol=native#text/plain diff --git a/rtl/aarch64/math.inc b/rtl/aarch64/math.inc new file mode 100644 index 0000000000..99e8efbde8 --- /dev/null +++ b/rtl/aarch64/math.inc @@ -0,0 +1,86 @@ +{ + Implementation of mathematical routines for x86_64 + + This file is part of the Free Pascal run time library. + Copyright (c) 1999-2005 by the Free Pascal development team + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{**************************************************************************** + Floating point type routines + ****************************************************************************} + + {$ifndef FPC_SYSTEM_HAS_ABS} + {$define FPC_SYSTEM_HAS_ABS} + function fpc_abs_real(d : ValReal) : ValReal;compilerproc; + begin + { Function is handled internal in the compiler } + runerror(207); + result:=0; + end; + {$endif FPC_SYSTEM_HAS_ABS} + + + {$ifndef FPC_SYSTEM_HAS_SQR} + {$define FPC_SYSTEM_HAS_SQR} + function fpc_sqr_real(d : ValReal) : ValReal;compilerproc; + begin + { Function is handled internal in the compiler } + runerror(207); + result:=0; + end; + {$endif FPC_SYSTEM_HAS_SQR} + + + {$ifndef FPC_SYSTEM_HAS_SQRT} + {$define FPC_SYSTEM_HAS_SQRT} + function fpc_sqrt_real(d : ValReal) : ValReal;compilerproc; + begin + { Function is handled internal in the compiler } + runerror(207); + result:=0; + end; + {$endif FPC_SYSTEM_HAS_SQRT} + + + {$ifndef FPC_SYSTEM_HAS_INT} + {$define FPC_SYSTEM_HAS_INT} + function fpc_int_real(d : ValReal) : ValReal;assembler;nostackframe;compilerproc; + asm + { round as floating point towards zero } + frintz d0,d0 + end; + {$endif FPC_SYSTEM_HAS_INT} + + + {$ifndef FPC_SYSTEM_HAS_TRUNC} + {$define FPC_SYSTEM_HAS_TRUNC} + function fpc_trunc_real(d : ValReal) : int64;assembler;nostackframe;compilerproc; + asm + { round to signed integer towards zero } + fcvtzs x0,d0 + end; + {$endif FPC_SYSTEM_HAS_TRUNC} + + + {$ifndef FPC_SYSTEM_HAS_ROUND} + {$define FPC_SYSTEM_HAS_ROUND} + function fpc_round_real(d : ValReal) : int64;assembler;nostackframe;compilerproc; + asm + { round as floating point using current rounding mode } + frintx d0,d0 + { convert to signed integer rounding towards zero (there's no "round to + integer using current rounding mode") } + fcvtzs x0,d0 + end; + {$endif FPC_SYSTEM_HAS_ROUND} + +