xref: /titanic_52/usr/src/lib/libm/i386/src/ieee_funcl.s (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1/*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
23 */
24/*
25 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
26 * Use is subject to license terms.
27 */
28
29        .file "ieee_funcl.s"
30
31#include "libm.h"
32
33	ENTRY(isinfl)
34	movl	12(%esp),%eax		/ ax <-- sign and bexp of x
35	notl	%eax
36	andl	$0x00007fff,%eax
37	jz	.L6
38	movl	$0,%eax
39.not_inf:
40	ret
41
42.L6:					/ here, (eax) = 0.0
43	movl	8(%esp),%ecx
44	xorl	$0x80000000,%ecx	/ handle unsupported implicitly
45	orl	4(%esp), %ecx
46	jnz	.not_inf
47	movl	$1,%eax
48	ret
49	.align	4
50	SET_SIZE(isinfl)
51
52	ENTRY(isnormall)
53					/ TRUE iff (x is finite, but
54					/	    neither subnormal nor zero)
55					/      iff (msb(sgnfcnd(x) /= 0
56					/	    &  0 < bexp(x) < 0x7fff)
57	movl	8(%esp),%eax		/ eax <-- hi_32(sgnfcnd(x))
58	andl	$0x80000000,%eax	/ eax[31]  <-- msb(sgnfcnd(x)),
59					/ rest_of(eax) <-- 0
60	jz	.L8			/ jump iff msb(sgnfcnd(x)) = 0
61	movl	12(%esp),%eax		/ ax <-- sign and bexp of x
62	notl	%eax			/ ax[0..14] <-- not(bexp(x))
63	andl	$0x00007fff,%eax	/ eax  <-- zero_xtnd(not(bexp(x)))
64	jz	.L8			/ jump	iff bexp(x) = 0x7fff or 0
65	xorl	$0x00007fff,%eax	/ treat pseudo-denormal as subnormal
66	jz	.L8
67	movl	$1,%eax
68.L8:
69	ret
70	.align	4
71	SET_SIZE(isnormall)
72
73	ENTRY(issubnormall)
74					/ TRUE iff (bexp(x) = 0 &
75					/ msb(sgnfcnd(x)) = 0 & frac(x) /= 0)
76	movl	8(%esp),%eax		/ eax <-- hi_32(sgnfcnd(x))
77	testl	$0x80000000,%eax	/ eax[31] = msb(sgnfcnd(x));
78					/ set ZF if it's 0.
79	jz	.may_be_subnorm		/ jump iff msb(sgnfcnd(x)) = 0
80.not_subnorm:
81	movl	$0,%eax
82.quicker_out:
83	ret
84.may_be_subnorm:
85	testl	$0x00007fff,12(%esp)	/ set ZF iff bexp(x)  = 0
86	jnz	.not_subnorm		/ jump   iff bexp(x) /= 0
87	orl	4(%esp),%eax		/ (eax) = 0 iff sgnfcnd(x) = 0
88	jz	.quicker_out
89	movl	$1,%eax
90	ret
91	.align	4
92	SET_SIZE(issubnormall)
93
94	ENTRY(iszerol)
95	movl	12(%esp),%eax		/ ax <-- sign and bexp of x
96	andl	$0x00007fff,%eax	/ eax <-- zero_xtnd(bexp(x))
97	jz	.may_be_zero		/ jump iff bexp(x) = 0
98.not_zero:
99	movl	$0,%eax
100	ret
101.may_be_zero:				/ here, (eax) = 0
102	orl	8(%esp),%eax		/ is hi_32(sgnfcnd(x)) = 0?
103	jnz	.not_zero		/ jump iff hi_32(sgnfcnd(x)) /= 0
104	orl	4(%esp),%eax		/ is lo_32(sgnfcnd(x)) = 0?
105	jnz	.not_zero		/ jump iff lo_32(sgnfcnd(x)) /= 0
106	movl	$1,%eax
107	ret
108	.align	4
109	SET_SIZE(iszerol)
110
111	ENTRY(signbitl)
112	movl	10(%esp),%eax		/ eax[31] <-- sign_bit(x)
113	shrl	$31,%eax		/ eax <-- zero_xtnd(sign_bit(x))
114	ret
115	.align	4
116	SET_SIZE(signbitl)
117