200 likes | 218 Views
FPU INSTRUCTIONS. Outline. General FPU Instruction format FPU Instruction families Examples. FPU Instructions. Data movement Data conversions Constant Instructions Arithmetic Instructions Comparison Instructions Transcendental Instructions Miscellaneous Instructions.
E N D
FPU INSTRUCTIONS TUC-N dr. Emil CEBUC
Outline • General FPU Instruction format • FPU Instruction families • Examples TUC-N dr. Emil CEBUC
FPU Instructions • Data movement • Data conversions • Constant Instructions • Arithmetic Instructions • Comparison Instructions • Transcendental Instructions • Miscellaneous Instructions TUC-N dr. Emil CEBUC
General FPU Instruction format [label:] Fopcode [label:] Fopcode op1 [label:] Fopcode op1,op2 [label:] FopcodeP ST(1),ST(0) op1 Stack Register ST(0…7), or memory op2 Stack Register ST(0…7) TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
Constant instructions FLD1 Push +1.0 to TOS FLDL2T Push log210 to TOS FLDL2E Push log2e to TOS FLDPI Push π to TOS FLDLG2 Push log102 to TOS FLDLN2 Push loge2 to TOS FLDZ Push +0.0 to TOS TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
Arithmetic instructions cont. FRNDINT FABS FCHS TUC-N dr. Emil CEBUC
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 TUC-N dr. Emil CEBUC
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)>0 f2xm1 2**ST(0)-1 -1<ST(0)<1 TUC-N dr. Emil CEBUC
Miscellaneous Instructions FINIT FWAIT FFREE ST(i) FLDCW FSTCW FLDENV FSTENV TUC-N dr. Emil CEBUC