/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
.file "__vatan.S"
#include "libm.h"
! #include <math.h>
! #include <stdio.h>
! double jkatan(double *x)
! {
! extern const double __vlibm_TBL_atan1[];
!
! /* Power series atan(x) = x + p1*x**3 + p2*x**5 + p3*x**7
! * Error = -3.08254E-18 On the interval |x| < 1/64 */
!
! /* define dummy names for readability. Use parray to help compiler optimize loads */
! #define soffset 3
!
! static const double parray[] = {
! -1.428029046844299722E-01, /* p[3] */
! 1.999999917247000615E-01, /* p[2] */
! -3.333333333329292858E-01, /* p[1] */
! 1.0, /* not used for p[0], though */
! -1.0, /* used to flip sign of answer */
! };
!
! f = *x; /* fetch argument */
!
! {
! if( (intf > 0x7ff00000) ||
! {
! dummy = 1.0e37 + f;
! return (*x);
! }
! {
! index = 2;
! return (f);
! }
! }
!
! index = 0; /* points to 0,0 in table */
! { f = -1.0/f;
! }
! {
! f = (f - z)/(1.0 + f*z); /* get reduced argument */
! }
! tmp = f*f;
! return ans;
! }
/* 8 bytes = 1 double f.p. word */
.COEFFS:
.double 0r-1.428029046844299722E-01 !p[3]
.double 0r-3.333333333329292858E-01 !p[1]
/*
__vatan(int n, double *x, int stridex, double *y, stridey)
computes y(i) = atan( x(i) ), for 1=1,n. Stridex, stridey
are the distance between x and y elements
%i0 n
%i1 address of x
%i2 stride x
%i3 address of y
%i4 stride y
*/
/* pre-load constants before beginning main loop */
.MAINLOOP:
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
.LOOP0:
bneg 1f
ba 2f
1:
2:
!----------------------
.ENDIF0:
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
.LOOP1:
bneg 1f
ba 2f
1:
2:
!----------------------
.ENDIF1:
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
.LOOP2:
bneg 1f
ba 2f
1:
2:
!----------------------
.ENDIF2:
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
.RETURN:
/*--------------------------------------------------------------------------*/
/*------------SPECIAL CASE HANDLING FOR LOOP0 ------------------------------*/
/*--------------------------------------------------------------------------*/
/* at this point
%i1 x address
%o0 intf
%o2 intf - 0x3e300000
%f34,36,38 f0,f1,f2
%f40,42,44 sign0,sign1,sign2
*/
.SPECIAL0:
bpos 1f !if >=...continue
ba 3f
1:
ba 3f
2:
3:
/*--------------------------------------------------------------------------*/
/*-----------SPECIAL CASE HANDLING FOR LOOP1 -------------------------------*/
/*--------------------------------------------------------------------------*/
.SPECIAL1:
bpos 1f !if >=...continue
ba 3f
1:
ba 3f
2:
3:
/*--------------------------------------------------------------------------*/
/*------------SPECIAL CASE HANDLING FOR LOOP2 ------------------------------*/
/*--------------------------------------------------------------------------*/
.SPECIAL2:
bpos 1f !if >=...continue
ba 3f
1:
ba 3f
2:
3:
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
! .ident "03-20-96 Sparc V9 3-way-unrolled version"