📄 e_asinf.s
字号:
.file "asinf.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/08/00 Improved speed by avoiding SIR flush.// 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 // Description//=========================================// The asinf function computes the arc sine of x in the range [-pi,+pi].// A doman error occurs for arguments not in the range [-1,+1].// asinf(+-0) returns +-0// asinf(x) returns a Nan and raises the invalid exception for |x| >1 // The acosf function returns the arc cosine in the range [0, +pi] radians.// A doman error occurs for arguments not in the range [-1,+1].// acosf(1) returns +0// acosf(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 + (poly_p7)// poly_p7 = x4 p9 + (x2 p8 + p7)// poly_Bx = x4 (x4 p9 + (x2 p8 + p7)) + x2 p6 + p5// answer1 = 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// |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) + (sign(x) pi/2)//// Assembly macros//=========================================// predicate registers//asinf_pred_LEsqrt2by2 = p7//asinf_pred_GTsqrt2by2 = p8// integer registersASINF_Addr1 = r33ASINF_Addr2 = r34ASINF_GR_1by2 = r35ASINF_GR_3by2 = r36ASINF_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 registersasinf_y = f32asinf_abs_x = f33asinf_x2 = f34asinf_sgn_x = f35asinf_1by2 = f36asinf_3by2 = f37asinf_5by2 = f38asinf_coeff_P3 = f39asinf_coeff_P8 = f40asinf_coeff_P1 = f41asinf_coeff_P4 = f42asinf_coeff_P5 = f43asinf_coeff_P2 = f44asinf_coeff_P7 = f45asinf_coeff_P6 = f46asinf_coeff_P9 = f47asinf_x2 = f48asinf_x3 = f49asinf_x4 = f50asinf_x8 = f51asinf_x5 = f52asinf_const_piby2 = f53asinf_const_sqrt2by2 = f54asinf_x11 = f55asinf_poly_p1 = f56asinf_poly_p3 = f57asinf_sinf1 = f58asinf_poly_p2 = f59asinf_poly_Ax = f60asinf_poly_p7 = f61asinf_poly_p5 = f62asinf_sgnx_t4 = f63asinf_poly_Bx = f64asinf_t = f65asinf_yby2 = f66asinf_B = f67asinf_B2 = f68asinf_Az = f69asinf_dz = f70asinf_Sz = f71asinf_d2z = f72asinf_Fz = f73asinf_z = f74asinf_sgnx_z = f75asinf_t2 = f76asinf_2poly_p4 = f77asinf_2poly_p6 = f78asinf_2poly_p1 = f79asinf_2poly_p2 = f80asinf_2poly_p8 = f81asinf_t4 = f82asinf_Pt = f83asinf_sgnx_2poly_p2 = f84asinf_sgn_x_piby2 = f85asinf_poly_p7a = f86asinf_2poly_p4a = f87asinf_2poly_p4b = f88asinf_2poly_p2a = f89asinf_poly_p1a = f90// Data tables//==============================================================RODATA.align 16LOCAL_OBJECT_START(asinf_coeff_1_table)data8 0x3FC5555607DCF816 // P1data8 0x3F9CF81AD9BAB2C6 // P4data8 0x3FC59E0975074DF3 // P7data8 0xBFA6F4CC2780AA1D // P6data8 0x3FC2DD45292E93CB // P9data8 0x3fe6a09e667f3bcd // sqrt(2)/2LOCAL_OBJECT_END(asinf_coeff_1_table)LOCAL_OBJECT_START(asinf_coeff_2_table)data8 0x3FA6F108E31EFBA6 // P3data8 0xBFCA31BF175D82A0 // P8data8 0x3FA30C0337F6418B // P5data8 0x3FB332C9266CB1F9 // P2data8 0x3ff921fb54442d18 // pi_by_2LOCAL_OBJECT_END(asinf_coeff_2_table).section .textGLOBAL_LIBM_ENTRY(asinf) // 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 asinf_t = f8,f8,f1 dep.z ASINF_GR_1by2 = 0x3f,24,8 // 0x3f000000} { .mfi addl ASINF_Addr1 = @ltoff(asinf_coeff_1_table),gp fma.s1 asinf_x2 = f8,f8,f0 addl ASINF_Addr2 = @ltoff(asinf_coeff_2_table),gp ;;} { .mfi ld8 ASINF_Addr1 = [ASINF_Addr1] fmerge.s asinf_abs_x = f1,f8 dep ASINF_GR_3by2 = -1,r0,22,8 // 0x3fc00000} { .mlx nop.m 999 movl ASINF_GR_5by2 = 0x40200000;;} { .mfi setf.s asinf_1by2 = ASINF_GR_1by2 fmerge.s asinf_sgn_x = f8,f1 nop.i 999} { .mfi ld8 ASINF_Addr2 = [ASINF_Addr2] nop.f 0 nop.i 999;;} { .mfi setf.s asinf_5by2 = ASINF_GR_5by2 fcmp.lt.s1 p11,p12 = f8,f0 nop.i 999;;}{ .mmf ldfpd asinf_coeff_P1,asinf_coeff_P4 = [ASINF_Addr1],16 setf.s asinf_3by2 = ASINF_GR_3by2 fclass.m.unc p8,p0 = f8, 0xc3 ;; //@qnan | @snan} { .mfi ldfpd asinf_coeff_P7,asinf_coeff_P6 = [ASINF_Addr1],16 fma.s1 asinf_t2 = asinf_t,asinf_t,f0 nop.i 999} { .mfi ldfpd asinf_coeff_P3,asinf_coeff_P8 = [ASINF_Addr2],16 fma.s1 asinf_x4 = asinf_x2,asinf_x2,f0 nop.i 999;;} { .mfi ldfpd asinf_coeff_P9,asinf_const_sqrt2by2 = [ASINF_Addr1] fclass.m.unc p10,p0 = f8, 0x07 //@zero nop.i 999} { .mfi ldfpd asinf_coeff_P5,asinf_coeff_P2 = [ASINF_Addr2],16 fma.s1 asinf_x3 = f8,asinf_x2,f0 nop.i 999;;} { .mfi ldfd asinf_const_piby2 = [ASINF_Addr2] frsqrta.s1 asinf_B,p0 = asinf_t nop.i 999} { .mfb nop.m 999
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -