home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Patches / ffppatch.lha / ffppatch.doc < prev    next >
Text File  |  1998-04-21  |  7KB  |  236 lines

  1. Short:      mathffp.library FPU speedup patch 1.8b
  2. Author:   Jess Sosnoski (at the below address!!!)
  3. Uploader: starblaz@ptdprolog.net
  4. Type:      util/boot
  5. Version:  1.9beta
  6. Requires: kick 2.04+, an 020+, and a 68881/2 FPU.
  7. Long:
  8.  
  9. FFPpatch 1.9beta ⌐ 1997 Jess Sosnoski
  10.  
  11. DESCRIPTION:
  12. -----------
  13. This is a program that patches some functions of the mathffp.library
  14. to use 68881/2 instructions, thus squeezing out a bit more speed.
  15. (I hope!)
  16.  
  17. This is also the first speedup patch I ever attempted to write! :)
  18.  
  19. Works on an '040 or '060 too!
  20. (does not use any FPU trig functions)
  21.  
  22. DISCLAIMER:
  23. ----------
  24. Use this program at your own risk!
  25. I assume no responsibility or liability for problem(s) and/or damage(s)
  26. that occur by the use, modification, and/or existence of this product,
  27. and/or its parts in any form.
  28.  
  29.  But if it don't work right, or slows things down, don't be afraid
  30.  to send me email...or even send some email if it makes your system
  31.  outprocess a cray (yeah, right)
  32.  
  33. Anywayz tho...the following functions are patched, and here's the
  34. speed differences I got with a test program I wrote:
  35.  
  36. *NOTE* The test program must call float() a lot, because when I re-enabled
  37. the SPFloat() patch, the test program ran one hell of a lot faster.
  38.  
  39. I've included the results before I re-enabled the float() patch so you
  40. can see what differences there were.
  41.  
  42. Function    PATCHED     Not_Patched
  43. -------------------------------------------
  44. SPAbs        2.21        12.02
  45. SPNeg        2.16        12.20
  46. SPAdd        5.18        18.91
  47. SPSub        5.17        17.78
  48. SPMul        5.18        20.70
  49. SPDiv        5.26        20.96
  50. SPFloat     2.13        11.94
  51. SPFix        2.96        14.26
  52. SPFloor     2.16        15.13
  53. SPCeil        4.75        27.41
  54.  
  55. (SPTst and SPCmp are also patched)
  56. Hmmm....very interesting.....that's why this patch is a beta :)
  57.  
  58. Your results will likely differ.
  59. (The testprogram isn't the best in the world)
  60.  
  61. INSTALLATION:
  62. ------------
  63. Copy it to your c: directory or wherever you like.
  64. You can add the line run <>NIL: ffppatch to your startup-sequence, or
  65. user-startup.  You can give it an icon and put it in WBstartup.
  66. You can basically put it anywhere :)
  67. (I have mine a little after setpatch in my startup-sequence)
  68.  
  69. USAGE:
  70. -----
  71. run <>NIL: ffppatch
  72.  
  73. OUTPUT:
  74. ------
  75. None...as I didn't feel like figuring out how to to text output
  76. in assembly.
  77. Although, if you don't have the right versions of the required libraries,
  78. it will exit with a returncode of 20.
  79.  
  80. REMOVAL:
  81. -------
  82. sorry....once it's in...it stays in!
  83. (didn't I hear Al Bundy say that to Peg once...hmmm....)
  84.  
  85. CAVEATS:
  86. -------
  87. This patch is experimental, so, don't expect any miracles.
  88.  
  89. Opens mathffp.library, and never closes it.
  90.  
  91. Also...not a whole hell of a lot of programs use mathffp.library, but those
  92. which do may benefit from a little speedup.
  93. (although some garshneblankers, the akJFIF, akLJPG, and akPNG
  94.  datatypes use it)
  95.  
  96. There exists a 68881 card for 68000 owners, but, as I found out via
  97. email, does not access the FPU in the same way that an 020+ would.
  98. I did not include any special code to support this, so it is likely that
  99. this patch may not do anything at all on that type of setup.
  100.  
  101. NOTES:
  102. -----
  103. mathffp.library is in your Kickstart ROM...you won't find it in libs.
  104.  
  105.  
  106. FFPTEST
  107. -------
  108. Here it is!   Just type ffptest and it will dump out the results.
  109. It disables multitasking while running.  It does actually give results
  110. with an 040 or 060.  (though the numbers are quite small)
  111.  
  112. The best thing you can do is go into the bootshell, with
  113. ALL CPU CACHES OFF--leaving them on can give different results with or
  114. without ffppatch when run multiple times (I found this out the hard way)
  115. (trust me, you WILL see a difference)
  116. Note: the testprogram is written in PCQ pascal and may be a bit dodgy.
  117.  
  118.  
  119. cpu NOCACHE
  120. ffptest
  121.  
  122. run <>NIL: ffppatch
  123. ffptest
  124.  
  125. Then you will see a difference.
  126.  
  127. HISTORY:
  128. -------
  129. 1.0    First Release
  130.  
  131. 1.1    Now closes mathffp.library when mathtrans.lib v40 can't be opened
  132.     Optimized spmul, spdiv, spabs, spneg, spflt, spfloor and squeezed
  133.     a couple more clock cycles out.
  134.     (spadd and spsub optimized too, but disabled cuz they were
  135.      slower for some reason :( )
  136.     Removed SPFix patch...it was slower :(
  137.  
  138. 1.2    Due to my rewriting of ffptest (included), I was able to more
  139.     accurately test speed of calls to mathffp.library.
  140.     I found out everything went faster in the first place :)
  141.     Re-enabled everything.
  142.  
  143. 1.3    Contacted Martin Berndt, author of fmath40x.lha, and asked
  144.     about the Fieee and Tieee functions....so, he emailed me the
  145.     source...and I removed the mathtrans.library requirement and
  146.     put the functions directly into the patch program, making it
  147.     faster :)
  148.  
  149. 1.4    Longword aligned all patches.
  150.     Changed spabs, spneg and spflt functions to not use fpu...
  151.     they didn't have to do all that work, and were probably horribly
  152.      slower before.
  153.     (worst case..they're probably the same speed as the stock library now
  154.      ..but, one of them can likely be inlined directly into the
  155.        jumptable in some future version to save a clock cycle or two)
  156.     Changed the SPFieee function to a faster one.
  157.     Changed the SPFix function to something more like the original.
  158.  
  159. 1.5    Inlined the SPFieee function whereever possible shaving off more
  160.     clock cycles.
  161.     Included Dave Jones' optimized SPTst and SPCmp functions!
  162.  
  163. 1.6    Added checks for 040+ processors...disables SPFloor and SPCeil
  164.     patches, which use instructions not available on 040+'s,
  165.     Optimized SpCeil, Fieee, SPCmp/Tst, SPFix.
  166.     Fixed some patching bugs.
  167.     Sourcecode cleaned up a lot.
  168.  
  169. 1.7    FIXED bug made while optimizing spcmp/tst..could cause some REALLY
  170.     bad results.  (That'll teach me to preserve the CCR!)
  171.  
  172. 1.8    Inlined the SPTieee function, shaving off a couple more clock cycles.
  173.  
  174. 1.9    Now checks for my mathffp.library v43 replacement, and doesn't patch
  175.     if installed.
  176.     Fixed a bug in SPCmp that was causing problems with picticon not
  177.     scaling images.
  178.     Speeded up SPFix.
  179.  
  180. FUTURE:
  181. ------
  182. Make this doc file a bit more presentable, and maybe leave it as plain
  183. text without Amigaguide OR HTML just for kicks.
  184. Write a more accurate test program, and maybe include it in the archive.
  185.  
  186. Maybe add command line-arguments to turn on/off selected patches.
  187.  
  188. Make the patch exit, instead of hanging around.
  189.  
  190. One word: NitrOS (if this patch turns out to work as I'd like it to)
  191.  
  192. THANKS TO:
  193. ---------
  194. Martin Berndt...for sending me the sourcecode to Tieee and Fieee
  195. functions from his fmath40x mathtrans.library, which helped a lot!
  196.  
  197. Adam "DC1" Polkosnik for ideas, help with sourcecode, and APATCH!
  198.  
  199. Dave "Barc0de" Jones, for help, ideas, optimized functions,  and StreamLineOS 2!
  200.  
  201. Iain "ook" Barclay for help, ideas, optimizations, debugging, and opatch!
  202.  
  203. Andreas Kleinert for help with 040 checking code!
  204.  
  205. Gerd Wieczorek for optimizations, and a new version of ffptest--coming soon!
  206.  
  207. Stephan Rupprecht for help with bugfixing, ideas, and an upcoming
  208. loader for a my replacement v43 mathffp.library :)
  209.  
  210. Everyone who sent me emails, praise, and complaints....your input
  211. was greatly appreciated!!!!
  212.  
  213. BUGS:
  214. ----
  215. Hmmm...what would Tom say, ohyeah, um....possibly.
  216. Crummy speedtest program.
  217.  
  218. AUTHOR:
  219. ------
  220. Jess Sosnoski
  221. 651 Hillside Drive
  222. Mount Carmel, PA 17851-2463
  223. USA
  224.  
  225. starblaz@ptdprolog.net
  226.  
  227. Updates will appear on my webpage before they appear in Aminet's RECENT file.
  228. http://home.ptd.net/~starblaz
  229.  
  230. IRC nick: starblazr
  231. On: galaxynet (amiga channels), dalnet (#nin ,#am-irc)
  232. pulsarnet (#elitecafe)
  233.  
  234. Emails, gifts, money, food, cigarettes, Amiga4060T's will all be
  235. gladly accepted.
  236.