public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] AArch64 optimized maths functions.
@ 2012-11-19  9:51 Marcus Shawcroft
  2012-11-19  9:58 ` Andrew Pinski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marcus Shawcroft @ 2012-11-19  9:51 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]

Hi,

This patch adds AArch64 optimized maths functions which were presented
in the orignal port but subsequently removed in order to get the core
of the port through the review process.

Does anyone have comments on this patch?


Thanks
/Marcus

2012-11-19  Marcus Shawcroft  <marcus.shawcroft@linaro.org>

        * 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: New 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.

[-- Attachment #2: aarch64-fpu.diff --]
[-- Type: application/octet-stream, Size: 34166 bytes --]

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
+   <http://www.gnu.org/licenses/>.  */
+
+#define	FUNC ceil
+#define INSN "frintp"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define	FUNC ceilf
+#define INSN "frintp"
+#include <s_frintf.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC floor
+#define INSN "frintm"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC floorf
+#define INSN "frintm"
+#include <s_frintf.x>
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 <sysdeps/ieee754/dbl-64/s_fma.c>
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC fmaf
+#define TYPE float
+#define REGS "s"
+#include <s_fma.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC fmax
+#define INSN "fmaxnm"
+#include <s_fmin.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC fmaxf
+#define INSN "fmaxnm"
+#define TYPE float
+#define REGS "s"
+#include <s_fmin.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC fminf
+#define TYPE float
+#define REGS "s"
+#include <s_fmin.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef FUNC
+#error FUNC not defined
+#endif
+#define TYPE float
+#define REGS "s"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC llrint
+#define OTYPE long long int
+#include <s_lrint.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC llrintf
+#define ITYPE float
+#define IREGS "s"
+#define OTYPE long long int
+#include <s_lrint.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC llround
+#define OTYPE long long int
+#include <s_lround.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC llroundf
+#define ITYPE float
+#define IREGS "s"
+#define OTYPE long long int
+#include <s_lround.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC lrintf
+#define ITYPE float
+#define IREGS "s"
+#include <s_lrint.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC lroundf
+#define ITYPE float
+#define IREGS "s"
+#include <s_lround.c>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define	FUNC nearbyint
+#define INSN "frinti"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC nearbyintf
+#define INSN "frinti"
+#include <s_frintf.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC	rint
+#define INSN "frintx"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC rintf
+#define INSN "frintx"
+#include <s_frintf.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC round
+#define INSN "frinta"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC roundf
+#define INSN "frinta"
+#include <s_frintf.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC trunc
+#define INSN "frintz"
+#include <s_frint.x>
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
+   <http://www.gnu.org/licenses/>.  */
+
+#define FUNC truncf
+#define INSN "frintz"
+#include <s_frintf.x>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AArch64 optimized maths functions.
  2012-11-19  9:51 [PATCH] AArch64 optimized maths functions Marcus Shawcroft
@ 2012-11-19  9:58 ` Andrew Pinski
  2012-11-19 12:51   ` Marcus Shawcroft
  2012-11-19 17:31 ` Richard Henderson
  2012-11-19 19:30 ` Andreas Jaeger
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2012-11-19  9:58 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: libc-ports

On Mon, Nov 19, 2012 at 1:51 AM, Marcus Shawcroft
<marcus.shawcroft@linaro.org> wrote:
> Hi,
>
> This patch adds AArch64 optimized maths functions which were presented
> in the orignal port but subsequently removed in order to get the core
> of the port through the review process.
>
> Does anyone have comments on this patch?

I really don't like inline-asm that much for intrinsics like these.
Is any way to get these intrinsics as builtin functions in GCC and
just use them here instead of the inline-asm?

Thanks,
Andrew Pinski


>
>
> Thanks
> /Marcus
>
> 2012-11-19  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
>
>         * 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: New 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AArch64 optimized maths functions.
  2012-11-19  9:58 ` Andrew Pinski
@ 2012-11-19 12:51   ` Marcus Shawcroft
  0 siblings, 0 replies; 6+ messages in thread
From: Marcus Shawcroft @ 2012-11-19 12:51 UTC (permalink / raw)
  To: pinskia; +Cc: libc-ports

> I really don't like inline-asm that much for intrinsics like these.
> Is any way to get these intrinsics as builtin functions in GCC and
> just use them here instead of the inline-asm?

We can go that route in the future. I'd like to have this
functionality included in 2.17, freeze imminent.  Unless there are
strong objections I propose to include this patch now with a view to
updating the implementation once such builtin support is provided in
gcc.

Cheers
/Marcus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AArch64 optimized maths functions.
  2012-11-19  9:51 [PATCH] AArch64 optimized maths functions Marcus Shawcroft
  2012-11-19  9:58 ` Andrew Pinski
@ 2012-11-19 17:31 ` Richard Henderson
  2012-11-20 12:02   ` Marcus Shawcroft
  2012-11-19 19:30 ` Andreas Jaeger
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2012-11-19 17:31 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: libc-ports

On 2012-11-19 01:51, Marcus Shawcroft wrote:
> +TYPE
> +__CONCATX(__,FUNC) (x, y, z)
> +     TYPE x;
> +     TYPE y;
> +     TYPE z;
> +{

Don't use K&R C.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AArch64 optimized maths functions.
  2012-11-19  9:51 [PATCH] AArch64 optimized maths functions Marcus Shawcroft
  2012-11-19  9:58 ` Andrew Pinski
  2012-11-19 17:31 ` Richard Henderson
@ 2012-11-19 19:30 ` Andreas Jaeger
  2 siblings, 0 replies; 6+ messages in thread
From: Andreas Jaeger @ 2012-11-19 19:30 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: libc-ports

On 11/19/2012 10:51 AM, Marcus Shawcroft wrote:
> Hi,
>
> This patch adds AArch64 optimized maths functions which were presented
> in the orignal port but subsequently removed in order to get the core
> of the port through the review process.
>
> Does anyone have comments on this patch?

A couple of nits that I noticed. I only commented the first usage, these 
happen more than once.

> 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 should be "2011-2012". Also, each new file should have as first 
line a description what it does.

> +#ifndef TYPE
> +#define TYPE double
> +#define REGS "d"
> +#else
> +#ifndef REGS
> +#error REGS not defined
> +#endif
> +#endif
Your indentation is off, we write
#ifndef
# define
#else
# ifndef
#  error
# endif
#endif

 > [...]
> +#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

Why do you need strong_aliasx and weak_aliasx? I don't see any benefit 
in using these macros here.

> 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

s_frint.x is a C file. I don't think introducing a ".x" ending is 
proper, it's used by sunrpc input files. Why not rename the file to 
"s_frintX.c"?

Andreas
-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AArch64 optimized maths functions.
  2012-11-19 17:31 ` Richard Henderson
@ 2012-11-20 12:02   ` Marcus Shawcroft
  0 siblings, 0 replies; 6+ messages in thread
From: Marcus Shawcroft @ 2012-11-20 12:02 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-ports

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

> Don't use K&R C.
>
>
> r~

Fixed with attached patch.

/Marcus

2012-11-19  Marcus Shawcroft  <marcus.shawcroft@linaro.org>

        * sysdeps/aarch64/fpu/s_fma.c (__CONCATX): Don't use K&R.
        * sysdeps/aarch64/fpu/s_fmin.c (__CONCATX): Likewise.
        * sysdeps/aarch64/fpu/s_lrint.c (__CONCATX): Likewise.
        * sysdeps/aarch64/fpu/s_lround.c (__CONCATX): Likewise.
        * sysdeps/aarch64/fpu/s_frint.x (__CONCATX): Likewise.

[-- Attachment #2: 0001-Remove-K-R-C-usage.patch --]
[-- Type: application/octet-stream, Size: 2070 bytes --]

diff --git a/ports/sysdeps/aarch64/fpu/s_fma.c b/ports/sysdeps/aarch64/fpu/s_fma.c
index 7d8bd77..7dc7073 100644
--- a/ports/sysdeps/aarch64/fpu/s_fma.c
+++ b/ports/sysdeps/aarch64/fpu/s_fma.c
@@ -34,10 +34,7 @@
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 TYPE
-__CONCATX(__,FUNC) (x, y, z)
-     TYPE x;
-     TYPE y;
-     TYPE z;
+__CONCATX(__,FUNC) (TYPE x, TYPE y, TYPE z)
 {
   TYPE result;
   asm ( "fmadd" "\t%" REGS "0, %" REGS "1, %" REGS "2, %" REGS "3"
diff --git a/ports/sysdeps/aarch64/fpu/s_fmin.c b/ports/sysdeps/aarch64/fpu/s_fmin.c
index 3214aa8..63e1596 100644
--- a/ports/sysdeps/aarch64/fpu/s_fmin.c
+++ b/ports/sysdeps/aarch64/fpu/s_fmin.c
@@ -38,9 +38,7 @@
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 TYPE
-__CONCATX(__,FUNC) (x, y)
-     TYPE x;
-     TYPE y;
+__CONCATX(__,FUNC) (TYPE x, TYPE y)
 {
   TYPE result;
   asm ( INSN "\t%" REGS "0, %" REGS "1, %" REGS "2"
diff --git a/ports/sysdeps/aarch64/fpu/s_frint.x b/ports/sysdeps/aarch64/fpu/s_frint.x
index b3e21e1..3c24031 100644
--- a/ports/sysdeps/aarch64/fpu/s_frint.x
+++ b/ports/sysdeps/aarch64/fpu/s_frint.x
@@ -38,8 +38,7 @@
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 TYPE
-__CONCATX(__,FUNC) (x)
-     TYPE x;
+__CONCATX(__,FUNC) (TYPE x)
 {
   TYPE result;
   asm ( INSN "\t%" REGS "0, %" REGS "1" :
diff --git a/ports/sysdeps/aarch64/fpu/s_lrint.c b/ports/sysdeps/aarch64/fpu/s_lrint.c
index a5ad1ea..945428f 100644
--- a/ports/sysdeps/aarch64/fpu/s_lrint.c
+++ b/ports/sysdeps/aarch64/fpu/s_lrint.c
@@ -40,8 +40,7 @@
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 OTYPE
-__CONCATX(__,FUNC) (x)
-     ITYPE x;
+__CONCATX(__,FUNC) (ITYPE x)
 {
   OTYPE result;
   ITYPE temp;
diff --git a/ports/sysdeps/aarch64/fpu/s_lround.c b/ports/sysdeps/aarch64/fpu/s_lround.c
index ca68bd7..472143d 100644
--- a/ports/sysdeps/aarch64/fpu/s_lround.c
+++ b/ports/sysdeps/aarch64/fpu/s_lround.c
@@ -40,8 +40,7 @@
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 OTYPE
-__CONCATX(__,FUNC) (x)
-     ITYPE x;
+__CONCATX(__,FUNC) (ITYPE x)
 {
   OTYPE result;
   asm ( "fcvtas" "\t%" OREGS "0, %" IREGS "1"
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-20 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19  9:51 [PATCH] AArch64 optimized maths functions Marcus Shawcroft
2012-11-19  9:58 ` Andrew Pinski
2012-11-19 12:51   ` Marcus Shawcroft
2012-11-19 17:31 ` Richard Henderson
2012-11-20 12:02   ` Marcus Shawcroft
2012-11-19 19:30 ` Andreas Jaeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).