?? libm_sincos_large.s
字號:
addl GR_Table_Base = @ltoff(FSINCOS_CONSTANTS#), gp nop.i 999};;{ .mmi ld8 GR_Table_Base = [GR_Table_Base] nop.m 999 nop.i 999};;//// Point to 2*-14// N_0 = Arg * Inv_P_0//{ .mmi add GR_Table_Base = 688, GR_Table_Base ;; ldfs FR_Two_to_M14 = [GR_Table_Base], 4 nop.i 999 ;;}{ .mfi ldfs FR_Neg_Two_to_M14 = [GR_Table_Base], 0 nop.f 999 nop.i 999 ;;}{ .mfi nop.m 999//// Load values 2**(-14) and -2**(-14)// fcvt.fx.s1 FR_N_0_fix = FR_N_0 nop.i 999 ;;}{ .mfi nop.m 999//// N_0_fix = integer part of N_0// fcvt.xf FR_N_0 = FR_N_0_fix nop.i 999 ;;}{ .mfi nop.m 999//// Make N_0 the integer part// fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X nop.i 999}{ .mfi nop.m 999 fma.s1 FR_w = FR_N_0, FR_d_1, f0 nop.i 999 ;;}{ .mfi nop.m 999//// Arg' = -N_0 * P_0 + Arg// w = N_0 * d_1// fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0 nop.i 999 ;;}{ .mfi nop.m 999//// N = A' * 2/pi// fcvt.fx.s1 FR_N_fix = FR_N_float nop.i 999 ;;}{ .mfi nop.m 999//// N_fix is the integer part// fcvt.xf FR_N_float = FR_N_fix nop.i 999 ;;}{ .mfi getf.sig GR_N_Inc = FR_N_fix nop.f 999 nop.i 999 ;;}{ .mii nop.m 999 nop.i 999 ;; add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos ;;}{ .mfi nop.m 999//// N is the integer part of the reduced-reduced argument.// Put the integer in a GP register// fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime nop.i 999}{ .mfi nop.m 999 fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w nop.i 999 ;;}{ .mfi nop.m 999//// s = -N*P_1 + Arg'// w = -N*P_2 + w// N_fix_gr = N_fix_gr + N_inc// fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14 nop.i 999 ;;}{ .mfi nop.m 999(p9) fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14 nop.i 999 ;;}{ .mfi nop.m 999//// For |s| > 2**(-14) r = S + w (r complete)// Else U_hi = N_0 * d_1//(p9) fma.s1 FR_V_hi = FR_N_float, FR_P_2, f0 nop.i 999}{ .mfi nop.m 999(p9) fma.s1 FR_U_hi = FR_N_0, FR_d_1, f0 nop.i 999 ;;}{ .mfi nop.m 999//// Either S <= -2**(-14) or S >= 2**(-14)// or -2**(-14) < s < 2**(-14)//(p8) fma.s1 FR_r = FR_s, f1, FR_w nop.i 999}{ .mfi nop.m 999(p9) fma.s1 FR_w = FR_N_float, FR_P_3, f0 nop.i 999 ;;}{ .mfi nop.m 999//// We need abs of both U_hi and V_hi - don't// worry about switched sign of V_hi.//(p9) fms.s1 FR_A = FR_U_hi, f1, FR_V_hi nop.i 999}{ .mfi nop.m 999//// Big s: finish up c = (S - r) + w (c complete)// Case 4: A = U_hi + V_hi// Note: Worry about switched sign of V_hi, so subtract instead of add.//(p9) fnma.s1 FR_V_lo = FR_N_float, FR_P_2, FR_V_hi nop.i 999 ;;}{ .mfi nop.m 999(p9) fms.s1 FR_U_lo = FR_N_0, FR_d_1, FR_U_hi nop.i 999 ;;}{ .mfi nop.m 999(p9) fmerge.s FR_V_hiabs = f0, FR_V_hi nop.i 999}{ .mfi nop.m 999// For big s: c = S - r// For small s do more work: U_lo = N_0 * d_1 - U_hi//(p9) fmerge.s FR_U_hiabs = f0, FR_U_hi nop.i 999 ;;}{ .mfi nop.m 999//// For big s: Is |r| < 2**(-3)// For big s: if p12 set, prepare to branch to Small_R.// For big s: If p13 set, prepare to branch to Normal_R.//(p8) fms.s1 FR_c = FR_s, f1, FR_r nop.i 999}{ .mfi nop.m 999//// For small S: V_hi = N * P_2// w = N * P_3// Note the product does not include the (-) as in the writeup// so (-) missing for V_hi and w.//(p8) fcmp.lt.unc.s1 p12, p13 = FR_r, FR_Two_to_M3 nop.i 999 ;;}{ .mfi nop.m 999(p12) fcmp.gt.s1 p12, p13 = FR_r, FR_Neg_Two_to_M3 nop.i 999 ;;}{ .mfi nop.m 999(p8) fma.s1 FR_c = FR_c, f1, FR_w nop.i 999}{ .mfb nop.m 999(p9) fms.s1 FR_w = FR_N_0, FR_d_2, FR_w(p12) br.cond.spnt SINCOS_SMALL_R ;;}{ .mib nop.m 999 nop.i 999(p13) br.cond.sptk SINCOS_NORMAL_R ;;}{ .mfi nop.m 999//// Big s: Vector off when |r| < 2**(-3). Recall that p8 will be true.// The remaining stuff is for Case 4.// Small s: V_lo = N * P_2 + U_hi (U_hi is in place of V_hi in writeup)// Note: the (-) is still missing for V_lo.// Small s: w = w + N_0 * d_2// Note: the (-) is now incorporated in w.//(p9) fcmp.ge.unc.s1 p10, p11 = FR_U_hiabs, FR_V_hiabs extr.u GR_i_1 = GR_N_Inc, 0, 1 ;;}{ .mfi nop.m 999//// C_hi = S + A//(p9) fma.s1 FR_t = FR_U_lo, f1, FR_V_lo extr.u GR_i_0 = GR_N_Inc, 1, 1 ;;}{ .mfi nop.m 999//// t = U_lo + V_lo////(p10) fms.s1 FR_a = FR_U_hi, f1, FR_A nop.i 999 ;;}{ .mfi nop.m 999(p11) fma.s1 FR_a = FR_V_hi, f1, FR_A nop.i 999};;{ .mmi nop.m 999 addl GR_Table_Base = @ltoff(FSINCOS_CONSTANTS#), gp nop.i 999};;{ .mmi ld8 GR_Table_Base = [GR_Table_Base] nop.m 999 nop.i 999};;{ .mfi add GR_Table_Base = 528, GR_Table_Base//// Is U_hiabs >= V_hiabs?//(p9) fma.s1 FR_C_hi = FR_s, f1, FR_A nop.i 999 ;;}{ .mmi ldfe FR_C_1 = [GR_Table_Base], 16 ;; ldfe FR_C_2 = [GR_Table_Base], 64 nop.i 999 ;;}{ .mmf nop.m 999//// c = c + C_lo finished.// Load C_2// ldfe FR_S_1 = [GR_Table_Base], 16//// C_lo = S - C_hi// fma.s1 FR_t = FR_t, f1, FR_w ;;}//// r and c have been computed.// Make sure ftz mode is set - should be automatic when using wre// |r| < 2**(-3)// Get [i_0,i_1] - two lsb of N_fix.// Load S_1//{ .mfi ldfe FR_S_2 = [GR_Table_Base], 64//// t = t + w//(p10) fms.s1 FR_a = FR_a, f1, FR_V_hi cmp.eq.unc p9, p10 = 0x0, GR_i_0}{ .mfi nop.m 999//// For larger u than v: a = U_hi - A// Else a = V_hi - A (do an add to account for missing (-) on V_hi// fms.s1 FR_C_lo = FR_s, f1, FR_C_hi nop.i 999 ;;}{ .mfi nop.m 999(p11) fms.s1 FR_a = FR_U_hi, f1, FR_a cmp.eq.unc p11, p12 = 0x0, GR_i_1}{ .mfi nop.m 999//// If u > v: a = (U_hi - A) + V_hi// Else a = (V_hi - A) + U_hi// In each case account for negative missing from V_hi.// fma.s1 FR_C_lo = FR_C_lo, f1, FR_A nop.i 999 ;;}{ .mfi nop.m 999//// C_lo = (S - C_hi) + A// fma.s1 FR_t = FR_t, f1, FR_a nop.i 999 ;;}{ .mfi nop.m 999//// t = t + a// fma.s1 FR_C_lo = FR_C_lo, f1, FR_t nop.i 999 ;;}{ .mfi nop.m 999//// C_lo = C_lo + t// Adjust Table_Base to beginning of table// fma.s1 FR_r = FR_C_hi, f1, FR_C_lo nop.i 999 ;;}{ .mfi nop.m 999//// Load S_2// fma.s1 FR_rsq = FR_r, FR_r, f0 nop.i 999}{ .mfi nop.m 999//// Table_Base points to C_1// r = C_hi + C_lo// fms.s1 FR_c = FR_C_hi, f1, FR_r nop.i 999 ;;}{ .mfi nop.m 999//// if i_1 ==0: poly = S_2 * FR_rsq + S_1// else poly = C_2 * FR_rsq + C_1////(p11) fma.s1 FR_Input_X = f0, f1, FR_r(p11) fma.s1 FR_prelim = f0, f1, FR_r nop.i 999 ;;}{ .mfi nop.m 999//(p12) fma.s1 FR_Input_X = f0, f1, f1(p12) fma.s1 FR_prelim = f0, f1, f1 nop.i 999 ;;}{ .mfi nop.m 999//// Compute r_cube = FR_rsq * r//(p11) fma.s1 FR_poly = FR_rsq, FR_S_2, FR_S_1 nop.i 999 ;;}{ .mfi nop.m 999(p12) fma.s1 FR_poly = FR_rsq, FR_C_2, FR_C_1 nop.i 999}{ .mfi nop.m 999//// Compute FR_rsq = r * r// Is i_1 == 0 ?// fma.s1 FR_r_cubed = FR_rsq, FR_r, f0 nop.i 999 ;;}{ .mfi nop.m 999//// c = C_hi - r// Load C_1// fma.s1 FR_c = FR_c, f1, FR_C_lo nop.i 999}{ .mfi nop.m 999//// if i_1 ==0: poly = r_cube * poly + c// else poly = FR_rsq * poly////(p10) fms.s1 FR_Input_X = f0, f1, FR_Input_X(p10) fms.s1 FR_prelim = f0, f1, FR_prelim nop.i 999 ;;}{ .mfi nop.m 999//// if i_1 ==0: Result = r// else Result = 1.0//(p11) fma.s1 FR_poly = FR_r_cubed, FR_poly, FR_c nop.i 999 ;;}{ .mfi nop.m 999(p12) fma.s1 FR_poly = FR_rsq, FR_poly, f0 nop.i 999 ;;}{ .mfi nop.m 999//// if i_0 !=0: Result = -Result//(p9) fma.s1 FR_Input_X = FR_prelim, f1, FR_poly}{ .mfb nop.m 999(p10) fms.s1 FR_Input_X = FR_prelim, f1, FR_poly//// if i_0 == 0: Result = Result + poly// else Result = Result - poly// br.ret.sptk b0 ;;}SINCOS_SMALL_R:{ .mii nop.m 999 extr.u GR_i_1 = GR_N_Inc, 0, 1 ;;////// Compare both i_1 and i_0 with 0.// if i_1 == 0, set p9.// if i_0 == 0, set p11.// cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;}{ .mfi nop.m 999 fma.s1 FR_rsq = FR_r, FR_r, f0 extr.u GR_i_0 = GR_N_Inc, 1, 1 ;;}{ .mfi nop.m 999//// Z = Z * FR_rsq//(p10) fnma.s1 FR_c = FR_c, FR_r, f0 cmp.eq.unc p11, p12 = 0x0, GR_i_0};;// ******************************************************************// ******************************************************************// ******************************************************************// r and c have been computed.// We know whether this is the sine or cosine routine.// Make sure ftz mode is set - should be automatic when using wre// |r| < 2**(-3)//// Set table_ptr1 to beginning of constant table.// Get [i_0,i_1] - two lsb of N_fix_gr.//{ .mmi nop.m 999 addl GR_Table_Base = @ltoff(FSINCOS_CONSTANTS#), gp nop.i 999};;{ .mmi ld8 GR_Table_Base = [GR_Table_Base] nop.m 999 nop.i 999};;//// Set table_ptr1 to point to S_5.// Set table_ptr1 to point to C_5.// Compute FR_rsq = r * r//{ .mfi(p9) add GR_Table_Base = 672, GR_Table_Base(p10) fmerge.s FR_r = f1, f1(p10) add GR_Table_Base = 592, GR_Table_Base ;;}//// Set table_ptr1 to point to S_5.// Set table_ptr1 to point to C_5.//{ .mmi(p9) ldfe FR_S_5 = [GR_Table_Base], -16 ;;//// if (i_1 == 0) load S_5// if (i_1 != 0) load C_5//(p9) ldfe FR_S_4 = [GR_Table_Base], -16 nop.i 999 ;;}{ .mmf(p10) ldfe FR_C_5 = [GR_Table_Base], -16//// Z = FR_rsq * FR_rsq//(p9) ldfe FR_S_3 = [GR_Table_Base], -16//// Compute FR_rsq = r * r// if (i_1 == 0) load S_4// if (i_1 != 0) load C_4// fma.s1 FR_Z = FR_rsq, FR_rsq, f0 ;;}//// if (i_1 == 0) load S_3// if (i_1 != 0) load C_3//{ .mmi(p9) ldfe FR_S_2 = [GR_Table_Base], -16 ;;//// if (i_1 == 0) load S_2// if (i_1 != 0) load C_2//(p9) ldfe FR_S_1 = [GR_Table_Base], -16 nop.i 999}{ .mmi(p10) ldfe FR_C_4 = [GR_Table_Base], -16 ;;(p10) ldfe FR_C_3 = [GR_Table_Base], -16 nop.i 999 ;;}{ .mmi(p10) ldfe FR_C_2 = [GR_Table_Base], -16 ;;(p10) ldfe FR_C_1 = [GR_Table_Base], -16 nop.i 999}{ .mfi nop.m 999//// if (i_1 != 0):// poly_lo = FR_rsq * C_5 + C_4// poly_hi = FR_rsq * C_2 + C_1//(p9) fma.s1 FR_Z = FR_Z, FR_r, f0 nop.i 999 ;;}{ .mfi nop.m 999//// if (i_1 == 0) load S_1// if (i_1 != 0) load C_1//(p9) fma.s1 FR_poly_lo = FR_rsq, FR_S_5, FR_S_4 nop.i 999}{ .mfi nop.m 999//// c = -c * r// dummy fmpy's to flag inexact.//(p9) fma.d.s1 FR_S_4 = FR_S_4, FR_S_4, f0 nop.i 999 ;;}{ .mfi nop.m 999//// poly_lo = FR_rsq * poly_lo + C_3// poly_hi = FR_rsq * poly_hi// fma.s1 FR_Z = FR_Z, FR_rsq, f0 nop.i 999 ;;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -