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]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #pragma weak fminf = __fminf
32 #include "libm.h" /* for islessequal macro */
35 __fminf(float x
, float y
) {
37 * On SPARC v8plus/v9, this could be implemented as follows
38 * (assuming %f0 = x, %f1 = y, return value left in %f0):
41 * fmovsu %fcc0,%f0,%f1
43 * fmovsug %fcc0,%f1,%f0
49 * sethi %hi(0x80000000),%l3
55 * If VIS instructions are available, use this code instead:
58 * fmovsu %fcc0,%f0,%f1
60 * fmovsug %fcc0,%f1,%f0
67 * If VIS 3.0 instructions are available, use this:
69 * flcmps %fcc0,%f0,%f1
70 * fmovsge %fcc0,%f1,%f0 ! move if %fcc0 is 0 or 2
79 /* if y is nan, replace it by x */
83 /* if x is nan, replace it by y */
87 /* At this point, x and y are either both numeric, or both NaN */
88 if (!isnan(x
) && !islessequal(x
, y
))
92 * set the sign of the result if either x or y has its sign set
96 s
= (xx
.i
| yy
.i
) & 0x80000000;