25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * CDDL HEADER START
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * The contents of this file are subject to the terms of the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Common Development and Distribution License (the "License").
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * You may not use this file except in compliance with the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * or http://www.opensolaris.org/os/licensing.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * See the License for the specific language governing permissions
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * and limitations under the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * When distributing Covered Code, include this CDDL HEADER in each
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * If applicable, add the following below this CDDL HEADER, with the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * fields enclosed by brackets "[]" replaced with your own identifying
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * information: Portions Copyright [yyyy] [name of copyright owner]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * CDDL HEADER END
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Use is subject to license terms.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis.LFmaxl: .long 0xffffffff,0xffffffff,0x00007ffe
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $1,-12(%ebp) /// -12(%ebp) contains Fminl
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $1,-12(%ebp) /// -12(%ebp) contains -Fminl
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $0x00008000,%ecx /// final needs this
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl 12(%ebp),%edx / high word of significand of x
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x0000ffff,%ecx
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %edx,%eax
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x80000000,%eax / look at explicit leading bit
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x80007fff,%eax
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis jnz .Lnot_pseudonormal / zero value implies pseudonormal
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis addl $1,%ecx / if pseudonormal, turn into equivalent normal
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis.Lnot_pseudonormal:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl 8(%ebp),%eax / low x
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis subl $1,%eax / low x - ulp
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %eax,-12(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis cmpl $0xffffffff,%eax / this means low x was 0
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %edx,-8(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,-4(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis cmpl $0x80000000,%edx / look at high x
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis je .Lsecond_borrow
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %edx,-8(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,-4(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis.Lsecond_borrow:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,%eax
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x7fff,%eax / look at exp x without sign bit
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis jbe .Lsubnormal_result / exp > 1 ==> result will be normal
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $0xffffffff,-8(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,-4(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis.Lsubnormal_result:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $0x7fffffff,-8(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,%eax
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x8000,%eax / look at sign bit
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl $0x8000,%ecx
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,-4(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl %ecx,-4(%ebp)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis movl 12(%ebp),%edx / high x
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis andl $0x80000000,%eax / look at explicit leading bit
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis jnz .Lnot_pseudonormal_2 / zero value implies pseudonormal
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis jz .Lcarry / jump if the content of %eax is 0
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis fmulp %st,%st(0) / create underflow signal
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis fstp %st(0) / C99 says to return y when x == y