📄 svr4fpu-if.s
字号:
ld [%l0], %f0 ! .. into the float register fsqrts %f0, %f2 ! .... have the fpu perform the operation st %f2, [%l1] ! .. save the result ld [%l1], %i0 ! .... and return it to caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Square (double)! Function: Calculate the Square of a double precision value! Calling: in0 = value! Returns: in0 = result! Convention: result = square_dp(value) ** !--------------------------------------------------------------------------square_dp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp, %l1 ! .. and temp st %i0, [%l0] ! .. get the callers value ld [%l0], %f0 ! .. into a float register fsqrtd %f0, %f2 ! .... have the fpu perform the operation st %f2, [%l1] ! .. save the result ld [%l1], %i0 ! .... and return it to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Add single precision! Function: Add two values! Calling: in0 = value1, in1 = value2! Returns: in0 = result! Convention: result = add_sp(value1,value2); !--------------------------------------------------------------------------add_sp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. and temp1 set temp, %l2 ! .. and temp st %i0, [%l0] ! .. get the users value1 st %i1, [%l1] ! .. and value2 ld [%l0], %f0 ! .. into the float registers ld [%l1], %f2 ! ...... fadds %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .... and return it to caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Add double precision ! Function: Add two 64 bit values! Calling: in0 = value1, in1 = value2! Returns: in0.1 = result! Convention: result = add_dp(value1,value2); !--------------------------------------------------------------------------add_dp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. and temp1 set temp, %l2 ! .. and temp st %i0, [%l0] ! .. get the user value1 st %i1, [%l1] ! .. get the user value2 ld [%l0], %f0 ! .. set them in float registers ld [%l1], %f2 ! .... both values faddd %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .... and return it to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Subtract Single Precision! Function: Subtract two single precision values from each other! Calling: in0 = Value1, in1 = value2! Returns: in0 = result! Convention: result = sub_sp(value1, value2);!--------------------------------------------------------------------------sub_sp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! set the address of the result holder set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fsubs %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Subtract Double Precision! Function: Subtract two double precision values! Calling: in0 = Value1, in1 = Value2! Returns: in0 = Result! Convention: Result = sub_dp(Value1,Value2);!--------------------------------------------------------------------------sub_dp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! set the address of the result holder set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fsubd %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Multiply Single Precision! Function: Multiply two single precision values! Calling: in0 = Value1, in1 = value2! Returns: in0 = Result! Convention: Result = mult_sp(Value1,Value2);!--------------------------------------------------------------------------mult_sp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. and temp1 set temp, %l2 ! .. and temp st %i0, [%l0] ! .. Get the callers value1 into temp2 st %i1, [%l1] ! .. Get the callers value2 into temp1 ld [%l0], %f0 ! .. then load Value1 ld [%l1], %f2 ! .. and Value2 fmuls %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .... and return it to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Multiply Double Precision! Function: Multiply two values and return the result! Calling: i0 = value1, i1 = value2! Returns: i0 = result! Convention: result = mul_dp(value1, value2); !--------------------------------------------------------------------------mult_dp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! set the address of the result holder set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fmuld %f0, %f2, %f4 ! .... have the fpu perform the operation st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Divide Single Precision! Function: Divide two value and return the result! Calling: i0 = value1, i1 = value2! Returns: i0 = result! Convention: result = div_sp(value1, value2); !--------------------------------------------------------------------------div_sp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register!-------! f4 = fdiv(f0,f2);! if ( (fsr && 0x000c000) == 0) /* see if Weitek fpu */! then fsr = 0; /* .. if so then clear the flags */!------- fdivs %f0, %f2, %f4 ! .... have the fpu perform the operation st %fsr, [%l0] ! .. copy the fsr into it ld [%l0], %l4 ! .... then into a register set 0x0c000, %l0 ! .. get the FPU Type mask and %l4, %l0, %l4 ! .... isolate the fpu type bne div_sp_done ! ...... exit if not a weitek (ie.. 0) fmovs %f3, %f3 ! .... code required by Weitekdiv_sp_done: st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Divide Double Precision! Function: Divide two value and return the result! Calling: i0 = value1, i1 = value2! Returns: i0 = result! Convention: result = div_dp(value1, value2); !--------------------------------------------------------------------------div_dp: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register!-------! f4 = fdiv(f0,f2);! if ( (fsr && 0x000c000) == 0) /* see if Weitek fpu */! then fsr = 0; /* .. if so then clear the flags */!------- fdivd %f0, %f2, %f4 ! .... have the fpu perform the operation st %fsr, [%l0] ! .. copy the fsr into it ld [%l0], %l4 ! .... then into a register set 0x0c000, %l0 ! .. get the FPU Type mask and %l4, %l0, %l4 ! .... isolate the fpu type bne div_dp_done ! ...... exit if not a weitek (ie.. 0) fmovs %f3, %f3 ! .... code required by Weitekdiv_dp_done: st %f4, [%l2] ! .. save the result ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!**************************************************************************!* Data Comparison Functions *!**************************************************************************!--------------------------------------------------------------------------! Name: Compare Single Precision Values! Function: Compare two values and return the FSR flags! Calling: i0 = value1, i2 = value2! Returns: i0 = flags! Convention: flagsresult = cmp_s(value1, value2);!--------------------------------------------------------------------------cmp_s: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fcmps %f0, %f2 ! .... have the fpu perform the operation nop ! .. delay st %fsr, [%l2] ! .. get the contents of the FSR register ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Compare double Precision Values! Function: Compare two values and return the FSR flags! Calling: i0 = value1, i2 = value2! Returns: i0 = flags! Convention: flagsresult = cmp_d(value1, value2);!--------------------------------------------------------------------------cmp_d: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fcmpd %f0, %f2 ! .... have the fpu perform the operation nop ! .. delay st %fsr, [%l2] ! .. get the contents of the FSR register ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Compare Single to EXtended precision values! Function: Compare two values and return the FSR flags! Warning: ** UNIMPLEMENTED INSTRUCTION TRAP (EXTENDED PRECISION) ** ! Calling: i0 = value1, i2 = value2! Returns: i0 = flags! Convention: flagsresult = cmp_s_ex(value1, value2);!--------------------------------------------------------------------------cmp_s_ex: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fcmpes %f0, %f2 ! .... have the fpu perform the operation nop ! .. delay st %fsr, [%l2] ! .. get the contents of the FSR register ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window!--------------------------------------------------------------------------! Name: Compare Double to EXtended precision values! Function: Compare two values and return the FSR flags! Warning: ** UNIMPLEMENTED INSTRUCTION TRAP (EXTENDED PRECISION) ** ! Calling: i0 = value1, i2 = value2! Returns: i0 = flags! Convention: flagsresult = cmp_d_ex(value1, value2);!--------------------------------------------------------------------------cmp_d_ex: save %sp, -88, %sp ! save the registers, stack set temp2, %l0 ! .. get the address of temp2 set temp1, %l1 ! .. get the address of temp1 (holder) set temp, %l2 ! .. get the address of temp st %i0, [%l0] ! .. save the value in memory st %i1, [%l1] ! .. save the value in memory ld [%l0], %f0 ! .. load the fpu register ld [%l1], %f2 ! .. load the fpu register fcmped %f0, %f2 ! .... have the FPU do it nop ! .. delay st %fsr, [%l2] ! .. get the contents of the FSR register ld [%l2], %i0 ! .. return the result to the caller ret ! Delayed return (get user ret addr) restore ! .. restore the frame window
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -