Print this page
5262 libm needs to be carefully unifdef'd
5268 libm doesn't need to hide symbols which are already local
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/m9x/fminf.c
+++ new/usr/src/lib/libm/common/m9x/fminf.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 -#if defined(ELFOBJ)
31 30 #pragma weak fminf = __fminf
32 -#endif
33 31
34 32 #include "libm.h" /* for islessequal macro */
35 33
36 34 float
37 35 __fminf(float x, float y) {
38 36 /*
39 37 * On SPARC v8plus/v9, this could be implemented as follows
40 38 * (assuming %f0 = x, %f1 = y, return value left in %f0):
41 39 *
42 40 * fcmps %fcc0,%f1,%f1
43 41 * fmovsu %fcc0,%f0,%f1
44 42 * fcmps %fcc0,%f0,%f1
45 43 * fmovsug %fcc0,%f1,%f0
46 44 * st %f0,[x]
47 45 * st %f1,[y]
48 46 * ld [x],%l0
49 47 * ld [y],%l1
50 48 * or %l0,%l1,%l2
51 49 * sethi %hi(0x80000000),%l3
52 50 * and %l3,%l2,%l2
53 51 * or %l0,%l2,%l0
54 52 * st %l0,[x]
55 53 * ld [x],%f0
56 54 *
57 55 * If VIS instructions are available, use this code instead:
58 56 *
59 57 * fcmps %fcc0,%f1,%f1
60 58 * fmovsu %fcc0,%f0,%f1
61 59 * fcmps %fcc0,%f0,%f1
62 60 * fmovsug %fcc0,%f1,%f0
63 61 * fors %f0,%f1,%f2
64 62 * fzeros %f3
65 63 * fnegs %f3,%f3
66 64 * fands %f3,%f2,%f2
67 65 * fors %f0,%f2,%f0
68 66 *
69 67 * If VIS 3.0 instructions are available, use this:
70 68 *
71 69 * flcmps %fcc0,%f0,%f1
72 70 * fmovsge %fcc0,%f1,%f0 ! move if %fcc0 is 0 or 2
73 71 */
74 72
75 73 union {
76 74 unsigned i;
77 75 float f;
78 76 } xx, yy;
79 77 unsigned s;
80 78
81 79 /* if y is nan, replace it by x */
82 80 if (y != y)
83 81 y = x;
84 82
85 83 /* if x is nan, replace it by y */
86 84 if (x != x)
87 85 x = y;
88 86
89 87 /* At this point, x and y are either both numeric, or both NaN */
90 88 if (!isnan(x) && !islessequal(x, y))
91 89 x = y;
92 90
93 91 /*
94 92 * set the sign of the result if either x or y has its sign set
95 93 */
96 94 xx.f = x;
97 95 yy.f = y;
98 96 s = (xx.i | yy.i) & 0x80000000;
99 97 xx.i |= s;
100 98
101 99 return (xx.f);
102 100 }
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX