News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

About fpu

Started by felipe, June 22, 2018, 07:24:26 AM

Previous topic - Next topic

felipe

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:

Siekmanski

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 a strategy.

daydreamer

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
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007


Siekmanski

Creative coders use backward thinking techniques as a strategy.