Главная » Просмотр файлов » Volume 1 Application Programming

Volume 1 Application Programming (794095), страница 69

Файл №794095 Volume 1 Application Programming (Intel and AMD manuals) 69 страницаVolume 1 Application Programming (794095) страница 692019-04-28СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 69)

In the zerooperand form, the instruction compares ST(1) with ST(0) and writes the x87 status-word conditioncodes accordingly. In the one-operand form, the instruction reads a 32-bit or 64-bit value frommemory, compares it with ST(0), and writes the x87 condition codes accordingly.The FCOMP instruction performs the same operation as FCOM but also pops ST(0) after writing thecondition codes.The FCOMPP instruction performs the same operation as FCOM but also pops both ST(0) and ST(1).FCOMPP can be used to initialize the x87 stack at the end of an x87 procedure by removing tworegisters of preloaded data from the stack.The FCOMI instruction compares the contents of ST(0) with the contents of another stack register andwrites the ZF, PF, and CF flags in the rFLAGS register as shown in Table 6-14.

If no source isspecified, ST(0) is compared to ST(1). If ST(0) or the source operand is a NaN or in an unsupportedformat, the flags are set to indicate an unordered condition.The FCOMIP instruction performs the same comparison as FCOMI but also pops ST(0) after writingthe rFLAGS bits.Table 6-14. rFLAGS Values for FCOMI InstructionFlagST(0) > ST(i) ST(0) < ST(i) ST(0) = ST(i)UnorderedZF0011PF0001CF0101For comparison-based branches, the combination of FCOMI and FCMOVcc is faster than the classicalmethod of using FxSTSW AX to copy condition codes through the AX register to the rFLAGS register,where they can provide branch direction for conditional operations.The FCOMx instructions perform ordered compares, as opposed to the FUCOMx instructions.

See thedescription of ordered vs. unordered compares immediately below.Floating-Point Unordered Compare••••FUCOM—Floating-Point Unordered CompareFUCOMP—Floating-Point Unordered Compare and PopFUCOMPP—Floating-Point Unordered Compare and Pop TwiceFUCOMI—Floating-Point Unordered Compare and Set Flags272x87 Floating-Point Programming24592—Rev.

3.13—July 2007•AMD64 TechnologyFUCOMIP—Floating-Point Unordered Compare and Set Flags and PopThe FUCOMx instructions perform the same operations as the FCOMx instructions, except that theFUCOMx instructions generate an invalid-operation exception (IE) only if any operand is anunsupported data type or a signaling NaN (SNaN), whereas the ordered-compare FCOMx instructionsgenerate an invalid-operation exception if any operand is an unsupported data type or any type of NaN.For a description of NaNs, see “Number Representation” on page 254.Integer Compare• FICOM—Floating-Point Integer Compare• FICOMP—Floating-Point Integer Compare and PopThe FICOM instruction reads a 16-bit or 32-bit integer value from memory, compares it with ST(0),and writes the condition codes in the same way as the FCOM instruction.The FICOMP instruction performs the same operations as FICOM but also pops ST(0).Test• FTST—Floating-Point Test with ZeroThe FTST instruction compares ST(0) with zero and writes the condition codes in the same way as theFCOM instruction.Classify• FXAM—Floating-Point ExamineThe FXAM instruction determines the type of value in ST(0) and sets the condition codes accordingly,as shown in Table 6-15.Table 6-15.

Condition-Code Settings for FXAMC3C2C0C11Meaning0000+unsupported0001-unsupported0010+NAN0011-NAN0100+normal0101-normal0110+infinity0111-infinity1000+01001-0Note:1. C1 is the sign of ST(0).x87 Floating-Point Programming273AMD64 Technology24592—Rev. 3.13—July 2007Table 6-15. Condition-Code Settings for FXAM (continued)C3C2C0C11Meaning1010+empty1011-empty1100+denormal1101-denormalNote:1.

C1 is the sign of ST(0).6.4.7 Stack ManagementThe stack management instructions move the x87 top-of-stack pointer (TOP) and clear the contents ofstack registers.Stack Control••FDECSTP—Floating-Point Decrement Stack-Top PointerFINCSTP—Floating-Point Increment Stack-Top PointerThe FINCSTP and FDECSTP instructions increment and decrement, respectively, the TOP, modulo-8.Neither the x87 tag word nor the contents of the floating-point stack itself is updated.Clear State• FFREE—Free Floating-Point RegisterThe FFREE instruction frees a specified stack register by setting the x87 tag-word bits for the registerto all 1s, indicating empty. Neither the stack-register contents nor the stack pointer is modified by thisinstruction.6.4.8 No OperationThis instruction uses processor cycles but generates no result.•FNOP—Floating-Point No OperationThe FNOP instruction has no operands and writes no result.

Its purpose is simply to delay execution ofa sequence of instructions.6.4.9 ControlThe control instructions are used to initialize, save, and restore x87 processor state and to manage x87exceptions.Initialize• FINIT—Floating-Point Initialize• FNINIT—Floating-Point No-Wait Initialize274x87 Floating-Point Programming24592—Rev. 3.13—July 2007AMD64 TechnologyThe FINIT and FNINIT instructions set all bits in the x87 control-word, status-word, and tag wordregisters to their default values. Assemblers issue FINIT as an FWAIT instruction followed by anFNINIT instruction. Thus, FINIT (but not FNINIT) reports pending unmasked x87 floating-pointexceptions before performing the initialization.Both FINIT and FNINIT write the control word with its initialization value, 037Fh, which specifiesround-to-nearest, all exceptions masked, and double-extended-precision.

The tag word indicates thatthe floating-point registers are empty. The status word and the four condition-code bits are cleared to 0.The x87 pointers and opcode state (“Pointers and Opcode State” on page 247) are all cleared to 0.The FINIT instruction should be used when pending x87 floating-point exceptions are being reported(unmasked).

The no-wait instruction, FNINIT, should be used when pending x87 floating-pointexceptions are not being reported (masked).Wait for Exceptions• FWAIT or WAIT—Wait for Unmasked x87 Floating-Point ExceptionsThe FWAIT and WAIT instructions are synonyms. The instruction forces the processor to test for andhandle any pending, unmasked x87 floating-point exceptions.Clear Exceptions• FCLEX—Floating-Point Clear Flags• FNCLEX—Floating-Point No-Wait Clear FlagsThese instructions clear the status-word exception flags, stack-fault flag, and busy flag. They leave thefour condition-code bits undefined.Assemblers issue FCLEX as an FWAIT instruction followed by an FNCLEX instruction. Thus,FCLEX (but not FNCLEX) reports pending unmasked x87 floating-point exceptions before clearingthe exception flags.The FCLEX instruction should be used when pending x87 floating-point exceptions are being reported(unmasked).

The no-wait instruction, FNCLEX, should be used when pending x87 floating-pointexceptions are not being reported (masked).Save and Restore x87 Control Word• FLDCW—Floating-Point Load x87 Control Word• FSTCW—Floating-Point Store Control Word• FNSTCW—Floating-Point No-Wait Store Control WordThese instructions load or store the x87 control-word register as a 2-byte value from or to a memorylocation.The FLDCW instruction loads a control word. If the loaded control word unmasks any pending x87floating-point exceptions, these exceptions are reported when the next non-control x87 or 64-bit mediainstruction is executed.x87 Floating-Point Programming275AMD64 Technology24592—Rev.

3.13—July 2007Assemblers issue FSTCW as an FWAIT instruction followed by an FNSTCW instruction. Thus,FSTCW (but not FNSTCW) reports pending unmasked x87 floating-point exceptions before storingthe control word.The FSTCW instruction should be used when pending x87 floating-point exceptions are beingreported (unmasked). The no-wait instruction, FNSTCW, should be used when pending x87 floatingpoint exceptions are not being reported (masked).Save x87 Status Word• FSTSW—Floating-Point Store Status Word• FNSTSW—Floating-Point No-Wait Store Status WordThese instructions store the x87 status word either at a specified 2-byte memory location or in the AXregister. The second form, FxSTSW AX, is used in older code to copy condition codes through the AXregister to the rFLAGS register, where they can be used for conditional branching using generalpurpose instructions.

However, the combination of FCOMI and FCMOVcc provides a faster method ofconditional branching.Assemblers issue FSTSW as an FWAIT instruction followed by an FNSTSW instruction. Thus,FSTSW (but not FNSTSW) reports pending unmasked x87 floating-point exceptions before storingthe status word.The FSTSW instruction should be used when pending x87 floating-point exceptions are beingreported (unmasked).

The no-wait instruction, FNSTSW, should be used when pending x87 floatingpoint exceptions are not being reported (masked).Save and Restore x87 Environment• FLDENV—Floating-Point Load x87 Environment• FNSTENV—Floating-Point No-Wait Store Environment• FSTENV—Floating-Point Store EnvironmentThese instructions load or store the entire x87 environment (non-data processor state) as a 14-byte or28-byte block, depending on effective operand size, from or to memory.When executing FLDENV, any exception flags are set in the new status word, and these exceptions areunmasked in the control word, a floating-point exception occurs when the next non-control x87 or 64bit media instruction is executed.Assemblers issue FSTENV as an FWAIT instruction followed by an FNSTENV instruction.

Характеристики

Тип файла
PDF-файл
Размер
2,24 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6417
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее