From a6d9783fe7b844ed10495ef3b01c04bd1f499c22 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Mon, 19 Nov 2012 15:15:18 +0000 Subject: [PATCH] AArch64: Adding optimized maths functions. --- ports/ChangeLog.aarch64 | 31 +++++++++++++++++ ports/sysdeps/aarch64/fpu/s_ceil.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_ceilf.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_floor.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_floorf.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_fma.c | 56 +++++++++++++++++++++++++++-- ports/sysdeps/aarch64/fpu/s_fmaf.c | 22 ++++++++++++ ports/sysdeps/aarch64/fpu/s_fmax.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_fmaxf.c | 23 ++++++++++++ ports/sysdeps/aarch64/fpu/s_fmin.c | 57 ++++++++++++++++++++++++++++++ ports/sysdeps/aarch64/fpu/s_fminf.c | 22 ++++++++++++ ports/sysdeps/aarch64/fpu/s_frint.x | 56 +++++++++++++++++++++++++++++ ports/sysdeps/aarch64/fpu/s_frintf.x | 24 +++++++++++++ ports/sysdeps/aarch64/fpu/s_llrint.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_llrintf.c | 23 ++++++++++++ ports/sysdeps/aarch64/fpu/s_llround.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_llroundf.c | 23 ++++++++++++ ports/sysdeps/aarch64/fpu/s_lrint.c | 60 ++++++++++++++++++++++++++++++++ ports/sysdeps/aarch64/fpu/s_lrintf.c | 22 ++++++++++++ ports/sysdeps/aarch64/fpu/s_lround.c | 58 ++++++++++++++++++++++++++++++ ports/sysdeps/aarch64/fpu/s_lroundf.c | 22 ++++++++++++ ports/sysdeps/aarch64/fpu/s_nearbyint.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_nearbyintf.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_rint.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_rintf.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_round.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_roundf.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_trunc.c | 21 +++++++++++ ports/sysdeps/aarch64/fpu/s_truncf.c | 21 +++++++++++ 29 files changed, 812 insertions(+), 2 deletions(-) create mode 100644 ports/sysdeps/aarch64/fpu/s_ceil.c create mode 100644 ports/sysdeps/aarch64/fpu/s_ceilf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_floor.c create mode 100644 ports/sysdeps/aarch64/fpu/s_floorf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_fmaf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_fmax.c create mode 100644 ports/sysdeps/aarch64/fpu/s_fmaxf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_fmin.c create mode 100644 ports/sysdeps/aarch64/fpu/s_fminf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_frint.x create mode 100644 ports/sysdeps/aarch64/fpu/s_frintf.x create mode 100644 ports/sysdeps/aarch64/fpu/s_llrint.c create mode 100644 ports/sysdeps/aarch64/fpu/s_llrintf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_llround.c create mode 100644 ports/sysdeps/aarch64/fpu/s_llroundf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_lrint.c create mode 100644 ports/sysdeps/aarch64/fpu/s_lrintf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_lround.c create mode 100644 ports/sysdeps/aarch64/fpu/s_lroundf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_nearbyint.c create mode 100644 ports/sysdeps/aarch64/fpu/s_nearbyintf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_rint.c create mode 100644 ports/sysdeps/aarch64/fpu/s_rintf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_round.c create mode 100644 ports/sysdeps/aarch64/fpu/s_roundf.c create mode 100644 ports/sysdeps/aarch64/fpu/s_trunc.c create mode 100644 ports/sysdeps/aarch64/fpu/s_truncf.c diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index 58f6fd0..941a5f9 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,34 @@ +2012-11-19 Marcus Shawcroft + + * sysdeps/aarch64/fpu/s_ceil.c: New file. + * sysdeps/aarch64/fpu/s_ceilf.c: New file. + * sysdeps/aarch64/fpu/s_floor.c: New file. + * sysdeps/aarch64/fpu/s_floorf.c: New file. + * sysdeps/aarch64/fpu/s_fma.c: Replace file. + * sysdeps/aarch64/fpu/s_fmaf.c: New file. + * sysdeps/aarch64/fpu/s_fmax.c: New file. + * sysdeps/aarch64/fpu/s_fmaxf.c: New file. + * sysdeps/aarch64/fpu/s_fmin.c: New file. + * sysdeps/aarch64/fpu/s_fminf.c: New file. + * sysdeps/aarch64/fpu/s_frint.x: New file. + * sysdeps/aarch64/fpu/s_frintf.x: New file. + * sysdeps/aarch64/fpu/s_llrint.c: New file. + * sysdeps/aarch64/fpu/s_llrintf.c: New file. + * sysdeps/aarch64/fpu/s_llround.c: New file. + * sysdeps/aarch64/fpu/s_llroundf.c: New file. + * sysdeps/aarch64/fpu/s_lrint.c: New file. + * sysdeps/aarch64/fpu/s_lrintf.c: New file. + * sysdeps/aarch64/fpu/s_lround.c: New file. + * sysdeps/aarch64/fpu/s_lroundf.c: New file. + * sysdeps/aarch64/fpu/s_nearbyint.c: New file. + * sysdeps/aarch64/fpu/s_nearbyintf.c: New file. + * sysdeps/aarch64/fpu/s_rint.c: New file. + * sysdeps/aarch64/fpu/s_rintf.c: New file. + * sysdeps/aarch64/fpu/s_round.c: New file. + * sysdeps/aarch64/fpu/s_roundf.c: New file. + * sysdeps/aarch64/fpu/s_trunc.c: New file. + * sysdeps/aarch64/fpu/s_truncf.c: New file. + 2012-11-09 Marcus Shawcroft * sysdeps/aarch64/Implies: New file. diff --git a/ports/sysdeps/aarch64/fpu/s_ceil.c b/ports/sysdeps/aarch64/fpu/s_ceil.c new file mode 100644 index 0000000..087b9b4 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_ceil.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC ceil +#define INSN "frintp" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_ceilf.c b/ports/sysdeps/aarch64/fpu/s_ceilf.c new file mode 100644 index 0000000..e503f99 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_ceilf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC ceilf +#define INSN "frintp" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_floor.c b/ports/sysdeps/aarch64/fpu/s_floor.c new file mode 100644 index 0000000..3f914b6 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_floor.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC floor +#define INSN "frintm" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_floorf.c b/ports/sysdeps/aarch64/fpu/s_floorf.c new file mode 100644 index 0000000..f5452c5 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_floorf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC floorf +#define INSN "frintm" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_fma.c b/ports/sysdeps/aarch64/fpu/s_fma.c index 8f62605..7d8bd77 100644 --- a/ports/sysdeps/aarch64/fpu/s_fma.c +++ b/ports/sysdeps/aarch64/fpu/s_fma.c @@ -1,2 +1,54 @@ -/* Always use dbl-64 version because long double is emulated in software. */ -#include +/* Copyright (C) 1996-2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef FUNC +#define FUNC fma +#endif + +#ifndef TYPE +#define TYPE double +#define REGS "d" +#else +#ifndef REGS +#error REGS not defined +#endif +#endif + +#define __CONCATX(a,b) __CONCAT(a,b) + +TYPE +__CONCATX(__,FUNC) (x, y, z) + TYPE x; + TYPE y; + TYPE z; +{ + TYPE result; + asm ( "fmadd" "\t%" REGS "0, %" REGS "1, %" REGS "2, %" REGS "3" + : "=w" (result) : "w" (x), "w" (y), "w" (z) ); + return result; +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (__CONCATX(__,FUNC), FUNC) +#define strong_aliasx(a,b) strong_alias(a,b) +#ifdef NO_LONG_DOUBLE +strong_aliasx (__CONCATX(__,FUNC), __CONCATX(__,__CONCATX(FUNC,l))) +weak_aliasx (__CONCATX(__,FUNC), __CONCATX(FUNC,l)) +#endif diff --git a/ports/sysdeps/aarch64/fpu/s_fmaf.c b/ports/sysdeps/aarch64/fpu/s_fmaf.c new file mode 100644 index 0000000..bcda67b --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_fmaf.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC fmaf +#define TYPE float +#define REGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_fmax.c b/ports/sysdeps/aarch64/fpu/s_fmax.c new file mode 100644 index 0000000..6fe1ecc --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_fmax.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC fmax +#define INSN "fmaxnm" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_fmaxf.c b/ports/sysdeps/aarch64/fpu/s_fmaxf.c new file mode 100644 index 0000000..fa2a4bd --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_fmaxf.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC fmaxf +#define INSN "fmaxnm" +#define TYPE float +#define REGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_fmin.c b/ports/sysdeps/aarch64/fpu/s_fmin.c new file mode 100644 index 0000000..3214aa8 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_fmin.c @@ -0,0 +1,57 @@ +/* Copyright (C) 1996, 1997, 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef FUNC +#define FUNC fmin +#endif + +#ifndef INSN +#define INSN "fminnm" +#endif + +#ifndef TYPE +#define TYPE double +#define REGS "d" +#else +#ifndef REGS +#error REGS not defined +#endif +#endif + +#define __CONCATX(a,b) __CONCAT(a,b) + +TYPE +__CONCATX(__,FUNC) (x, y) + TYPE x; + TYPE y; +{ + TYPE result; + asm ( INSN "\t%" REGS "0, %" REGS "1, %" REGS "2" + : "=w" (result) : "w" (x), "w" (y) ); + return result; +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (__CONCATX(__,FUNC), FUNC) +#define strong_aliasx(a,b) strong_alias(a,b) +#ifdef NO_LONG_DOUBLE +strong_aliasx (__CONCATX(__,FUNC), __CONCATX(__,__CONCATX(FUNC,l))) +weak_aliasx (__CONCATX(__,FUNC), __CONCATX(FUNC,l)) +#endif diff --git a/ports/sysdeps/aarch64/fpu/s_fminf.c b/ports/sysdeps/aarch64/fpu/s_fminf.c new file mode 100644 index 0000000..5e8b60e --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_fminf.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC fminf +#define TYPE float +#define REGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_frint.x b/ports/sysdeps/aarch64/fpu/s_frint.x new file mode 100644 index 0000000..b3e21e1 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_frint.x @@ -0,0 +1,56 @@ +/* Copyright (C) 1996, 1997, 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef FUNC +#error FUNC not defined +#endif + +#ifndef TYPE +#define TYPE double +#define REGS "d" +#else +#ifndef REGS +#error REGS not defined +#endif +#endif + +#ifndef INSN +#error INSN not defined +#endif + +#define __CONCATX(a,b) __CONCAT(a,b) + +TYPE +__CONCATX(__,FUNC) (x) + TYPE x; +{ + TYPE result; + asm ( INSN "\t%" REGS "0, %" REGS "1" : + "=w" (result) : "w" (x) ); + return result; +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (__CONCATX(__,FUNC), FUNC) +#define strong_aliasx(a,b) strong_alias(a,b) +#ifdef NO_LONG_DOUBLE +strong_aliasx (__CONCATX(__,FUNC), __CONCATX(__,__CONCATX(FUNC,l))) +weak_aliasx (__CONCATX(__,FUNC), __CONCATX(FUNC,l)) +#endif diff --git a/ports/sysdeps/aarch64/fpu/s_frintf.x b/ports/sysdeps/aarch64/fpu/s_frintf.x new file mode 100644 index 0000000..8ce97df --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_frintf.x @@ -0,0 +1,24 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef FUNC +#error FUNC not defined +#endif +#define TYPE float +#define REGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_llrint.c b/ports/sysdeps/aarch64/fpu/s_llrint.c new file mode 100644 index 0000000..6eceb68 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_llrint.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC llrint +#define OTYPE long long int +#include diff --git a/ports/sysdeps/aarch64/fpu/s_llrintf.c b/ports/sysdeps/aarch64/fpu/s_llrintf.c new file mode 100644 index 0000000..17b73a7 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_llrintf.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC llrintf +#define ITYPE float +#define IREGS "s" +#define OTYPE long long int +#include diff --git a/ports/sysdeps/aarch64/fpu/s_llround.c b/ports/sysdeps/aarch64/fpu/s_llround.c new file mode 100644 index 0000000..5646e00 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_llround.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC llround +#define OTYPE long long int +#include diff --git a/ports/sysdeps/aarch64/fpu/s_llroundf.c b/ports/sysdeps/aarch64/fpu/s_llroundf.c new file mode 100644 index 0000000..2555226 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_llroundf.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC llroundf +#define ITYPE float +#define IREGS "s" +#define OTYPE long long int +#include diff --git a/ports/sysdeps/aarch64/fpu/s_lrint.c b/ports/sysdeps/aarch64/fpu/s_lrint.c new file mode 100644 index 0000000..a5ad1ea --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_lrint.c @@ -0,0 +1,60 @@ +/* Copyright (C) 1996, 1997, 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef FUNC +#define FUNC lrint +#endif + +#ifndef ITYPE +#define ITYPE double +#define IREGS "d" +#else +#ifndef IREGS +#error IREGS not defined +#endif +#endif + +#ifndef OTYPE +#define OTYPE long int +#endif + +#define OREGS "x" + +#define __CONCATX(a,b) __CONCAT(a,b) + +OTYPE +__CONCATX(__,FUNC) (x) + ITYPE x; +{ + OTYPE result; + ITYPE temp; + asm ( "frintx" "\t%" IREGS "1, %" IREGS "2\n\t" + "fcvtzs" "\t%" OREGS "0, %" IREGS "1" + : "=r" (result), "=w" (temp) : "w" (x) ); + return result; +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (__CONCATX(__,FUNC), FUNC) +#define strong_aliasx(a,b) strong_alias(a,b) +#ifdef NO_LONG_DOUBLE +strong_aliasx (__CONCATX(__,FUNC), __CONCATX(__,__CONCATX(FUNC,l))) +weak_aliasx (__CONCATX(__,FUNC), __CONCATX(FUNC,l)) +#endif diff --git a/ports/sysdeps/aarch64/fpu/s_lrintf.c b/ports/sysdeps/aarch64/fpu/s_lrintf.c new file mode 100644 index 0000000..06eb4b7 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_lrintf.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC lrintf +#define ITYPE float +#define IREGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_lround.c b/ports/sysdeps/aarch64/fpu/s_lround.c new file mode 100644 index 0000000..ca68bd7 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_lround.c @@ -0,0 +1,58 @@ +/* Copyright (C) 1996, 1997, 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef FUNC +#define FUNC lround +#endif + +#ifndef ITYPE +#define ITYPE double +#define IREGS "d" +#else +#ifndef IREGS +#error IREGS not defined +#endif +#endif + +#ifndef OTYPE +#define OTYPE long int +#endif + +#define OREGS "x" + +#define __CONCATX(a,b) __CONCAT(a,b) + +OTYPE +__CONCATX(__,FUNC) (x) + ITYPE x; +{ + OTYPE result; + asm ( "fcvtas" "\t%" OREGS "0, %" IREGS "1" + : "=r" (result) : "w" (x) ); + return result; +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (__CONCATX(__,FUNC), FUNC) +#define strong_aliasx(a,b) strong_alias(a,b) +#ifdef NO_LONG_DOUBLE +strong_aliasx (__CONCATX(__,FUNC), __CONCATX(__,__CONCATX(FUNC,l))) +weak_aliasx (__CONCATX(__,FUNC), __CONCATX(FUNC,l)) +#endif diff --git a/ports/sysdeps/aarch64/fpu/s_lroundf.c b/ports/sysdeps/aarch64/fpu/s_lroundf.c new file mode 100644 index 0000000..9700d3f --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_lroundf.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC lroundf +#define ITYPE float +#define IREGS "s" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_nearbyint.c b/ports/sysdeps/aarch64/fpu/s_nearbyint.c new file mode 100644 index 0000000..11fcd01 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_nearbyint.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC nearbyint +#define INSN "frinti" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_nearbyintf.c b/ports/sysdeps/aarch64/fpu/s_nearbyintf.c new file mode 100644 index 0000000..8d6af83 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_nearbyintf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC nearbyintf +#define INSN "frinti" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_rint.c b/ports/sysdeps/aarch64/fpu/s_rint.c new file mode 100644 index 0000000..7f37f7c --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_rint.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC rint +#define INSN "frintx" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_rintf.c b/ports/sysdeps/aarch64/fpu/s_rintf.c new file mode 100644 index 0000000..2d7832a --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_rintf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC rintf +#define INSN "frintx" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_round.c b/ports/sysdeps/aarch64/fpu/s_round.c new file mode 100644 index 0000000..71ec254 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_round.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC round +#define INSN "frinta" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_roundf.c b/ports/sysdeps/aarch64/fpu/s_roundf.c new file mode 100644 index 0000000..919a752 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_roundf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC roundf +#define INSN "frinta" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_trunc.c b/ports/sysdeps/aarch64/fpu/s_trunc.c new file mode 100644 index 0000000..caf7ec1 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_trunc.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC trunc +#define INSN "frintz" +#include diff --git a/ports/sysdeps/aarch64/fpu/s_truncf.c b/ports/sysdeps/aarch64/fpu/s_truncf.c new file mode 100644 index 0000000..3cbba72 --- /dev/null +++ b/ports/sysdeps/aarch64/fpu/s_truncf.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FUNC truncf +#define INSN "frintz" +#include -- 2.7.4