]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
AArch64: Use math-use-builtins for roundeven(f)/lrint(f)/lround(f)
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Wed, 15 Oct 2025 16:38:03 +0000 (16:38 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Fri, 17 Oct 2025 17:03:54 +0000 (17:03 +0000)
Remove target implementations of roundeven(f)/lrint(f)/lround(f) and
use the math-use-builtins mechanism instead.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
15 files changed:
sysdeps/aarch64/fpu/math-use-builtins-llrint.h [new file with mode: 0644]
sysdeps/aarch64/fpu/math-use-builtins-llround.h [new file with mode: 0644]
sysdeps/aarch64/fpu/math-use-builtins-lrint.h [new file with mode: 0644]
sysdeps/aarch64/fpu/math-use-builtins-lround.h [new file with mode: 0644]
sysdeps/aarch64/fpu/math-use-builtins-roundeven.h [new file with mode: 0644]
sysdeps/aarch64/fpu/s_llrint.c [deleted file]
sysdeps/aarch64/fpu/s_llrintf.c [deleted file]
sysdeps/aarch64/fpu/s_llround.c [deleted file]
sysdeps/aarch64/fpu/s_llroundf.c [deleted file]
sysdeps/aarch64/fpu/s_lrint.c [deleted file]
sysdeps/aarch64/fpu/s_lrintf.c [deleted file]
sysdeps/aarch64/fpu/s_lround.c [deleted file]
sysdeps/aarch64/fpu/s_lroundf.c [deleted file]
sysdeps/aarch64/fpu/s_roundeven.c [deleted file]
sysdeps/aarch64/fpu/s_roundevenf.c [deleted file]

diff --git a/sysdeps/aarch64/fpu/math-use-builtins-llrint.h b/sysdeps/aarch64/fpu/math-use-builtins-llrint.h
new file mode 100644 (file)
index 0000000..32a6fb8
--- /dev/null
@@ -0,0 +1,4 @@
+#define USE_LLRINT_BUILTIN 1
+#define USE_LLRINTF_BUILTIN 1
+#define USE_LLRINTL_BUILTIN 0
+#define USE_LLRINTF128_BUILTIN 0
diff --git a/sysdeps/aarch64/fpu/math-use-builtins-llround.h b/sysdeps/aarch64/fpu/math-use-builtins-llround.h
new file mode 100644 (file)
index 0000000..d4623a0
--- /dev/null
@@ -0,0 +1,4 @@
+#define USE_LLROUND_BUILTIN 1
+#define USE_LLROUNDF_BUILTIN 1
+#define USE_LLROUNDL_BUILTIN 0
+#define USE_LLROUNDF128_BUILTIN 0
diff --git a/sysdeps/aarch64/fpu/math-use-builtins-lrint.h b/sysdeps/aarch64/fpu/math-use-builtins-lrint.h
new file mode 100644 (file)
index 0000000..d8a8d6c
--- /dev/null
@@ -0,0 +1,4 @@
+#define USE_LRINT_BUILTIN 1
+#define USE_LRINTF_BUILTIN 1
+#define USE_LRINTL_BUILTIN 0
+#define USE_LRINTF128_BUILTIN 0
diff --git a/sysdeps/aarch64/fpu/math-use-builtins-lround.h b/sysdeps/aarch64/fpu/math-use-builtins-lround.h
new file mode 100644 (file)
index 0000000..eaeb601
--- /dev/null
@@ -0,0 +1,4 @@
+#define USE_LROUND_BUILTIN 1
+#define USE_LROUNDF_BUILTIN 1
+#define USE_LROUNDL_BUILTIN 0
+#define USE_LROUNDF128_BUILTIN 0
diff --git a/sysdeps/aarch64/fpu/math-use-builtins-roundeven.h b/sysdeps/aarch64/fpu/math-use-builtins-roundeven.h
new file mode 100644 (file)
index 0000000..b7f5173
--- /dev/null
@@ -0,0 +1,4 @@
+#define USE_ROUNDEVEN_BUILTIN 1
+#define USE_ROUNDEVENF_BUILTIN 1
+#define USE_ROUNDEVENL_BUILTIN 0
+#define USE_ROUNDEVENF128_BUILTIN 0
diff --git a/sysdeps/aarch64/fpu/s_llrint.c b/sysdeps/aarch64/fpu/s_llrint.c
deleted file mode 100644 (file)
index 3ed519c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <math-barriers.h>
-#include <libm-alias-double.h>
-
-long long int
-__llrint (double x)
-{
-  double r = __builtin_rint (x);
-
-  /* Prevent gcc from calling llrint directly when compiled with
-     -fno-math-errno by inserting a barrier.  */
-
-  math_opt_barrier (r);
-  return r;
-}
-
-libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/aarch64/fpu/s_llrintf.c b/sysdeps/aarch64/fpu/s_llrintf.c
deleted file mode 100644 (file)
index 0f33958..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <math-barriers.h>
-#include <libm-alias-float.h>
-
-long long int
-__llrintf (float x)
-{
-  float r = __builtin_rintf (x);
-
-  /* Prevent gcc from calling llrintf directly when compiled with
-     -fno-math-errno by inserting a barrier.  */
-
-
-  math_opt_barrier (r);
-  return r;
-}
-
-libm_alias_float (__llrint, llrint)
diff --git a/sysdeps/aarch64/fpu/s_llround.c b/sysdeps/aarch64/fpu/s_llround.c
deleted file mode 100644 (file)
index a1b46e8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <libm-alias-double.h>
-
-long long int
-__llround (double x)
-{
-  return __builtin_llround (x);
-}
-
-libm_alias_double (__llround, llround)
diff --git a/sysdeps/aarch64/fpu/s_llroundf.c b/sysdeps/aarch64/fpu/s_llroundf.c
deleted file mode 100644 (file)
index 5269f44..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <libm-alias-float.h>
-
-long long int
-__llroundf (float x)
-{
-  return __builtin_llroundf (x);
-}
-
-libm_alias_float (__llround, llround)
diff --git a/sysdeps/aarch64/fpu/s_lrint.c b/sysdeps/aarch64/fpu/s_lrint.c
deleted file mode 100644 (file)
index 66b3cca..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1996-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <get-rounding-mode.h>
-#include <stdint.h>
-#include <math-barriers.h>
-#include <libm-alias-double.h>
-
-long int
-__lrint (double x)
-{
-  double r =  __builtin_rint (x);
-
-  /* Prevent gcc from calling lrint directly when compiled with
-     -fno-math-errno by inserting a barrier.  */
-
-  math_opt_barrier (r);
-  return r;
-}
-
-libm_alias_double (__lrint, lrint)
diff --git a/sysdeps/aarch64/fpu/s_lrintf.c b/sysdeps/aarch64/fpu/s_lrintf.c
deleted file mode 100644 (file)
index cc9d44c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <math-barriers.h>
-#include <libm-alias-float.h>
-
-long int
-__lrintf (float x)
-{
-  float r = __builtin_rintf (x);
-
-  /* Prevent gcc from calling lrintf directly when compiled with
-     -fno-math-errno by inserting a barrier.  */
-
-  math_opt_barrier (r);
-  return r;
-}
-
-libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/aarch64/fpu/s_lround.c b/sysdeps/aarch64/fpu/s_lround.c
deleted file mode 100644 (file)
index ab5c7ce..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1996-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <libm-alias-double.h>
-
-long int
-__lround (double x)
- {
-  return __builtin_lround (x);
- }
-
-libm_alias_double (__lround, lround)
diff --git a/sysdeps/aarch64/fpu/s_lroundf.c b/sysdeps/aarch64/fpu/s_lroundf.c
deleted file mode 100644 (file)
index 236f1a8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2011-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <libm-alias-float.h>
-
-long int
-__lroundf (float x)
-{
-  return __builtin_lroundf (x);
-}
-
-libm_alias_float (__lround, lround)
diff --git a/sysdeps/aarch64/fpu/s_roundeven.c b/sysdeps/aarch64/fpu/s_roundeven.c
deleted file mode 100644 (file)
index de9ee56..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2021-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-#include <math.h>
-#include <libm-alias-double.h>
-
-double
-__roundeven (double x)
-{
-  asm volatile ("frintn \t%d0, %d1" : "=w" (x) : "w" (x));
-  return x;
-}
-libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/aarch64/fpu/s_roundevenf.c b/sysdeps/aarch64/fpu/s_roundevenf.c
deleted file mode 100644 (file)
index 63b8aa7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2021-2025 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-#include <math.h>
-#include <libm-alias-float.h>
-
-float
-__roundevenf (float x)
-{
-  asm volatile ("frintn \t%s0, %s1" : "=w" (x) : "w" (x));
-  return x;
-}
-libm_alias_float (__roundeven, roundeven)