Author Topic: About fpu  (Read 137 times)

felipe

  • Member
  • ****
  • Posts: 866
  • Eagles are just great!
About fpu
« on: June 22, 2018, 07:24:26 AM »
I want to share here with all of you that i have finally readed the whole tutorial made by raymond on fpu. I know fpu is old and that even the microsoft abi for 64 bits don't use it. But i felt a hole on my knowledge of the intel architecture without it.

I want to confese that this was not my first try on the tutorial, but now with a more mature mind i readed from the beginning to the end.
Also i want to express my gratitude again to raymond for this fpu tutorial. I think is an excellent way (and fast) to get familiar with the fpu. Also all the code is well commented, i think.  :greenclp:

Finally to raymond and all too: I was reading (once again as i said before, this time it took me finish the whole tutorial approximately 4 weeks i think) the part on the fpu internals. I was thinking why if this revolver barrel metaphor is easy to grasp i had always quited the tutorial before finish it completly. Until i get to the instructions on fpu internals that change the top field of the status word (fincstp and fdecstp). In that moment all that nice picture started (once again) to become confused, because it seemed that every was upside down. So, because this time i didn't want to quit, i looked to some intel document about the fpu. It was then when i saw a picture of the stack when i finally get it! After that, following the code took me some time, because even knowing all this the fpu is tricky, but with the time and the wonderfull comments in the code (specially those that keep track of what's in the data registers) this internal structure and the behavior with the instructions starts to automate.  :idea:

I think that this experience can be helpfull for those beginners that start with this fpu tutorial. Finally, i think is a good idea to use the appendix that raymond made with all the fpu instructions, as a bookmark in the browser to check for each instruction you may need to remember, before using it.  :idea:
Felipe.

Siekmanski

  • Member
  • *****
  • Posts: 1548
Re: About fpu
« Reply #1 on: June 22, 2018, 09:55:07 AM »
I like the FPU too.  :t
The FPU is not old but a very useful coprocessor, especially for scientific calculations such as sin cos exp log etc. and with high precision.

Of course you can do those calculations in software ( approximate by polynomial calculations ) but with less precision.
Creative coders use backward thinking techniques as their strategy.

daydreamer

  • Member
  • ***
  • Posts: 465
Re: About fpu
« Reply #2 on: June 22, 2018, 07:10:40 PM »
the fpu is easy to use for sine,cosine etc,compared to know advanced math to code taylor series in SSE,but best is to use fpu initializing LUTS and 1/x of most common divisions in innerloop and SIMD in innerloop for speed,especially if you choose to use MMX/SSE2 integer instructions,you need to use fixed point math with most common divisions,exchanged with mul with their reciprocals,because it lacks division opcodes
and if you use RCPPS/MULPS combination,RCP might lack the precision you need,but a stored reciprocal precalculated with fpu fix this when its just a constant
you also avoid getting "division by zero" with this
Quote from Flashdance
Nick  :  When you give up your dream, you die.
*wears a flameproof asbestos suit*

jj2007

  • Member
  • *****
  • Posts: 8504
  • Assembler is fun ;-)
    • MasmBasic
Re: About fpu
« Reply #3 on: June 22, 2018, 07:51:14 PM »
What is LUTS?

Siekmanski

  • Member
  • *****
  • Posts: 1548
Re: About fpu
« Reply #4 on: June 22, 2018, 10:02:21 PM »
Creative coders use backward thinking techniques as their strategy.