17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2011, Richard Lowe.
29 */
30
31 /* Functions in this file are duplicated in locallibm.il. Keep them in sync */
32
33 #ifndef _LIBM_INLINES_H
34 #define _LIBM_INLINES_H
35
36 #ifdef __GNUC__
37
38 #include <sys/types.h>
39 #include <sys/ieeefp.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 extern __GNU_INLINE enum fp_class_type
46 fp_classf(float f)
47 {
48 enum fp_class_type ret;
49 int fint; /* scratch for f as int */
50 uint64_t tmp;
51
52 __asm__ __volatile__(
53 "fabss %3,%3\n\t"
54 "st %3,%1\n\t"
55 "ld %1,%0\n\t"
56 "orcc %%g0,%0,%%g0\n\t"
57 "be,pn %%icc,2f\n\t"
275 fabs(double d)
276 {
277 double ret;
278
279 __asm__ __volatile__("fabsd %1,%0\n\t" : "=e" (ret) : "e" (d));
280 return (ret);
281 }
282
283 extern __GNU_INLINE float
284 fabsf(float f)
285 {
286 float ret;
287
288 __asm__ __volatile__("fabss %1,%0\n\t" : "=f" (ret) : "f" (f));
289 return (ret);
290 }
291
292 #ifdef __cplusplus
293 }
294 #endif
295
296 #endif /* __GNUC__ */
297
298 #endif /* _LIBM_INLINES_H */
|
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2011, Richard Lowe.
29 */
30
31 /* Functions in this file are duplicated in locallibm.il. Keep them in sync */
32
33 #ifndef _LIBM_INLINES_H
34 #define _LIBM_INLINES_H
35
36 #ifdef __GNUC__
37 #include <sys/types.h>
38 #include <sys/ieeefp.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 extern __GNU_INLINE enum fp_class_type
45 fp_classf(float f)
46 {
47 enum fp_class_type ret;
48 int fint; /* scratch for f as int */
49 uint64_t tmp;
50
51 __asm__ __volatile__(
52 "fabss %3,%3\n\t"
53 "st %3,%1\n\t"
54 "ld %1,%0\n\t"
55 "orcc %%g0,%0,%%g0\n\t"
56 "be,pn %%icc,2f\n\t"
274 fabs(double d)
275 {
276 double ret;
277
278 __asm__ __volatile__("fabsd %1,%0\n\t" : "=e" (ret) : "e" (d));
279 return (ret);
280 }
281
282 extern __GNU_INLINE float
283 fabsf(float f)
284 {
285 float ret;
286
287 __asm__ __volatile__("fabss %1,%0\n\t" : "=f" (ret) : "f" (f));
288 return (ret);
289 }
290
291 #ifdef __cplusplus
292 }
293 #endif
294 #endif /* __GNUC__ */
295 #endif /* _LIBM_INLINES_H */
|