?? e_acosf.s
字號:
.file "acosf.s"// Copyright (c) 2000 - 2003, Intel Corporation// All rights reserved.//// Contributed 2000 by the Intel Numerics Group, Intel Corporation//// Redistribution and use in source and binary forms, with or without// modification, are permitted provided that the following conditions are// met://// * Redistributions of source code must retain the above copyright// notice, this list of conditions and the following disclaimer.//// * Redistributions in binary form must reproduce the above copyright// notice, this list of conditions and the following disclaimer in the// documentation and/or other materials provided with the distribution.//// * The name of Intel Corporation may not be used to endorse or promote// products derived from this software without specific prior written// permission.// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.//// Intel Corporation is the author of this code, and requests that all// problem reports or change requests be submitted to it directly at// http://www.intel.com/software/products/opensource/libraries/num.htm.// History//==============================================================// 02/02/00 Initial version// 06/28/00 Improved speed// 06/31/00 Changed register allocation because of some duplicate macros// moved nan exit bundle up to gain a cycle.// 08/15/00 Bundle added after call to __libm_error_support to properly// set [the previously overwritten] GR_Parameter_RESULT.// 08/17/00 Changed predicate register macro-usage to direct predicate// names due to an assembler bug.// 10/17/00 Improved speed of x=0 and x=1 paths, set D flag if x denormal.// 03/13/01 Corrected sign of imm1 value in dep instruction.// 05/20/02 Cleaned up namespace and sf0 syntax// 02/06/03 Reordered header: .section, .global, .proc, .align// 04/17/03 Moved mutex after label// Description//=========================================// The acosf function computes the principle value of the arc sine of x.// A doman error occurs for arguments not in the range [-1,+1].// The acosf function returns the arc cosine in the range [0, +pi] radians.// acos(1) returns +0// acos(x) returns a Nan and raises the invalid exception for |x| >1 // |x| <= sqrt(2)/2. get Ax and Bx// poly_p1 = x p1// poly_p3 = x2 p4 + p3// poly_p1 = x2 (poly_p1) + x = x2(x p1) + x// poly_p2 = x2( poly_p3) + p2 = x2(x2 p4 + p3) + p2// poly_Ax = x5(x2( poly_p3) + p2) + x2(x p1) + x// = x5(x2(x2 p4 + p3) + p2) + x2(x p1) + x// poly_p7 = x2 p8 + p7// poly_p5 = x2 p6 + p5// poly_p7 = x4 p9 + (x2 p8 + p7)// poly_Bx = x4 (x4 p9 + (x2 p8 + p7)) + x2 p6 + p5// sinf1 = x11(x4 (x4 p9 + (x2 p8 + p7)) + x2 p6 + p5) + x5(x2(x2 p4 + p3) + p2) + x2(x p1) + x// = x19 p9 + x17 p8 + x15 p7 x13 p6 + x11 p5 + x9 p4 + x7 p3 + x5 p2 + x3 p1 + x// answer1 = pi/2 - sinf1// |x| > sqrt(2)/2// Get z = sqrt(1-x2)// Get polynomial in t = 1-x2// t2 = t t// t4 = t2 t2// poly_p4 = t p5 + p4// poly_p1 = t p1 + 1// poly_p6 = t p7 + p6// poly_p2 = t p3 + p2// poly_p8 = t p9 + p8// poly_p4 = t2 poly_p6 + poly_p4// = t2 (t p7 + p6) + (t p5 + p4)// poly_p2 = t2 poly_p2 + poly_p1// = t2 (t p3 + p2) + (t p1 + 1)// poly_p4 = t4 poly_p8 + poly_p4// = t4 (t p9 + p8) + (t2 (t p7 + p6) + (t p5 + p4))// P(t) = poly_p2 + t4 poly_p8// = t2 (t p3 + p2) + (t p1 + 1) + t4 (t4 (t p9 + p8) + (t2 (t p7 + p6) + (t p5 + p4)))// = t3 p3 + t2 p2 + t p1 + 1 + t9 p9 + t8 p8 + t7 p7 + t6 p6 + t5 p5 + t4 p4// answer2 = sign(x) z P(t) if x>0// = sign(x) z P(t) + pi if x<0//// Assembly macros//=========================================// predicate registers//acosf_pred_LEsqrt2by2 = p7//acosf_pred_GTsqrt2by2 = p8// integer registersACOSF_Addr1 = r33ACOSF_Addr2 = r34ACOSF_GR_1by2 = r35ACOSF_GR_3by2 = r36ACOSF_GR_5by2 = r37GR_SAVE_B0 = r38GR_SAVE_PFS = r39GR_SAVE_GP = r40GR_Parameter_X = r41GR_Parameter_Y = r42GR_Parameter_RESULT = r43GR_Parameter_TAG = r44// floating point registersacosf_y = f32acosf_abs_x = f33acosf_x2 = f34acosf_sgn_x = f35acosf_1by2 = f36acosf_3by2 = f37acosf_5by2 = f38acosf_coeff_P3 = f39acosf_coeff_P8 = f40acosf_coeff_P1 = f41acosf_coeff_P4 = f42acosf_coeff_P5 = f43acosf_coeff_P2 = f44acosf_coeff_P7 = f45acosf_coeff_P6 = f46acosf_coeff_P9 = f47acosf_x2 = f48acosf_x3 = f49acosf_x4 = f50acosf_x8 = f51acosf_x5 = f52acosf_const_piby2 = f53acosf_const_sqrt2by2 = f54acosf_x11 = f55acosf_poly_p1 = f56acosf_poly_p3 = f57acosf_sinf1 = f58acosf_poly_p2 = f59acosf_poly_Ax = f60acosf_poly_p7 = f61acosf_poly_p5 = f62acosf_sgnx_t4 = f63acosf_poly_Bx = f64acosf_t = f65acosf_yby2 = f66acosf_B = f67acosf_B2 = f68acosf_Az = f69acosf_dz = f70acosf_Sz = f71acosf_d2z = f72acosf_Fz = f73acosf_z = f74acosf_sgnx_z = f75acosf_t2 = f76acosf_2poly_p4 = f77acosf_2poly_p6 = f78acosf_2poly_p1 = f79acosf_2poly_p2 = f80acosf_2poly_p8 = f81acosf_t4 = f82acosf_Pt = f83acosf_sgnx_2poly_p2 = f84acosf_sgn_x_piby2 = f85acosf_poly_p7a = f86acosf_2poly_p4a = f87acosf_2poly_p4b = f88acosf_2poly_p2a = f89acosf_poly_p1a = f90// Data tables//==============================================================RODATA.align 16LOCAL_OBJECT_START(acosf_coeff_1_table)data8 0x3FC5555607DCF816 // P1data8 0x3F9CF81AD9BAB2C6 // P4data8 0x3FC59E0975074DF3 // P7data8 0xBFA6F4CC2780AA1D // P6data8 0x3FC2DD45292E93CB // P9data8 0x3fe6a09e667f3bcd // sqrt(2)/2LOCAL_OBJECT_END(acosf_coeff_1_table)LOCAL_OBJECT_START(acosf_coeff_2_table)data8 0x3FA6F108E31EFBA6 // P3data8 0xBFCA31BF175D82A0 // P8data8 0x3FA30C0337F6418B // P5data8 0x3FB332C9266CB1F9 // P2data8 0x3ff921fb54442d18 // pi_by_2LOCAL_OBJECT_END(acosf_coeff_2_table).section .textGLOBAL_LIBM_ENTRY(acosf) // Load the addresses of the two tables.// Then, load the coefficients and other constants.{ .mfi alloc r32 = ar.pfs,1,8,4,0 fnma.s1 acosf_t = f8,f8,f1 dep.z ACOSF_GR_1by2 = 0x3f,24,8 // 0x3f000000} { .mfi addl ACOSF_Addr1 = @ltoff(acosf_coeff_1_table),gp fma.s1 acosf_x2 = f8,f8,f0 addl ACOSF_Addr2 = @ltoff(acosf_coeff_2_table),gp ;;} { .mfi ld8 ACOSF_Addr1 = [ACOSF_Addr1] fmerge.s acosf_abs_x = f1,f8 dep ACOSF_GR_3by2 = -1,r0,22,8 // 0x3fc00000} { .mlx nop.m 999 movl ACOSF_GR_5by2 = 0x40200000;;} { .mfi setf.s acosf_1by2 = ACOSF_GR_1by2 fmerge.s acosf_sgn_x = f8,f1 nop.i 999} { .mfi ld8 ACOSF_Addr2 = [ACOSF_Addr2] nop.f 0 nop.i 999;;} { .mfi setf.s acosf_5by2 = ACOSF_GR_5by2 fcmp.lt.s1 p11,p12 = f8,f0 nop.i 999;;}{ .mmf ldfpd acosf_coeff_P1,acosf_coeff_P4 = [ACOSF_Addr1],16 setf.s acosf_3by2 = ACOSF_GR_3by2 fclass.m.unc p8,p0 = f8, 0xc3 ;; //@qnan | @snan} { .mfi ldfpd acosf_coeff_P7,acosf_coeff_P6 = [ACOSF_Addr1],16 fma.s1 acosf_t2 = acosf_t,acosf_t,f0 nop.i 999} { .mfi ldfpd acosf_coeff_P3,acosf_coeff_P8 = [ACOSF_Addr2],16 fma.s1 acosf_x4 = acosf_x2,acosf_x2,f0 nop.i 999;;} { .mfi ldfpd acosf_coeff_P9,acosf_const_sqrt2by2 = [ACOSF_Addr1] fclass.m.unc p10,p0 = f8, 0x07 //@zero nop.i 999} { .mfi ldfpd acosf_coeff_P5,acosf_coeff_P2 = [ACOSF_Addr2],16 fma.s1 acosf_x3 = f8,acosf_x2,f0 nop.i 999;;} { .mfi ldfd acosf_const_piby2 = [ACOSF_Addr2] frsqrta.s1 acosf_B,p0 = acosf_t nop.i 999} { .mfb nop.m 999(p8) fma.s.s0 f8 = f8,f1,f0(p8) br.ret.spnt b0 ;; // Exit if x=nan} { .mfb nop.m 999 fcmp.eq.s1 p6,p0 = acosf_abs_x,f1(p10) br.cond.spnt ACOSF_ZERO ;; // Branch if x=0} { .mfi nop.m 999
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -