?? s_tanf.s
字號(hào):
.file "tancotf.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// 12/27/00 Improved speed// 02/21/01 Updated to call tanl// 05/30/02 Improved speed, added cotf.// 11/25/02 Added explicit completer on fnorm// 02/10/03 Reordered header: .section, .global, .proc, .align// 04/17/03 Eliminated redundant stop bits// 03/31/05 Reformatted delimiters between data tables//// APIs//==============================================================// float tanf(float)// float cotf(float)//// Algorithm Description for tanf//==============================================================// The tanf function computes the principle value of the tangent of x,// where x is radian argument.//// There are 5 paths:// 1. x = +/-0.0// Return tanf(x) = +/-0.0//// 2. x = [S,Q]NaN// Return tanf(x) = QNaN//// 3. x = +/-Inf// Return tanf(x) = QNaN//// 4. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is even, |r|<Pi/4// Return tanf(x) = P19(r) = A1*r + A3*r^3 + A5*r^5 + ... + A19*r^19 =// = r*(A1 + A3*t + A5*t^2 + ... + A19*t^9) = r*P9(t), where t = r^2//// 5. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is odd, |r|<Pi/4// Return tanf(x) = -1/r + P11(r) = -1/r + B1*r + B3*r^3 + ... + B11*r^11 =// = -1/r + r*(B1 + B3*t + B5*t^2 + ... + B11*t^5) = -1/r + r*P11(t),// where t = r^2//// Algorithm Description for cotf//==============================================================// The cotf function computes the principle value of the cotangent of x,// where x is radian argument.//// There are 5 paths:// 1. x = +/-0.0// Return cotf(x) = +/-Inf and error handling is called//// 2. x = [S,Q]NaN// Return cotf(x) = QNaN//// 3. x = +/-Inf// Return cotf(x) = QNaN//// 4. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is odd, |r|<Pi/4// Return cotf(x) = P19(-r) = A1*(-r) + A3*(-r^3) + ... + A19*(-r^19) =// = -r*(A1 + A3*t + A5*t^2 + ... + A19*t^9) = -r*P9(t), where t = r^2//// 5. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is even, |r|<Pi/4// Return cotf(x) = 1/r + P11(-r) = 1/r + B1*(-r) + ... + B11*(-r^11) =// = 1/r - r*(B1 + B3*t + B5*t^2 + ... + B11*t^5) = 1/r - r*P11(t),// where t = r^2//// We set p10 and clear p11 if computing tanf, vice versa for cotf.////// Registers used//==============================================================// Floating Point registers used:// f8, input// f32 -> f80//// General registers used:// r14 -> r23, r32 -> r39//// Predicate registers used:// p6 -> p13//// Assembly macros//==============================================================// integer registersrExp = r14rSignMask = r15rRshf = r16rScFctrExp = r17rIntN = r18rSigRcpPiby2 = r19rScRshf = r20rCoeffA = r21rCoeffB = r22rExpCut = r23GR_SAVE_B0 = r33GR_SAVE_PFS = r34GR_SAVE_GP = r35GR_Parameter_X = r36GR_Parameter_Y = r37GR_Parameter_RESULT = r38GR_Parameter_Tag = r39//==============================================================// floating point registersfScRcpPiby2 = f32fScRshf = f33fNormArg = f34fScFctr = f35fRshf = f36fShiftedN = f37fN = f38fR = f39fA01 = f40fA03 = f41fA05 = f42fA07 = f43fA09 = f44fA11 = f45fA13 = f46fA15 = f47fA17 = f48fA19 = f49fB01 = f50fB03 = f51fB05 = f52fB07 = f53fB09 = f54fB11 = f55fA03_01 = f56fA07_05 = f57fA11_09 = f58fA15_13 = f59fA19_17 = f60fA11_05 = f61fA19_13 = f62fA19_05 = f63fRbyA03_01 = f64fB03_01 = f65fB07_05 = f66fB11_09 = f67fB11_05 = f68fRbyB03_01 = f69fRbyB11_01 = f70fRp2 = f71fRp4 = f72fRp8 = f73fRp5 = f74fY0 = f75fY1 = f76fD = f77fDp2 = f78fInvR = f79fPiby2 = f80//==============================================================RODATA.align 16LOCAL_OBJECT_START(coeff_A)data8 0x3FF0000000000000 // A1 = 1.00000000000000000000e+00data8 0x3FD5555556BCE758 // A3 = 3.33333334641442641606e-01data8 0x3FC111105C2DAE48 // A5 = 1.33333249100689099175e-01data8 0x3FABA1F876341060 // A7 = 5.39701122561673229739e-02data8 0x3F965FB86D12A38D // A9 = 2.18495194027670719750e-02data8 0x3F8265F62415F9D6 // A11 = 8.98353860497717439465e-03data8 0x3F69E3AE64CCF58D // A13 = 3.16032468108912746342e-03data8 0x3F63920D09D0E6F6 // A15 = 2.38897844840557235331e-03LOCAL_OBJECT_END(coeff_A)LOCAL_OBJECT_START(coeff_B)data8 0xC90FDAA22168C235, 0x3FFF // pi/2data8 0x3FD55555555358DB // B1 = 3.33333333326107426583e-01data8 0x3F96C16C252F643F // B3 = 2.22222230621336129239e-02data8 0x3F61566243AB3C60 // B5 = 2.11638633968606896785e-03data8 0x3F2BC1169BD4438B // B7 = 2.11748132564551094391e-04data8 0x3EF611B4CEA056A1 // B9 = 2.10467959860990200942e-05data8 0x3EC600F9E32194BF // B11 = 2.62305891234274186608e-06data8 0xBF42BA7BCC177616 // A17 =-5.71546981685324877205e-04data8 0x3F4F2614BC6D3BB8 // A19 = 9.50584530849832782542e-04LOCAL_OBJECT_END(coeff_B).section .textLOCAL_LIBM_ENTRY(cotf){ .mlx getf.exp rExp = f8 // ***** Get 2
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -