libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / posix / glibc / include / arch / ppc / bits / mathinline.h
blobe0435516ef7e5adce51ef6f39a29cc2da0a50849
1 /* Inline math functions for powerpc.
2 Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #if defined __GNUC__ && !defined _SOFT_FLOAT
22 #ifdef __USE_ISOC99
23 # if __GNUC_PREREQ (2,96)
25 # define isgreater(x, y) __builtin_isgreater (x, y)
26 # define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
27 # define isless(x, y) __builtin_isless (x, y)
28 # define islessequal(x, y) __builtin_islessequal (x, y)
29 # define islessgreater(x, y) __builtin_islessgreater (x, y)
30 # define isunordered(x, y) __builtin_isunordered (x, y)
32 # else
34 # define __unordered_cmp(x, y) \
35 (__extension__ \
36 ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
37 unsigned __r; \
38 __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \
39 : "cr7"); \
40 __r; }))
42 # define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
43 # define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0)
44 # define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1)
45 # define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0)
46 # define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0)
47 # define isunordered(x, y) (__unordered_cmp (x, y) & 1)
49 # endif /* __GNUC_PREREQ (2,97) */
50 #endif /* __USE_ISOC99 */
52 #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
54 #ifndef __extern_always_inline
55 # define __MATH_INLINE __inline
56 #else
57 # define __MATH_INLINE __extern_always_inline
58 #endif /* __cplusplus */
60 #ifdef __USE_ISOC99
61 __MATH_INLINE long int lrint (double __x) __THROW;
62 __MATH_INLINE long int
63 lrint (double __x) __THROW
65 union {
66 double __d;
67 int __ll[2];
68 } __u;
69 __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
70 return __u.__ll[1];
73 __MATH_INLINE long int lrintf (float __x) __THROW;
74 __MATH_INLINE long int
75 lrintf (float __x) __THROW
77 union {
78 double __d;
79 int __ll[2];
80 } __u;
81 __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
82 return __u.__ll[1];
85 __MATH_INLINE double fdim (double __x, double __y) __THROW;
86 __MATH_INLINE double
87 fdim (double __x, double __y) __THROW
89 return __x < __y ? 0 : __x - __y;
92 __MATH_INLINE float fdimf (float __x, float __y) __THROW;
93 __MATH_INLINE float
94 fdimf (float __x, float __y) __THROW
96 return __x < __y ? 0 : __x - __y;
99 #endif /* __USE_ISOC99 */
100 #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
101 #endif /* __GNUC__ && !_SOFT_FLOAT */