📄 e_expf.s
字号:
};;{ .mfi nop.m 0 // check for underflow and tiny (+0) result fcmp.le.s1 p11, p0 = fNormX, fMAX_SGL_ZERO_ARG nop.i 0}{ .mfb nop.m 0 fms.s1 fN = fNint, f1, fRightShifter // n in FP register // branch out if overflow(p15) br.cond.spnt EXP_CERTAIN_OVERFLOW};;{ .mfb getf.sig rNJ = fNint // bits of n, j // check for underflow and deno result fcmp.lt.s1 p13, p0 = fNormX, fMIN_SGL_NORM_ARG // branch out if underflow and tiny (+0) result(p11) br.cond.spnt EXP_CERTAIN_UNDERFLOW};;{ .mfi nop.m 0 // check for possible overflow fcmp.gt.s1 p14, p0 = fNormX, fMAX_SGL_NORM_ARG extr.u rJ = rNJ, 0, 6 // bits of j}{ .mfi addl rN = 0xFFFF - 63, rNJ // biased and shifted n fnma.s1 fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64 nop.i 0};;{ .mfi shladd rJ = rJ, 3, rTblAddr // address in the 2^(j/64) table nop.f 0 shr rN = rN, 6 // biased n};;{ .mfi ld8 rJ = [rJ] nop.f 0 shl rN = rN, 52 // 2^n bits in DP format};;{ .mfi or rN = rN, rJ // bits of 2^n * 2^(j/64) in DP format nop.f 0 nop.i 0};;{ .mfi setf.d fT = rN // 2^n * 2^(j/64) fma.s1 fP = fA3, fR, fA2 // A3*R + A2 nop.i 0}{ .mfi nop.m 0 fma.s1 fRSqr = fR, fR, f0 // R^2 nop.i 0};;{ .mfi nop.m 0 fma.s1 fP = fP, fRSqr, fR // P = (A3*R + A2)*R^2 + R nop.i 0};;{ .mbb nop.m 0 // branch out if possible underflow(p13) br.cond.spnt EXP_POSSIBLE_UNDERFLOW // branch out if possible overflow result(p14) br.cond.spnt EXP_POSSIBLE_OVERFLOW};;{ .mfb nop.m 0 // final result in the absence of over- and underflow fma.s.s0 f8 = fP, fT, fT // exit here in the absence of over- and underflow br.ret.sptk b0};;EXP_POSSIBLE_OVERFLOW:// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG// This cannot happen if input is a single, only if input higher precision.// Overflow is a possibility, not a certainty.// Recompute result using status field 2 with user's rounding mode,// and wre set. If result is larger than largest single, then we have// overflow{ .mfi mov rGt_ln = 0x1007f // Exponent for largest single + 1 ulp fsetc.s2 0x7F,0x42 // Get user's round mode, set wre nop.i 0};;{ .mfi setf.exp fGt_pln = rGt_ln // Create largest single + 1 ulp fma.s.s2 fWre_urm_f8 = fP, fT, fT // Result with wre set nop.i 0};;{ .mfi nop.m 0 fsetc.s2 0x7F,0x40 // Turn off wre in sf2 nop.i 0};;{ .mfi nop.m 0 fcmp.ge.s1 p6, p0 = fWre_urm_f8, fGt_pln // Test for overflow nop.i 0};;{ .mfb nop.m 0 nop.f 0(p6) br.cond.spnt EXP_CERTAIN_OVERFLOW // Branch if overflow};;{ .mfb nop.m 0 fma.s.s0 f8 = fP, fT, fT br.ret.sptk b0 // Exit if really no overflow};;// here if overflowEXP_CERTAIN_OVERFLOW:{ .mmi addl r17ones_m1 = 0x1FFFE, r0;; setf.exp fTmp = r17ones_m1 nop.i 0};;{ .mfi alloc r32=ar.pfs,0,3,4,0 fmerge.s FR_X = f8,f8 nop.i 0}{ .mfb mov GR_Parameter_TAG = 16 fma.s.s0 FR_RESULT = fTmp, fTmp, fTmp // Set I,O and +INF result br.cond.sptk __libm_error_region};;EXP_POSSIBLE_UNDERFLOW:// Here if fMAX_SGL_ZERO_ARG < x < fMIN_SGL_NORM_ARG// Underflow is a possibility, not a certainty// We define an underflow when the answer with// ftz set// is zero (tiny numbers become zero)// Notice (from below) that if we have an unlimited exponent range,// then there is an extra machine number E between the largest denormal and// the smallest normal.// So if with unbounded exponent we round to E or below, then we are// tiny and underflow has occurred.// But notice that you can be in a situation where we are tiny, namely// rounded to E, but when the exponent is bounded we round to smallest// normal. So the answer can be the smallest normal with underflow.// E// -----+--------------------+--------------------+-----// | | |// 1.1...10 2^-3fff 1.1...11 2^-3fff 1.0...00 2^-3ffe// 0.1...11 2^-3ffe (biased, 1)// largest dn smallest normal{ .mfi nop.m 0 fsetc.s2 0x7F,0x41 // Get user's round mode, set ftz nop.i 0};;{ .mfi nop.m 0 fma.s.s2 fFtz_urm_f8 = fP, fT, fT // Result with ftz set nop.i 0};;{ .mfi nop.m 0 fsetc.s2 0x7F,0x40 // Turn off ftz in sf2 nop.i 0};;{ .mfi nop.m 0 fcmp.eq.s1 p6, p7 = fFtz_urm_f8, f0 // Test for underflow nop.i 0}{ .mfi nop.m 0 fma.s.s0 f8 = fP, fT, fT // Compute result, set I, maybe U nop.i 0};;{ .mbb nop.m 0(p6) br.cond.spnt EXP_UNDERFLOW_COMMON // Branch if really underflow(p7) br.ret.sptk b0 // Exit if really no underflow};;EXP_CERTAIN_UNDERFLOW:// Here if x < fMAX_SGL_ZERO_ARG// Result will be zero (or smallest denorm if round to +inf) with I, U set{ .mmi mov rTmp = 1;; setf.exp fTmp = rTmp // Form small normal nop.i 0};;{ .mfi nop.m 0 fmerge.se fTmp = fTmp, f64DivLn2 // Small with non-trial signif nop.i 0};; { .mfb nop.m 0 fma.s.s0 f8 = fTmp, fTmp, f0 // Set I,U, tiny (+0.0) result br.cond.sptk EXP_UNDERFLOW_COMMON};;EXP_UNDERFLOW_COMMON:// Determine if underflow result is zero or nonzero{ .mfi alloc r32=ar.pfs,0,3,4,0 fcmp.eq.s1 p6, p0 = f8, f0 nop.i 0};;{ .mfb nop.m 0 fmerge.s FR_X = fNormX,fNormX(p6) br.cond.spnt EXP_UNDERFLOW_ZERO};;EXP_UNDERFLOW_NONZERO:// Here if x < fMIN_SGL_NORM_ARG and result nonzero;// I, U are set{ .mfb mov GR_Parameter_TAG = 17 nop.f 0 // FR_RESULT already set br.cond.sptk __libm_error_region};;EXP_UNDERFLOW_ZERO:// Here if x < fMIN_SGL_NORM_ARG and result zero;// I, U are set{ .mfb mov GR_Parameter_TAG = 17 nop.f 0 // FR_RESULT already set br.cond.sptk __libm_error_region};;GLOBAL_IEEE754_END(expf)LOCAL_LIBM_ENTRY(__libm_error_region).prologue{ .mfi add GR_Parameter_Y=-32,sp // Parameter 2 value nop.f 0.save ar.pfs,GR_SAVE_PFS mov GR_SAVE_PFS=ar.pfs // Save ar.pfs}{ .mfi.fframe 64 add sp=-64,sp // Create new stack nop.f 0 mov GR_SAVE_GP=gp // Save gp};;{ .mmi stfs [GR_Parameter_Y] = FR_Y,16 // Store Parameter 2 on stack add GR_Parameter_X = 16,sp // Parameter 1 address.save b0, GR_SAVE_B0 mov GR_SAVE_B0=b0 // Save b0};;.body{ .mfi stfs [GR_Parameter_X] = FR_X // Store Parameter 1 on stack nop.f 0 add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address}{ .mib stfs [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack add GR_Parameter_Y = -16,GR_Parameter_Y br.call.sptk b0=__libm_error_support# // Call error handling function};;{ .mmi add GR_Parameter_RESULT = 48,sp nop.m 0 nop.i 0};;{ .mmi ldfs f8 = [GR_Parameter_RESULT] // Get return result off stack.restore sp add sp = 64,sp // Restore stack pointer mov b0 = GR_SAVE_B0 // Restore return address};;{ .mib mov gp = GR_SAVE_GP // Restore gp mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs br.ret.sptk b0 // Return};;LOCAL_LIBM_END(__libm_error_region).type __libm_error_support#,@function.global __libm_error_support#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -