dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libc / inc / base_inlines.h
bloba3ccd4eadfd6c2ecbc89ce3eda4da84140441864
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _BASE_INLINES_H
28 #define _BASE_INLINES_H
30 #include <sys/ccompile.h>
31 #include <sys/types.h>
34 * This file is intended to contain gcc-style inline assembly for all
35 * architectures. At the moment these inlines exist only for sparc and
36 * sparcv9 and these functions are implemented in C for x86.
39 #if defined(__sparc)
40 extern __GNU_INLINE double
41 __mul_set(double x, double y, int *pe)
43 double __result;
44 uint32_t __fsr;
45 uint32_t *__addr = &__fsr;
47 __asm__ __volatile__(
48 "fmuld %4, %5, %0\n\t"
49 "st %%fsr, %3\n\t"
50 "ld %3, %2\n\t"
51 "and %2, 1, %2\n\t"
52 "st %2, %1"
53 : "=&e" (__result), "=m" (*pe), "=r" (__fsr), "=m" (*__addr)
54 : "e" (x), "e" (y));
55 return (__result);
57 #endif /* __sparc */
59 #if defined(__sparc)
60 extern __GNU_INLINE double
61 __div_set(double x, double y, int *pe)
63 double __result;
64 uint32_t __fsr;
65 uint32_t *__addr = &__fsr;
67 __asm__ __volatile__(
68 "fdivd %4, %5, %0\n\t"
69 "st %%fsr, %3\n\t"
70 "ld %3, %2\n\t"
71 "and %2, 1, %2\n\t"
72 "st %2, %1"
73 : "=&e" (__result), "=m" (*pe), "=r" (__fsr), "=m" (*__addr)
74 : "e" (x), "e" (y));
75 return (__result);
77 #endif /* __sparc */
79 #if defined(__sparc)
80 extern __GNU_INLINE double
81 __dabs(double *x)
83 double __result;
85 __asm__ __volatile__(
86 #if defined(__sparcv9)
87 "fabsd %1, %0"
88 #else
89 "fabss %1, %0"
90 #endif
91 : "=e" (__result)
92 : "0" (*x));
93 return (__result);
95 #endif /* __sparc */
97 #if defined(__sparc)
98 extern __GNU_INLINE void
99 __get_ieee_flags(__ieee_flags_type *b)
101 uint32_t __fsr;
104 * It's preferable to let the assembler insert the nops as
105 * needed; however, it warns as it does so. Add them here for now.
107 __asm__ __volatile__(
108 "st %%fsr, %0\n\t"
109 "st %%g0, %1\n\t"
110 "ld %1, %%fsr\n\t"
111 "nop; nop; nop"
112 : "=m" (*b), "=m" (__fsr));
114 #endif /* __sparc */
116 #if defined(__sparc)
117 extern __GNU_INLINE void
118 __set_ieee_flags(__ieee_flags_type *b)
121 * It's preferable to let the assembler insert the nops as
122 * needed; however, it warns as it does so. Add them here for now.
124 __asm__ __volatile__(
125 "ld %0, %%fsr\n\t"
126 "nop; nop; nop"
127 : /* no outputs */
128 : "m" (*b));
130 #endif /* __sparc */
132 #endif /* _BASE_INLINES_H */