Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

763 lines
26 KiB

  1. .file "logf.s"
  2. // Copyright (c) 2000, Intel Corporation
  3. // All rights reserved.
  4. //
  5. // Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
  6. // and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
  7. //
  8. // WARRANTY DISCLAIMER
  9. //
  10. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  11. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  12. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  13. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
  14. // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  15. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  17. // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  18. // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
  19. // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  20. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. //
  22. // Intel Corporation is the author of this code, and requests that all
  23. // problem reports or change requests be submitted to it directly at
  24. // http://developer.intel.com/opensource.
  25. // History
  26. //==============================================================
  27. // ?/??/00 Initial version
  28. // 8/15/00 Bundle added after call to __libm_error_support to properly
  29. // set [the previously overwritten] GR_Parameter_RESULT.
  30. //
  31. // Assembly macros
  32. //=========================================
  33. // integer registers used
  34. LOG_AD_COEFF = r33
  35. LOG_AD_CONSTANTS = r34
  36. LOG_mask = r35
  37. LOG_FFF7 = r36
  38. LOG_bias = r37
  39. LOG_x_n = r38
  40. LOG_x_ind = r39
  41. LOG_x_sexp = r40
  42. GR_SAVE_B0 = r41
  43. GR_SAVE_PFS = r42
  44. GR_SAVE_GP = r43
  45. GR_Parameter_X = r44
  46. GR_Parameter_Y = r45
  47. GR_Parameter_RESULT = r46
  48. LOG_tag = r47
  49. // floating point registers used
  50. log_coeff_p3 = f32
  51. log_coeff_p2 = f33
  52. log_coeff_p1 = f34
  53. log_const_log2 = f35
  54. log_threshhold = f36
  55. log_B = f37
  56. log_r = f38
  57. log_poly_p1 = f39
  58. log_rsq = f40
  59. log_poly_p2 = f41
  60. log_poly_p3 = f42
  61. log_n = f43
  62. log_T = f44
  63. log_s = f45
  64. log_poly_q1 = f46
  65. log_ssq = f47
  66. log_abs_s = f48
  67. log_poly_q2 = f49
  68. log_x_norm = f50
  69. log_inv_ln10 = f51
  70. log10_f8 = f52
  71. .data
  72. .align 16
  73. log_coeff_table:
  74. data8 0xbfd0001008f39d59 // p3
  75. data8 0x3fd5556073e0c45a // p2
  76. log_constants_table:
  77. data8 0xbfdffffffffaea15 // p1
  78. data8 0x3fe62e42fefa39ef // Log(2)
  79. data8 0x3f70000000000000 // 2^-8, threshhold
  80. data8 0x3fdbcb7b1526e50e // 1/ln10
  81. data8 0x3F60040155D5889E //log(1/frcpa(1+ 0/256)
  82. data8 0x3F78121214586B54 //log(1/frcpa(1+ 1/256)
  83. data8 0x3F841929F96832F0 //log(1/frcpa(1+ 2/256)
  84. data8 0x3F8C317384C75F06 //log(1/frcpa(1+ 3/256)
  85. data8 0x3F91A6B91AC73386 //log(1/frcpa(1+ 4/256)
  86. data8 0x3F95BA9A5D9AC039 //log(1/frcpa(1+ 5/256)
  87. data8 0x3F99D2A8074325F4 //log(1/frcpa(1+ 6/256)
  88. data8 0x3F9D6B2725979802 //log(1/frcpa(1+ 7/256)
  89. data8 0x3FA0C58FA19DFAAA //log(1/frcpa(1+ 8/256)
  90. data8 0x3FA2954C78CBCE1B //log(1/frcpa(1+ 9/256)
  91. data8 0x3FA4A94D2DA96C56 //log(1/frcpa(1+ 10/256)
  92. data8 0x3FA67C94F2D4BB58 //log(1/frcpa(1+ 11/256)
  93. data8 0x3FA85188B630F068 //log(1/frcpa(1+ 12/256)
  94. data8 0x3FAA6B8ABE73AF4C //log(1/frcpa(1+ 13/256)
  95. data8 0x3FAC441E06F72A9E //log(1/frcpa(1+ 14/256)
  96. data8 0x3FAE1E6713606D07 //log(1/frcpa(1+ 15/256)
  97. data8 0x3FAFFA6911AB9301 //log(1/frcpa(1+ 16/256)
  98. data8 0x3FB0EC139C5DA601 //log(1/frcpa(1+ 17/256)
  99. data8 0x3FB1DBD2643D190B //log(1/frcpa(1+ 18/256)
  100. data8 0x3FB2CC7284FE5F1C //log(1/frcpa(1+ 19/256)
  101. data8 0x3FB3BDF5A7D1EE64 //log(1/frcpa(1+ 20/256)
  102. data8 0x3FB4B05D7AA012E0 //log(1/frcpa(1+ 21/256)
  103. data8 0x3FB580DB7CEB5702 //log(1/frcpa(1+ 22/256)
  104. data8 0x3FB674F089365A7A //log(1/frcpa(1+ 23/256)
  105. data8 0x3FB769EF2C6B568D //log(1/frcpa(1+ 24/256)
  106. data8 0x3FB85FD927506A48 //log(1/frcpa(1+ 25/256)
  107. data8 0x3FB9335E5D594989 //log(1/frcpa(1+ 26/256)
  108. data8 0x3FBA2B0220C8E5F5 //log(1/frcpa(1+ 27/256)
  109. data8 0x3FBB0004AC1A86AC //log(1/frcpa(1+ 28/256)
  110. data8 0x3FBBF968769FCA11 //log(1/frcpa(1+ 29/256)
  111. data8 0x3FBCCFEDBFEE13A8 //log(1/frcpa(1+ 30/256)
  112. data8 0x3FBDA727638446A2 //log(1/frcpa(1+ 31/256)
  113. data8 0x3FBEA3257FE10F7A //log(1/frcpa(1+ 32/256)
  114. data8 0x3FBF7BE9FEDBFDE6 //log(1/frcpa(1+ 33/256)
  115. data8 0x3FC02AB352FF25F4 //log(1/frcpa(1+ 34/256)
  116. data8 0x3FC097CE579D204D //log(1/frcpa(1+ 35/256)
  117. data8 0x3FC1178E8227E47C //log(1/frcpa(1+ 36/256)
  118. data8 0x3FC185747DBECF34 //log(1/frcpa(1+ 37/256)
  119. data8 0x3FC1F3B925F25D41 //log(1/frcpa(1+ 38/256)
  120. data8 0x3FC2625D1E6DDF57 //log(1/frcpa(1+ 39/256)
  121. data8 0x3FC2D1610C86813A //log(1/frcpa(1+ 40/256)
  122. data8 0x3FC340C59741142E //log(1/frcpa(1+ 41/256)
  123. data8 0x3FC3B08B6757F2A9 //log(1/frcpa(1+ 42/256)
  124. data8 0x3FC40DFB08378003 //log(1/frcpa(1+ 43/256)
  125. data8 0x3FC47E74E8CA5F7C //log(1/frcpa(1+ 44/256)
  126. data8 0x3FC4EF51F6466DE4 //log(1/frcpa(1+ 45/256)
  127. data8 0x3FC56092E02BA516 //log(1/frcpa(1+ 46/256)
  128. data8 0x3FC5D23857CD74D5 //log(1/frcpa(1+ 47/256)
  129. data8 0x3FC6313A37335D76 //log(1/frcpa(1+ 48/256)
  130. data8 0x3FC6A399DABBD383 //log(1/frcpa(1+ 49/256)
  131. data8 0x3FC70337DD3CE41B //log(1/frcpa(1+ 50/256)
  132. data8 0x3FC77654128F6127 //log(1/frcpa(1+ 51/256)
  133. data8 0x3FC7E9D82A0B022D //log(1/frcpa(1+ 52/256)
  134. data8 0x3FC84A6B759F512F //log(1/frcpa(1+ 53/256)
  135. data8 0x3FC8AB47D5F5A310 //log(1/frcpa(1+ 54/256)
  136. data8 0x3FC91FE49096581B //log(1/frcpa(1+ 55/256)
  137. data8 0x3FC981634011AA75 //log(1/frcpa(1+ 56/256)
  138. data8 0x3FC9F6C407089664 //log(1/frcpa(1+ 57/256)
  139. data8 0x3FCA58E729348F43 //log(1/frcpa(1+ 58/256)
  140. data8 0x3FCABB55C31693AD //log(1/frcpa(1+ 59/256)
  141. data8 0x3FCB1E104919EFD0 //log(1/frcpa(1+ 60/256)
  142. data8 0x3FCB94EE93E367CB //log(1/frcpa(1+ 61/256)
  143. data8 0x3FCBF851C067555F //log(1/frcpa(1+ 62/256)
  144. data8 0x3FCC5C0254BF23A6 //log(1/frcpa(1+ 63/256)
  145. data8 0x3FCCC000C9DB3C52 //log(1/frcpa(1+ 64/256)
  146. data8 0x3FCD244D99C85674 //log(1/frcpa(1+ 65/256)
  147. data8 0x3FCD88E93FB2F450 //log(1/frcpa(1+ 66/256)
  148. data8 0x3FCDEDD437EAEF01 //log(1/frcpa(1+ 67/256)
  149. data8 0x3FCE530EFFE71012 //log(1/frcpa(1+ 68/256)
  150. data8 0x3FCEB89A1648B971 //log(1/frcpa(1+ 69/256)
  151. data8 0x3FCF1E75FADF9BDE //log(1/frcpa(1+ 70/256)
  152. data8 0x3FCF84A32EAD7C35 //log(1/frcpa(1+ 71/256)
  153. data8 0x3FCFEB2233EA07CD //log(1/frcpa(1+ 72/256)
  154. data8 0x3FD028F9C7035C1C //log(1/frcpa(1+ 73/256)
  155. data8 0x3FD05C8BE0D9635A //log(1/frcpa(1+ 74/256)
  156. data8 0x3FD085EB8F8AE797 //log(1/frcpa(1+ 75/256)
  157. data8 0x3FD0B9C8E32D1911 //log(1/frcpa(1+ 76/256)
  158. data8 0x3FD0EDD060B78081 //log(1/frcpa(1+ 77/256)
  159. data8 0x3FD122024CF0063F //log(1/frcpa(1+ 78/256)
  160. data8 0x3FD14BE2927AECD4 //log(1/frcpa(1+ 79/256)
  161. data8 0x3FD180618EF18ADF //log(1/frcpa(1+ 80/256)
  162. data8 0x3FD1B50BBE2FC63B //log(1/frcpa(1+ 81/256)
  163. data8 0x3FD1DF4CC7CF242D //log(1/frcpa(1+ 82/256)
  164. data8 0x3FD214456D0EB8D4 //log(1/frcpa(1+ 83/256)
  165. data8 0x3FD23EC5991EBA49 //log(1/frcpa(1+ 84/256)
  166. data8 0x3FD2740D9F870AFB //log(1/frcpa(1+ 85/256)
  167. data8 0x3FD29ECDABCDFA04 //log(1/frcpa(1+ 86/256)
  168. data8 0x3FD2D46602ADCCEE //log(1/frcpa(1+ 87/256)
  169. data8 0x3FD2FF66B04EA9D4 //log(1/frcpa(1+ 88/256)
  170. data8 0x3FD335504B355A37 //log(1/frcpa(1+ 89/256)
  171. data8 0x3FD360925EC44F5D //log(1/frcpa(1+ 90/256)
  172. data8 0x3FD38BF1C3337E75 //log(1/frcpa(1+ 91/256)
  173. data8 0x3FD3C25277333184 //log(1/frcpa(1+ 92/256)
  174. data8 0x3FD3EDF463C1683E //log(1/frcpa(1+ 93/256)
  175. data8 0x3FD419B423D5E8C7 //log(1/frcpa(1+ 94/256)
  176. data8 0x3FD44591E0539F49 //log(1/frcpa(1+ 95/256)
  177. data8 0x3FD47C9175B6F0AD //log(1/frcpa(1+ 96/256)
  178. data8 0x3FD4A8B341552B09 //log(1/frcpa(1+ 97/256)
  179. data8 0x3FD4D4F3908901A0 //log(1/frcpa(1+ 98/256)
  180. data8 0x3FD501528DA1F968 //log(1/frcpa(1+ 99/256)
  181. data8 0x3FD52DD06347D4F6 //log(1/frcpa(1+ 100/256)
  182. data8 0x3FD55A6D3C7B8A8A //log(1/frcpa(1+ 101/256)
  183. data8 0x3FD5925D2B112A59 //log(1/frcpa(1+ 102/256)
  184. data8 0x3FD5BF406B543DB2 //log(1/frcpa(1+ 103/256)
  185. data8 0x3FD5EC433D5C35AE //log(1/frcpa(1+ 104/256)
  186. data8 0x3FD61965CDB02C1F //log(1/frcpa(1+ 105/256)
  187. data8 0x3FD646A84935B2A2 //log(1/frcpa(1+ 106/256)
  188. data8 0x3FD6740ADD31DE94 //log(1/frcpa(1+ 107/256)
  189. data8 0x3FD6A18DB74A58C5 //log(1/frcpa(1+ 108/256)
  190. data8 0x3FD6CF31058670EC //log(1/frcpa(1+ 109/256)
  191. data8 0x3FD6F180E852F0BA //log(1/frcpa(1+ 110/256)
  192. data8 0x3FD71F5D71B894F0 //log(1/frcpa(1+ 111/256)
  193. data8 0x3FD74D5AEFD66D5C //log(1/frcpa(1+ 112/256)
  194. data8 0x3FD77B79922BD37E //log(1/frcpa(1+ 113/256)
  195. data8 0x3FD7A9B9889F19E2 //log(1/frcpa(1+ 114/256)
  196. data8 0x3FD7D81B037EB6A6 //log(1/frcpa(1+ 115/256)
  197. data8 0x3FD8069E33827231 //log(1/frcpa(1+ 116/256)
  198. data8 0x3FD82996D3EF8BCB //log(1/frcpa(1+ 117/256)
  199. data8 0x3FD85855776DCBFB //log(1/frcpa(1+ 118/256)
  200. data8 0x3FD8873658327CCF //log(1/frcpa(1+ 119/256)
  201. data8 0x3FD8AA75973AB8CF //log(1/frcpa(1+ 120/256)
  202. data8 0x3FD8D992DC8824E5 //log(1/frcpa(1+ 121/256)
  203. data8 0x3FD908D2EA7D9512 //log(1/frcpa(1+ 122/256)
  204. data8 0x3FD92C59E79C0E56 //log(1/frcpa(1+ 123/256)
  205. data8 0x3FD95BD750EE3ED3 //log(1/frcpa(1+ 124/256)
  206. data8 0x3FD98B7811A3EE5B //log(1/frcpa(1+ 125/256)
  207. data8 0x3FD9AF47F33D406C //log(1/frcpa(1+ 126/256)
  208. data8 0x3FD9DF270C1914A8 //log(1/frcpa(1+ 127/256)
  209. data8 0x3FDA0325ED14FDA4 //log(1/frcpa(1+ 128/256)
  210. data8 0x3FDA33440224FA79 //log(1/frcpa(1+ 129/256)
  211. data8 0x3FDA57725E80C383 //log(1/frcpa(1+ 130/256)
  212. data8 0x3FDA87D0165DD199 //log(1/frcpa(1+ 131/256)
  213. data8 0x3FDAAC2E6C03F896 //log(1/frcpa(1+ 132/256)
  214. data8 0x3FDADCCC6FDF6A81 //log(1/frcpa(1+ 133/256)
  215. data8 0x3FDB015B3EB1E790 //log(1/frcpa(1+ 134/256)
  216. data8 0x3FDB323A3A635948 //log(1/frcpa(1+ 135/256)
  217. data8 0x3FDB56FA04462909 //log(1/frcpa(1+ 136/256)
  218. data8 0x3FDB881AA659BC93 //log(1/frcpa(1+ 137/256)
  219. data8 0x3FDBAD0BEF3DB165 //log(1/frcpa(1+ 138/256)
  220. data8 0x3FDBD21297781C2F //log(1/frcpa(1+ 139/256)
  221. data8 0x3FDC039236F08819 //log(1/frcpa(1+ 140/256)
  222. data8 0x3FDC28CB1E4D32FD //log(1/frcpa(1+ 141/256)
  223. data8 0x3FDC4E19B84723C2 //log(1/frcpa(1+ 142/256)
  224. data8 0x3FDC7FF9C74554C9 //log(1/frcpa(1+ 143/256)
  225. data8 0x3FDCA57B64E9DB05 //log(1/frcpa(1+ 144/256)
  226. data8 0x3FDCCB130A5CEBB0 //log(1/frcpa(1+ 145/256)
  227. data8 0x3FDCF0C0D18F326F //log(1/frcpa(1+ 146/256)
  228. data8 0x3FDD232075B5A201 //log(1/frcpa(1+ 147/256)
  229. data8 0x3FDD490246DEFA6B //log(1/frcpa(1+ 148/256)
  230. data8 0x3FDD6EFA918D25CD //log(1/frcpa(1+ 149/256)
  231. data8 0x3FDD9509707AE52F //log(1/frcpa(1+ 150/256)
  232. data8 0x3FDDBB2EFE92C554 //log(1/frcpa(1+ 151/256)
  233. data8 0x3FDDEE2F3445E4AF //log(1/frcpa(1+ 152/256)
  234. data8 0x3FDE148A1A2726CE //log(1/frcpa(1+ 153/256)
  235. data8 0x3FDE3AFC0A49FF40 //log(1/frcpa(1+ 154/256)
  236. data8 0x3FDE6185206D516E //log(1/frcpa(1+ 155/256)
  237. data8 0x3FDE882578823D52 //log(1/frcpa(1+ 156/256)
  238. data8 0x3FDEAEDD2EAC990C //log(1/frcpa(1+ 157/256)
  239. data8 0x3FDED5AC5F436BE3 //log(1/frcpa(1+ 158/256)
  240. data8 0x3FDEFC9326D16AB9 //log(1/frcpa(1+ 159/256)
  241. data8 0x3FDF2391A2157600 //log(1/frcpa(1+ 160/256)
  242. data8 0x3FDF4AA7EE03192D //log(1/frcpa(1+ 161/256)
  243. data8 0x3FDF71D627C30BB0 //log(1/frcpa(1+ 162/256)
  244. data8 0x3FDF991C6CB3B379 //log(1/frcpa(1+ 163/256)
  245. data8 0x3FDFC07ADA69A910 //log(1/frcpa(1+ 164/256)
  246. data8 0x3FDFE7F18EB03D3E //log(1/frcpa(1+ 165/256)
  247. data8 0x3FE007C053C5002E //log(1/frcpa(1+ 166/256)
  248. data8 0x3FE01B942198A5A1 //log(1/frcpa(1+ 167/256)
  249. data8 0x3FE02F74400C64EB //log(1/frcpa(1+ 168/256)
  250. data8 0x3FE04360BE7603AD //log(1/frcpa(1+ 169/256)
  251. data8 0x3FE05759AC47FE34 //log(1/frcpa(1+ 170/256)
  252. data8 0x3FE06B5F1911CF52 //log(1/frcpa(1+ 171/256)
  253. data8 0x3FE078BF0533C568 //log(1/frcpa(1+ 172/256)
  254. data8 0x3FE08CD9687E7B0E //log(1/frcpa(1+ 173/256)
  255. data8 0x3FE0A10074CF9019 //log(1/frcpa(1+ 174/256)
  256. data8 0x3FE0B5343A234477 //log(1/frcpa(1+ 175/256)
  257. data8 0x3FE0C974C89431CE //log(1/frcpa(1+ 176/256)
  258. data8 0x3FE0DDC2305B9886 //log(1/frcpa(1+ 177/256)
  259. data8 0x3FE0EB524BAFC918 //log(1/frcpa(1+ 178/256)
  260. data8 0x3FE0FFB54213A476 //log(1/frcpa(1+ 179/256)
  261. data8 0x3FE114253DA97D9F //log(1/frcpa(1+ 180/256)
  262. data8 0x3FE128A24F1D9AFF //log(1/frcpa(1+ 181/256)
  263. data8 0x3FE1365252BF0865 //log(1/frcpa(1+ 182/256)
  264. data8 0x3FE14AE558B4A92D //log(1/frcpa(1+ 183/256)
  265. data8 0x3FE15F85A19C765B //log(1/frcpa(1+ 184/256)
  266. data8 0x3FE16D4D38C119FA //log(1/frcpa(1+ 185/256)
  267. data8 0x3FE18203C20DD133 //log(1/frcpa(1+ 186/256)
  268. data8 0x3FE196C7BC4B1F3B //log(1/frcpa(1+ 187/256)
  269. data8 0x3FE1A4A738B7A33C //log(1/frcpa(1+ 188/256)
  270. data8 0x3FE1B981C0C9653D //log(1/frcpa(1+ 189/256)
  271. data8 0x3FE1CE69E8BB106B //log(1/frcpa(1+ 190/256)
  272. data8 0x3FE1DC619DE06944 //log(1/frcpa(1+ 191/256)
  273. data8 0x3FE1F160A2AD0DA4 //log(1/frcpa(1+ 192/256)
  274. data8 0x3FE2066D7740737E //log(1/frcpa(1+ 193/256)
  275. data8 0x3FE2147DBA47A394 //log(1/frcpa(1+ 194/256)
  276. data8 0x3FE229A1BC5EBAC3 //log(1/frcpa(1+ 195/256)
  277. data8 0x3FE237C1841A502E //log(1/frcpa(1+ 196/256)
  278. data8 0x3FE24CFCE6F80D9A //log(1/frcpa(1+ 197/256)
  279. data8 0x3FE25B2C55CD5762 //log(1/frcpa(1+ 198/256)
  280. data8 0x3FE2707F4D5F7C41 //log(1/frcpa(1+ 199/256)
  281. data8 0x3FE285E0842CA384 //log(1/frcpa(1+ 200/256)
  282. data8 0x3FE294294708B773 //log(1/frcpa(1+ 201/256)
  283. data8 0x3FE2A9A2670AFF0C //log(1/frcpa(1+ 202/256)
  284. data8 0x3FE2B7FB2C8D1CC1 //log(1/frcpa(1+ 203/256)
  285. data8 0x3FE2C65A6395F5F5 //log(1/frcpa(1+ 204/256)
  286. data8 0x3FE2DBF557B0DF43 //log(1/frcpa(1+ 205/256)
  287. data8 0x3FE2EA64C3F97655 //log(1/frcpa(1+ 206/256)
  288. data8 0x3FE3001823684D73 //log(1/frcpa(1+ 207/256)
  289. data8 0x3FE30E97E9A8B5CD //log(1/frcpa(1+ 208/256)
  290. data8 0x3FE32463EBDD34EA //log(1/frcpa(1+ 209/256)
  291. data8 0x3FE332F4314AD796 //log(1/frcpa(1+ 210/256)
  292. data8 0x3FE348D90E7464D0 //log(1/frcpa(1+ 211/256)
  293. data8 0x3FE35779F8C43D6E //log(1/frcpa(1+ 212/256)
  294. data8 0x3FE36621961A6A99 //log(1/frcpa(1+ 213/256)
  295. data8 0x3FE37C299F3C366A //log(1/frcpa(1+ 214/256)
  296. data8 0x3FE38AE2171976E7 //log(1/frcpa(1+ 215/256)
  297. data8 0x3FE399A157A603E7 //log(1/frcpa(1+ 216/256)
  298. data8 0x3FE3AFCCFE77B9D1 //log(1/frcpa(1+ 217/256)
  299. data8 0x3FE3BE9D503533B5 //log(1/frcpa(1+ 218/256)
  300. data8 0x3FE3CD7480B4A8A3 //log(1/frcpa(1+ 219/256)
  301. data8 0x3FE3E3C43918F76C //log(1/frcpa(1+ 220/256)
  302. data8 0x3FE3F2ACB27ED6C7 //log(1/frcpa(1+ 221/256)
  303. data8 0x3FE4019C2125CA93 //log(1/frcpa(1+ 222/256)
  304. data8 0x3FE4181061389722 //log(1/frcpa(1+ 223/256)
  305. data8 0x3FE42711518DF545 //log(1/frcpa(1+ 224/256)
  306. data8 0x3FE436194E12B6BF //log(1/frcpa(1+ 225/256)
  307. data8 0x3FE445285D68EA69 //log(1/frcpa(1+ 226/256)
  308. data8 0x3FE45BCC464C893A //log(1/frcpa(1+ 227/256)
  309. data8 0x3FE46AED21F117FC //log(1/frcpa(1+ 228/256)
  310. data8 0x3FE47A1527E8A2D3 //log(1/frcpa(1+ 229/256)
  311. data8 0x3FE489445EFFFCCC //log(1/frcpa(1+ 230/256)
  312. data8 0x3FE4A018BCB69835 //log(1/frcpa(1+ 231/256)
  313. data8 0x3FE4AF5A0C9D65D7 //log(1/frcpa(1+ 232/256)
  314. data8 0x3FE4BEA2A5BDBE87 //log(1/frcpa(1+ 233/256)
  315. data8 0x3FE4CDF28F10AC46 //log(1/frcpa(1+ 234/256)
  316. data8 0x3FE4DD49CF994058 //log(1/frcpa(1+ 235/256)
  317. data8 0x3FE4ECA86E64A684 //log(1/frcpa(1+ 236/256)
  318. data8 0x3FE503C43CD8EB68 //log(1/frcpa(1+ 237/256)
  319. data8 0x3FE513356667FC57 //log(1/frcpa(1+ 238/256)
  320. data8 0x3FE522AE0738A3D8 //log(1/frcpa(1+ 239/256)
  321. data8 0x3FE5322E26867857 //log(1/frcpa(1+ 240/256)
  322. data8 0x3FE541B5CB979809 //log(1/frcpa(1+ 241/256)
  323. data8 0x3FE55144FDBCBD62 //log(1/frcpa(1+ 242/256)
  324. data8 0x3FE560DBC45153C7 //log(1/frcpa(1+ 243/256)
  325. data8 0x3FE5707A26BB8C66 //log(1/frcpa(1+ 244/256)
  326. data8 0x3FE587F60ED5B900 //log(1/frcpa(1+ 245/256)
  327. data8 0x3FE597A7977C8F31 //log(1/frcpa(1+ 246/256)
  328. data8 0x3FE5A760D634BB8B //log(1/frcpa(1+ 247/256)
  329. data8 0x3FE5B721D295F10F //log(1/frcpa(1+ 248/256)
  330. data8 0x3FE5C6EA94431EF9 //log(1/frcpa(1+ 249/256)
  331. data8 0x3FE5D6BB22EA86F6 //log(1/frcpa(1+ 250/256)
  332. data8 0x3FE5E6938645D390 //log(1/frcpa(1+ 251/256)
  333. data8 0x3FE5F673C61A2ED2 //log(1/frcpa(1+ 252/256)
  334. data8 0x3FE6065BEA385926 //log(1/frcpa(1+ 253/256)
  335. data8 0x3FE6164BFA7CC06B //log(1/frcpa(1+ 254/256)
  336. data8 0x3FE62643FECF9743 //log(1/frcpa(1+ 255/256)
  337. .global logf
  338. .global log10f
  339. .text
  340. .proc log10f
  341. .align 32
  342. log10f:
  343. { .mfi
  344. alloc r32 = ar.pfs,1,11,4,0
  345. frcpa.s1 log_B,p15 = f1,f8
  346. addl LOG_AD_COEFF = @ltoff(log_coeff_table),gp
  347. }
  348. { .mfi
  349. mov LOG_mask = 0x1FFFF
  350. fnorm.s1 log_x_norm = f8
  351. addl LOG_AD_CONSTANTS = @ltoff(log_constants_table),gp;;
  352. }
  353. { .mfi
  354. mov LOG_FFF7 = 0xFFF7
  355. fclass.m.unc p8,p0 = f8,0x7 // @zero
  356. shr LOG_bias = LOG_mask,1
  357. }
  358. { .mfi
  359. nop.m 999
  360. fms.s1 log_s = f1,f8,f1
  361. cmp.eq p6,p7 = r0,r0 ;;
  362. }
  363. { .mfi
  364. ld8 LOG_AD_COEFF = [LOG_AD_COEFF]
  365. nop.f 999
  366. nop.i 999
  367. }
  368. { .mfb
  369. ld8 LOG_AD_CONSTANTS = [LOG_AD_CONSTANTS]
  370. nop.f 999
  371. br.sptk LOGF_LOG10F_COMMON
  372. }
  373. .endp log10f
  374. .text
  375. .proc logf
  376. .align 32
  377. logf:
  378. { .mfi
  379. alloc r32 = ar.pfs,1,11,4,0
  380. frcpa.s1 log_B,p15 = f1,f8
  381. addl LOG_AD_COEFF = @ltoff(log_coeff_table),gp
  382. }
  383. { .mfi
  384. mov LOG_mask = 0x1FFFF
  385. fnorm.s1 log_x_norm = f8
  386. addl LOG_AD_CONSTANTS = @ltoff(log_constants_table),gp;;
  387. }
  388. { .mfi
  389. mov LOG_FFF7 = 0xFFF7
  390. fclass.m.unc p8,p0 = f8,0x7 // @zero
  391. shr LOG_bias = LOG_mask,1
  392. }
  393. { .mfi
  394. nop.m 999
  395. fms.s1 log_s = f1,f8,f1
  396. cmp.eq p7,p6 = r0,r0 ;;
  397. }
  398. { .mfi
  399. ld8 LOG_AD_COEFF = [LOG_AD_COEFF]
  400. nop.f 999
  401. nop.i 999
  402. }
  403. { .mfi
  404. ld8 LOG_AD_CONSTANTS = [LOG_AD_CONSTANTS]
  405. nop.f 999
  406. nop.i 999;;
  407. }
  408. LOGF_LOG10F_COMMON:
  409. { .mfi
  410. ldfpd log_coeff_p3,log_coeff_p2 = [LOG_AD_COEFF],16
  411. fms.s1 log_r = f8,log_B,f1
  412. nop.i 999
  413. }
  414. { .mfb
  415. ldfpd log_coeff_p1,log_const_log2 = [LOG_AD_CONSTANTS],16
  416. nop.f 999
  417. (p8) br.cond.spnt LOG_NAN_INF_NEG_ZERO ;;
  418. }
  419. { .mfi
  420. ldfpd log_threshhold, log_inv_ln10 = [LOG_AD_CONSTANTS],16
  421. fma.s1 log_ssq = log_s,log_s,f0
  422. nop.i 999;;
  423. }
  424. { .mfi
  425. getf.exp LOG_x_sexp = log_x_norm
  426. fmerge.s log_abs_s = f1,log_s
  427. nop.i 999;;
  428. }
  429. { .mfi
  430. getf.sig LOG_x_ind = log_x_norm
  431. nop.f 999
  432. nop.i 999;;
  433. }
  434. { .mfi
  435. and LOG_x_n = LOG_x_sexp,LOG_mask
  436. fma.s1 log_rsq = log_r,log_r,f0
  437. cmp.ge p10,p0 = LOG_x_sexp,LOG_mask;;
  438. }
  439. { .mfi
  440. sub LOG_x_n = LOG_x_n,LOG_bias
  441. nop.f 999
  442. shl LOG_x_ind = LOG_x_ind,1;;
  443. }
  444. { .mfi
  445. setf.sig log_n = LOG_x_n
  446. nop.f 999
  447. shr.u LOG_x_ind = LOG_x_ind,56;;
  448. }
  449. { .mfi
  450. nop.m 999
  451. nop.f 999
  452. shl LOG_x_ind = LOG_x_ind,3;;
  453. }
  454. { .mfi
  455. nop.m 999
  456. fma.s1 log_poly_q1 = log_s,log_coeff_p3,log_coeff_p2
  457. nop.i 999
  458. }
  459. { .mfi
  460. nop.m 999
  461. fma.s1 log_poly_p1 = log_r,log_coeff_p3,log_coeff_p2
  462. nop.i 999;;
  463. }
  464. { .mfb
  465. add LOG_AD_CONSTANTS = LOG_AD_CONSTANTS,LOG_x_ind
  466. fcmp.lt.s1 p11,p12 = log_abs_s,log_threshhold
  467. (p10) br.cond.spnt LOG_NAN_INF_NEG_ZERO ;;
  468. }
  469. { .mfi
  470. ldfd log_T = [LOG_AD_CONSTANTS]
  471. nop.f 999
  472. nop.i 999;;
  473. }
  474. { .mfi
  475. nop.m 999
  476. fma.s1 log_poly_q2 = log_s,log_poly_q1,log_coeff_p1
  477. nop.i 999
  478. }
  479. { .mfi
  480. nop.m 999
  481. fma.s1 log_poly_p2 = log_r,log_poly_p1,log_coeff_p1
  482. nop.i 999;;
  483. }
  484. { .mfi
  485. nop.m 999
  486. fcvt.xf log_n = log_n
  487. nop.i 999;;
  488. }
  489. { .mfi
  490. nop.m 999
  491. (p11) fma.s f8 = log_ssq,log_poly_q2,log_s
  492. nop.i 999
  493. }
  494. { .mfi
  495. nop.m 999
  496. fma.s1 log_poly_p3 = log_rsq,log_poly_p2,log_r
  497. nop.i 999;;
  498. }
  499. { .mfi
  500. nop.m 999
  501. (p11) fma.s1 log10_f8 = log_ssq,log_poly_q2,log_s
  502. nop.i 999
  503. }
  504. ;;
  505. { .mfi
  506. nop.m 999
  507. fma.s1 log_T = log_n,log_const_log2,log_T
  508. nop.i 999;;
  509. }
  510. { .mfb
  511. nop.m 999
  512. (p12) fma.s f8 = log_T,f1,log_poly_p3
  513. nop.b 999
  514. }
  515. { .mfb
  516. nop.m 999
  517. (p12) fma.s1 log10_f8 = log_T,f1,log_poly_p3
  518. nop.b 999
  519. }
  520. ;;
  521. { .mfb
  522. nop.m 999
  523. (p6) fma.s f8 = log_inv_ln10, log10_f8, f0
  524. br.ret.sptk b0
  525. }
  526. ;;
  527. LOG_NAN_INF_NEG_ZERO:
  528. // Log[inf] = inf
  529. // Log[0] = -infinity, call error support, tag 4
  530. // Log[-0] = -infinity, call error support, tag 4
  531. // Log[-nonzero] = qnan indefinite, call error support, tag 5
  532. // Log[-inf] = qnan indefinite, call error support, tag 5
  533. // Log[0] = -infinity, call error support, tag 10
  534. // Log[-0] = -infinity, call error support, tag 10
  535. // Log[-nonzero] = qnan indefinite, call error support, tag 11
  536. // Log[-inf] = qnan indefinite, call error support, tag 11
  537. // Log[Nan] = quite NaN
  538. ///////////////////////
  539. // if x is Nan, leave immediately
  540. fclass.m.unc p8,p0 = f8,0xc3 // @snan | @qnan
  541. ;;
  542. (p8) fnorm f8 = f8
  543. ;;
  544. (p8) br.ret.spnt b0
  545. ///////////////////////
  546. // if x is +infinity, leave immediately
  547. fclass.m.unc p8,p0 = f8,0x21 // @inf | @pos
  548. ;;
  549. (p8) frcpa.s1 f8,p15 = f1,f0
  550. ;;
  551. (p8) br.ret.spnt b0
  552. // else if x is zero, set tag to 4 (logf) or 10 (log10f) and call error support
  553. // Log[+-0] = -infinity, with dbz set. Range error
  554. fclass.m.unc p8,p9 = f8,0x7 // @zero
  555. ;;
  556. (p8) frcpa f8,p15 = f1,f0
  557. ;;
  558. .pred.rel "mutex",p7,p6
  559. (p8) fmerge.ns f8 = f8,f8
  560. (p7) mov LOG_tag = 4
  561. (p6) mov LOG_tag = 10
  562. (p8) br.cond.spnt __libm_error_region
  563. // else if x is -non-zero, set tag to 5 and call error support
  564. // Log[-norm, -unorm, -inf] = qnan indefinite, invalid set, domain error
  565. (p9) fclass.m.unc p10, p0 = f8,0x3a // @inf | @norm | @unorm | @neg
  566. ;;
  567. (p10) frcpa.s0 f8,p15 = f0,f0
  568. (p7) mov LOG_tag = 5
  569. (p6) mov LOG_tag = 11
  570. br.cond.spnt __libm_error_region
  571. .endp logf
  572. ///////////////////////////////////////////////////////////////////
  573. // Error handling region
  574. ///////////////////////////////////////////////////////////////////
  575. // Stack operations when calling error support.
  576. // (1) (2)
  577. // sp -> + psp -> +
  578. // | |
  579. // | | <- GR_Y
  580. // | |
  581. // | <-GR_Y Y2->|
  582. // | |
  583. // | | <- GR_X
  584. // | |
  585. // sp-64 -> + sp -> +
  586. // save ar.pfs save b0
  587. // save gp
  588. // (3) (call) (4)
  589. // psp -> + sp -> +
  590. // | |
  591. // R3 ->| <- GR_RESULT | -> f8
  592. // | |
  593. // Y2 ->| <- GR_Y |
  594. // | |
  595. // X1 ->| |
  596. // | |
  597. // sp -> + +
  598. // restore gp
  599. // restore ar.pfs
  600. .proc __libm_error_region
  601. __libm_error_region:
  602. .prologue
  603. // (1)
  604. { .mfi
  605. add GR_Parameter_Y=-32,sp // Parameter 2 value
  606. nop.f 0
  607. .save ar.pfs,GR_SAVE_PFS
  608. mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
  609. }
  610. { .mfi
  611. .fframe 64
  612. add sp=-64,sp // Create new stack
  613. nop.f 0
  614. mov GR_SAVE_GP=gp // Save gp
  615. };;
  616. // (2)
  617. { .mmi
  618. stfs [GR_Parameter_Y] = f1,16 // STORE Parameter 2 on stack
  619. add GR_Parameter_X = 16,sp // Parameter 1 address
  620. .save b0, GR_SAVE_B0
  621. mov GR_SAVE_B0=b0 // Save b0
  622. };;
  623. .body
  624. // (3)
  625. { .mib
  626. stfs [GR_Parameter_X] = log_x_norm // STORE Parameter 1 on stack
  627. add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
  628. nop.b 0
  629. }
  630. { .mib
  631. stfs [GR_Parameter_Y] = f8 // STORE Parameter 3 on stack
  632. add GR_Parameter_Y = -16,GR_Parameter_Y
  633. br.call.sptk b0=__libm_error_support# // Call error handling function
  634. };;
  635. { .mmi
  636. nop.m 0
  637. nop.m 0
  638. add GR_Parameter_RESULT = 48,sp
  639. };;
  640. { .mmi
  641. ldfs f8 = [GR_Parameter_RESULT] // Get return result off stack
  642. .restore
  643. add sp = 64,sp // Restore stack pointer
  644. mov b0 = GR_SAVE_B0 // Restore return address
  645. };;
  646. { .mib
  647. mov gp = GR_SAVE_GP // Restore gp
  648. mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
  649. br.ret.sptk b0 // Return
  650. };;
  651. .endp __libm_error_region
  652. .type __libm_error_support#,@function
  653. .global __libm_error_support#