⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_expm1f.s

📁 glibc 2.9,最新版的C语言库函数
💻 S
📖 第 1 页 / 共 2 页
字号:
.file "expf_m1.s"// Copyright (c) 2000 - 2005, 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// 04/04/00 Unwind support added// 08/15/00 Bundle added after call to __libm_error_support to properly//          set [the previously overwritten] GR_Parameter_RESULT.// 07/07/01 Improved speed of all paths// 05/20/02 Cleaned up namespace and sf0 syntax// 11/20/02 Improved speed, algorithm based on expf// 03/31/05 Reformatted delimiters between data tables////// API//*********************************************************************// float expm1f(float)//// Overview of operation//*********************************************************************// 1. Inputs of Nan, Inf, Zero, NatVal handled with special paths//// 2. |x| < 2^-40//    Result = x, computed by x + x*x to handle appropriate flags and rounding//// 3. 2^-40 <= |x| < 2^-2//    Result determined by 8th order Taylor series polynomial//    expm1f(x) = x + A2*x^2 + ... + A8*x^8//// 4. x < -24.0//    Here we know result is essentially -1 + eps, where eps only affects//    rounded result.  Set I.//// 5. x >= 88.7228 //    Result overflows.  Set I, O, and call error support//// 6. 2^-2 <= x < 88.7228  or  -24.0 <= x < -2^-2  //    This is the main path.  The algorithm is described below:// Take the input x. w is "how many log2/128 in x?"//  w = x * 64/log2//  NJ = int(w)//  x = NJ*log2/64 + R//  NJ = 64*n + j//  x = n*log2 + (log2/64)*j + R////  So, exp(x) = 2^n * 2^(j/64)* exp(R)////  T =  2^n * 2^(j/64)//       Construct 2^n//       Get 2^(j/64) table//           actually all the entries of 2^(j/64) table are stored in DP and//           with exponent bits set to 0 -> multiplication on 2^n can be//           performed by doing logical "or" operation with bits presenting 2^n//  exp(R) = 1 + (exp(R) - 1)//  P = exp(R) - 1 approximated by Taylor series of 3rd degree//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2////  The final result is reconstructed as follows//  expm1f(x) = T*P + (T - 1.0)// Special values//*********************************************************************// expm1f(+0)    = +0.0// expm1f(-0)    = -0.0// expm1f(+qnan) = +qnan// expm1f(-qnan) = -qnan// expm1f(+snan) = +qnan// expm1f(-snan) = -qnan// expm1f(-inf)  = -1.0// expm1f(+inf)  = +inf// Overflow and Underflow//*********************************************************************// expm1f(x) = largest single normal when//     x = 88.7228 = 0x42b17217//// Underflow is handled as described in case 2 above.// Registers used//*********************************************************************// Floating Point registers used:// f8, input// f6,f7, f9 -> f15,  f32 -> f45// General registers used:// r3, r20 -> r38// Predicate registers used:// p9 -> p15// Assembly macros//*********************************************************************// integer registers used// scratchrNJ                   = r3rExp_half             = r20rSignexp_x            = r21rExp_x                = r22rExp_mask             = r23rExp_bias             = r24rTmp                  = r25rM1_lim               = r25rGt_ln                = r25rJ                    = r26rN                    = r27rTblAddr              = r28rLn2Div64             = r29rRightShifter         = r30r64DivLn2             = r31// stackedGR_SAVE_PFS           = r32GR_SAVE_B0            = r33GR_SAVE_GP            = r34GR_Parameter_X        = r35GR_Parameter_Y        = r36GR_Parameter_RESULT   = r37GR_Parameter_TAG      = r38// floating point registers usedFR_X                  = f10FR_Y                  = f1FR_RESULT             = f8// scratchfRightShifter         = f6f64DivLn2             = f7fNormX                = f9fNint                 = f10fN                    = f11fR                    = f12fLn2Div64             = f13fA2                   = f14fA3                   = f15// stackedfP                    = f32fX3                   = f33fT                    = f34fMIN_SGL_OFLOW_ARG    = f35fMAX_SGL_NORM_ARG     = f36fMAX_SGL_MINUS_1_ARG  = f37fA4                   = f38fA43                  = f38fA432                 = f38fRSqr                 = f39fA5                   = f40fTmp                  = f41fGt_pln               = f41fXsq                  = f41fA7                   = f42fA6                   = f43fA65                  = f43fTm1                  = f44fA8                   = f45fA87                  = f45fA8765                = f45fA8765432             = f45fWre_urm_f8           = f45RODATA.align 16LOCAL_OBJECT_START(_expf_table)data8 0x3efa01a01a01a01a // A8 = 1/8!data8 0x3f2a01a01a01a01a // A7 = 1/7!data8 0x3f56c16c16c16c17 // A6 = 1/6!data8 0x3f81111111111111 // A5 = 1/5!data8 0x3fa5555555555555 // A4 = 1/4!data8 0x3fc5555555555555 // A3 = 1/3!//data4 0x42b17218         // Smallest sgl arg to overflow sgl resultdata4 0x42b17217         // Largest sgl arg to give sgl result//// 2^(j/64) table, j goes from 0 to 63data8 0x0000000000000000 // 2^(0/64)data8 0x00002C9A3E778061 // 2^(1/64)data8 0x000059B0D3158574 // 2^(2/64)data8 0x0000874518759BC8 // 2^(3/64)data8 0x0000B5586CF9890F // 2^(4/64)data8 0x0000E3EC32D3D1A2 // 2^(5/64)data8 0x00011301D0125B51 // 2^(6/64)data8 0x0001429AAEA92DE0 // 2^(7/64)data8 0x000172B83C7D517B // 2^(8/64)data8 0x0001A35BEB6FCB75 // 2^(9/64)data8 0x0001D4873168B9AA // 2^(10/64)data8 0x0002063B88628CD6 // 2^(11/64)data8 0x0002387A6E756238 // 2^(12/64)data8 0x00026B4565E27CDD // 2^(13/64)data8 0x00029E9DF51FDEE1 // 2^(14/64)data8 0x0002D285A6E4030B // 2^(15/64)data8 0x000306FE0A31B715 // 2^(16/64)data8 0x00033C08B26416FF // 2^(17/64)data8 0x000371A7373AA9CB // 2^(18/64)data8 0x0003A7DB34E59FF7 // 2^(19/64)data8 0x0003DEA64C123422 // 2^(20/64)data8 0x0004160A21F72E2A // 2^(21/64)data8 0x00044E086061892D // 2^(22/64)data8 0x000486A2B5C13CD0 // 2^(23/64)data8 0x0004BFDAD5362A27 // 2^(24/64)data8 0x0004F9B2769D2CA7 // 2^(25/64)data8 0x0005342B569D4F82 // 2^(26/64)data8 0x00056F4736B527DA // 2^(27/64)data8 0x0005AB07DD485429 // 2^(28/64)data8 0x0005E76F15AD2148 // 2^(29/64)data8 0x0006247EB03A5585 // 2^(30/64)data8 0x0006623882552225 // 2^(31/64)data8 0x0006A09E667F3BCD // 2^(32/64)data8 0x0006DFB23C651A2F // 2^(33/64)data8 0x00071F75E8EC5F74 // 2^(34/64)data8 0x00075FEB564267C9 // 2^(35/64)data8 0x0007A11473EB0187 // 2^(36/64)data8 0x0007E2F336CF4E62 // 2^(37/64)data8 0x00082589994CCE13 // 2^(38/64)data8 0x000868D99B4492ED // 2^(39/64)data8 0x0008ACE5422AA0DB // 2^(40/64)data8 0x0008F1AE99157736 // 2^(41/64)data8 0x00093737B0CDC5E5 // 2^(42/64)data8 0x00097D829FDE4E50 // 2^(43/64)data8 0x0009C49182A3F090 // 2^(44/64)data8 0x000A0C667B5DE565 // 2^(45/64)data8 0x000A5503B23E255D // 2^(46/64)data8 0x000A9E6B5579FDBF // 2^(47/64)data8 0x000AE89F995AD3AD // 2^(48/64)data8 0x000B33A2B84F15FB // 2^(49/64)data8 0x000B7F76F2FB5E47 // 2^(50/64)data8 0x000BCC1E904BC1D2 // 2^(51/64)data8 0x000C199BDD85529C // 2^(52/64)data8 0x000C67F12E57D14B // 2^(53/64)data8 0x000CB720DCEF9069 // 2^(54/64)data8 0x000D072D4A07897C // 2^(55/64)data8 0x000D5818DCFBA487 // 2^(56/64)data8 0x000DA9E603DB3285 // 2^(57/64)data8 0x000DFC97337B9B5F // 2^(58/64)data8 0x000E502EE78B3FF6 // 2^(59/64)data8 0x000EA4AFA2A490DA // 2^(60/64)data8 0x000EFA1BEE615A27 // 2^(61/64)data8 0x000F50765B6E4540 // 2^(62/64)data8 0x000FA7C1819E90D8 // 2^(63/64)LOCAL_OBJECT_END(_expf_table).section .textGLOBAL_IEEE754_ENTRY(expm1f){ .mlx      getf.exp        rSignexp_x = f8      // Must recompute if x unorm      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)}{ .mlx      addl            rTblAddr = @ltoff(_expf_table),gp      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter};;{ .mfi      // point to the beginning of the table      ld8             rTblAddr = [rTblAddr]      fclass.m        p14, p0 = f8 , 0x22  // test for -INF      mov             rExp_mask = 0x1ffff   // Exponent mask}{ .mfi      nop.m           0      fnorm.s1        fNormX = f8 // normalized x      nop.i           0};;{ .mfi      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg      fclass.m        p9, p0 = f8 , 0x0b    // test for x unorm      mov             rExp_bias = 0xffff    // Exponent bias}{ .mlx      // load Right Shifter to FP reg      setf.d          fRightShifter = rRightShifter      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR};;{ .mfi      ldfpd           fA8, fA7 = [rTblAddr], 16      fcmp.eq.s1      p13, p0 = f0, f8      // test for x = 0.0      mov             rExp_half = 0xfffe}{ .mfb      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg      nop.f           0(p9)  br.cond.spnt    EXPM1_UNORM // Branch if x unorm};;EXPM1_COMMON:{ .mfb      ldfpd           fA6, fA5 = [rTblAddr], 16

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -