📄 e_expf.s
字号:
// If the input is really a single arg, then there will never be "Possible// Underflow" or "Possible Overflow" arguments.//{ .mfi add EXP_AD_M1 = exp_GR_Ind1,EXP_AD_T1 fcmp.ge.s1 p15,p14 = exp_norm_f8,EXP_MIN_SGL_OFLOW_ARG nop.i 999}{ .mfi shladd EXP_AD_M2 = exp_GR_Ind2,4,EXP_AD_T2 fms.s1 exp_R = f1,f8,exp_Mfloat nop.i 999 ;;}{ .mfi ldfe exp_T1 = [EXP_AD_M1] fcmp.le.s1 p11,p12 = exp_norm_f8,EXP_MAX_SGL_ZERO_ARG nop.i 999 ;;}{ .mfb ldfe exp_T2 = [EXP_AD_M2](p14) fcmp.gt.s1 p14,p0 = exp_norm_f8,EXP_MAX_SGL_NORM_ARG(p15) br.cond.spnt L(EXP_CERTAIN_OVERFLOW) ;;}{ .mfb nop.m 999(p12) fcmp.le.s1 p12,p0 = exp_norm_f8,EXP_MAX_SGL_UFLOW_ARG(p11) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW_ZERO)};;{ .mfi nop.m 999(p13) fcmp.lt.s1 p13,p0 = exp_norm_f8,EXP_MIN_SGL_NORM_ARG nop.i 999};;{ .mfi nop.m 999 fma.s1 exp_Rsq = exp_R,exp_R,f0 nop.i 999}{ .mfi nop.m 999 fma.s1 exp_P3 = exp_R,exp_coeff_P2,exp_coeff_P1 nop.i 999 };;{ .mfi nop.m 999 fma.s1 exp_P1 = exp_R,exp_coeff_P6,exp_coeff_P5 nop.i 999 }{ .mfi nop.m 999 fma.s1 exp_P2 = exp_R,exp_coeff_P4,exp_coeff_P3 nop.i 999};;{ .mfi nop.m 999 fma.s1 exp_P7 = f1,exp_R,f1 nop.i 999};;{ .mfi nop.m 999 fma.s1 exp_P5 = exp_Rsq,exp_P3,f0 nop.i 999}{ .mfi nop.m 999 fma.s1 exp_R4 = exp_Rsq,exp_Rsq,f0 nop.i 999 };;{ .mfi nop.m 999 fma.s1 exp_T = exp_T1,exp_T2,f0 nop.i 999 }{ .mfi nop.m 999 fma.s1 exp_P4 = exp_Rsq,exp_P1,exp_P2 nop.i 999 };;{ .mfi nop.m 999 fma.s1 exp_A = exp_T,exp_P7,f0 nop.i 999}{ .mfi nop.m 999 fma.s1 exp_P6 = exp_R4,exp_P4,exp_P5 nop.i 999};;{ .bbb(p12) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW)(p13) br.cond.spnt L(EXP_POSSIBLE_UNDERFLOW)(p14) br.cond.spnt L(EXP_POSSIBLE_OVERFLOW)};;{ .mfb nop.m 999 fma.s f8 = exp_T,exp_P6,exp_A br.ret.sptk b0};;L(EXP_POSSIBLE_OVERFLOW):// We got an answer. EXP_MAX_SGL_NORM_ARG < x < EXP_MIN_SGL_OFLOW_ARG// overflow is a possibility, not a certainty// Set wre in s2 and perform the last operation with s2// We define an overflow when the answer with// WRE set// user-defined rounding mode// is lsn +1// Is the exponent 1 more than the largest single?// If so, go to ERROR RETURN, else (no overflow) get the answer and// leave.// Largest single is FE (biased single)// FE - 7F + FFFF = 1007E// Create + largest_single_plus_ulp// Create - largest_single_plus_ulp// Calculate answer with WRE set.// Cases when answer is lsn+1 are as follows:// midpoint// |// lsn | lsn+1// --+----------|----------+------------// |// +inf +inf -inf// RN RN// RZ// exp_gt_pln contains the floating point number lsn+1.// The setf.exp puts 0x1007f in the exponent and 0x800... in the significand.// If the answer is >= lsn+1, we have overflowed.// Then p6 is TRUE. Set the overflow tag, save input in FR_X,// do the final calculation for IEEE result, and branch to error return.{ .mfi mov exp_GR_gt_ln = 0x1007F fsetc.s2 0x7F,0x42 nop.i 999};;{ .mfi setf.exp exp_gt_pln = exp_GR_gt_ln fma.s.s2 exp_wre_urm_f8 = exp_T, exp_P6, exp_A nop.i 999};;{ .mfi nop.m 999 fsetc.s2 0x7F,0x40 nop.i 999};;{ .mfi nop.m 999 fcmp.ge.unc.s1 p6, p0 = exp_wre_urm_f8, exp_gt_pln nop.i 999};;{ .mfb nop.m 999 nop.f 999(p6) br.cond.spnt L(EXP_CERTAIN_OVERFLOW) // Branch if really overflow};;{ .mfb nop.m 999 fma.s f8 = exp_T, exp_P6, exp_A br.ret.sptk b0 // Exit if really no overflow};;L(EXP_CERTAIN_OVERFLOW):{ .mmi sub exp_GR_17ones_m1 = exp_GR_17ones, r0, 1 ;; setf.exp f9 = exp_GR_17ones_m1 nop.i 999 ;;}{ .mfi nop.m 999 fmerge.s FR_X = f8,f8 nop.i 999}{ .mfb mov GR_Parameter_TAG = 16 fma.s FR_RESULT = f9, f9, f0 // Set I,O and +INF result br.cond.sptk __libm_error_region ;; }L(EXP_POSSIBLE_UNDERFLOW): // We got an answer. EXP_MAX_SGL_UFLOW_ARG < x < EXP_MIN_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^-7f 1.1...11 2^-7f 1.0...00 2^-7e // 0.1...11 2^-7e (biased, 1)// largest dn smallest normal// If the answer is = 0, we have underflowed.// Then p6 is TRUE. Set the underflow tag, save input in FR_X,// do the final calculation for IEEE result, and branch to error return.{ .mfi nop.m 999 fsetc.s2 0x7F,0x41 nop.i 999};;{ .mfi nop.m 999 fma.s.s2 exp_ftz_urm_f8 = exp_T, exp_P6, exp_A nop.i 999};;{ .mfi nop.m 999 fsetc.s2 0x7F,0x40 nop.i 999};;{ .mfi nop.m 999 fcmp.eq.unc.s1 p6, p0 = exp_ftz_urm_f8, f0 nop.i 999};;{ .mfb nop.m 999 nop.f 999(p6) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW) // Branch if really underflow };;{ .mfb nop.m 999 fma.s f8 = exp_T, exp_P6, exp_A br.ret.sptk b0 // Exit if really no underflow};;L(EXP_CERTAIN_UNDERFLOW):{ .mfi nop.m 999 fmerge.s FR_X = f8,f8 nop.i 999}{ .mfb mov GR_Parameter_TAG = 17 fma.s FR_RESULT = exp_T, exp_P6, exp_A // Set I,U and tiny result br.cond.sptk __libm_error_region ;; }L(EXP_CERTAIN_UNDERFLOW_ZERO):{ .mmi mov exp_GR_one = 1 ;; setf.exp f9 = exp_GR_one nop.i 999 ;;}{ .mfi nop.m 999 fmerge.s FR_X = f8,f8 nop.i 999}{ .mfb mov GR_Parameter_TAG = 17 fma.s FR_RESULT = f9, f9, f0 // Set I,U and tiny (+0.0) result br.cond.sptk __libm_error_region ;; }.endp expfASM_SIZE_DIRECTIVE(expf).proc __libm_error_region__libm_error_region:.prologue{ .mfi add GR_Parameter_Y=-32,sp // Parameter 2 value nop.f 999.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 nop.m 0 nop.m 0 add GR_Parameter_RESULT = 48,sp};;{ .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};; .endp __libm_error_regionASM_SIZE_DIRECTIVE(__libm_error_region).type __libm_error_support#,@function.global __libm_error_support#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -