|
Packit |
6c4009 |
.file "tgammaf.s"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// Copyright (c) 2001 - 2005, Intel Corporation
|
|
Packit |
6c4009 |
// All rights reserved.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Contributed 2001 by the Intel Numerics Group, Intel Corporation
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
6c4009 |
// modification, are permitted provided that the following conditions are
|
|
Packit |
6c4009 |
// met:
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// * Redistributions of source code must retain the above copyright
|
|
Packit |
6c4009 |
// notice, this list of conditions and the following disclaimer.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
6c4009 |
// notice, this list of conditions and the following disclaimer in the
|
|
Packit |
6c4009 |
// documentation and/or other materials provided with the distribution.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// * The name of Intel Corporation may not be used to endorse or promote
|
|
Packit |
6c4009 |
// products derived from this software without specific prior written
|
|
Packit |
6c4009 |
// permission.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
6c4009 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT
|
|
Packit |
6c4009 |
// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
6c4009 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
|
|
Packit |
6c4009 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
|
|
Packit |
6c4009 |
// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
|
|
Packit |
6c4009 |
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR
|
|
Packit |
6c4009 |
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
Packit |
6c4009 |
// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
|
|
Packit |
6c4009 |
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
Packit |
6c4009 |
// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Intel Corporation is the author of this code,and requests that all
|
|
Packit |
6c4009 |
// problem reports or change requests be submitted to it directly at
|
|
Packit |
6c4009 |
// http://www.intel.com/software/products/opensource/libraries/num.htm.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// History:
|
|
Packit |
6c4009 |
// 11/30/01 Initial version
|
|
Packit |
6c4009 |
// 05/20/02 Cleaned up namespace and sf0 syntax
|
|
Packit |
6c4009 |
// 02/10/03 Reordered header: .section, .global, .proc, .align
|
|
Packit |
6c4009 |
// 04/04/03 Changed error codes for overflow and negative integers
|
|
Packit |
6c4009 |
// 04/10/03 Changed code for overflow near zero handling
|
|
Packit |
6c4009 |
// 12/16/03 Fixed parameter passing to/from error handling routine
|
|
Packit |
6c4009 |
// 03/31/05 Reformatted delimiters between data tables
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Function: tgammaf(x) computes the principle value of the GAMMA
|
|
Packit |
6c4009 |
// function of x.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Resources Used:
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Floating-Point Registers: f8-f15
|
|
Packit |
6c4009 |
// f33-f75
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// General Purpose Registers:
|
|
Packit |
6c4009 |
// r8-r11
|
|
Packit |
6c4009 |
// r14-r29
|
|
Packit |
6c4009 |
// r32-r36
|
|
Packit |
6c4009 |
// r37-r40 (Used to pass arguments to error handling routine)
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Predicate Registers: p6-p15
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// IEEE Special Conditions:
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// tgammaf(+inf) = +inf
|
|
Packit |
6c4009 |
// tgammaf(-inf) = QNaN
|
|
Packit |
6c4009 |
// tgammaf(+/-0) = +/-inf
|
|
Packit |
6c4009 |
// tgammaf(x<0, x - integer) = QNaN
|
|
Packit |
6c4009 |
// tgammaf(SNaN) = QNaN
|
|
Packit |
6c4009 |
// tgammaf(QNaN) = QNaN
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Overview
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// The method consists of three cases.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// If 2 <= x < OVERFLOW_BOUNDARY use case tgamma_regular;
|
|
Packit |
6c4009 |
// else if 0 < x < 2 use case tgamma_from_0_to_2;
|
|
Packit |
6c4009 |
// else if -(i+1) < x < -i, i = 0...43 use case tgamma_negatives;
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Case 2 <= x < OVERFLOW_BOUNDARY
|
|
Packit |
6c4009 |
// -------------------------------
|
|
Packit |
6c4009 |
// Here we use algorithm based on the recursive formula
|
|
Packit |
6c4009 |
// GAMMA(x+1) = x*GAMMA(x). For that we subdivide interval
|
|
Packit |
6c4009 |
// [2; OVERFLOW_BOUNDARY] into intervals [8*n; 8*(n+1)] and
|
|
Packit |
6c4009 |
// approximate GAMMA(x) by polynomial of 22th degree on each
|
|
Packit |
6c4009 |
// [8*n; 8*n+1], recursive formula is used to expand GAMMA(x)
|
|
Packit |
6c4009 |
// to [8*n; 8*n+1]. In other words we need to find n, i and r
|
|
Packit |
6c4009 |
// such that x = 8 * n + i + r where n and i are integer numbers
|
|
Packit |
6c4009 |
// and r is fractional part of x. So GAMMA(x) = GAMMA(8*n+i+r) =
|
|
Packit |
6c4009 |
// = (x-1)*(x-2)*...*(x-i)*GAMMA(x-i) =
|
|
Packit |
6c4009 |
// = (x-1)*(x-2)*...*(x-i)*GAMMA(8*n+r) ~
|
|
Packit |
6c4009 |
// ~ (x-1)*(x-2)*...*(x-i)*P12n(r).
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 1: Reduction
|
|
Packit |
6c4009 |
// -----------------
|
|
Packit |
6c4009 |
// N = [x] with truncate
|
|
Packit |
6c4009 |
// r = x - N, note 0 <= r < 1
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// n = N & ~0xF - index of table that contains coefficient of
|
|
Packit |
6c4009 |
// polynomial approximation
|
|
Packit |
6c4009 |
// i = N & 0xF - is used in recursive formula
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 2: Approximation
|
|
Packit |
6c4009 |
// ---------------------
|
|
Packit |
6c4009 |
// We use factorized minimax approximation polynomials
|
|
Packit |
6c4009 |
// P12n(r) = A12*(r^2+C01(n)*r+C00(n))*
|
|
Packit |
6c4009 |
// *(r^2+C11(n)*r+C10(n))*...*(r^2+C51(n)*r+C50(n))
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 3: Recursion
|
|
Packit |
6c4009 |
// -----------------
|
|
Packit |
6c4009 |
// In case when i > 0 we need to multiply P12n(r) by product
|
|
Packit |
6c4009 |
// R(i,x)=(x-1)*(x-2)*...*(x-i). To reduce number of fp-instructions
|
|
Packit |
6c4009 |
// we can calculate R as follow:
|
|
Packit |
6c4009 |
// R(i,x) = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-1))*(x-i)) if i is
|
|
Packit |
6c4009 |
// even or R = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-2))*(x-(i-1)))*
|
|
Packit |
6c4009 |
// *(i-1) if i is odd. In both cases we need to calculate
|
|
Packit |
6c4009 |
// R2(i,x) = (x^2-3*x+2)*(x^2-7*x+12)*...*(x^2+x+2*j*(2*j-1)) =
|
|
Packit |
6c4009 |
// = ((x^2-x)+2*(1-x))*((x^2-x)+6*(2-x))*...*((x^2-x)+2*(2*j-1)*(j-x)) =
|
|
Packit |
6c4009 |
// = (RA+2*RB)*(RA+6*(1-RB))*...*(RA+2*(2*j-1)*(j-1+RB))
|
|
Packit |
6c4009 |
// where j = 1..[i/2], RA = x^2-x, RB = 1-x.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 4: Reconstruction
|
|
Packit |
6c4009 |
// ----------------------
|
|
Packit |
6c4009 |
// Reconstruction is just simple multiplication i.e.
|
|
Packit |
6c4009 |
// GAMMA(x) = P12n(r)*R(i,x)
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Case 0 < x < 2
|
|
Packit |
6c4009 |
// --------------
|
|
Packit |
6c4009 |
// To calculate GAMMA(x) on this interval we do following
|
|
Packit |
6c4009 |
// if 1.0 <= x < 1.25 than GAMMA(x) = P7(x-1)
|
|
Packit |
6c4009 |
// if 1.25 <= x < 1.5 than GAMMA(x) = P7(x-x_min) where
|
|
Packit |
6c4009 |
// x_min is point of local minimum on [1; 2] interval.
|
|
Packit |
6c4009 |
// if 1.5 <= x < 1.75 than GAMMA(x) = P7(x-1.5)
|
|
Packit |
6c4009 |
// if 1.75 <= x < 2.0 than GAMMA(x) = P7(x-1.5)
|
|
Packit |
6c4009 |
// and
|
|
Packit |
6c4009 |
// if 0 < x < 1 than GAMMA(x) = GAMMA(x+1)/x
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Case -(i+1) < x < -i, i = 0...43
|
|
Packit |
6c4009 |
// ----------------------------------
|
|
Packit |
6c4009 |
// Here we use the fact that GAMMA(-x) = PI/(x*GAMMA(x)*sin(PI*x)) and
|
|
Packit |
6c4009 |
// so we need to calculate GAMMA(x), sin(PI*x)/PI. Calculation of
|
|
Packit |
6c4009 |
// GAMMA(x) is described above.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 1: Reduction
|
|
Packit |
6c4009 |
// -----------------
|
|
Packit |
6c4009 |
// Note that period of sin(PI*x) is 2 and range reduction for
|
|
Packit |
6c4009 |
// sin(PI*x) is like to range reduction for GAMMA(x)
|
|
Packit |
6c4009 |
// i.e rs = x - round(x) and |rs| <= 0.5.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 2: Approximation
|
|
Packit |
6c4009 |
// ---------------------
|
|
Packit |
6c4009 |
// To approximate sin(PI*x)/PI = sin(PI*(2*n+rs))/PI =
|
|
Packit |
6c4009 |
// = (-1)^n*sin(PI*rs)/PI Taylor series is used.
|
|
Packit |
6c4009 |
// sin(PI*rs)/PI ~ S17(rs).
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// Step 3: Division
|
|
Packit |
6c4009 |
// ----------------
|
|
Packit |
6c4009 |
// To calculate 1/x and 1/(GAMMA(x)*S12(rs)) we use frcpa
|
|
Packit |
6c4009 |
// instruction with following Newton-Raphson interations.
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//*********************************************************************
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GR_ad_Data = r8
|
|
Packit |
6c4009 |
GR_TAG = r8
|
|
Packit |
6c4009 |
GR_SignExp = r9
|
|
Packit |
6c4009 |
GR_Sig = r10
|
|
Packit |
6c4009 |
GR_ArgNz = r10
|
|
Packit |
6c4009 |
GR_RqDeg = r11
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GR_NanBound = r14
|
|
Packit |
6c4009 |
GR_ExpOf025 = r15
|
|
Packit |
6c4009 |
GR_ExpOf05 = r16
|
|
Packit |
6c4009 |
GR_ad_Co = r17
|
|
Packit |
6c4009 |
GR_ad_Ce = r18
|
|
Packit |
6c4009 |
GR_TblOffs = r19
|
|
Packit |
6c4009 |
GR_Arg = r20
|
|
Packit |
6c4009 |
GR_Exp2Ind = r21
|
|
Packit |
6c4009 |
GR_TblOffsMask = r21
|
|
Packit |
6c4009 |
GR_Offs = r22
|
|
Packit |
6c4009 |
GR_OvfNzBound = r23
|
|
Packit |
6c4009 |
GR_ZeroResBound = r24
|
|
Packit |
6c4009 |
GR_ad_SinO = r25
|
|
Packit |
6c4009 |
GR_ad_SinE = r26
|
|
Packit |
6c4009 |
GR_Correction = r27
|
|
Packit |
6c4009 |
GR_Tbl12Offs = r28
|
|
Packit |
6c4009 |
GR_NzBound = r28
|
|
Packit |
6c4009 |
GR_ExpOf1 = r29
|
|
Packit |
6c4009 |
GR_fpsr = r29
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GR_SAVE_B0 = r33
|
|
Packit |
6c4009 |
GR_SAVE_PFS = r34
|
|
Packit |
6c4009 |
GR_SAVE_GP = r35
|
|
Packit |
6c4009 |
GR_SAVE_SP = r36
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GR_Parameter_X = r37
|
|
Packit |
6c4009 |
GR_Parameter_Y = r38
|
|
Packit |
6c4009 |
GR_Parameter_RESULT = r39
|
|
Packit |
6c4009 |
GR_Parameter_TAG = r40
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_X = f10
|
|
Packit |
6c4009 |
FR_Y = f1
|
|
Packit |
6c4009 |
FR_RESULT = f8
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_iXt = f11
|
|
Packit |
6c4009 |
FR_Xt = f12
|
|
Packit |
6c4009 |
FR_r = f13
|
|
Packit |
6c4009 |
FR_r2 = f14
|
|
Packit |
6c4009 |
FR_r4 = f15
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_C01 = f33
|
|
Packit |
6c4009 |
FR_A7 = f33
|
|
Packit |
6c4009 |
FR_C11 = f34
|
|
Packit |
6c4009 |
FR_A6 = f34
|
|
Packit |
6c4009 |
FR_C21 = f35
|
|
Packit |
6c4009 |
FR_A5 = f35
|
|
Packit |
6c4009 |
FR_C31 = f36
|
|
Packit |
6c4009 |
FR_A4 = f36
|
|
Packit |
6c4009 |
FR_C41 = f37
|
|
Packit |
6c4009 |
FR_A3 = f37
|
|
Packit |
6c4009 |
FR_C51 = f38
|
|
Packit |
6c4009 |
FR_A2 = f38
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_C00 = f39
|
|
Packit |
6c4009 |
FR_A1 = f39
|
|
Packit |
6c4009 |
FR_C10 = f40
|
|
Packit |
6c4009 |
FR_A0 = f40
|
|
Packit |
6c4009 |
FR_C20 = f41
|
|
Packit |
6c4009 |
FR_C30 = f42
|
|
Packit |
6c4009 |
FR_C40 = f43
|
|
Packit |
6c4009 |
FR_C50 = f44
|
|
Packit |
6c4009 |
FR_An = f45
|
|
Packit |
6c4009 |
FR_OvfBound = f46
|
|
Packit |
6c4009 |
FR_InvAn = f47
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_Multplr = f48
|
|
Packit |
6c4009 |
FR_NormX = f49
|
|
Packit |
6c4009 |
FR_X2mX = f50
|
|
Packit |
6c4009 |
FR_1mX = f51
|
|
Packit |
6c4009 |
FR_Rq0 = f51
|
|
Packit |
6c4009 |
FR_Rq1 = f52
|
|
Packit |
6c4009 |
FR_Rq2 = f53
|
|
Packit |
6c4009 |
FR_Rq3 = f54
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_Rcp0 = f55
|
|
Packit |
6c4009 |
FR_Rcp1 = f56
|
|
Packit |
6c4009 |
FR_Rcp2 = f57
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_InvNormX1 = f58
|
|
Packit |
6c4009 |
FR_InvNormX2 = f59
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_rs = f60
|
|
Packit |
6c4009 |
FR_rs2 = f61
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_LocalMin = f62
|
|
Packit |
6c4009 |
FR_10 = f63
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_05 = f64
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_S32 = f65
|
|
Packit |
6c4009 |
FR_S31 = f66
|
|
Packit |
6c4009 |
FR_S01 = f67
|
|
Packit |
6c4009 |
FR_S11 = f68
|
|
Packit |
6c4009 |
FR_S21 = f69
|
|
Packit |
6c4009 |
FR_S00 = f70
|
|
Packit |
6c4009 |
FR_S10 = f71
|
|
Packit |
6c4009 |
FR_S20 = f72
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
FR_GAMMA = f73
|
|
Packit |
6c4009 |
FR_2 = f74
|
|
Packit |
6c4009 |
FR_6 = f75
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// Data tables
|
|
Packit |
6c4009 |
//==============================================================
|
|
Packit |
6c4009 |
RODATA
|
|
Packit |
6c4009 |
.align 16
|
|
Packit |
6c4009 |
LOCAL_OBJECT_START(tgammaf_data)
|
|
Packit |
6c4009 |
data8 0x3FDD8B618D5AF8FE // local minimum (0.461632144968362356785)
|
|
Packit |
6c4009 |
data8 0x4024000000000000 // 10.0
|
|
Packit |
6c4009 |
data8 0x3E90FC992FF39E13 // S32
|
|
Packit |
6c4009 |
data8 0xBEC144B2760626E2 // S31
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[2; 8)
|
|
Packit |
6c4009 |
data8 0x4009EFD1BA0CB3B4 // C01
|
|
Packit |
6c4009 |
data8 0x3FFFB35378FF4822 // C11
|
|
Packit |
6c4009 |
data8 0xC01032270413B896 // C41
|
|
Packit |
6c4009 |
data8 0xC01F171A4C0D6827 // C51
|
|
Packit |
6c4009 |
data8 0x40148F8E197396AC // C20
|
|
Packit |
6c4009 |
data8 0x401C601959F1249C // C30
|
|
Packit |
6c4009 |
data8 0x3EE21AD881741977 // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary (35.04010009765625)
|
|
Packit |
6c4009 |
data8 0x3FD9CE68F695B198 // C21
|
|
Packit |
6c4009 |
data8 0xBFF8C30AC900DA03 // C31
|
|
Packit |
6c4009 |
data8 0x400E17D2F0535C02 // C00
|
|
Packit |
6c4009 |
data8 0x4010689240F7FAC8 // C10
|
|
Packit |
6c4009 |
data8 0x402563147DDCCF8D // C40
|
|
Packit |
6c4009 |
data8 0x4033406D0480A21C // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[8; 16)
|
|
Packit |
6c4009 |
data8 0x4006222BAE0B793B // C01
|
|
Packit |
6c4009 |
data8 0x4002452733473EDA // C11
|
|
Packit |
6c4009 |
data8 0xC0010EF3326FDDB3 // C41
|
|
Packit |
6c4009 |
data8 0xC01492B817F99C0F // C51
|
|
Packit |
6c4009 |
data8 0x40099C905A249B75 // C20
|
|
Packit |
6c4009 |
data8 0x4012B972AE0E533D // C30
|
|
Packit |
6c4009 |
data8 0x3FE6F6DB91D0D4CC // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary
|
|
Packit |
6c4009 |
data8 0x3FF545828F7B73C5 // C21
|
|
Packit |
6c4009 |
data8 0xBFBBD210578764DF // C31
|
|
Packit |
6c4009 |
data8 0x4000542098F53CFC // C00
|
|
Packit |
6c4009 |
data8 0x40032C1309AD6C81 // C10
|
|
Packit |
6c4009 |
data8 0x401D7331E19BD2E1 // C40
|
|
Packit |
6c4009 |
data8 0x402A06807295EF57 // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[16; 24)
|
|
Packit |
6c4009 |
data8 0x4000131002867596 // C01
|
|
Packit |
6c4009 |
data8 0x3FFAA362D5D1B6F2 // C11
|
|
Packit |
6c4009 |
data8 0xBFFCB6985697DB6D // C41
|
|
Packit |
6c4009 |
data8 0xC0115BEE3BFC3B3B // C51
|
|
Packit |
6c4009 |
data8 0x3FFE62FF83456F73 // C20
|
|
Packit |
6c4009 |
data8 0x4007E33478A114C4 // C30
|
|
Packit |
6c4009 |
data8 0x41E9B2B73795ED57 // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary
|
|
Packit |
6c4009 |
data8 0x3FEEB1F345BC2769 // C21
|
|
Packit |
6c4009 |
data8 0xBFC3BBE6E7F3316F // C31
|
|
Packit |
6c4009 |
data8 0x3FF14E07DA5E9983 // C00
|
|
Packit |
6c4009 |
data8 0x3FF53B76BF81E2C0 // C10
|
|
Packit |
6c4009 |
data8 0x4014051E0269A3DC // C40
|
|
Packit |
6c4009 |
data8 0x40229D4227468EDB // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[24; 32)
|
|
Packit |
6c4009 |
data8 0x3FFAF7BD498384DE // C01
|
|
Packit |
6c4009 |
data8 0x3FF62AD8B4D1C3D2 // C11
|
|
Packit |
6c4009 |
data8 0xBFFABCADCD004C32 // C41
|
|
Packit |
6c4009 |
data8 0xC00FADE97C097EC9 // C51
|
|
Packit |
6c4009 |
data8 0x3FF6DA9ED737707E // C20
|
|
Packit |
6c4009 |
data8 0x4002A29E9E0C782C // C30
|
|
Packit |
6c4009 |
data8 0x44329D5B5167C6C3 // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary
|
|
Packit |
6c4009 |
data8 0x3FE8943CBBB4B727 // C21
|
|
Packit |
6c4009 |
data8 0xBFCB39D466E11756 // C31
|
|
Packit |
6c4009 |
data8 0x3FE879AF3243D8C1 // C00
|
|
Packit |
6c4009 |
data8 0x3FEEC7DEBB14CE1E // C10
|
|
Packit |
6c4009 |
data8 0x401017B79BA80BCB // C40
|
|
Packit |
6c4009 |
data8 0x401E941DC3C4DE80 // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[32; 40)
|
|
Packit |
6c4009 |
data8 0x3FF7ECB3A0E8FE5C // C01
|
|
Packit |
6c4009 |
data8 0x3FF3815A8516316B // C11
|
|
Packit |
6c4009 |
data8 0xBFF9ABD8FCC000C3 // C41
|
|
Packit |
6c4009 |
data8 0xC00DD89969A4195B // C51
|
|
Packit |
6c4009 |
data8 0x3FF2E43139CBF563 // C20
|
|
Packit |
6c4009 |
data8 0x3FFF96DC3474A606 // C30
|
|
Packit |
6c4009 |
data8 0x46AFF4CA9B0DDDF0 // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary
|
|
Packit |
6c4009 |
data8 0x3FE4CE76DA1B5783 // C21
|
|
Packit |
6c4009 |
data8 0xBFD0524DB460BC4E // C31
|
|
Packit |
6c4009 |
data8 0x3FE35852DF14E200 // C00
|
|
Packit |
6c4009 |
data8 0x3FE8C7610359F642 // C10
|
|
Packit |
6c4009 |
data8 0x400BCF750EC16173 // C40
|
|
Packit |
6c4009 |
data8 0x401AC14E02EA701C // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[40; 48)
|
|
Packit |
6c4009 |
data8 0x3FF5DCE4D8193097 // C01
|
|
Packit |
6c4009 |
data8 0x3FF1B0D8C4974FFA // C11
|
|
Packit |
6c4009 |
data8 0xBFF8FB450194CAEA // C41
|
|
Packit |
6c4009 |
data8 0xC00C9658E030A6C4 // C51
|
|
Packit |
6c4009 |
data8 0x3FF068851118AB46 // C20
|
|
Packit |
6c4009 |
data8 0x3FFBF7C7BB46BF7D // C30
|
|
Packit |
6c4009 |
data8 0x3FF0000000000000 // An
|
|
Packit |
6c4009 |
data8 0x4041852200000000 // overflow boundary
|
|
Packit |
6c4009 |
data8 0x3FE231DEB11D847A // C21
|
|
Packit |
6c4009 |
data8 0xBFD251ECAFD7E935 // C31
|
|
Packit |
6c4009 |
data8 0x3FE0368AE288F6BF // C00
|
|
Packit |
6c4009 |
data8 0x3FE513AE4215A70C // C10
|
|
Packit |
6c4009 |
data8 0x4008F960F7141B8B // C40
|
|
Packit |
6c4009 |
data8 0x40183BA08134397B // C50
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[1.0; 1.25)
|
|
Packit |
6c4009 |
data8 0xBFD9909648921868 // A7
|
|
Packit |
6c4009 |
data8 0x3FE96FFEEEA8520F // A6
|
|
Packit |
6c4009 |
data8 0xBFED0800D93449B8 // A3
|
|
Packit |
6c4009 |
data8 0x3FEFA648D144911C // A2
|
|
Packit |
6c4009 |
data8 0xBFEE3720F7720B4D // A5
|
|
Packit |
6c4009 |
data8 0x3FEF4857A010CA3B // A4
|
|
Packit |
6c4009 |
data8 0xBFE2788CCD545AA4 // A1
|
|
Packit |
6c4009 |
data8 0x3FEFFFFFFFE9209E // A0
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[1.25; 1.5)
|
|
Packit |
6c4009 |
data8 0xBFB421236426936C // A7
|
|
Packit |
6c4009 |
data8 0x3FAF237514F36691 // A6
|
|
Packit |
6c4009 |
data8 0xBFC0BADE710A10B9 // A3
|
|
Packit |
6c4009 |
data8 0x3FDB6C5465BBEF1F // A2
|
|
Packit |
6c4009 |
data8 0xBFB7E7F83A546EBE // A5
|
|
Packit |
6c4009 |
data8 0x3FC496A01A545163 // A4
|
|
Packit |
6c4009 |
data8 0xBDEE86A39D8452EB // A1
|
|
Packit |
6c4009 |
data8 0x3FEC56DC82A39AA2 // A0
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[1.5; 1.75)
|
|
Packit |
6c4009 |
data8 0xBF94730B51795867 // A7
|
|
Packit |
6c4009 |
data8 0x3FBF4203E3816C7B // A6
|
|
Packit |
6c4009 |
data8 0xBFE85B427DBD23E4 // A3
|
|
Packit |
6c4009 |
data8 0x3FEE65557AB26771 // A2
|
|
Packit |
6c4009 |
data8 0xBFD59D31BE3AB42A // A5
|
|
Packit |
6c4009 |
data8 0x3FE3C90CC8F09147 // A4
|
|
Packit |
6c4009 |
data8 0xBFE245971DF735B8 // A1
|
|
Packit |
6c4009 |
data8 0x3FEFFC613AE7FBC8 // A0
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
//[1.75; 2.0)
|
|
Packit |
6c4009 |
data8 0xBF7746A85137617E // A7
|
|
Packit |
6c4009 |
data8 0x3FA96E37D09735F3 // A6
|
|
Packit |
6c4009 |
data8 0xBFE3C24AC40AC0BB // A3
|
|
Packit |
6c4009 |
data8 0x3FEC56A80A977CA5 // A2
|
|
Packit |
6c4009 |
data8 0xBFC6F0E707560916 // A5
|
|
Packit |
6c4009 |
data8 0x3FDB262D949175BE // A4
|
|
Packit |
6c4009 |
data8 0xBFE1C1AEDFB25495 // A1
|
|
Packit |
6c4009 |
data8 0x3FEFEE1E644B2022 // A0
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// sin(pi*x)/pi
|
|
Packit |
6c4009 |
data8 0xC026FB0D377656CC // S01
|
|
Packit |
6c4009 |
data8 0x3FFFB15F95A22324 // S11
|
|
Packit |
6c4009 |
data8 0x406CE58F4A41C6E7 // S10
|
|
Packit |
6c4009 |
data8 0x404453786302C61E // S20
|
|
Packit |
6c4009 |
data8 0xC023D59A47DBFCD3 // S21
|
|
Packit |
6c4009 |
data8 0x405541D7ABECEFCA // S00
|
|
Packit |
6c4009 |
//
|
|
Packit |
6c4009 |
// 1/An for [40; 48)
|
|
Packit |
6c4009 |
data8 0xCAA7576DE621FCD5, 0x3F68
|
|
Packit |
6c4009 |
LOCAL_OBJECT_END(tgammaf_data)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
//==============================================================
|
|
Packit |
6c4009 |
// Code
|
|
Packit |
6c4009 |
//==============================================================
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.section .text
|
|
Packit |
6c4009 |
GLOBAL_LIBM_ENTRY(tgammaf)
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
getf.exp GR_SignExp = f8
|
|
Packit |
6c4009 |
fma.s1 FR_NormX = f8,f1,f0
|
|
Packit |
6c4009 |
addl GR_ad_Data = @ltoff(tgammaf_data), gp
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
mov GR_ExpOf05 = 0xFFFE
|
|
Packit |
6c4009 |
fcvt.fx.trunc.s1 FR_iXt = f8 // [x]
|
|
Packit |
6c4009 |
mov GR_Offs = 0 // 2 <= x < 8
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
getf.d GR_Arg = f8
|
|
Packit |
6c4009 |
fcmp.lt.s1 p14,p15 = f8,f0
|
|
Packit |
6c4009 |
mov GR_Tbl12Offs = 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
setf.exp FR_05 = GR_ExpOf05
|
|
Packit |
6c4009 |
fma.s1 FR_2 = f1,f1,f1 // 2
|
|
Packit |
6c4009 |
mov GR_Correction = 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ld8 GR_ad_Data = [GR_ad_Data]
|
|
Packit |
6c4009 |
fclass.m p10,p0 = f8,0x1E7 // is x NaTVal, NaN, +/-0 or +/-INF?
|
|
Packit |
6c4009 |
tbit.z p12,p13 = GR_SignExp,16 // p13 if |x| >= 2
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
mov GR_ExpOf1 = 0xFFFF
|
|
Packit |
6c4009 |
fcvt.fx.s1 FR_rs = f8 // round(x)
|
|
Packit |
6c4009 |
and GR_Exp2Ind = 7,GR_SignExp
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p15) cmp.eq.unc p11,p0 = GR_ExpOf1,GR_SignExp // p11 if 1 <= x < 2
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_1mX = f1,f1,f8 // 1 - |x|
|
|
Packit |
6c4009 |
mov GR_Sig = 0 // if |x| < 2
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p13) cmp.eq.unc p7,p0 = 2,GR_Exp2Ind
|
|
Packit |
6c4009 |
(p15) fms.s1 FR_1mX = f1,f1,f8 // 1 - |x|
|
|
Packit |
6c4009 |
(p13) cmp.eq.unc p8,p0 = 3,GR_Exp2Ind
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p7,p8
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p7) mov GR_Offs = 0x7 // 8 <= |x| < 16
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p8) tbit.z.unc p0,p6 = GR_Arg,51
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
(p13) cmp.lt.unc p9,p0 = 3,GR_Exp2Ind
|
|
Packit |
6c4009 |
(p8) mov GR_Offs = 0xE // 16 <= |x| < 32
|
|
Packit |
6c4009 |
// jump if x is NaTVal, NaN, +/-0 or +/-INF?
|
|
Packit |
6c4009 |
(p10) br.cond.spnt tgammaf_spec_args
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
.pred.rel "mutex",p6,p9
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p9) mov GR_Offs = 0x1C // 32 <= |x|
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_X2mX = FR_NormX,FR_NormX,FR_NormX // x^2-|x|
|
|
Packit |
6c4009 |
(p9) tbit.z.unc p0,p8 = GR_Arg,50
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_LocalMin,FR_10 = [GR_ad_Data],16
|
|
Packit |
6c4009 |
(p15) fms.s1 FR_X2mX = FR_NormX,FR_NormX,FR_NormX // x^2-|x|
|
|
Packit |
6c4009 |
(p6) add GR_Offs = 0x7,GR_Offs // 24 <= x < 32
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p8,p12
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_ad_Ce = 0x50,GR_ad_Data
|
|
Packit |
6c4009 |
(p15) fcmp.lt.unc.s1 p10,p0 = f8,f1 // p10 if 0 <= x < 1
|
|
Packit |
6c4009 |
mov GR_OvfNzBound = 2
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
ldfpd FR_S32,FR_S31 = [GR_ad_Data],16
|
|
Packit |
6c4009 |
(p8) add GR_Offs = 0x7,GR_Offs // 40 <= |x|
|
|
Packit |
6c4009 |
// jump if 1 <= x < 2
|
|
Packit |
6c4009 |
(p11) br.cond.spnt tgammaf_from_1_to_2
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
shladd GR_ad_Ce = GR_Offs,4,GR_ad_Ce
|
|
Packit |
6c4009 |
fcvt.xf FR_Xt = FR_iXt // [x]
|
|
Packit |
6c4009 |
(p13) cmp.eq.unc p7,p0 = r0,GR_Offs // p7 if 2 <= |x| < 8
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
shladd GR_ad_Co = GR_Offs,4,GR_ad_Data
|
|
Packit |
6c4009 |
fma.s1 FR_6 = FR_2,FR_2,FR_2
|
|
Packit |
6c4009 |
mov GR_ExpOf05 = 0x7FC
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p13) getf.sig GR_Sig = FR_iXt // if |x| >= 2
|
|
Packit |
6c4009 |
frcpa.s1 FR_Rcp0,p0 = f1,FR_NormX
|
|
Packit |
6c4009 |
(p10) shr GR_Arg = GR_Arg,51
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
ldfpd FR_C01,FR_C11 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
(p7) mov GR_Correction = 2
|
|
Packit |
6c4009 |
// jump if 0 < x < 1
|
|
Packit |
6c4009 |
(p10) br.cond.spnt tgammaf_from_0_to_1
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_C21,FR_C31 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
fma.s1 FR_Rq2 = f1,f1,FR_1mX // 2 - |x|
|
|
Packit |
6c4009 |
(p14) sub GR_Correction = r0,GR_Correction
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_C41,FR_C51 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
(p14) fcvt.xf FR_rs = FR_rs
|
|
Packit |
6c4009 |
(p14) add GR_ad_SinO = 0x3A0,GR_ad_Data
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_C00,FR_C10 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p14) sub GR_Sig = GR_Correction,GR_Sig
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_C20,FR_C30 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
fma.s1 FR_Rq1 = FR_1mX,FR_2,FR_X2mX // (x-1)*(x-2)
|
|
Packit |
6c4009 |
(p15) sub GR_Sig = GR_Sig,GR_Correction
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) ldfpd FR_S01,FR_S11 = [GR_ad_SinO],16
|
|
Packit |
6c4009 |
fma.s1 FR_Rq3 = FR_2,f1,FR_1mX // 3 - |x|
|
|
Packit |
6c4009 |
and GR_RqDeg = 0x6,GR_Sig
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_C40,FR_C50 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
(p14) fma.d.s0 FR_X = f0,f0,f8 // set deno flag
|
|
Packit |
6c4009 |
mov GR_NanBound = 0x30016 // -2^23
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) add GR_ad_SinE = 0x3C0,GR_ad_Data
|
|
Packit |
6c4009 |
(p15) fms.s1 FR_r = FR_NormX,f1,FR_Xt // r = x - [x]
|
|
Packit |
6c4009 |
cmp.eq p8,p0 = 2,GR_RqDeg
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_An,FR_OvfBound = [GR_ad_Co]
|
|
Packit |
6c4009 |
(p14) fms.s1 FR_r = FR_Xt,f1,FR_NormX // r = |x - [x]|
|
|
Packit |
6c4009 |
cmp.eq p9,p0 = 4,GR_RqDeg
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p8,p9
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) ldfpd FR_S21,FR_S00 = [GR_ad_SinE],16
|
|
Packit |
6c4009 |
(p8) fma.s1 FR_Rq0 = FR_2,f1,FR_1mX // (3-x)
|
|
Packit |
6c4009 |
tbit.z p0,p6 = GR_Sig,0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) ldfpd FR_S10,FR_S20 = [GR_ad_SinO],16
|
|
Packit |
6c4009 |
(p9) fma.s1 FR_Rq0 = FR_2,FR_2,FR_1mX // (5-x)
|
|
Packit |
6c4009 |
cmp.eq p10,p0 = 6,GR_RqDeg
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) getf.s GR_Arg = f8
|
|
Packit |
6c4009 |
(p14) fcmp.eq.unc.s1 p13,p0 = FR_NormX,FR_Xt
|
|
Packit |
6c4009 |
(p14) mov GR_ZeroResBound = 0xC22C // -43
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) ldfe FR_InvAn = [GR_ad_SinE]
|
|
Packit |
6c4009 |
(p10) fma.s1 FR_Rq0 = FR_6,f1,FR_1mX // (7-x)
|
|
Packit |
6c4009 |
cmp.eq p7,p0 = r0,GR_RqDeg
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) cmp.ge.unc p11,p0 = GR_SignExp,GR_NanBound
|
|
Packit |
6c4009 |
fma.s1 FR_Rq2 = FR_Rq2,FR_6,FR_X2mX // (x-3)*(x-4)
|
|
Packit |
6c4009 |
(p14) shl GR_ZeroResBound = GR_ZeroResBound,16
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
(p14) mov GR_OvfNzBound = 0x802
|
|
Packit |
6c4009 |
(p14) fms.s1 FR_rs = FR_rs,f1,FR_NormX // rs = round(x) - x
|
|
Packit |
6c4009 |
// jump if x < -2^23 i.e. x is negative integer
|
|
Packit |
6c4009 |
(p11) br.cond.spnt tgammaf_singularity
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p7) fma.s1 FR_Rq1 = f0,f0,f1
|
|
Packit |
6c4009 |
(p14) shl GR_OvfNzBound = GR_OvfNzBound,20
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_Rq3 = FR_Rq3,FR_10,FR_X2mX // (x-5)*(x-6)
|
|
Packit |
6c4009 |
// jump if x is negative integer such that -2^23 < x < 0
|
|
Packit |
6c4009 |
(p13) br.cond.spnt tgammaf_singularity
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C01 = FR_C01,f1,FR_r
|
|
Packit |
6c4009 |
(p14) mov GR_ExpOf05 = 0xFFFE
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) cmp.eq.unc p7,p0 = GR_Arg,GR_OvfNzBound
|
|
Packit |
6c4009 |
fma.s1 FR_C11 = FR_C11,f1,FR_r
|
|
Packit |
6c4009 |
(p14) cmp.ltu.unc p11,p0 = GR_Arg,GR_OvfNzBound
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C21 = FR_C21,f1,FR_r
|
|
Packit |
6c4009 |
(p14) cmp.ltu.unc p9,p0 = GR_ZeroResBound,GR_Arg
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C31 = FR_C31,f1,FR_r
|
|
Packit |
6c4009 |
// jump if argument is close to 0 negative
|
|
Packit |
6c4009 |
(p11) br.cond.spnt tgammaf_overflow
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C41 = FR_C41,f1,FR_r
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C51 = FR_C51,f1,FR_r
|
|
Packit |
6c4009 |
// jump if x is negative noninteger such that -2^23 < x < -43
|
|
Packit |
6c4009 |
(p9) br.cond.spnt tgammaf_underflow
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_rs2 = FR_rs,FR_rs,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S01 = FR_rs,FR_rs,FR_S01
|
|
Packit |
6c4009 |
// jump if argument is 0x80200000
|
|
Packit |
6c4009 |
(p7) br.cond.spnt tgammaf_overflow_near0_bound
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p6) fnma.s1 FR_Rq1 = FR_Rq1,FR_Rq0,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p10) fma.s1 FR_Rq2 = FR_Rq2,FR_Rq3,f0
|
|
Packit |
6c4009 |
and GR_Sig = 0x7,GR_Sig
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C01 = FR_C01,FR_r,FR_C00
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C11 = FR_C11,FR_r,FR_C10
|
|
Packit |
6c4009 |
cmp.eq p6,p7 = r0,GR_Sig // p6 if |x| from one of base intervals
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C21 = FR_C21,FR_r,FR_C20
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C31 = FR_C31,FR_r,FR_C30
|
|
Packit |
6c4009 |
(p7) cmp.lt.unc p9,p0 = 2,GR_RqDeg
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S11 = FR_rs,FR_rs,FR_S11
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S21 = FR_rs,FR_rs,FR_S21
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C41 = FR_C41,FR_r,FR_C40
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S32 = FR_rs2,FR_S32,FR_S31
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p9) fma.s1 FR_Rq1 = FR_Rq1,FR_Rq2,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C51 = FR_C51,FR_r,FR_C50
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) getf.exp GR_SignExp = FR_rs
|
|
Packit |
6c4009 |
fma.s1 FR_C01 = FR_C01,FR_C11,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S01 = FR_S01,FR_rs2,FR_S00
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C21 = FR_C21,FR_C31,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
(p14) fnma.s1 FR_InvNormX1 = FR_Rcp0,FR_NormX,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S11 = FR_S11,FR_rs2,FR_S10
|
|
Packit |
6c4009 |
(p14) tbit.z.unc p11,p12 = GR_SignExp,17
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S21 = FR_S21,FR_rs2,FR_S20
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p15) fcmp.lt.unc.s1 p0,p13 = FR_NormX,FR_OvfBound
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S32 = FR_rs2,FR_S32,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C41 = FR_C41,FR_C51,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p7) fma.s1 FR_An = FR_Rq1,FR_An,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
// jump if x > 35.04010009765625
|
|
Packit |
6c4009 |
(p13) br.cond.spnt tgammaf_overflow
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_InvNormX1 = FR_Rcp0,FR_InvNormX1,FR_Rcp0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S01 = FR_S01,FR_S11,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_S21 = FR_S21,FR_S32,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p14) getf.exp GR_SignExp = FR_NormX
|
|
Packit |
6c4009 |
fma.s1 FR_C01 = FR_C01,FR_C21,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_C41 = FR_C41,FR_An,f0
|
|
Packit |
6c4009 |
(p14) mov GR_ExpOf1 = 0x2FFFF
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
(p14) fnma.s1 FR_InvNormX2 = FR_InvNormX1,FR_NormX,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p11,p12
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p12) fnma.s1 FR_S01 = FR_S01,FR_S21,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p11) fma.s1 FR_S01 = FR_S01,FR_S21,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fma.s1 FR_GAMMA = FR_C01,FR_C41,f0
|
|
Packit |
6c4009 |
(p14) tbit.z.unc p6,p7 = GR_Sig,0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p15) fma.s.s0 f8 = FR_C01,FR_C41,f0
|
|
Packit |
6c4009 |
(p15) br.ret.spnt b0 // exit for positives
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p11,p12
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p12) fms.s1 FR_S01 = FR_rs,FR_S01,FR_rs
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p11) fma.s1 FR_S01 = FR_rs,FR_S01,FR_rs
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fma.s1 FR_InvNormX2 = FR_InvNormX1,FR_InvNormX2,FR_InvNormX1
|
|
Packit |
6c4009 |
cmp.eq p10,p0 = 0x23,GR_Offs
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p6,p7
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p6) fma.s1 FR_GAMMA = FR_S01,FR_GAMMA,f0
|
|
Packit |
6c4009 |
cmp.gtu p8,p0 = GR_SignExp,GR_ExpOf1
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p7) fnma.s1 FR_GAMMA = FR_S01,FR_GAMMA,f0
|
|
Packit |
6c4009 |
cmp.eq p9,p0 = GR_SignExp,GR_ExpOf1
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fnma.s1 FR_InvNormX1 = FR_InvNormX2,FR_NormX,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p10) fma.s1 FR_InvNormX2 = FR_InvNormX2,FR_InvAn,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
frcpa.s1 FR_Rcp0,p0 = f1,FR_GAMMA
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fms.s1 FR_Multplr = FR_NormX,f1,f1 // x - 1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fnma.s1 FR_Rcp1 = FR_Rcp0,FR_GAMMA,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p8,p9
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// 1/x or 1/(An*x)
|
|
Packit |
6c4009 |
(p8) fma.s1 FR_Multplr = FR_InvNormX2,FR_InvNormX1,FR_InvNormX2
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p9) fma.s1 FR_Multplr = f1,f1,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fma.s1 FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fnma.s1 FR_Rcp2 = FR_Rcp1,FR_GAMMA,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fma.s1 FR_Rcp1 = FR_Rcp1,FR_Multplr,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s.s0 f8 = FR_Rcp1,FR_Rcp2,FR_Rcp1
|
|
Packit |
6c4009 |
br.ret.sptk b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// here if 0 < x < 1
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_from_0_to_1:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
cmp.lt p7,p0 = GR_Arg,GR_ExpOf05
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fnma.s1 FR_Rcp1 = FR_Rcp0,FR_NormX,f1
|
|
Packit |
6c4009 |
cmp.eq p8,p0 = GR_Arg,GR_ExpOf05
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
cmp.gt p9,p0 = GR_Arg,GR_ExpOf05
|
|
Packit |
6c4009 |
fma.s1 FR_r = f0,f0,FR_NormX // reduced arg for (0;1)
|
|
Packit |
6c4009 |
mov GR_ExpOf025 = 0x7FA
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
getf.s GR_ArgNz = f8
|
|
Packit |
6c4009 |
fma.d.s0 FR_X = f0,f0,f8 // set deno flag
|
|
Packit |
6c4009 |
shl GR_OvfNzBound = GR_OvfNzBound,20
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p8) mov GR_Tbl12Offs = 0x80 // 0.5 <= x < 0.75
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p7) cmp.ge.unc p6,p0 = GR_Arg,GR_ExpOf025
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p6,p9
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p9) mov GR_Tbl12Offs = 0xC0 // 0.75 <= x < 1
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p6) mov GR_Tbl12Offs = 0x40 // 0.25 <= x < 0.5
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_ad_Ce = 0x2C0,GR_ad_Data
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
add GR_ad_Co = 0x2A0,GR_ad_Data
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_ad_Co = GR_ad_Co,GR_Tbl12Offs
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
cmp.lt p12,p0 = GR_ArgNz,GR_OvfNzBound
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
add GR_ad_Ce = GR_ad_Ce,GR_Tbl12Offs
|
|
Packit |
6c4009 |
cmp.eq p7,p0 = GR_ArgNz,GR_OvfNzBound
|
|
Packit |
6c4009 |
// jump if argument is 0x00200000
|
|
Packit |
6c4009 |
(p7) br.cond.spnt tgammaf_overflow_near0_bound
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmb
|
|
Packit |
6c4009 |
ldfpd FR_A7,FR_A6 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
ldfpd FR_A5,FR_A4 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
// jump if argument is close to 0 positive
|
|
Packit |
6c4009 |
(p12) br.cond.spnt tgammaf_overflow
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
ldfpd FR_A3,FR_A2 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
fma.s1 FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
ldfpd FR_A1,FR_A0 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
br.cond.sptk tgamma_from_0_to_2
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// here if 1 < x < 2
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_from_1_to_2:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_ad_Co = 0x2A0,GR_ad_Data
|
|
Packit |
6c4009 |
fms.s1 FR_r = f0,f0,FR_1mX
|
|
Packit |
6c4009 |
shr GR_TblOffs = GR_Arg,47
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_ad_Ce = 0x2C0,GR_ad_Data
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
mov GR_TblOffsMask = 0x18
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
and GR_TblOffs = GR_TblOffs,GR_TblOffsMask
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
shladd GR_ad_Co = GR_TblOffs,3,GR_ad_Co
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
shladd GR_ad_Ce = GR_TblOffs,3,GR_ad_Ce
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
cmp.eq p6,p7 = 8,GR_TblOffs
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmi
|
|
Packit |
6c4009 |
ldfpd FR_A7,FR_A6 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
ldfpd FR_A5,FR_A4 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmi
|
|
Packit |
6c4009 |
ldfpd FR_A3,FR_A2 = [GR_ad_Co],16
|
|
Packit |
6c4009 |
ldfpd FR_A1,FR_A0 = [GR_ad_Ce],16
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgamma_from_0_to_2:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p6) fms.s1 FR_r = FR_r,f1,FR_LocalMin
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
(p10) fnma.s1 FR_Rcp2 = FR_Rcp1,FR_NormX,f1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fms.s1 FR_r2 = FR_r,FR_r,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A7 = FR_A7,FR_r,FR_A6
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A5 = FR_A5,FR_r,FR_A4
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A3 = FR_A3,FR_r,FR_A2
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A1 = FR_A1,FR_r,FR_A0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
// NR-iteration
|
|
Packit |
6c4009 |
(p10) fma.s1 FR_Rcp2 = FR_Rcp1,FR_Rcp2,FR_Rcp1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A7 = FR_A7,FR_r2,FR_A5
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_r4 = FR_r2,FR_r2,f0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fma.s1 FR_A3 = FR_A3,FR_r2,FR_A1
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p10) fma.s1 FR_GAMMA = FR_A7,FR_r4,FR_A3
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p11) fma.s.s0 f8 = FR_A7,FR_r4,FR_A3
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p10) fma.s.s0 f8 = FR_GAMMA,FR_Rcp2,f0
|
|
Packit |
6c4009 |
br.ret.sptk b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// overflow
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_overflow_near0_bound:
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
mov GR_fpsr = ar.fpsr
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p15) mov r8 = 0x7f8
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
(p14) mov r8 = 0xff8
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
shl r8 = r8,20
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
sub r8 = r8,r0,1
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
extr.u GR_fpsr = GR_fpsr,10,2 // rounding mode
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
// set p8 to 0 in case of overflow and to 1 otherwise
|
|
Packit |
6c4009 |
// for negative arg:
|
|
Packit |
6c4009 |
// no overflow if rounding mode either Z or +Inf, i.e.
|
|
Packit |
6c4009 |
// GR_fpsr > 1
|
|
Packit |
6c4009 |
(p14) cmp.lt p8,p0 = 1,GR_fpsr
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
// for positive arg:
|
|
Packit |
6c4009 |
// no overflow if rounding mode either Z or -Inf, i.e.
|
|
Packit |
6c4009 |
// (GR_fpsr & 1) == 0
|
|
Packit |
6c4009 |
(p15) tbit.z p0,p8 = GR_fpsr,0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
(p8) setf.s f8 = r8 // set result to 0x7f7fffff without
|
|
Packit |
6c4009 |
// OVERFLOW flag raising
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
(p8) br.ret.sptk b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_overflow:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
mov r8 = 0x1FFFE
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
setf.exp f9 = r8
|
|
Packit |
6c4009 |
fmerge.s FR_X = f8,f8
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p14,p15
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p14) fnma.s.s0 f8 = f9,f9,f0 // set I,O and -INF result
|
|
Packit |
6c4009 |
mov GR_TAG = 261 // overflow
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p15) fma.s.s0 f8 = f9,f9,f0 // set I,O and +INF result
|
|
Packit |
6c4009 |
br.cond.sptk tgammaf_libm_err
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// x is negative integer or +/-0
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_singularity:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fmerge.s FR_X = f8,f8
|
|
Packit |
6c4009 |
mov GR_TAG = 262 // negative
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
frcpa.s0 f8,p0 = f0,f0
|
|
Packit |
6c4009 |
br.cond.sptk tgammaf_libm_err
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
// x is negative noninteger with big absolute value
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_underflow:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
mov r8 = 0x00001
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
tbit.z p6,p7 = GR_Sig,0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
setf.exp f9 = r8
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p6,p7
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p6) fms.s.s0 f8 = f9,f9,f9
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p7) fma.s.s0 f8 = f9,f9,f9
|
|
Packit |
6c4009 |
br.ret.sptk b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// x for natval, nan, +/-inf or +/-0
|
|
Packit |
6c4009 |
//--------------------------------------------------------------------
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_spec_args:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fclass.m p6,p0 = f8,0x1E1 // Test x for natval, nan, +inf
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fclass.m p7,p8 = f8,0x7 // +/-0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
fmerge.s FR_X = f8,f8
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfb
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
(p6) fma.s.s0 f8 = f8,f1,f8
|
|
Packit |
6c4009 |
(p6) br.ret.spnt b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.pred.rel "mutex",p7,p8
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
(p7) mov GR_TAG = 262 // negative
|
|
Packit |
6c4009 |
(p7) frcpa.s0 f8,p0 = f1,f8
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.i 0
|
|
Packit |
6c4009 |
(p8) br.cond.spnt tgammaf_singularity
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
tgammaf_libm_err:
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
alloc r32 = ar.pfs,1,4,4,0
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
mov GR_Parameter_TAG = GR_TAG
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GLOBAL_LIBM_END(tgammaf)
|
|
Packit |
6c4009 |
libm_alias_float_other (tgamma, tgamma)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOCAL_LIBM_ENTRY(__libm_error_region)
|
|
Packit |
6c4009 |
.prologue
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
add GR_Parameter_Y=-32,sp // Parameter 2 value
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
.save ar.pfs,GR_SAVE_PFS
|
|
Packit |
6c4009 |
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mfi
|
|
Packit |
6c4009 |
.fframe 64
|
|
Packit |
6c4009 |
add sp=-64,sp // Create new stack
|
|
Packit |
6c4009 |
nop.f 0
|
|
Packit |
6c4009 |
mov GR_SAVE_GP=gp // Save gp
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmi
|
|
Packit |
6c4009 |
stfs [GR_Parameter_Y] = FR_Y,16 // STORE Parameter 2 on stack
|
|
Packit |
6c4009 |
add GR_Parameter_X = 16,sp // Parameter 1 address
|
|
Packit |
6c4009 |
.save b0, GR_SAVE_B0
|
|
Packit |
6c4009 |
mov GR_SAVE_B0=b0 // Save b0
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
.body
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
stfs [GR_Parameter_X] = FR_X // STORE Parameter 1 on stack
|
|
Packit |
6c4009 |
add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
|
|
Packit |
6c4009 |
nop.b 0
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
stfs [GR_Parameter_Y] = FR_RESULT // STORE Parameter 3 on stack
|
|
Packit |
6c4009 |
add GR_Parameter_Y = -16,GR_Parameter_Y
|
|
Packit |
6c4009 |
br.call.sptk b0=__libm_error_support# // Call error handling function
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmi
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
nop.m 0
|
|
Packit |
6c4009 |
add GR_Parameter_RESULT = 48,sp
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mmi
|
|
Packit |
6c4009 |
ldfs f8 = [GR_Parameter_RESULT] // Get return result off stack
|
|
Packit |
6c4009 |
.restore sp
|
|
Packit |
6c4009 |
add sp = 64,sp // Restore stack pointer
|
|
Packit |
6c4009 |
mov b0 = GR_SAVE_B0 // Restore return address
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
{ .mib
|
|
Packit |
6c4009 |
mov gp = GR_SAVE_GP // Restore gp
|
|
Packit |
6c4009 |
mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
|
|
Packit |
6c4009 |
br.ret.sptk b0 // Return
|
|
Packit |
6c4009 |
};;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOCAL_LIBM_END(__libm_error_region)
|
|
Packit |
6c4009 |
.type __libm_error_support#,@function
|
|
Packit |
6c4009 |
.global __libm_error_support#
|