FPU INSTRUCTIONS - PowerPoint PPT Presentation

About This Presentation
Title:

FPU INSTRUCTIONS

Description:

TUC-N dr. Emil CEBUC. Arithmetic instructions ... TUC-N dr. Emil CEBUC. Comparison Instructions. FCOM ST(i) Compare ST(0) with ST(i) ... – PowerPoint PPT presentation

Number of Views:129
Avg rating:3.0/5.0
Slides: 21
Provided by: dremil
Category:
Tags: fpu | instructions | emil

less

Transcript and Presenter's Notes

Title: FPU INSTRUCTIONS


1
FPU INSTRUCTIONS
2
Outline
  • General FPU Instruction format
  • FPU Instruction families
  • Examples

3
FPU Instructions
  • Data movement
  • Data conversions
  • Constant Instructions
  • Arithmetic Instructions
  • Comparison Instructions
  • Transcendental Instructions
  • Miscellaneous Instructions

4
General FPU Instruction format
  • label Fopcode
  • label Fopcode op1
  • label Fopcode op1,op2
  • label FopcodeP ST(1),ST(0)
  • op1 Stack Register ST(07), or memory
  • op2 Stack Register ST(07)

5
Data movement
  • FLD memory
  • Loads memory short, long or temp real number to
    TOS, TOP (Top Of stack Pointer is decremented)
  • FLD ST(i)
  • FLD ST(0) duplicates TOS

6
Data movement cont.
  • FST memory
  • Stores TOS to memory in short or long real format
  • FSTP memory
  • Stores TOS to memory in short, long or temporary
    real format TOP is incremented and TOS set to
    empty

7
Data conversion
  • FILD memory
  • Loads word, doubleword or quadword integer from
    memory and converts to temporary real to TOS,
    decrements TOP
  • FIST memory
  • Stores TOS memory and converts to word or
    doubleword

8
Data conversion cont
  • FISTP memory
  • Stores TOS to memory and converts to word,
    doubleword or quadword increments TOP, frees TOS
  • IF value in TOS is non integer rounding is
    performed according to bits in CTRL word

9
Data conversion cont.
  • FBLD memory
  • Loads and converts Packed BCD operand from memory
    to TOS
  • FBSTP memory
  • Stores to memory and converts to Packed BCD, pops
    TOS

10
Constant instructions
  • FLD1 Push 1.0 to TOS
  • FLDL2T Push log210 to TOS
  • FLDL2E Push log2e to TOS
  • FLDPI Push p to TOS
  • FLDLG2 Push log102 to TOS
  • FLDLN2 Push loge2 to TOS
  • FLDZ Push 0.0 to TOS

11
Arithmetic instructions
  • FIADD memory adds memory word, doubleword or
    quadword integer to TOS
  • FADD memory adds memory short, long or temporary
    real to TOS
  • FADD st(i) adds st(i) to TOS
  • FADDP add TOS to st(1) and pop TOS
  • FADDP st(i),st(0) add TOS to ST(i) and pop TOS

12
Arithmetic instructions cont.
  • FISUB memory subtracts memory word, doubleword
    or quadword integer from TOS
  • FSUB memory subtracts memory short, long or
    temporary real from TOS
  • FSUB st(0),st(1) subtracts st(i) from TOS
  • FSUBP subtracts TOS from st(1) and pop TOS
  • FSUBP st(i),st(0) subtracts TOS from ST(i) and
    pop TOS

13
Arithmetic instructions cont.
  • FSUBR reverse subtract
  • FISUBR memory subtracts TOS from memory word,
    doubleword or quadword integer
  • FSUBR memory TOS from subtracts memory short,
    long or temporary real
  • FSUBR st(0),st(1) subtracts TOS from st(i)
  • FSUBRP subtracts st(1) from TOS and pop TOS
  • FSUBRP st(i),st(0) subtracts TOS from ST(i) and
    pop TOS

14
Arithmetic instructions cont.
  • FMUL MULTIPLY
  • FMUL memory real
  • FIMUL memory int
  • FMUL ST(0), ST(i) Multiply ST(0) by ST(i) and
    store in ST(0)
  • FMUL ST(i), ST(0) Multiply ST(i) by ST(0) and
    store in ST(i)
  • FMULP ST(i), ST(0) Multiply ST(i) by ST(0),
    store result in ST(i), and pop the register
    stack.
  • FMULP Multiply ST(1) by ST(0), store result in
    ST(1), and pop the register stack

15
Arithmetic instructions cont.
  • FDIV division
  • FDIV memory real
  • FIDIV memory integer divide TOS by memory,
    result in TOS
  • FDIV ST(0), ST(i) Divide ST(0) by ST(i) and
    store result in ST(0)
  • FDIV ST(i), ST(0) Divide ST(i) by ST(0) and
    store
  • result in ST(i)
  • FDIVP ST(i), ST(0) Divide ST(i) by ST(0), store
    result in ST(i), and pop the register stack.
  • FDIVP Divide ST(1) by ST(0), store result
  • in ST(1), and pop the register stack

16
Arithmetic instructions cont.
  • FDIVR memory real Divide by ST(0) store in TOS
  • FDIVR ST(0),ST(i) Divide ST(i) by ST(0) store
    TOS
  • FDIVR ST(i),ST(0) Divide ST(0) by ST(i)
    ST(i).
  • FDIVRP ST(i), ST(0) Divide ST(0) by ST(i), store
    ST(i), pop the register stack.
  • FDIVRP Divide ST(0) by ST(1), store in ST(1),
    pop the register stack.
  • FIDIVR memory int Divide by ST(0) store in
    TOS

17
Arithmetic instructions cont.
  • FRNDINT
  • FABS
  • FCHS

18
Comparison Instructions
  • FCOM ST(i) Compare ST(0) with ST(i)
  • FCOM Compare ST(0) with ST(1)
  • FCOMP ST(i) Compare ST(0) with ST(i) and pop
    register stack
  • FCOMP Compare ST(0) with ST(1) and pop register
    stack
  • FCOMPP Compare ST(0) with ST(1) and pop register
    stack twice
  • FTEST COMPARE WITH 0.0
  • Results in C3,C2,C0 bits of FPU status word

19
Transcendental Instructions
  • FSQRT
  • FPTAN
  • FPATAN
  • FSIN
  • FCOS
  • fyl2x and fyl2xp1 instructions compute st(1)
    log2(st(0)) and st(1) log2(st(0)1), st(0)gt0
  • f2xm1 2ST(0)-1 -1ltST(0)lt1

20
Miscellaneous Instructions
  • FINIT
  • FWAIT
  • FFREE ST(i)
  • FLDCW
  • FSTCW
  • FLDENV
  • FSTENV
Write a Comment
User Comments (0)
About PowerShow.com