This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][AArch64] Add inlines for signbit


Add AArch64 inlines for __signbit, __signbitf and __signbitl which default to the GCC builtin
functions.

Is there a reason this couldn't be done by default in math.h similar to isgreater (unlike
__builtin_isinf et al, GCC implements signbit efficiently and correctly).

OK for commit?

2015-04-15  Wilco Dijkstra  <wdijkstr@arm.com>

	* sysdeps/aarch64/fpu/bits/mathinline.h: New file.
	(__signbit): New function, use __builtin_signbit.
	(__signbitf): Likewise.  (__signbitl): Likewise.

---
 sysdeps/aarch64/fpu/bits/mathinline.h | 49 +++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 sysdeps/aarch64/fpu/bits/mathinline.h

diff --git a/sysdeps/aarch64/fpu/bits/mathinline.h b/sysdeps/aarch64/fpu/bits/mathinline.h
new file mode 100644
index 0000000..e3d6a3d
--- /dev/null
+++ b/sysdeps/aarch64/fpu/bits/mathinline.h
@@ -0,0 +1,49 @@
+/* Inline math functions for AArch64.
+   Copyright (C) 2015 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 _MATH_H
+# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+#endif
+
+#ifndef __extern_inline
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE __extern_inline
+#endif
+
+#ifdef __USE_ISOC99
+
+__MATH_INLINE int
+__NTH (__signbitf (float __x))
+{
+  return __builtin_signbitf (__x);
+}
+
+__MATH_INLINE int
+__NTH (__signbit (double __x))
+{
+  return __builtin_signbit (__x);
+}
+
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+  return __builtin_signbitl (__x);
+}
+
+#endif /* C99 */
-- 
1.9.1




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]