reciprocal instruction usage to speed up raytracing code

Started by Mark_Larson, September 26, 2008, 11:43:13 PM

Previous topic - Next topic

Mark_Larson

  my bad, it's RECIPROCAL square root, not reverse :)

  There is also a reciropcal function that is a lot faster than a standard DIV.  It also takes 3 cycles just like reciprocal square root.  It simply does   1/x.  So you would have to do a multiply instead of a division.  I will post how it works in more detail on the bounding box thread.  There is a packed version and a scalar version.  I will use the scalar version.

BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

dr_eck

On the subject of the reciprocal and reciprocal square root, see Phantom's pictures at the bottom of tihis thread: http://ompf.org/forum/viewtopic.php?f=11&t=1021

TBP's reference in his third posting in that thread also shows how to regain the lost accuracy in 3 cycles for reciprocal or 5 for reciprocal square root.  Now if I just had the code...

Mark_Larson

Quote from: dr_eck on October 07, 2008, 02:32:37 PM
On the subject of the reciprocal and reciprocal square root, see Phantom's pictures at the bottom of tihis thread: http://ompf.org/forum/viewtopic.php?f=11&t=1021

TBP's reference in his third posting in that thread also shows how to regain the lost accuracy in 3 cycles for reciprocal or 5 for reciprocal square root.  Now if I just had the code...

thanks Doc :)

EDIT:  I had actually mentioned doing newton raphson at one point, just not on the reciprocal square root.  Doc, you already have some newton raphson code?  If not I can write some.

EDIT2: this is my FAVORITE math reference webpage.  This is where tons of cool formulas to compute pi ( and newton raphson) are.
http://mathworld.wolfram.com/

EDIT3: tbp posted some sample code from intel for the Newton Raphson.  here is the link.
http://sunsite.rediris.es/pub/mirror/intel/design/perftool/cbts/appnotes/ap803/
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm