/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/
/ x ** 1 is x
/ x ** 2 is x*x
#include "libm.h"
#include "libm_protos.h"
#include "xpg6.h"
.data
.align 4
.float -0.0
one:
.float 1.0
.float -1.0
two:
.float 2.0
Snan:
.long 0x7f800001
.long 0x7f800000
.long 0xff800000
PIC_SETUP(1)
.pow_main:
jne 1f
jne 2f
/ 0^0
pushl $20
2:
jne 2f
/ NaN^0
pushl $42
2:
fld1 / 1
je 1f
fld1 / 1, y, x
jne 1f
1:
jne 1f
jne 1f
/ x ** 1 is x
jne 1f
jne 1f
/ x ** 2 is x*x
jne 1f
fmulp / x^2 , y , x
/ x < 0
jne 1f
pushl $24
1: / x < 0 & y = int
fxch / x , y , y , x
.merge:
/ px > 0
frndint / [t] , t , y , x
fxch / t , [t] , y , x
jmp 2f
1:
fld1 / 1 , t , y , x
2:
.signok:
jne 1f
/ x^y overflows
pushl $21
1:
jne 1f
/ x^y underflows
pushl $22
1:
/ ------------------------------------------------------------------------
.xispinf:
.xisninf:
fchs / -y , x
.yispinf:
fabs / |x| , y , x
.yisninf:
fabs / |x| , y , x
.xispzero:
/ x = +0 & y < 0
.xisnzero:
.retpzero:
fldz / +0
.retnzero:
je 1f
fld1 / 1
1:
.retpinf:
pushl $23
.SVIDerr:
/ %edx.
.y_is_int:
movl %eax,%ecx
sarl $20,%ecx
subl $0x433,%ecx
negl %ecx / 52 - unbiased exponent of y
movl 16(%ebp),%eax
bsfl %eax,%eax / index of least sig. 1 bit
jne 3f / jump if 1 bit found
movl 20(%ebp),%eax
bsfl %eax,%eax
addl $32,%eax / 32 + index of least sig. 1 bit
3:
cmpl %ecx,%eax
jb 2f
ja 1f
movl $1,%ecx
ret
1:
movl $2,%ecx
ret
2:
xorl %ecx,%ecx
ret
.align 4
SET_SIZE(pow)