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

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

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

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

In the zerooperand form, the instruction subtracts ST(0) from ST(1), writes the result to ST(1), and pops thestack. In the two-operand form, both source operands are located in stack registers. The instructionsubtracts the second operand from the first operand, writes the result to the first operand, and pops thestack.The FISUB instruction reads a 16-bit or 32-bit integer value from memory, converts it to the doubleextended-precision format, subtracts it from ST(0), and writes the result to ST(0).The FSUBR and FSUBRP instructions perform the same operations as FSUB and FSUBP,respectively, except that the source operands are reversed.

Instead of subtracting the second operandfrom the first operand, FSUBR and FSUBRP subtract the first operand from the second operand.Multiplication• FMUL—Floating-Point Multiply• FMULP—Floating-Point Multiply and Pop• FIMUL—Floating-Point Integer MultiplyThe FMUL instruction has three forms. One form of the instruction multiplies two double-extendedprecision floating-point values located in ST(0) and another floating-point stack register and leaves theproduct in ST(0). The second form multiplies two double-extended precision floating-point valueslocated in ST(0) and another floating-point stack destination register and leaves the product in thedestination register.

The third form converts a floating-point value in a specified memory location todouble-extended-precision format, multiplies the result by the value in ST(0) and writes the product toST(0).The FMULP instruction syntax is similar to the form of FMUL described in the previous paragraph.This instruction pops the floating-point register stack after performing the multiplication operation.This instruction cannot take a memory operand.The FIMUL instruction reads a 16-bit or 32-bit integer value from memory, converts it to the doubleextended-precision format, multiplies ST(0) by the memory operand, and writes the result to ST(0).Division• FDIV—Floating-Point Divide• FDIVP—Floating-Point Divide and Pop• FIDIV—Floating-Point Integer Divide268x87 Floating-Point Programming24592—Rev.

3.13—July 2007•••AMD64 TechnologyFDIVR—Floating-Point Divide ReverseFDIVRP—Floating-Point Divide Reverse and PopFIDIVR—Floating-Point Integer Divide ReverseThe FDIV instruction syntax has forms that include one or two source explicit operands that may besingle-precision or double-precision floating-point values or 16-bit or 32-bit integer values. In the oneoperand form, the instruction reads a value from memory, divides ST(0) by the memory operand, andwrites the result to ST(0). In the two-operand form, both source operands are located in stack registers.The instruction divides the first operand by the second operand and writes the result to the firstoperand.The FDIVP instruction syntax has forms that include zero or two explicit source operands. In the zerooperand form, the instruction divides ST(1) by ST(0), writes the result to ST(1), and pops the stack. Inthe two-operand form, both source operands are located in stack registers.

The instruction divides thefirst operand by the second operand, writes the result to the first operand, and pops the stack.The FIDIV instruction reads a 16-bit or 32-bit integer value from memory, converts it to the doubleextended-precision format, divides ST(0) by the memory operand, and writes the result to ST(0).The FDIVR and FDIVRP instructions perform the same operations as FDIV and FDIVP, respectively,except that the source operands are reversed.

Instead of dividing the first operand by the secondoperand, FDIVR and FDIVRP divide the second operand by the first operand.Change Sign• FABS—Floating-Point Absolute Value• FCHS—Floating-Point Change SignThe FABS instruction changes the top-of-stack value, ST(0), to its absolute value by clearing its signbit to 0.

The top-of-stack value is always positive following execution of the FABS instruction. TheFCHS instruction complements the sign bit of ST(0). For example, if ST(0) was +0.0 before theexecution of FCHS, it is changed to -0.0.Round• FRNDINT—Floating-Point Round to IntegerThe FRNDINT instruction rounds the top-of-stack value, ST(0), to an integer value, although the valueremains in double-extended-precision floating-point format.

Rounding takes place according to thesetting of the rounding control (RC) field in the x87 control word.Partial Remainder• FPREM—Floating-Point Partial Remainder• FPREM1—Floating-Point Partial RemainderThe FPREM instruction returns the remainder obtained by dividing ST(0) by ST(1) and stores it inST(0). If the exponent difference between ST(0) and ST(1) is less than 64, all integer bits of thex87 Floating-Point Programming269AMD64 Technology24592—Rev. 3.13—July 2007quotient are calculated, guaranteeing that the remainder returned is less in magnitude that the divisor inST(1).

If the exponent difference is equal to or greater than 64, only a subset of the integer quotientbits, numbering between 32 and 63, are calculated and a partial remainder is returned. FPREM can berepeated on a partial remainder until reduction is complete. It can be used to bring the operands oftranscendental functions into their proper range.

FPREM is supported for software written for earlyx87 coprocessors. Unlike the FPREM1 instruction, FPREM does not calculate the partial remainder asspecified in IEEE Standard 754.The FPREM1 instruction works like FPREM, except that the FPREM1 quotient is rounded usinground-to-nearest mode, whereas FPREM truncates the quotient.Square Root• FSQRT—Floating-Point Square RootThe FSQRT instruction replaces the contents of the top-of-stack, ST(0), with its square root.6.4.5 Transcendental FunctionsThe transcendental instructions compute trigonometric functions, inverse trigonometric functions,logarithmic functions, and exponential functions.Trigonometric Functions• FSIN—Floating-Point Sine• FCOS—Floating-Point Cosine• FSINCOS—Floating-Point Sine and Cosine• FPTAN—Floating-Point Partial Tangent• FPATAN—Floating-Point Partial ArctangentThe FSIN instruction replaces the contents of ST(0) (in radians) with its sine.The FCOS instruction replaces the contents of ST(0) (in radians) with its cosine.The FSINCOS instruction computes both the sine and cosine of the contents of ST(0) (in radians) andwrites the sine to ST(0) and pushes the cosine onto the stack.

Frequently, a piece of code that needs tocompute the sine of an argument also needs to compute the cosine of that same argument. In suchcases, use the FSINCOS instruction to compute both functions concurrently, which is faster than usingseparate FSIN and FCOS instructions.The FPTAN instruction replaces the contents of the ST(0) (in radians), with its tangent, in radians, andpushes the value 1.0 onto the stack.The FPATAN instruction computes θ = arctan (Y/X), in which X is located in ST(0) and Y in ST(1).The result, θ, is written over Y in ST(1), and the stack is popped.FSIN, FCOS, FSINCOS, and FPTAN are architecturally restricted in their argument range. Onlyarguments with a magnitude of less than 263 can be evaluated.

If the argument is out of range, the C2270x87 Floating-Point Programming24592—Rev. 3.13—July 2007AMD64 Technologycondition-code bit in the x87 status word is set to 1, and the argument is returned as the result. Ifsoftware detects an out-of-range argument, the FPREM or FPREM1 instruction can be used to reducethe magnitude of the argument before using the FSIN, FCOS, FSINCOS, or FPTAN instruction again.Logarithmic Functions• F2XM1—Floating-Point Compute 2x–1• FSCALE—Floating-Point Scale• FYL2X—Floating-Point y * log2x• FYL2XP1—Floating-Point y * log2(x +1)The F2XM1 instruction computes Y = 2X – 1. X is located in ST(0) and must fall between –1 and +1.Y replaces X in ST(0).

If ST(0) is out of range, the instruction returns an undefined result but no x87status-word exception bits are affected.The FSCALE instruction replaces ST(0) with ST(0) times 2n, where n is the value in ST(1) truncatedto an integer. This provides a fast method of multiplying by integral powers of 2.The FYL2X instruction computes Z = Y * log2 X.

X is located in ST(0) and Y is located in ST(1). Xmust be greater than 0. The result, Z, replaces Y in ST(1), which becomes the new top-of-stackbecause X is popped off the stack.The FYL2XP1 instruction computes Z = Y * log2(X + 1). X located in ST(0) and must be in the range0 < |X| < (1 – 2½ / 2). Y is taken from ST(1). The result, Z, replaces Y in ST(1), which becomes the newtop-of-stack because X is popped off the stack.Accuracy of Transcendental Results. x87 computations are carried out in double-extended-precision format, so that the transcendental functions provide results accurate to within one unit in thelast place (ulp) for each of the floating-point data types.Argument Reduction Using Pi. The FPREM and FPREM1 instructions can be used to reduce anargument of a trigonometric function by a multiple of Pi.

The following example shows a reduction by2π:sin(n*2π + x) = sin(x) for all integral nIn this example, the range is 0 ≤ x < 2π in the case of FPREM or -π ≤ x ≤ π in the case of FPREM1.Negative arguments are reduced by repeatedly subtracting –2π. See “Partial Remainder” on page 269for details of the instructions.6.4.6 Compare and TestThe compare-and-test instructions set and clear flags in the rFLAGS register to indicate therelationship between two operands (less, equal, greater, or unordered).Floating-Point Ordered Compare• FCOM—Floating-Point Comparex87 Floating-Point Programming271AMD64 Technology••••24592—Rev. 3.13—July 2007FCOMP—Floating-Point Compare and PopFCOMPP—Floating-Point Compare and Pop TwiceFCOMI—Floating-Point Compare and Set FlagsFCOMIP—Floating-Point Compare and Set Flags and PopThe FCOM instruction syntax has forms that include zero or one explicit source operands.

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

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

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

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