This preview shows page 1. Sign up to view the full content.
Unformatted text preview: remaindercomputation loop, a higherpriority interrupting routine that needs the FPU can force a context switch inbetween the instructions in the loop.) An important use of the FPREM instruction is to reduce the arguments of periodic functions. When reduction is complete, the instruction stores the three leastsignificant bits of the quotient in the C3, C1, and C0 flags of the FPU status word. This information is important in argument reduction for the tangent function (using a modulus of /4), because it locates the original angle in the correct one of eight sectors of the unit circle. This instruction's operation is the same in non64bit modes and 64bit mode. Operation
D exponent(ST(0)) exponent(ST(1)); IF D < 64 THEN Q Integer(TruncateTowardZero(ST(0) / ST(1))); ST(0) ST(0) (ST(1) Q); C2 0; C0, C3, C1 LeastSignificantBits(Q); (* Q2, Q1, Q0 *) ELSE C2 1; N An implementationdependent number between 32 and 63; QQ Integer(TruncateTowardZero((ST(0) / ST(1)) / 2(D  N))); ST(0) ST(0) (ST(1) QQ 2(D  N)); FI; 3358 Vol. 2 INSTRUCTION SET REFERENCE, AM FPU Flags Affected
C0 C1 C2 C3 Set to bit 2 (Q2) of the quotient. Set to 0 if stack underflow occurred; otherwise, set to least significant bit of quotient (Q0). Set to 0 if reduction complete; set to 1 if incomplete. Set to bit 1 (Q1) of the quotient. FloatingPoint Exceptions
#IS #IA #D #U Stack underflow occurred. Source operand is an SNaN value, modulus is 0, dividend is , or unsupported format. Source operand is a denormal value. Result is too small for destination format. Protected Mode Exceptions
#NM MF CR0.EM[bit 2] or CR0.TS[bit 3] = 1. If there is a pending x87 FPU exception. RealAddress Mode Exceptions
Same exceptions as in Protected Mode. Virtual8086 Mode Exceptions
Same exceptions as in Protected Mode. Compatibility Mode Exceptions
Same exceptions as in Protected Mode. 64Bit Mode Exceptions
Same exceptions as in Protected Mode. Vol. 2 3359 INSTRUCTION SET REFERENCE, AM FPREM1Partial Remainder
Opcode D9 F5 Instructio n FPREM1 64Bit Mode Valid Compat/ Leg Mode Valid Description Replace ST(0) with the IEEE remainder obtained from dividing ST(0) by ST(1). Description
Computes the IEEE remainder obtained from dividing the value in the ST(0) register (the dividend) by the value in the ST(1) register (the divisor or modulus), and stores the result in ST(0). The remainder represents the following value: Remainder ST(0)  (Q ST(1)) Here, Q is an integer value that is obtained by rounding the floatingpoint number quotient of [ST(0) / ST(1)] toward the nearest integer value. The magnitude of the remainder is less than or equal to half the magnitude of the modulus, unless a partial remainder was computed (as described below). This instruction produces an exact result; the precision (inexact) exception does not occur and the rounding control has no effect. The following table shows the results obtained when computing the remainder of various classes of numbers, assuming that underflow does...
View
Full
Document
This note was uploaded on 10/01/2013 for the course CPE 103 taught by Professor Watlins during the Winter '11 term at Mississippi State.
 Winter '11
 Watlins

Click to edit the document details