powl.s revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8
/*
* 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 ** 0 is 1
/ x ** 1 is x
/ x ** 2 is x*x
#include "libm.h"
#include "libm_synonyms.h"
#include "xpg6.h"
.data
.align 16
.float -0.0
half:
.float 0.5
one:
.float 1.0
.float -1.0
two:
.float 2.0
Snan:
PIC_SETUP(1)
.pow_main:
/ x ** 0 is 1
jne 1f
fld1 / 1
je 1f
fld1 / 1, y, x
jne 1f
1:
jne 1f
jne 1f
/ x ** 1 is x
fld1 / 1, y, x
jne 1f
jne 1f
/ x ** 2 is x*x
jne 1f
fmulp / x^2 , y , x
jne 1f
fldz / 0 , y , x , y , x
/ x < 0
jne 1f
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:
/ ------------------------------------------------------------------------
.xispinf:
.xisninf:
fchs / -y , x
.yispinf:
fabs / |x| , y , x
.yisninf:
fabs / |x| , y , x
.xispzero:
fldz / 0 , y , x
.xisnzero:
je 2f
2:
.retpzero:
fldz / +0
.retnzero:
je 1f
fld1 / 1
1:
.retpinf:
/ %edx.
.y_is_int:
movl %eax,%ecx
subl $0x403e,%ecx
negl %ecx / 63 - unbiased exponent of y
movq 32(%rbp),%rax
bsfq %rax,%rax / index of least sig. 1 bit
cmpl %ecx,%eax
jb 2f
ja 1f
movl $1,%ecx
ret
1:
movl $2,%ecx
ret
2:
xorl %ecx,%ecx
ret
.align 16
SET_SIZE(powl)