Volume 5 64-Bit Media and x87 Floating-Point Instructions (794099), страница 44
Текст из файла (страница 44)
If FXSAVE is executedin 64-bit mode, the 64-bit format is used, otherwise the 32-bit format is used. When the 64-bit format isused, if the operand-size is 64-bit, FXSAVE saves the x87 pointer registers as offset64, otherwise itsaves them as sel:offset32. For more details about the memory format used by FXSAVE, see “SavingMedia and x87 Processor State” in Volume 2.If the fast-FXSAVE/FXRSTOR (FFXSR) feature is enabled in EFER, FXSAVE does not save theXMM registers (XMM0-XMM15) when executed in 64-bit mode at CPL 0. MXCSR is saved whetherfast-FXSAVE/FXRSTOR is enabled or not.
Software can use CPUID to determine whether the fastFXSAVE/FXRSTOR feature is available. (See “CPUID” in Volume 3.)If the operating-system FXSAVE/FXRSTOR support bit (OSFXSR) of CR4 is cleared to 0, FXSAVEdoes not save the image of XMM0–XMM15 or MXCSR. For details about the CR4.OSFXSR bit, see“FXSAVE and FXRSTOR Instructions” in Volume 2.MnemonicFXSAVE mem512envOpcode0F AE /0DescriptionSaves XMM, MMX™, and x87 state to 512-bytememory location.Related InstructionsFINIT, FNSAVE, FRSTOR, FSAVE, FXRSTOR, LDMXCSR, STMXCSRrFLAGS AffectedNoneInstruction ReferenceFXSAVE327AMD64 Technology26569—Rev.
3.08—July 2007MXCSR Flags AffectedNoneExceptionsExceptionRealVirtual8086 ProtectedCause of ExceptionXXXThe FXSAVE/FXRSTOR instructions are notsupported, as indicated by bit 24 of CPUID function0000_0001h or function 8000_0001h.XXXThe emulate bit (EM) of CR0 was set to 1.Device not available,#NMXXXThe task-switch bit (TS) of CR0 was set to 1.Stack, #SSXXXA memory address exceeded the stack segment limit,or was non-canonical.XXXA memory address exceeded the data segment limitor was non-canonical.XA null data segment was used to reference memory.XThe destination operand was in a non-writablesegment.XXThe memory operand was not aligned on a 16-byteboundary.XXA page fault resulted from the execution of theinstruction.Invalid opcode, #UDGeneral protection, #GPXPage fault, #PF328FXSAVEInstruction Reference26569—Rev. 3.08—July 2007FXTRACTAMD64 TechnologyFloating-Point Extract Exponent and SignificandExtracts the exponent and significand portions of the floating-point value in ST(0), stores the exponentin ST(0), and then pushes the significand onto the x87 register stack.
After this operation, the newST(0) contains a real number with the sign and value of the original significand and an exponent of3FFFh (biased value for true exponent of zero), and ST(1) contains a real number that is the value ofthe original value’s true (unbiased) exponent.The FXTRACT instruction is useful for converting a double-extended-precision number to its decimalrepresentation.If the zero-divide-exception mask (ZM) bit of the x87 control word is set to 1 and the source value is±0, then the instruction stores ±zero in ST(0) and an exponent value of –∞ in register ST(1).MnemonicOpcodeFXTRACTD9 F4DescriptionExtract the exponent and significand of ST(0), store theexponent in ST(0), and push the significand onto the x87register stack.Related InstructionsFABS, FPREM, FRNDINT, FCHSrFLAGS AffectedNonex87 Condition Codex87 Condition CodeValueC0UDescription0x87 stack underflow, if an x87 register stack fault was detected.1x87 stack overflow, if an x87 register stack fault was detected.C1C2UC3UNote: A flag set to 1 or cleared to 0 is M (modified).
Unaffected flags are blank. Undefined flags are U.Instruction ReferenceFXTRACT329AMD64 Technology26569—Rev. 3.08—July 2007ExceptionsVirtual8086 ProtectedExceptionRealCause of ExceptionDevice not available,#NMXXXThe emulate bit (EM) or the task switch bit (TS) of thecontrol register (CR0) is set to 1.x87 floating-pointexception pending,#MFXXXAn unmasked x87 floating-point exception was pending.x87 Floating-Point Exception Generated, #MFInvalid-operationexception (IE)XXXA source operand was an SNaN value or an unsupportedformat.XXXAn x87 stack underflow occurred.XXXAn x87 stack overflow occurred.Denormalizedoperand exception(DE)XXXA source operand was a denormal value.Zero-divideexception (ZE)XXXThe source operand was ±zero.Invalid-operationexception (IE) withstack fault (SF)330FXTRACTInstruction Reference26569—Rev.
3.08—July 2007AMD64 TechnologyFloating-Point y ∗ Log2 (x)FYL2XComputes (ST(1) ∗ log2(ST(0))), stores the result in ST(1), and pops the x87 register stack. The valuein ST(0) must be greater than zero.If the zero-divide-exception mask (ZM) bit in the x87 control word is set to 1 and ST(0) contains±zero, the instruction returns ∞ with the opposite sign of the value in register ST(1).MnemonicFYL2XOpcodeD9 F1DescriptionReplace ST(1) with ST(1) ∗ log2(ST(0)), then pop the x87register stack.Related InstructionsFYL2XP1, F2XM1rFLAGS AffectedNonex87 Condition Codex87 Condition CodeValueC0UDescription0No precision exception occurred.0x87 stack underflow, if an x87 register stack fault was detected.0Result was rounded down, if a precision exception was detected.1Result was rounded up, if a precision exception was detected.C1C2UNote: A flag set to 1 or cleared to 0 is M (modified).
Unaffected flags are blank. Undefined flags are U.Instruction ReferenceFYL2X331AMD64 Technology26569—Rev. 3.08—July 2007ExceptionsVirtual8086 ProtectedExceptionRealCause of ExceptionDevice not available,#NMXXXThe emulate bit (EM) or the task switch bit (TS) of thecontrol register (CR0) was set to 1.x87 floating-pointexception pending,#MFXXXAn unmasked x87 floating-point exception was pending.x87 Floating-Point Exception Generated, #MFXXXA source operand was an SNaN value or an unsupportedformat.XXXThe source operand in ST(0) was a negative finite value(not -zero).XXXThe source operand in ST(0) was +1 and the sourceoperand in ST(1) was ±infinity.XXXThe source operand in ST(0) was -infinity.XXXThe source operand in ST(0) was ±zero or ±infinity and thesource operand in ST(1) was ±zero.Invalid-operationexception (IE) withstack fault (SF)XXXAn x87 stack underflow occurred.Denormalizedoperand exception(DE)XXXA source operand was a denormal value.Zero-divideexception (ZE)XXXThe source operand in ST(0) was ±zero and the sourceoperand in ST(1) was a finite value.Overflow exception(OE)XXXA rounded result was too large to fit into the format of thedestination operand.Underflow exception(UE)XXXA rounded result was too small to fit into the format of thedestination operand.Precision exception(PE)XXXA result could not be represented exactly in the destinationformat.Invalid-operationexception (IE)332FYL2XInstruction Reference26569—Rev.
3.08—July 2007AMD64 TechnologyFloating-Point y ∗ Log2 (x+1)FYL2XP1Computes (ST(1) ∗ log2(ST(0) + 1.0)), stores the result in ST(1), and pops the x87 register stack. Thevalue in ST(0) must be in the range sqrt(1/2)–1 to sqrt(2)-1.MnemonicOpcodeFYL2XP1D9 F9DescriptionReplace ST(1) with ST(1) ∗ log2(ST(0) + 1.0), then pop thex87 register stack.Related InstructionsFYL2X, F2XM1rFLAGS AffectedNonex87 Condition Codex87 Condition CodeValueC0UC1Description0x87 stack underflow, if an x87 register stack fault was detected.0Result was rounded down, if a precision exception was detected.1Result was rounded up, if a precision exception was detected.C2UC3UNote: A flag set to 1 or cleared to 0 is M (modified). Unaffected flags are blank.
Undefined flags are U.Instruction ReferenceFYL2XP1333AMD64 Technology26569—Rev. 3.08—July 2007ExceptionsVirtual8086 ProtectedExceptionRealCause of ExceptionDevice not available,#NMXXXThe emulate bit (EM) or the task switch bit (TS) of thecontrol register (CR0) was set to 1.x87 floating-pointexception pending,#MFXXXAn unmasked x87 floating-point exception was pending.x87 Floating-Point Exception Generated, #MFXXXA source operand was an SNaN or unsupported format.XXXThe source operand in ST(0) was ±0 and the sourceoperand in ST(1) was ±infinity.Invalid-operationexception (IE) withstack fault (SF)XXXAn x87 stack underflow occurred.Denormalizedoperand exception(DE)XXXA source operand was a denormal value.Overflow exception(OE)XXXA rounded result was too large to fit into the format of thedestination operand.Underflow exception(UE)XXXA rounded result was too small to fit into the format of thedestination operand.Precision exception(PE)XXXA result could not be represented exactly in the destinationformat.Invalid-operationexception (IE)334FYL2XP1Instruction Reference26569—Rev.
3.08—July 2007AMD64 TechnologyAppendix A Recommended Substitutions for3DNow!™ InstructionsTable A-1 lists the deprecated 3DNow!™ instructions and the recommended substitutions.Table A-1. Substitutions for 3DNow!™ Instructions64-Bit 3DNow!™Instruction128-Bit SSEInstruction64-Bit MMX™InstructionFEMMSN/AEMMS (MMX)PAVGUSBPAVGBPAVGBPF2IDCVTTPS2DQNotesSSE and MMX™ instructions round according to thecurrent rounding mode; 3DNow!™ instructions alwaysround up.CVTTPS2DQ may be used if 16-bit result is notnecessary.PF2IWPFACCHADDPSPFADDADDPSPFCMPEQCMPPSPFCMPGECMPPSPFCMPGTCMPPSPFMAXMAXPSMAXPS may return -0.0.MINPS may return -0.0.PFMINMINPSPFMULMULPSPFNACCHSUBPSPFPNACCADDSUBPSADDSUBPS expects arguments in different positionsfrom PFPNACC.RCPSS may be used in conjunction with the NewtonRaphson algorithm.PFRCPPFRCPIT1See PFRCP.PFRCPIT2See PFRCP.PFRSQIT1See PFRSQRT.PFRSQRTRSQRTSS may be used in conjunction with theNewton-Raphson algorithm.PFSUBSUBPSSUBPS may be used.PFSUBRPI2FDCVTDQ2PSSSE instructions round according to the currentrounding mode; 3DNow! instructions always truncate.PI2FWPMULHW may be used if rounding is not necessary.PMULHRWPSWAPDPSHUFDRecommended Substitutions for 3DNow!™ Instructions335AMD64 Technology33626569—Rev.