e_acos.s
来自「Glibc 2.3.2源代码(解压后有100多M)」· S 代码 · 共 920 行 · 第 1/2 页
S
920 行
.file "acos.s"// Copyright (C) 2000, 2001, Intel Corporation// All rights reserved.//// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,// and Ping Tak Peter Tang of the Computational Software Lab, 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.//// WARRANTY DISCLAIMER//// 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://developer.intel.com/opensource.// History//==============================================================// 2/02/00 Initial version // 8/17/00 New and much faster algorithm.// 8/30/00 Avoided bank conflicts on loads, shortened |x|=1 and x=0 paths,// fixed mfb split issue stalls.// Description//=========================================// The acos function computes the principle value of the arc sine of x.// A doman error occurs for arguments not in the range [-1,+1].// The acos function returns the arc cosine in the range [0, +pi] radians.// acos(1) returns +0, acos(-1) returns pi, acos(0) returns pi/2.// acos(x) returns a Nan and raises the invalid exception for |x| >1// The acos function is just like asin except that pi/2 is added at the end.//// Assembly macros//=========================================#include "libm_support.h"// predicate registers//acos_pred_LEsqrt2by2 = p7//acos_pred_GTsqrt2by2 = p8// integer registersASIN_Addr1 = r33ASIN_Addr2 = r34ASIN_FFFE = r35GR_SAVE_B0 = r36GR_SAVE_PFS = r37GR_SAVE_GP = r38GR_Parameter_X = r39GR_Parameter_Y = r40GR_Parameter_RESULT = r41GR_Parameter_Tag = r42// floating point registersacos_coeff_P1 = f32acos_coeff_P2 = f33acos_coeff_P3 = f34acos_coeff_P4 = f35acos_coeff_P5 = f36acos_coeff_P6 = f37acos_coeff_P7 = f38acos_coeff_P8 = f39acos_coeff_P9 = f40acos_coeff_P10 = f41acos_coeff_P11 = f42acos_coeff_P12 = f43acos_coeff_P13 = f44acos_coeff_P14 = f45acos_coeff_P15 = f46acos_coeff_P16 = f47acos_coeff_P17 = f48acos_coeff_P18 = f49acos_coeff_P19 = f50acos_coeff_P20 = f51acos_coeff_P21 = f52acos_const_sqrt2by2 = f53acos_const_piby2 = f54acos_abs_x = f55acos_tx = f56acos_tx2 = f57acos_tx3 = f58acos_tx4 = f59acos_tx8 = f60acos_tx11 = f61acos_1poly_p8 = f62acos_1poly_p19 = f63acos_1poly_p4 = f64acos_1poly_p15 = f65acos_1poly_p6 = f66acos_1poly_p17 = f67acos_1poly_p0 = f68acos_1poly_p11 = f69acos_1poly_p2 = f70acos_1poly_p13 = f71acos_series_tx = f72acos_t = f73acos_t2 = f74acos_t3 = f75acos_t4 = f76acos_t8 = f77acos_t11 = f78acos_poly_p8 = f79acos_poly_p19 = f80acos_poly_p4 = f81acos_poly_p15 = f82acos_poly_p6 = f83acos_poly_p17 = f84acos_poly_p0 = f85acos_poly_p11 = f86acos_poly_p2 = f87acos_poly_p13 = f88acos_series_t = f89acos_1by2 = f90acos_3by2 = f91acos_5by2 = f92acos_11by4 = f93acos_35by8 = f94acos_63by8 = f95acos_231by16 = f96 acos_y0 = f97 acos_H0 = f98 acos_S0 = f99 acos_d = f100acos_l1 = f101acos_d2 = f102acos_T0 = f103acos_d1 = f104acos_e0 = f105acos_l2 = f106acos_d3 = f107acos_T3 = f108acos_S1 = f109acos_e1 = f110acos_z = f111answer2 = f112acos_sgn_x = f113acos_429by16 = f114acos_18by4 = f115acos_3by4 = f116acos_l3 = f117acos_T6 = f118acos_const_add = f119// Data tables//==============================================================#ifdef _LIBC.rodata#else.data#endif.align 16acos_coeff_1_table:ASM_TYPE_DIRECTIVE(acos_coeff_1_table,@object)data8 0xE4E7E0A423A21249 , 0x00003FF8 //P7data8 0xC2F7EE0200FCE2A5 , 0x0000C003 //P18data8 0xB745D7F6C65C20E0 , 0x00003FF9 //P5data8 0xF75E381A323D4D94 , 0x0000C002 //P16data8 0x8959C2629C1024C0 , 0x0000C002 //P20data8 0xAFF68E7D241292C5 , 0x00003FF8 //P9data8 0xB6DB6DB7260AC30D , 0x00003FFA //P3data8 0xD0417CE2B41CB7BF , 0x0000C000 //P14data8 0x81D570FEA724E3E4 , 0x0000BFFD //P12data8 0xAAAAAAAAAAAAC277 , 0x00003FFC //P1data8 0xF534912FF3E7B76F , 0x00003FFF //P21data8 0xc90fdaa22168c235 , 0x00003fff // pi/2data8 0x0000000000000000 , 0x00000000 // pad to avoid bank conflictsASM_SIZE_DIRECTIVE(acos_coeff_1_table)acos_coeff_2_table:ASM_TYPE_DIRECTIVE(acos_coeff_2_table,@object)data8 0x8E26AF5F29B39A2A , 0x00003FF9 //P6data8 0xB4F118A4B1015470 , 0x00004003 //P17data8 0xF8E38E10C25990E0 , 0x00003FF9 //P4data8 0x80F50489AEF1CAC6 , 0x00004002 //P15data8 0x92728015172CFE1C , 0x00004003 //P19data8 0xBBC3D831D4595971 , 0x00003FF8 //P8data8 0x999999999952A5C3 , 0x00003FFB //P2data8 0x855576BE6F0975EC , 0x00003FFF //P13data8 0xF12420E778077D89 , 0x00003FFA //P11data8 0xB6590FF4D23DE003 , 0x00003FF3 //P10data8 0xb504f333f9de6484 , 0x00003ffe // sqrt(2)/2ASM_SIZE_DIRECTIVE(acos_coeff_2_table).align 32.global acosASM_TYPE_DIRECTIVE(acos,@function).section .text.proc acos.align 32acos: { .mfi alloc r32 = ar.pfs,1,6,4,0 fma.s1 acos_tx = f8,f8,f0 addl ASIN_Addr2 = @ltoff(acos_coeff_2_table),gp} { .mfi mov ASIN_FFFE = 0xFFFE fnma.s1 acos_t = f8,f8,f1 addl ASIN_Addr1 = @ltoff(acos_coeff_1_table),gp};; { .mfi setf.exp acos_1by2 = ASIN_FFFE fmerge.s acos_abs_x = f1,f8 nop.i 999 ;;} { .mmf ld8 ASIN_Addr1 = [ASIN_Addr1] ld8 ASIN_Addr2 = [ASIN_Addr2] fmerge.s acos_sgn_x = f8,f1} ;;{ .mfi nop.m 999 fcmp.lt.s1 p11,p12 = f8, f0 nop.i 999 ;;} { .mfi ldfe acos_coeff_P7 = [ASIN_Addr1],16 fma.s1 acos_tx2 = acos_tx,acos_tx,f0 nop.i 999} { .mfi ldfe acos_coeff_P6 = [ASIN_Addr2],16 fma.s1 acos_t2 = acos_t,acos_t,f0 nop.i 999;;} { .mmf ldfe acos_coeff_P18 = [ASIN_Addr1],16 ldfe acos_coeff_P17 = [ASIN_Addr2],16 fclass.m.unc p8,p0 = f8, 0xc3 //@qnan |@snan} ;; { .mmf ldfe acos_coeff_P5 = [ASIN_Addr1],16 ldfe acos_coeff_P4 = [ASIN_Addr2],16 frsqrta.s1 acos_y0,p0 = acos_t} ;; { .mfi ldfe acos_coeff_P16 = [ASIN_Addr1],16 fcmp.gt.s1 p9,p0 = acos_abs_x,f1 nop.i 999} { .mfb ldfe acos_coeff_P15 = [ASIN_Addr2],16(p8) fma.d f8 = f8,f1,f0(p8) br.ret.spnt b0};; { .mmf ldfe acos_coeff_P20 = [ASIN_Addr1],16 ldfe acos_coeff_P19 = [ASIN_Addr2],16 fclass.m.unc p10,p0 = f8, 0x07 //@zero} ;; { .mfi ldfe acos_coeff_P9 = [ASIN_Addr1],16 fma.s1 acos_t4 = acos_t2,acos_t2,f0(p9) mov GR_Parameter_Tag = 58 } { .mfi ldfe acos_coeff_P8 = [ASIN_Addr2],16 fma.s1 acos_3by2 = acos_1by2,f1,f1 nop.i 999;;} { .mfi ldfe acos_coeff_P2 = [ASIN_Addr2],16 fma.s1 acos_tx4 = acos_tx2,acos_tx2,f0 nop.i 999} { .mfb ldfe acos_coeff_P3 = [ASIN_Addr1],16 fma.s1 acos_t3 = acos_t,acos_t2,f0(p9) br.cond.spnt __libm_error_region};; { .mfi ldfe acos_coeff_P13 = [ASIN_Addr2],16 fma.s1 acos_H0 = acos_y0,acos_1by2,f0 nop.i 999} { .mfi ldfe acos_coeff_P14 = [ASIN_Addr1],16 fma.s1 acos_S0 = acos_y0,acos_t,f0 nop.i 999;;} { .mfi ldfe acos_coeff_P11 = [ASIN_Addr2],16 fcmp.eq.s1 p6,p0 = acos_abs_x, f1 nop.i 999} { .mfi ldfe acos_coeff_P12 = [ASIN_Addr1],16 fma.s1 acos_tx3 = acos_tx,acos_tx2,f0 nop.i 999};; { .mfi ldfe acos_coeff_P10 = [ASIN_Addr2],16 fma.s1 acos_1poly_p6 = acos_tx,acos_coeff_P7,acos_coeff_P6 nop.i 999} { .mfi ldfe acos_coeff_P1 = [ASIN_Addr1],16 fma.s1 acos_poly_p6 = acos_t,acos_coeff_P7,acos_coeff_P6 nop.i 999;;} { .mfi ldfe acos_const_sqrt2by2 = [ASIN_Addr2],16 fma.s1 acos_5by2 = acos_3by2,f1,f1 nop.i 999} { .mfi ldfe acos_coeff_P21 = [ASIN_Addr1],16 fma.s1 acos_11by4 = acos_3by2,acos_3by2,acos_1by2 nop.i 999;;} { .mfi ldfe acos_const_piby2 = [ASIN_Addr1],16 fma.s1 acos_poly_p17 = acos_t,acos_coeff_P18,acos_coeff_P17 nop.i 999} { .mfb nop.m 999 fma.s1 acos_3by4 = acos_3by2,acos_1by2,f0(p10) br.cond.spnt L(ACOS_ZERO) // Branch to short path if x=0};; { .mfi nop.m 999 fma.s1 acos_poly_p15 = acos_t,acos_coeff_P16,acos_coeff_P15 nop.i 999} { .mfb nop.m 999 fnma.s1 acos_d = acos_S0,acos_H0,acos_1by2(p6) br.cond.spnt L(ACOS_ABS_ONE) // Branch to short path if |x|=1};; { .mfi nop.m 999 fma.s1 acos_poly_p19 = acos_t,acos_coeff_P20,acos_coeff_P19 nop.i 999} { .mfi nop.m 999 fma.s1 acos_poly_p4 = acos_t,acos_coeff_P5,acos_coeff_P4 nop.i 999;;} { .mfi nop.m 999 fma.s1 acos_1poly_p17 = acos_tx,acos_coeff_P18,acos_coeff_P17 nop.i 999} { .mfi nop.m 999 fma.s1 acos_poly_p8 = acos_t,acos_coeff_P9,acos_coeff_P8 nop.i 999;;} { .mfi nop.m 999 fms.s1 acos_35by8 = acos_5by2,acos_11by4,acos_5by2 nop.i 999} { .mfi
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?