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.

2359 lines
72 KiB

  1. .file "powf.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. //
  26. // History
  27. //==============================================================
  28. // 2/02/00 Initial version
  29. // 2/03/00 Added p12 to definite over/under path. With odd power we did not
  30. // maintain the sign of x in this path.
  31. // 4/04/00 Unwind support added
  32. // 4/19/00 pow(+-1,inf) now returns NaN
  33. // pow(+-val, +-inf) returns 0 or inf, but now does not call error support
  34. // Added s1 to fcvt.fx because invalid flag was incorrectly set.
  35. // 8/15/00 Bundle added after call to __libm_error_support to properly
  36. // set [the previously overwritten] GR_Parameter_RESULT.
  37. // 9/07/00 Improved performance by eliminating bank conflicts and other stalls,
  38. // and tweaking the critical path
  39. // 9/08/00 Per c99, pow(+-1,inf) now returns 1, and pow(+1,nan) returns 1
  40. // 9/28/00 Updated NaN**0 path
  41. //
  42. // API
  43. //==============================================================
  44. // double pow(double)
  45. // float powf(float)
  46. //
  47. // Overview of operation
  48. //==============================================================
  49. //
  50. // Three steps...
  51. // 1. Log(x)
  52. // 2. y Log(x)
  53. // 3. exp(y log(x))
  54. //
  55. // This means we work with the absolute value of x and merge in the sign later.
  56. // Log(x) = G + delta + r -rsq/2 + p
  57. // G,delta depend on the exponent of x and table entries. The table entries are
  58. // indexed by the exponent of x, called K.
  59. //
  60. // The G and delta come out of the reduction; r is the reduced x.
  61. //
  62. // B = frcpa(x)
  63. // xB-1 is small means that B is the approximate inverse of x.
  64. //
  65. // Log(x) = Log( (1/B)(Bx) )
  66. // = Log(1/B) + Log(Bx)
  67. // = Log(1/B) + Log( 1 + (Bx-1))
  68. //
  69. // x = 2^K 1.x_1x_2.....x_52
  70. // B= frcpa(x) = 2^-k Cm
  71. // Log(1/B) = Log(1/(2^-K Cm))
  72. // Log(1/B) = Log((2^K/ Cm))
  73. // Log(1/B) = K Log(2) + Log(1/Cm)
  74. //
  75. // Log(x) = K Log(2) + Log(1/Cm) + Log( 1 + (Bx-1))
  76. //
  77. // If you take the significand of x, set the exponent to true 0, then Cm is
  78. // the frcpa. We tabulate the Log(1/Cm) values. There are 256 of them.
  79. // The frcpa table is indexed by 8 bits, the x_1 thru x_8.
  80. // m = x_1x_2...x_8 is an 8-bit index.
  81. //
  82. // Log(1/Cm) = log(1/frcpa(1+m/256)) where m goes from 0 to 255.
  83. //
  84. // We tabluate as two doubles, T and t, where T +t is the value itself.
  85. //
  86. // Log(x) = (K Log(2)_hi + T) + (Log(2)_hi + t) + Log( 1 + (Bx-1))
  87. // Log(x) = G + delta + Log( 1 + (Bx-1))
  88. //
  89. // The Log( 1 + (Bx-1)) can be calculated as a series in r = Bx-1.
  90. //
  91. // Log( 1 + (Bx-1)) = r - rsq/2 + p
  92. //
  93. // Then,
  94. //
  95. // yLog(x) = yG + y delta + y(r-rsq/2) + yp
  96. // yLog(x) = Z1 + e3 + Z2 + Z3 + (e2 + e3)
  97. //
  98. //
  99. // exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
  100. //
  101. //
  102. // exp(Z3) is another series.
  103. // exp(e1 + e2 + e3) is approximated as f3 = 1 + (e1 + e2 + e3)
  104. //
  105. // Z1 (128/log2) = number of log2/128 in Z1 is N1
  106. // Z2 (128/log2) = number of log2/128 in Z2 is N2
  107. //
  108. // s1 = Z1 - N1 log2/128
  109. // s2 = Z2 - N2 log2/128
  110. //
  111. // s = s1 + s2
  112. // N = N1 + N2
  113. //
  114. // exp(Z1 + Z2) = exp(Z)
  115. // exp(Z) = exp(s) exp(N log2/128)
  116. //
  117. // exp(r) = exp(Z - N log2/128)
  118. //
  119. // r = s + d = (Z - N (log2/128)_hi) -N (log2/128)_lo
  120. // = Z - N (log2/128)
  121. //
  122. // Z = s+d +N (log2/128)
  123. //
  124. // exp(Z) = exp(s) (1+d) exp(N log2/128)
  125. //
  126. // N = M 128 + n
  127. //
  128. // N log2/128 = M log2 + n log2/128
  129. //
  130. // n is 8 binary digits = n_7n_6...n_1
  131. //
  132. // n log2/128 = n_7n_6n_5 16 log2/128 + n_4n_3n_2n_1 log2/128
  133. // n log2/128 = n_7n_6n_5 log2/8 + n_4n_3n_2n_1 log2/128
  134. // n log2/128 = I2 log2/8 + I1 log2/128
  135. //
  136. // N log2/128 = M log2 + I2 log2/8 + I1 log2/128
  137. //
  138. // exp(Z) = exp(s) (1+d) exp(log(2^M) + log(2^I2/8) + log(2^I1/128))
  139. // exp(Z) = exp(s) (1+d1) (1+d2)(2^M) 2^I2/8 2^I1/128
  140. // exp(Z) = exp(s) f1 f2 (2^M) 2^I2/8 2^I1/128
  141. //
  142. // I1, I2 are table indices. Use a series for exp(s).
  143. // Then get exp(Z)
  144. //
  145. // exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
  146. // exp(yLog(x)) = exp(Z) exp(Z3) f3
  147. // exp(yLog(x)) = exp(Z)f3 exp(Z3)
  148. // exp(yLog(x)) = A exp(Z3)
  149. //
  150. // We actually calculate exp(Z3) -1.
  151. // Then,
  152. // exp(yLog(x)) = A + A( exp(Z3) -1)
  153. //
  154. // Table Generation
  155. //==============================================================
  156. // The log values
  157. // ==============
  158. // The operation (K*log2_hi) must be exact. K is the true exponent of x.
  159. // If we allow gradual underflow (denormals), K can be represented in 12 bits
  160. // (as a two's complement number). We assume 13 bits as an engineering precaution.
  161. //
  162. // +------------+----------------+-+
  163. // | 13 bits | 50 bits | |
  164. // +------------+----------------+-+
  165. // 0 1 66
  166. // 2 34
  167. //
  168. // So we want the lsb(log2_hi) to be 2^-50
  169. // We get log2 as a quad-extended (15-bit exponent, 128-bit significand)
  170. //
  171. // 0 fffe b17217f7d1cf79ab c9e3b39803f2f6af (4...)
  172. //
  173. // Consider numbering the bits left to right, starting at 0 thru 127.
  174. // Bit 0 is the 2^-1 bit; bit 49 is the 2^-50 bit.
  175. //
  176. // ...79ab
  177. // 0111 1001 1010 1011
  178. // 44
  179. // 89
  180. //
  181. // So if we shift off the rightmost 14 bits, then (shift back only
  182. // the top half) we get
  183. //
  184. // 0 fffe b17217f7d1cf4000 e6af278ece600fcb dabc000000000000
  185. //
  186. // Put the right 64-bit signficand in an FR register, convert to double;
  187. // it is exact. Put the next 128 bits into a quad register and round to double.
  188. // The true exponent of the low part is -51.
  189. //
  190. // hi is 0 fffe b17217f7d1cf4000
  191. // lo is 0 ffcc e6af278ece601000
  192. //
  193. // Convert to double memory format and get
  194. //
  195. // hi is 0x3fe62e42fefa39e8
  196. // lo is 0x3cccd5e4f1d9cc02
  197. //
  198. // log2_hi + log2_lo is an accurate value for log2.
  199. //
  200. //
  201. // The T and t values
  202. // ==================
  203. // A similar method is used to generate the T and t values.
  204. //
  205. // K * log2_hi + T must be exact.
  206. //
  207. // Smallest T,t
  208. // ----------
  209. // The smallest T,t is
  210. // T t
  211. // data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81 log(1/frcpa(1+0/256))= +1.95503e-003
  212. //
  213. // The exponent is 0x3f6 (biased) or -9 (true).
  214. // For the smallest T value, what we want is to clip the significand such that
  215. // when it is shifted right by 9, its lsb is in the bit for 2^-51. The 9 is the specific
  216. // for the first entry. In general, it is 0xffff - (biased 15-bit exponent).
  217. // Independently, what we have calculated is the table value as a quad precision number.
  218. // Table entry 1 is
  219. // 0 fff6 80200aaeac44ef38 338f77605fdf8000
  220. //
  221. // We store this quad precision number in a data structure that is
  222. // sign: 1
  223. // exponent: 15
  224. // signficand_hi: 64 (includes explicit bit)
  225. // signficand_lo: 49
  226. // Because the explicit bit is included, the significand is 113 bits.
  227. //
  228. // Consider significand_hi for table entry 1.
  229. //
  230. //
  231. // +-+--- ... -------+--------------------+
  232. // | |
  233. // +-+--- ... -------+--------------------+
  234. // 0 1 4444444455555555556666
  235. // 2345678901234567890123
  236. //
  237. // Labeled as above, bit 0 is 2^0, bit 1 is 2^-1, etc.
  238. // Bit 42 is 2^-42. If we shift to the right by 9, the bit in
  239. // bit 42 goes in 51.
  240. //
  241. // So what we want to do is shift bits 43 thru 63 into significand_lo.
  242. // This is shifting bit 42 into bit 63, taking care to retain the shifted-off bits.
  243. // Then shifting (just with signficaand_hi) back into bit 42.
  244. //
  245. // The shift_value is 63-42 = 21. In general, this is
  246. // 63 - (51 -(0xffff - 0xfff6))
  247. // For this example, it is
  248. // 63 - (51 - 9) = 63 - 42 = 21
  249. //
  250. // This means we are shifting 21 bits into significand_lo. We must maintain more
  251. // that a 128-bit signficand not to lose bits. So before the shift we put the 128-bit
  252. // significand into a 256-bit signficand and then shift.
  253. // The 256-bit significand has four parts: hh, hl, lh, and ll.
  254. //
  255. // Start off with
  256. // hh hl lh ll
  257. // <64> <49><15_0> <64_0> <64_0>
  258. //
  259. // After shift by 21 (then return for significand_hi),
  260. // <43><21_0> <21><43> <6><58_0> <64_0>
  261. //
  262. // Take the hh part and convert to a double. There is no rounding here.
  263. // The conversion is exact. The true exponent of the high part is the same as the
  264. // true exponent of the input quad.
  265. //
  266. // We have some 64 plus significand bits for the low part. In this example, we have
  267. // 70 bits. We want to round this to a double. Put them in a quad and then do a quad fnorm.
  268. // For this example the true exponent of the low part is
  269. // true_exponent_of_high - 43 = true_exponent_of_high - (64-21)
  270. // In general, this is
  271. // true_exponent_of_high - (64 - shift_value)
  272. //
  273. //
  274. // Largest T,t
  275. // ----------
  276. // The largest T,t is
  277. // data8 0x3fe62643fecf9742, 0x3c9e3147684bd37d log(1/frcpa(1+255/256))= +6.92171e-001
  278. //
  279. // Table entry 256 is
  280. // 0 fffe b1321ff67cba178c 51da12f4df5a0000
  281. //
  282. // The shift value is
  283. // 63 - (51 -(0xffff - 0xfffe)) = 13
  284. //
  285. // The true exponent of the low part is
  286. // true_exponent_of_high - (64 - shift_value)
  287. // -1 - (64-13) = -52
  288. // Biased as a double, this is 0x3cb
  289. //
  290. //
  291. //
  292. // So then lsb(T) must be >= 2^-51
  293. // msb(Klog2_hi) <= 2^12
  294. //
  295. // +--------+---------+
  296. // | 51 bits | <== largest T
  297. // +--------+---------+
  298. // | 9 bits | 42 bits | <== smallest T
  299. // +------------+----------------+-+
  300. // | 13 bits | 50 bits | |
  301. // +------------+----------------+-+
  302. // Special Cases
  303. //==============================================================
  304. // double float
  305. // overflow error 24 30
  306. // underflow error 25 31
  307. // X zero Y zero
  308. // +0 +0 +1 error 26 32
  309. // -0 +0 +1 error 26 32
  310. // +0 -0 +1 error 26 32
  311. // -0 -0 +1 error 26 32
  312. // X zero Y negative
  313. // +0 -odd integer +inf error 27 33 divide-by-zero
  314. // -0 -odd integer -inf error 27 33 divide-by-zero
  315. // +0 !-odd integer +inf error 27 33 divide-by-zero
  316. // -0 !-odd integer +inf error 27 33 divide-by-zero
  317. // +0 -inf +inf error 27 33 divide-by-zero
  318. // -0 -inf +inf error 27 33 divide-by-zero
  319. // X zero Y positve
  320. // +0 +odd integer +0
  321. // -0 +odd integer -0
  322. // +0 !+odd integer +0
  323. // -0 !+odd integer +0
  324. // +0 +inf +0
  325. // -0 +inf +0
  326. // X one
  327. // -1 Y inf +1
  328. // -1 Y NaN quiet Y invalid if Y SNaN
  329. // +1 Y any +1
  330. // X - Y not integer QNAN error 28 34 invalid
  331. // X NaN Y 0 +1 error 29 35
  332. // X NaN Y NaN quiet X invalid if X or Y SNaN
  333. // X NaN Y any else quiet X invalid if X SNaN
  334. // X !+1 Y NaN quiet Y invalid if Y SNaN
  335. // X +inf Y >0 +inf
  336. // X -inf Y >0, !odd integer +inf
  337. // X -inf Y >0, odd integer -inf
  338. // X +inf Y <0 +0
  339. // X -inf Y <0, !odd integer +0
  340. // X -inf Y <0, odd integer -0
  341. // X +inf Y =0 +0
  342. // X -inf Y =0 +0
  343. // Assembly macros
  344. //==============================================================
  345. // integer registers used
  346. pow_AD_Tt = r33
  347. pow_GR_FFF7 = r34
  348. pow_GR_exp_Y = r34 // duplicate
  349. pow_GR_17ones = r35
  350. pow_AD_P = r36
  351. pow_AD_Q = r37
  352. pow_AD_tbl1 = r38
  353. pow_AD_tbl2 = r39
  354. pow_GR_exp_X = r40
  355. pow_GR_true_exp_X = r40 // duplicate
  356. pow_GR_offset = r41
  357. pow_GR_exp_Xm1 = r42
  358. pow_GR_sig_X = r43
  359. pow_GR_signexp_X = r44
  360. pow_GR_signexp_Xm1 = r46
  361. pow_GR_int_W1 = r47
  362. pow_GR_int_W2 = r48
  363. pow_GR_int_N = r49
  364. pow_GR_index1 = r50
  365. pow_GR_index2 = r51
  366. pow_AD_T1 = r52
  367. pow_AD_T2 = r53
  368. pow_GR_gt_ln = r53 // duplicate
  369. pow_int_GR_M = r54
  370. pow_GR_FFFE = r55
  371. pow_GR_10033 = r55
  372. pow_GR_16ones = r56
  373. pow_GR_sig_int_Y = r57
  374. pow_GR_sign_Y_Gpr = r58
  375. pow_GR_17ones_m1 = r59
  376. pow_GR_one = r60
  377. pow_GR_sign_Y = r60
  378. pow_GR_signexp_Y_Gpr = r61
  379. pow_GR_exp_Y_Gpr = r62
  380. pow_GR_true_exp_Y_Gpr = r63
  381. pow_GR_signexp_Y = r64
  382. GR_SAVE_B0 = r65
  383. GR_SAVE_GP = r66
  384. GR_SAVE_PFS = r67
  385. GR_Parameter_X = r68
  386. GR_Parameter_Y = r69
  387. GR_Parameter_RESULT = r70
  388. pow_GR_tag = r71
  389. // floating point registers used
  390. POW_B = f32
  391. POW_NORM_X = f33
  392. POW_Xm1 = f34
  393. POW_r1 = f34
  394. POW_P4 = f35
  395. POW_P5 = f36
  396. POW_NORM_Y = f37
  397. POW_Q2 = f38
  398. POW_Q3 = f39
  399. POW_P2 = f40
  400. POW_P3 = f41
  401. POW_P0 = f42
  402. POW_log2_lo = f43
  403. POW_r = f44
  404. POW_Q0 = f45
  405. POW_Q1 = f46
  406. POW_v21 = f47
  407. POW_log2_hi = f48
  408. POW_Q4 = f49
  409. POW_P1 = f50
  410. POW_log2_by_128_hi = f51
  411. POW_inv_log2_by_128 = f52
  412. POW_rsq = f53
  413. POW_r1sq = f54
  414. POW_log2_by_128_lo = f55
  415. POW_v6 = f56
  416. POW_v61 = f57
  417. POW_v4 = f58
  418. POW_v2 = f59
  419. POW_T = f60
  420. POW_Tt = f61
  421. POW_r1sq_by_2 = f62
  422. POW_rsq_by_2 = f63
  423. POW_r1cub = f64
  424. POW_rcub = f65
  425. POW_U = f66
  426. POW_G = f67
  427. POW_delta = f68
  428. POW_v3 = f69
  429. POW_V = f70
  430. POW_p = f71
  431. POW_Z1 = f72
  432. POW_e3 = f73
  433. POW_e2 = f74
  434. POW_Z2 = f75
  435. POW_e1 = f76
  436. POW_W1 = f77
  437. POW_UmZ2 = f78
  438. POW_W2 = f79
  439. POW_Z3 = f80
  440. POW_int_W1 = f81
  441. POW_e12 = f82
  442. POW_int_W2 = f83
  443. POW_UmZ2pV = f84
  444. POW_Z3sq = f85
  445. POW_e123 = f86
  446. POW_N1float = f87
  447. POW_N2float = f88
  448. POW_f3 = f89
  449. POW_q = f90
  450. POW_s1 = f91
  451. POW_Nfloat = f92
  452. POW_s2 = f93
  453. POW_f2 = f94
  454. POW_f1 = f95
  455. POW_T1 = f96
  456. POW_T2 = f97
  457. POW_2M = f98
  458. POW_s = f99
  459. POW_f12 = f100
  460. POW_ssq = f101
  461. POW_T1T2 = f102
  462. POW_1ps = f103
  463. POW_A = f104
  464. POW_es = f105
  465. POW_half = f106
  466. POW_int_K = f107
  467. POW_K = f108
  468. POW_f123 = f109
  469. POW_Gpr = f110
  470. POW_Y_Gpr = f111
  471. POW_int_Y = f112
  472. POW_v61 = f113
  473. POW_v41 = f114
  474. POW_abs_f8 = f115
  475. POW_float_int_Y = f116
  476. POW_ftz_urm_f8 = f117
  477. POW_wre_urm_f8 = f118
  478. POW_abs_A = f119
  479. POW_gt_pln = f120
  480. POW_ABS_NORM_X = f121
  481. // Data tables
  482. //==============================================================
  483. .data
  484. .align 16
  485. pow_table_P:
  486. data8 0x9249FE7F0DC423CF, 0x00003FFC // P_4
  487. data8 0x8000F7B249FF332D, 0x0000BFFC // P_5
  488. data8 0xAAAAAAA9E7902C7F, 0x0000BFFC // P_3
  489. data8 0x80000000000018E5, 0x0000BFFD // P_1
  490. data8 0xb8aa3b295c17f0bc, 0x00004006 // inv_ln2_by_128
  491. data8 0xc9e3b39803f2f6af, 0x00003fb7 // ln2_by_128_lo
  492. data8 0x3FA5555555554A9E // Q_2
  493. data8 0x3F8111124F4DD9F9 // Q_3
  494. data8 0x3FE0000000000000 // Q_0
  495. data8 0x3FC5555555554733 // Q_1
  496. data8 0x3F56C16D9360FFA0 // Q_4
  497. data8 0x0000000000000000 // pad
  498. data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
  499. data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
  500. pow_Tt:
  501. data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81 // log(1/frcpa(1+0/256))= +1.95503e-003
  502. data8 0x3f78121214586a00, 0x3cb540e0a5cfc9bc // log(1/frcpa(1+1/256))= +5.87661e-003
  503. data8 0x3f841929f9683200, 0x3cbdf1d57404da1f // log(1/frcpa(1+2/256))= +9.81362e-003
  504. data8 0x3f8c317384c75f00, 0x3c69806208c04c22 // log(1/frcpa(1+3/256))= +1.37662e-002
  505. data8 0x3f91a6b91ac73380, 0x3c7874daa716eb32 // log(1/frcpa(1+4/256))= +1.72376e-002
  506. data8 0x3f95ba9a5d9ac000, 0x3cacbb84e08d78ac // log(1/frcpa(1+5/256))= +2.12196e-002
  507. data8 0x3f99d2a807432580, 0x3cbcf80538b441e1 // log(1/frcpa(1+6/256))= +2.52177e-002
  508. data8 0x3f9d6b2725979800, 0x3c6095e5c8f8f359 // log(1/frcpa(1+7/256))= +2.87291e-002
  509. data8 0x3fa0c58fa19dfa80, 0x3cb4c5d4e9d0dda2 // log(1/frcpa(1+8/256))= +3.27573e-002
  510. data8 0x3fa2954c78cbce00, 0x3caa932b860ab8d6 // log(1/frcpa(1+9/256))= +3.62953e-002
  511. data8 0x3fa4a94d2da96c40, 0x3ca670452b76bbd5 // log(1/frcpa(1+10/256))= +4.03542e-002
  512. data8 0x3fa67c94f2d4bb40, 0x3ca84104f9941798 // log(1/frcpa(1+11/256))= +4.39192e-002
  513. data8 0x3fa85188b630f040, 0x3cb40a882cbf0153 // log(1/frcpa(1+12/256))= +4.74971e-002
  514. data8 0x3faa6b8abe73af40, 0x3c988d46e25c9059 // log(1/frcpa(1+13/256))= +5.16017e-002
  515. data8 0x3fac441e06f72a80, 0x3cae3e930a1a2a96 // log(1/frcpa(1+14/256))= +5.52072e-002
  516. data8 0x3fae1e6713606d00, 0x3c8a796f6283b580 // log(1/frcpa(1+15/256))= +5.88257e-002
  517. data8 0x3faffa6911ab9300, 0x3c5193070351e88a // log(1/frcpa(1+16/256))= +6.24574e-002
  518. data8 0x3fb0ec139c5da600, 0x3c623f2a75eb992d // log(1/frcpa(1+17/256))= +6.61022e-002
  519. data8 0x3fb1dbd2643d1900, 0x3ca649b2ef8927f0 // log(1/frcpa(1+18/256))= +6.97605e-002
  520. data8 0x3fb2cc7284fe5f00, 0x3cbc5e86599513e2 // log(1/frcpa(1+19/256))= +7.34321e-002
  521. data8 0x3fb3bdf5a7d1ee60, 0x3c90bd4bb69dada3 // log(1/frcpa(1+20/256))= +7.71173e-002
  522. data8 0x3fb4b05d7aa012e0, 0x3c54e377c9b8a54f // log(1/frcpa(1+21/256))= +8.08161e-002
  523. data8 0x3fb580db7ceb5700, 0x3c7fdb2f98354cde // log(1/frcpa(1+22/256))= +8.39975e-002
  524. data8 0x3fb674f089365a60, 0x3cb9994c9d3301c1 // log(1/frcpa(1+23/256))= +8.77219e-002
  525. data8 0x3fb769ef2c6b5680, 0x3caaec639db52a79 // log(1/frcpa(1+24/256))= +9.14602e-002
  526. data8 0x3fb85fd927506a40, 0x3c9f9f99a3cf8e25 // log(1/frcpa(1+25/256))= +9.52125e-002
  527. data8 0x3fb9335e5d594980, 0x3ca15c3abd47d99a // log(1/frcpa(1+26/256))= +9.84401e-002
  528. data8 0x3fba2b0220c8e5e0, 0x3cb4ca639adf6fc3 // log(1/frcpa(1+27/256))= +1.02219e-001
  529. data8 0x3fbb0004ac1a86a0, 0x3ca7cb81bf959a59 // log(1/frcpa(1+28/256))= +1.05469e-001
  530. data8 0x3fbbf968769fca00, 0x3cb0c646c121418e // log(1/frcpa(1+29/256))= +1.09274e-001
  531. data8 0x3fbccfedbfee13a0, 0x3ca0465fce24ab4b // log(1/frcpa(1+30/256))= +1.12548e-001
  532. data8 0x3fbda727638446a0, 0x3c82803f4e2e6603 // log(1/frcpa(1+31/256))= +1.15832e-001
  533. data8 0x3fbea3257fe10f60, 0x3cb986a3f2313d1a // log(1/frcpa(1+32/256))= +1.19677e-001
  534. data8 0x3fbf7be9fedbfde0, 0x3c97d16a6a621cf4 // log(1/frcpa(1+33/256))= +1.22985e-001
  535. data8 0x3fc02ab352ff25f0, 0x3c9cc6baad365600 // log(1/frcpa(1+34/256))= +1.26303e-001
  536. data8 0x3fc097ce579d2040, 0x3cb9ba16d329440b // log(1/frcpa(1+35/256))= +1.29633e-001
  537. data8 0x3fc1178e8227e470, 0x3cb7bc671683f8e6 // log(1/frcpa(1+36/256))= +1.33531e-001
  538. data8 0x3fc185747dbecf30, 0x3c9d1116f66d2345 // log(1/frcpa(1+37/256))= +1.36885e-001
  539. data8 0x3fc1f3b925f25d40, 0x3c8162c9ef939ac6 // log(1/frcpa(1+38/256))= +1.40250e-001
  540. data8 0x3fc2625d1e6ddf50, 0x3caad3a1ec384fc3 // log(1/frcpa(1+39/256))= +1.43627e-001
  541. data8 0x3fc2d1610c868130, 0x3cb3ad997036941b // log(1/frcpa(1+40/256))= +1.47015e-001
  542. data8 0x3fc340c597411420, 0x3cbc2308262c7998 // log(1/frcpa(1+41/256))= +1.50414e-001
  543. data8 0x3fc3b08b6757f2a0, 0x3cb2170d6cdf0526 // log(1/frcpa(1+42/256))= +1.53825e-001
  544. data8 0x3fc40dfb08378000, 0x3c9bb453c4f7b685 // log(1/frcpa(1+43/256))= +1.56677e-001
  545. data8 0x3fc47e74e8ca5f70, 0x3cb836a48fdfce9d // log(1/frcpa(1+44/256))= +1.60109e-001
  546. data8 0x3fc4ef51f6466de0, 0x3ca07a43919aa64b // log(1/frcpa(1+45/256))= +1.63553e-001
  547. data8 0x3fc56092e02ba510, 0x3ca85006899d97b0 // log(1/frcpa(1+46/256))= +1.67010e-001
  548. data8 0x3fc5d23857cd74d0, 0x3ca30a5ba6e7abbe // log(1/frcpa(1+47/256))= +1.70478e-001
  549. data8 0x3fc6313a37335d70, 0x3ca905586f0ac97e // log(1/frcpa(1+48/256))= +1.73377e-001
  550. data8 0x3fc6a399dabbd380, 0x3c9b2c6657a96684 // log(1/frcpa(1+49/256))= +1.76868e-001
  551. data8 0x3fc70337dd3ce410, 0x3cb50bc52f55cdd8 // log(1/frcpa(1+50/256))= +1.79786e-001
  552. data8 0x3fc77654128f6120, 0x3cad2eb7c9a39efe // log(1/frcpa(1+51/256))= +1.83299e-001
  553. data8 0x3fc7e9d82a0b0220, 0x3cba127e90393c01 // log(1/frcpa(1+52/256))= +1.86824e-001
  554. data8 0x3fc84a6b759f5120, 0x3cbd7fd52079f706 // log(1/frcpa(1+53/256))= +1.89771e-001
  555. data8 0x3fc8ab47d5f5a300, 0x3cbfae141751a3de // log(1/frcpa(1+54/256))= +1.92727e-001
  556. data8 0x3fc91fe490965810, 0x3cb69cf30a1c319e // log(1/frcpa(1+55/256))= +1.96286e-001
  557. data8 0x3fc981634011aa70, 0x3ca5bb3d208bc42a // log(1/frcpa(1+56/256))= +1.99261e-001
  558. data8 0x3fc9f6c407089660, 0x3ca04d68658179a0 // log(1/frcpa(1+57/256))= +2.02843e-001
  559. data8 0x3fca58e729348f40, 0x3c99f5411546c286 // log(1/frcpa(1+58/256))= +2.05838e-001
  560. data8 0x3fcabb55c31693a0, 0x3cb9a5350eb327d5 // log(1/frcpa(1+59/256))= +2.08842e-001
  561. data8 0x3fcb1e104919efd0, 0x3c18965fcce7c406 // log(1/frcpa(1+60/256))= +2.11855e-001
  562. data8 0x3fcb94ee93e367c0, 0x3cb503716da45184 // log(1/frcpa(1+61/256))= +2.15483e-001
  563. data8 0x3fcbf851c0675550, 0x3cbdf1b3f7ab5378 // log(1/frcpa(1+62/256))= +2.18516e-001
  564. data8 0x3fcc5c0254bf23a0, 0x3ca7aab9ed0b1d7b // log(1/frcpa(1+63/256))= +2.21558e-001
  565. data8 0x3fccc000c9db3c50, 0x3c92a7a2a850072a // log(1/frcpa(1+64/256))= +2.24609e-001
  566. data8 0x3fcd244d99c85670, 0x3c9f6019120edf4c // log(1/frcpa(1+65/256))= +2.27670e-001
  567. data8 0x3fcd88e93fb2f450, 0x3c6affb96815e081 // log(1/frcpa(1+66/256))= +2.30741e-001
  568. data8 0x3fcdedd437eaef00, 0x3c72553595897976 // log(1/frcpa(1+67/256))= +2.33820e-001
  569. data8 0x3fce530effe71010, 0x3c90913b020fa182 // log(1/frcpa(1+68/256))= +2.36910e-001
  570. data8 0x3fceb89a1648b970, 0x3c837ba4045bfd25 // log(1/frcpa(1+69/256))= +2.40009e-001
  571. data8 0x3fcf1e75fadf9bd0, 0x3cbcea6d13e0498d // log(1/frcpa(1+70/256))= +2.43117e-001
  572. data8 0x3fcf84a32ead7c30, 0x3ca5e3a67b3c6d77 // log(1/frcpa(1+71/256))= +2.46235e-001
  573. data8 0x3fcfeb2233ea07c0, 0x3cba0c6f0049c5a6 // log(1/frcpa(1+72/256))= +2.49363e-001
  574. data8 0x3fd028f9c7035c18, 0x3cb0a30b06677ff6 // log(1/frcpa(1+73/256))= +2.52501e-001
  575. data8 0x3fd05c8be0d96358, 0x3ca0f1c77ccb5865 // log(1/frcpa(1+74/256))= +2.55649e-001
  576. data8 0x3fd085eb8f8ae790, 0x3cbd513f45fe7a97 // log(1/frcpa(1+75/256))= +2.58174e-001
  577. data8 0x3fd0b9c8e32d1910, 0x3c927449047ca006 // log(1/frcpa(1+76/256))= +2.61339e-001
  578. data8 0x3fd0edd060b78080, 0x3c89b52d8435f53e // log(1/frcpa(1+77/256))= +2.64515e-001
  579. data8 0x3fd122024cf00638, 0x3cbdd976fabda4bd // log(1/frcpa(1+78/256))= +2.67701e-001
  580. data8 0x3fd14be2927aecd0, 0x3cb02f90ad0bc471 // log(1/frcpa(1+79/256))= +2.70257e-001
  581. data8 0x3fd180618ef18ad8, 0x3cbd003792c71a98 // log(1/frcpa(1+80/256))= +2.73461e-001
  582. data8 0x3fd1b50bbe2fc638, 0x3ca9ae64c6403ead // log(1/frcpa(1+81/256))= +2.76675e-001
  583. data8 0x3fd1df4cc7cf2428, 0x3cb43f0455f7e395 // log(1/frcpa(1+82/256))= +2.79254e-001
  584. data8 0x3fd214456d0eb8d0, 0x3cb0fbd748d75d30 // log(1/frcpa(1+83/256))= +2.82487e-001
  585. data8 0x3fd23ec5991eba48, 0x3c906edd746b77e2 // log(1/frcpa(1+84/256))= +2.85081e-001
  586. data8 0x3fd2740d9f870af8, 0x3ca9802e6a00a670 // log(1/frcpa(1+85/256))= +2.88333e-001
  587. data8 0x3fd29ecdabcdfa00, 0x3cacecef70890cfa // log(1/frcpa(1+86/256))= +2.90943e-001
  588. data8 0x3fd2d46602adcce8, 0x3cb97911955f3521 // log(1/frcpa(1+87/256))= +2.94214e-001
  589. data8 0x3fd2ff66b04ea9d0, 0x3cb12dabe191d1c9 // log(1/frcpa(1+88/256))= +2.96838e-001
  590. data8 0x3fd335504b355a30, 0x3cbdf9139df924ec // log(1/frcpa(1+89/256))= +3.00129e-001
  591. data8 0x3fd360925ec44f58, 0x3cb253e68977a1e3 // log(1/frcpa(1+90/256))= +3.02769e-001
  592. data8 0x3fd38bf1c3337e70, 0x3cb3d283d2a2da21 // log(1/frcpa(1+91/256))= +3.05417e-001
  593. data8 0x3fd3c25277333180, 0x3cadaa5b035eae27 // log(1/frcpa(1+92/256))= +3.08735e-001
  594. data8 0x3fd3edf463c16838, 0x3cb983d680d3c108 // log(1/frcpa(1+93/256))= +3.11399e-001
  595. data8 0x3fd419b423d5e8c0, 0x3cbc86dd921c139d // log(1/frcpa(1+94/256))= +3.14069e-001
  596. data8 0x3fd44591e0539f48, 0x3c86a76d6dc2782e // log(1/frcpa(1+95/256))= +3.16746e-001
  597. data8 0x3fd47c9175b6f0a8, 0x3cb59a2e013c6b5f // log(1/frcpa(1+96/256))= +3.20103e-001
  598. data8 0x3fd4a8b341552b08, 0x3c93f1e86e468694 // log(1/frcpa(1+97/256))= +3.22797e-001
  599. data8 0x3fd4d4f390890198, 0x3cbf5e4ea7c5105a // log(1/frcpa(1+98/256))= +3.25498e-001
  600. data8 0x3fd501528da1f960, 0x3cbf58da53e9ad10 // log(1/frcpa(1+99/256))= +3.28206e-001
  601. data8 0x3fd52dd06347d4f0, 0x3cb98a28cebf6eef // log(1/frcpa(1+100/256))= +3.30921e-001
  602. data8 0x3fd55a6d3c7b8a88, 0x3c9c76b67c2d1fd4 // log(1/frcpa(1+101/256))= +3.33644e-001
  603. data8 0x3fd5925d2b112a58, 0x3c9029616a4331b8 // log(1/frcpa(1+102/256))= +3.37058e-001
  604. data8 0x3fd5bf406b543db0, 0x3c9fb8292ecfc820 // log(1/frcpa(1+103/256))= +3.39798e-001
  605. data8 0x3fd5ec433d5c35a8, 0x3cb71a1229d17eec // log(1/frcpa(1+104/256))= +3.42545e-001
  606. data8 0x3fd61965cdb02c18, 0x3cbba94fe1dbb8d2 // log(1/frcpa(1+105/256))= +3.45300e-001
  607. data8 0x3fd646a84935b2a0, 0x3c9ee496d2c9ae57 // log(1/frcpa(1+106/256))= +3.48063e-001
  608. data8 0x3fd6740add31de90, 0x3cb1da3a6c7a9dfd // log(1/frcpa(1+107/256))= +3.50833e-001
  609. data8 0x3fd6a18db74a58c0, 0x3cb494c257add8dc // log(1/frcpa(1+108/256))= +3.53610e-001
  610. data8 0x3fd6cf31058670e8, 0x3cb0b244a70a8da9 // log(1/frcpa(1+109/256))= +3.56396e-001
  611. data8 0x3fd6f180e852f0b8, 0x3c9db7aefa866720 // log(1/frcpa(1+110/256))= +3.58490e-001
  612. data8 0x3fd71f5d71b894e8, 0x3cbe91c4bf324957 // log(1/frcpa(1+111/256))= +3.61289e-001
  613. data8 0x3fd74d5aefd66d58, 0x3cb06b3d9bfac023 // log(1/frcpa(1+112/256))= +3.64096e-001
  614. data8 0x3fd77b79922bd378, 0x3cb727d8804491f4 // log(1/frcpa(1+113/256))= +3.66911e-001
  615. data8 0x3fd7a9b9889f19e0, 0x3ca2ef22df5bc543 // log(1/frcpa(1+114/256))= +3.69734e-001
  616. data8 0x3fd7d81b037eb6a0, 0x3cb8fd3ba07a7ece // log(1/frcpa(1+115/256))= +3.72565e-001
  617. data8 0x3fd8069e33827230, 0x3c8bd1e25866e61a // log(1/frcpa(1+116/256))= +3.75404e-001
  618. data8 0x3fd82996d3ef8bc8, 0x3ca5aab9f5928928 // log(1/frcpa(1+117/256))= +3.77538e-001
  619. data8 0x3fd85855776dcbf8, 0x3ca56f33337789d6 // log(1/frcpa(1+118/256))= +3.80391e-001
  620. data8 0x3fd8873658327cc8, 0x3cbb8ef0401db49d // log(1/frcpa(1+119/256))= +3.83253e-001
  621. data8 0x3fd8aa75973ab8c8, 0x3cbb9961f509a680 // log(1/frcpa(1+120/256))= +3.85404e-001
  622. data8 0x3fd8d992dc8824e0, 0x3cb220512a53732d // log(1/frcpa(1+121/256))= +3.88280e-001
  623. data8 0x3fd908d2ea7d9510, 0x3c985f0e513bfb5c // log(1/frcpa(1+122/256))= +3.91164e-001
  624. data8 0x3fd92c59e79c0e50, 0x3cb82e073fd30d63 // log(1/frcpa(1+123/256))= +3.93332e-001
  625. data8 0x3fd95bd750ee3ed0, 0x3ca4aa7cdb6dd8a8 // log(1/frcpa(1+124/256))= +3.96231e-001
  626. data8 0x3fd98b7811a3ee58, 0x3caa93a5b660893e // log(1/frcpa(1+125/256))= +3.99138e-001
  627. data8 0x3fd9af47f33d4068, 0x3cac294b3b3190ba // log(1/frcpa(1+126/256))= +4.01323e-001
  628. data8 0x3fd9df270c1914a0, 0x3cbe1a58fd0cd67e // log(1/frcpa(1+127/256))= +4.04245e-001
  629. data8 0x3fda0325ed14fda0, 0x3cb1efa7950fb57e // log(1/frcpa(1+128/256))= +4.06442e-001
  630. data8 0x3fda33440224fa78, 0x3c8915fe75e7d477 // log(1/frcpa(1+129/256))= +4.09379e-001
  631. data8 0x3fda57725e80c380, 0x3ca72bd1062b1b7f // log(1/frcpa(1+130/256))= +4.11587e-001
  632. data8 0x3fda87d0165dd198, 0x3c91f7845f58dbad // log(1/frcpa(1+131/256))= +4.14539e-001
  633. data8 0x3fdaac2e6c03f890, 0x3cb6f237a911c509 // log(1/frcpa(1+132/256))= +4.16759e-001
  634. data8 0x3fdadccc6fdf6a80, 0x3c90ddc4b7687169 // log(1/frcpa(1+133/256))= +4.19726e-001
  635. data8 0x3fdb015b3eb1e790, 0x3c692dd7d90e1e8e // log(1/frcpa(1+134/256))= +4.21958e-001
  636. data8 0x3fdb323a3a635948, 0x3c6f85655cbe14de // log(1/frcpa(1+135/256))= +4.24941e-001
  637. data8 0x3fdb56fa04462908, 0x3c95252d841994de // log(1/frcpa(1+136/256))= +4.27184e-001
  638. data8 0x3fdb881aa659bc90, 0x3caa53a745a3642f // log(1/frcpa(1+137/256))= +4.30182e-001
  639. data8 0x3fdbad0bef3db160, 0x3cb32f2540dcc16a // log(1/frcpa(1+138/256))= +4.32437e-001
  640. data8 0x3fdbd21297781c28, 0x3cbd8e891e106f1d // log(1/frcpa(1+139/256))= +4.34697e-001
  641. data8 0x3fdc039236f08818, 0x3c809435af522ba7 // log(1/frcpa(1+140/256))= +4.37718e-001
  642. data8 0x3fdc28cb1e4d32f8, 0x3cb3944752fbd81e // log(1/frcpa(1+141/256))= +4.39990e-001
  643. data8 0x3fdc4e19b84723c0, 0x3c9a465260cd3fe5 // log(1/frcpa(1+142/256))= +4.42267e-001
  644. data8 0x3fdc7ff9c74554c8, 0x3c92447d5b6ca369 // log(1/frcpa(1+143/256))= +4.45311e-001
  645. data8 0x3fdca57b64e9db00, 0x3cb44344a8a00c82 // log(1/frcpa(1+144/256))= +4.47600e-001
  646. data8 0x3fdccb130a5ceba8, 0x3cbefaddfb97b73f // log(1/frcpa(1+145/256))= +4.49895e-001
  647. data8 0x3fdcf0c0d18f3268, 0x3cbd3e7bfee57898 // log(1/frcpa(1+146/256))= +4.52194e-001
  648. data8 0x3fdd232075b5a200, 0x3c9222599987447c // log(1/frcpa(1+147/256))= +4.55269e-001
  649. data8 0x3fdd490246defa68, 0x3cabafe9a767a80d // log(1/frcpa(1+148/256))= +4.57581e-001
  650. data8 0x3fdd6efa918d25c8, 0x3cb58a2624e1c6fd // log(1/frcpa(1+149/256))= +4.59899e-001
  651. data8 0x3fdd9509707ae528, 0x3cbdc3babce578e7 // log(1/frcpa(1+150/256))= +4.62221e-001
  652. data8 0x3fddbb2efe92c550, 0x3cb0ac0943c434a4 // log(1/frcpa(1+151/256))= +4.64550e-001
  653. data8 0x3fddee2f3445e4a8, 0x3cbba9d07ce820e8 // log(1/frcpa(1+152/256))= +4.67663e-001
  654. data8 0x3fde148a1a2726c8, 0x3cb6537e3375b205 // log(1/frcpa(1+153/256))= +4.70004e-001
  655. data8 0x3fde3afc0a49ff38, 0x3cbfed5518dbc20e // log(1/frcpa(1+154/256))= +4.72350e-001
  656. data8 0x3fde6185206d5168, 0x3cb6572601f73d5c // log(1/frcpa(1+155/256))= +4.74702e-001
  657. data8 0x3fde882578823d50, 0x3c9b24abd4584d1a // log(1/frcpa(1+156/256))= +4.77060e-001
  658. data8 0x3fdeaedd2eac9908, 0x3cb0ceb5e4d2c8f7 // log(1/frcpa(1+157/256))= +4.79423e-001
  659. data8 0x3fded5ac5f436be0, 0x3ca72f21f1f5238e // log(1/frcpa(1+158/256))= +4.81792e-001
  660. data8 0x3fdefc9326d16ab8, 0x3c85081a1639a45c // log(1/frcpa(1+159/256))= +4.84166e-001
  661. data8 0x3fdf2391a21575f8, 0x3cbf11015bdd297a // log(1/frcpa(1+160/256))= +4.86546e-001
  662. data8 0x3fdf4aa7ee031928, 0x3cb3795bc052a2d1 // log(1/frcpa(1+161/256))= +4.88932e-001
  663. data8 0x3fdf71d627c30bb0, 0x3c35c61f0f5a88f3 // log(1/frcpa(1+162/256))= +4.91323e-001
  664. data8 0x3fdf991c6cb3b378, 0x3c97d99419be6028 // log(1/frcpa(1+163/256))= +4.93720e-001
  665. data8 0x3fdfc07ada69a908, 0x3cbfe9341ded70b1 // log(1/frcpa(1+164/256))= +4.96123e-001
  666. data8 0x3fdfe7f18eb03d38, 0x3cb85718a640c33f // log(1/frcpa(1+165/256))= +4.98532e-001
  667. data8 0x3fe007c053c5002c, 0x3cb3addc9c065f09 // log(1/frcpa(1+166/256))= +5.00946e-001
  668. data8 0x3fe01b942198a5a0, 0x3c9d5aa4c77da6ac // log(1/frcpa(1+167/256))= +5.03367e-001
  669. data8 0x3fe02f74400c64e8, 0x3cb5a0ee4450ef52 // log(1/frcpa(1+168/256))= +5.05793e-001
  670. data8 0x3fe04360be7603ac, 0x3c9dd00c35630fe0 // log(1/frcpa(1+169/256))= +5.08225e-001
  671. data8 0x3fe05759ac47fe30, 0x3cbd063e1f0bd82c // log(1/frcpa(1+170/256))= +5.10663e-001
  672. data8 0x3fe06b5f1911cf50, 0x3cae8da674af5289 // log(1/frcpa(1+171/256))= +5.13107e-001
  673. data8 0x3fe078bf0533c568, 0x3c62241edf5fd1f7 // log(1/frcpa(1+172/256))= +5.14740e-001
  674. data8 0x3fe08cd9687e7b0c, 0x3cb3007febcca227 // log(1/frcpa(1+173/256))= +5.17194e-001
  675. data8 0x3fe0a10074cf9018, 0x3ca496e84603816b // log(1/frcpa(1+174/256))= +5.19654e-001
  676. data8 0x3fe0b5343a234474, 0x3cb46098d14fc90a // log(1/frcpa(1+175/256))= +5.22120e-001
  677. data8 0x3fe0c974c89431cc, 0x3cac0a7cdcbb86c6 // log(1/frcpa(1+176/256))= +5.24592e-001
  678. data8 0x3fe0ddc2305b9884, 0x3cb2f753210410ff // log(1/frcpa(1+177/256))= +5.27070e-001
  679. data8 0x3fe0eb524bafc918, 0x3c88affd6682229e // log(1/frcpa(1+178/256))= +5.28726e-001
  680. data8 0x3fe0ffb54213a474, 0x3cadeefbab9af993 // log(1/frcpa(1+179/256))= +5.31214e-001
  681. data8 0x3fe114253da97d9c, 0x3cbaf1c2b8bc160a // log(1/frcpa(1+180/256))= +5.33709e-001
  682. data8 0x3fe128a24f1d9afc, 0x3cb9cf4df375e650 // log(1/frcpa(1+181/256))= +5.36210e-001
  683. data8 0x3fe1365252bf0864, 0x3c985a621d4be111 // log(1/frcpa(1+182/256))= +5.37881e-001
  684. data8 0x3fe14ae558b4a92c, 0x3ca104c4aa8977d1 // log(1/frcpa(1+183/256))= +5.40393e-001
  685. data8 0x3fe15f85a19c7658, 0x3cbadf26e540f375 // log(1/frcpa(1+184/256))= +5.42910e-001
  686. data8 0x3fe16d4d38c119f8, 0x3cb3aea11caec416 // log(1/frcpa(1+185/256))= +5.44592e-001
  687. data8 0x3fe18203c20dd130, 0x3cba82d1211d1d6d // log(1/frcpa(1+186/256))= +5.47121e-001
  688. data8 0x3fe196c7bc4b1f38, 0x3cb6267acc4f4f4a // log(1/frcpa(1+187/256))= +5.49656e-001
  689. data8 0x3fe1a4a738b7a33c, 0x3c858930213c987d // log(1/frcpa(1+188/256))= +5.51349e-001
  690. data8 0x3fe1b981c0c9653c, 0x3c9bc2a4a30f697b // log(1/frcpa(1+189/256))= +5.53895e-001
  691. data8 0x3fe1ce69e8bb1068, 0x3cb7ae6199cf2a00 // log(1/frcpa(1+190/256))= +5.56447e-001
  692. data8 0x3fe1dc619de06944, 0x3c6b50bb38388177 // log(1/frcpa(1+191/256))= +5.58152e-001
  693. data8 0x3fe1f160a2ad0da0, 0x3cbd05b2778a5e1d // log(1/frcpa(1+192/256))= +5.60715e-001
  694. data8 0x3fe2066d7740737c, 0x3cb32e828f9c6bd6 // log(1/frcpa(1+193/256))= +5.63285e-001
  695. data8 0x3fe2147dba47a390, 0x3cbd579851b8b672 // log(1/frcpa(1+194/256))= +5.65001e-001
  696. data8 0x3fe229a1bc5ebac0, 0x3cbb321be5237ce8 // log(1/frcpa(1+195/256))= +5.67582e-001
  697. data8 0x3fe237c1841a502c, 0x3cb3b56e0915ea64 // log(1/frcpa(1+196/256))= +5.69306e-001
  698. data8 0x3fe24cfce6f80d98, 0x3cb34a4d1a422919 // log(1/frcpa(1+197/256))= +5.71898e-001
  699. data8 0x3fe25b2c55cd5760, 0x3cb237401ea5015e // log(1/frcpa(1+198/256))= +5.73630e-001
  700. data8 0x3fe2707f4d5f7c40, 0x3c9d30f20acc8341 // log(1/frcpa(1+199/256))= +5.76233e-001
  701. data8 0x3fe285e0842ca380, 0x3cbc4d866d5f21c0 // log(1/frcpa(1+200/256))= +5.78842e-001
  702. data8 0x3fe294294708b770, 0x3cb85e14d5dc54fa // log(1/frcpa(1+201/256))= +5.80586e-001
  703. data8 0x3fe2a9a2670aff0c, 0x3c7e6f8f468bbf91 // log(1/frcpa(1+202/256))= +5.83207e-001
  704. data8 0x3fe2b7fb2c8d1cc0, 0x3c930ffcf63c8b65 // log(1/frcpa(1+203/256))= +5.84959e-001
  705. data8 0x3fe2c65a6395f5f4, 0x3ca0afe20b53d2d2 // log(1/frcpa(1+204/256))= +5.86713e-001
  706. data8 0x3fe2dbf557b0df40, 0x3cb646be1188fbc9 // log(1/frcpa(1+205/256))= +5.89350e-001
  707. data8 0x3fe2ea64c3f97654, 0x3c96516fa8df33b2 // log(1/frcpa(1+206/256))= +5.91113e-001
  708. data8 0x3fe3001823684d70, 0x3cb96d64e16d1360 // log(1/frcpa(1+207/256))= +5.93762e-001
  709. data8 0x3fe30e97e9a8b5cc, 0x3c98ef96bc97cca0 // log(1/frcpa(1+208/256))= +5.95531e-001
  710. data8 0x3fe32463ebdd34e8, 0x3caef1dc9a56c1bf // log(1/frcpa(1+209/256))= +5.98192e-001
  711. data8 0x3fe332f4314ad794, 0x3caa4f0ac5d5fa11 // log(1/frcpa(1+210/256))= +5.99970e-001
  712. data8 0x3fe348d90e7464cc, 0x3cbe7889f0516acd // log(1/frcpa(1+211/256))= +6.02643e-001
  713. data8 0x3fe35779f8c43d6c, 0x3ca96bbab7245411 // log(1/frcpa(1+212/256))= +6.04428e-001
  714. data8 0x3fe36621961a6a98, 0x3ca31f32262db9fb // log(1/frcpa(1+213/256))= +6.06217e-001
  715. data8 0x3fe37c299f3c3668, 0x3cb15c72c107ee29 // log(1/frcpa(1+214/256))= +6.08907e-001
  716. data8 0x3fe38ae2171976e4, 0x3cba42a2554b2dd4 // log(1/frcpa(1+215/256))= +6.10704e-001
  717. data8 0x3fe399a157a603e4, 0x3cb99c62286d8919 // log(1/frcpa(1+216/256))= +6.12504e-001
  718. data8 0x3fe3afccfe77b9d0, 0x3ca11048f96a43bd // log(1/frcpa(1+217/256))= +6.15210e-001
  719. data8 0x3fe3be9d503533b4, 0x3ca4022f47588c3e // log(1/frcpa(1+218/256))= +6.17018e-001
  720. data8 0x3fe3cd7480b4a8a0, 0x3cb4ba7afc2dc56a // log(1/frcpa(1+219/256))= +6.18830e-001
  721. data8 0x3fe3e3c43918f76c, 0x3c859673d064b8ba // log(1/frcpa(1+220/256))= +6.21554e-001
  722. data8 0x3fe3f2acb27ed6c4, 0x3cb55c6b452a16a8 // log(1/frcpa(1+221/256))= +6.23373e-001
  723. data8 0x3fe4019c2125ca90, 0x3cb8c367879c5a31 // log(1/frcpa(1+222/256))= +6.25197e-001
  724. data8 0x3fe4181061389720, 0x3cb2c17a79c5cc6c // log(1/frcpa(1+223/256))= +6.27937e-001
  725. data8 0x3fe42711518df544, 0x3ca5f38d47012fc5 // log(1/frcpa(1+224/256))= +6.29769e-001
  726. data8 0x3fe436194e12b6bc, 0x3cb9854d65a9b426 // log(1/frcpa(1+225/256))= +6.31604e-001
  727. data8 0x3fe445285d68ea68, 0x3ca3ff9b3a81cd81 // log(1/frcpa(1+226/256))= +6.33442e-001
  728. data8 0x3fe45bcc464c8938, 0x3cb0a2d8011a6c05 // log(1/frcpa(1+227/256))= +6.36206e-001
  729. data8 0x3fe46aed21f117fc, 0x3c8a2be41f8e9f3d // log(1/frcpa(1+228/256))= +6.38053e-001
  730. data8 0x3fe47a1527e8a2d0, 0x3cba4a83594fab09 // log(1/frcpa(1+229/256))= +6.39903e-001
  731. data8 0x3fe489445efffcc8, 0x3cbf306a23dcbcde // log(1/frcpa(1+230/256))= +6.41756e-001
  732. data8 0x3fe4a018bcb69834, 0x3ca46c9285029fd1 // log(1/frcpa(1+231/256))= +6.44543e-001
  733. data8 0x3fe4af5a0c9d65d4, 0x3cbbc1db897580e3 // log(1/frcpa(1+232/256))= +6.46405e-001
  734. data8 0x3fe4bea2a5bdbe84, 0x3cb84d880d7ef775 // log(1/frcpa(1+233/256))= +6.48271e-001
  735. data8 0x3fe4cdf28f10ac44, 0x3cb3ec4b7893ce1f // log(1/frcpa(1+234/256))= +6.50140e-001
  736. data8 0x3fe4dd49cf994058, 0x3c897224d59d3408 // log(1/frcpa(1+235/256))= +6.52013e-001
  737. data8 0x3fe4eca86e64a680, 0x3cbccf620f24f0cd // log(1/frcpa(1+236/256))= +6.53889e-001
  738. data8 0x3fe503c43cd8eb68, 0x3c3f872c65971084 // log(1/frcpa(1+237/256))= +6.56710e-001
  739. data8 0x3fe513356667fc54, 0x3cb9ca64cc3d52c8 // log(1/frcpa(1+238/256))= +6.58595e-001
  740. data8 0x3fe522ae0738a3d4, 0x3cbe708164c75968 // log(1/frcpa(1+239/256))= +6.60483e-001
  741. data8 0x3fe5322e26867854, 0x3cb9988ba4aea615 // log(1/frcpa(1+240/256))= +6.62376e-001
  742. data8 0x3fe541b5cb979808, 0x3ca1662e3a6b95f5 // log(1/frcpa(1+241/256))= +6.64271e-001
  743. data8 0x3fe55144fdbcbd60, 0x3cb3acd4ca45c1e0 // log(1/frcpa(1+242/256))= +6.66171e-001
  744. data8 0x3fe560dbc45153c4, 0x3cb4988947959fed // log(1/frcpa(1+243/256))= +6.68074e-001
  745. data8 0x3fe5707a26bb8c64, 0x3cb3017fe6607ba9 // log(1/frcpa(1+244/256))= +6.69980e-001
  746. data8 0x3fe587f60ed5b8fc, 0x3cbe7a3266366ed4 // log(1/frcpa(1+245/256))= +6.72847e-001
  747. data8 0x3fe597a7977c8f30, 0x3ca1e12b9959a90e // log(1/frcpa(1+246/256))= +6.74763e-001
  748. data8 0x3fe5a760d634bb88, 0x3cb7c365e53d9602 // log(1/frcpa(1+247/256))= +6.76682e-001
  749. data8 0x3fe5b721d295f10c, 0x3cb716c2551ccbf0 // log(1/frcpa(1+248/256))= +6.78605e-001
  750. data8 0x3fe5c6ea94431ef8, 0x3ca02b2ed0e28261 // log(1/frcpa(1+249/256))= +6.80532e-001
  751. data8 0x3fe5d6bb22ea86f4, 0x3caf43a8bbb2f974 // log(1/frcpa(1+250/256))= +6.82462e-001
  752. data8 0x3fe5e6938645d38c, 0x3cbcedc98821b333 // log(1/frcpa(1+251/256))= +6.84397e-001
  753. data8 0x3fe5f673c61a2ed0, 0x3caa385eef5f2789 // log(1/frcpa(1+252/256))= +6.86335e-001
  754. data8 0x3fe6065bea385924, 0x3cb11624f165c5b4 // log(1/frcpa(1+253/256))= +6.88276e-001
  755. data8 0x3fe6164bfa7cc068, 0x3cbad884f87073fa // log(1/frcpa(1+254/256))= +6.90222e-001
  756. data8 0x3fe62643fecf9740, 0x3cb78c51da12f4df // log(1/frcpa(1+255/256))= +6.92171e-001
  757. pow_table_Q:
  758. data8 0xCCCCCCCC4ED2BA7F, 0x00003FFC // P_2
  759. data8 0xAAAAAAAAAAAAB505, 0x00003FFD // P_0
  760. data8 0x3fe62e42fefa39e8, 0x3cccd5e4f1d9cc02 // log2 hi lo = +6.93147e-001
  761. data8 0xb17217f7d1cf79ab, 0x00003ff7 // ln2_by_128_hi
  762. // Table 1 is 2^(index_1/128) where
  763. // index_1 goes from 0 to 15
  764. pow_tbl1:
  765. data8 0x8000000000000000 , 0x00003FFF
  766. data8 0x80B1ED4FD999AB6C , 0x00003FFF
  767. data8 0x8164D1F3BC030773 , 0x00003FFF
  768. data8 0x8218AF4373FC25EC , 0x00003FFF
  769. data8 0x82CD8698AC2BA1D7 , 0x00003FFF
  770. data8 0x8383594EEFB6EE37 , 0x00003FFF
  771. data8 0x843A28C3ACDE4046 , 0x00003FFF
  772. data8 0x84F1F656379C1A29 , 0x00003FFF
  773. data8 0x85AAC367CC487B15 , 0x00003FFF
  774. data8 0x8664915B923FBA04 , 0x00003FFF
  775. data8 0x871F61969E8D1010 , 0x00003FFF
  776. data8 0x87DB357FF698D792 , 0x00003FFF
  777. data8 0x88980E8092DA8527 , 0x00003FFF
  778. data8 0x8955EE03618E5FDD , 0x00003FFF
  779. data8 0x8A14D575496EFD9A , 0x00003FFF
  780. data8 0x8AD4C6452C728924 , 0x00003FFF
  781. // Table 2 is 2^(index_1/8) where
  782. // index_2 goes from 0 to 7
  783. pow_tbl2:
  784. data8 0x8000000000000000 , 0x00003FFF
  785. data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
  786. data8 0x9837F0518DB8A96F , 0x00003FFF
  787. data8 0xA5FED6A9B15138EA , 0x00003FFF
  788. data8 0xB504F333F9DE6484 , 0x00003FFF
  789. data8 0xC5672A115506DADD , 0x00003FFF
  790. data8 0xD744FCCAD69D6AF4 , 0x00003FFF
  791. data8 0xEAC0C6E7DD24392F , 0x00003FFF
  792. .global powf
  793. .section .text
  794. .proc powf
  795. .align 32
  796. powf:
  797. { .mfi
  798. alloc r32=ar.pfs,1,35,4,0
  799. frcpa.s1 POW_B, p6 = f1,f8
  800. mov pow_GR_17ones = 0x1FFFF
  801. }
  802. { .mfi
  803. (p0) addl pow_AD_P = @ltoff(pow_table_P), gp
  804. fma.s1 POW_NORM_X = f8,f1,f0
  805. mov pow_GR_FFFE = 0xFFFE
  806. ;;
  807. }
  808. { .mmf
  809. ld8 pow_AD_P = [pow_AD_P]
  810. mov pow_GR_FFF7 = 0xFFF7
  811. fmerge.s POW_abs_f8 = f0,f8
  812. }
  813. ;;
  814. // p14 = TRUE ==> X is ZERO
  815. // qnan snan inf norm unorm 0 -+
  816. // 0 0 0 0 0 1 11
  817. // 0 7
  818. { .mfi
  819. setf.exp POW_half = pow_GR_FFFE
  820. fclass.m.unc p14,p15 = f8, 0x07
  821. nop.i 999
  822. }
  823. { .mfi
  824. mov pow_GR_16ones = 0xFFFF
  825. fma.s1 POW_NORM_Y = f9,f1,f0
  826. adds pow_AD_Tt = pow_Tt - pow_table_P, pow_AD_P
  827. }
  828. ;;
  829. // qnan snan inf norm unorm 0 -+
  830. // 1 1 0 0 0 0 11
  831. // c 3
  832. // p11 = TRUE ==> Y is a NAN
  833. { .mmf
  834. adds pow_AD_Q = pow_table_Q - pow_table_P, pow_AD_P
  835. ldfe POW_P4 = [pow_AD_P], 16
  836. fclass.m.unc p11,p0 = f9, 0xc3
  837. }
  838. ;;
  839. // qnan snan inf norm unorm 0 -+
  840. // 0 0 0 0 0 1 11
  841. // 0 7
  842. // p12 = TRUE ==> X is ZERO and Y is ZERO
  843. { .mmf
  844. ldfe POW_P5 = [pow_AD_P], 16
  845. ldfe POW_P2 = [pow_AD_Q], 16
  846. (p14) fclass.m.unc p12,p0 = f9, 0x07
  847. }
  848. ;;
  849. { .mmf
  850. ldfe POW_P3 = [pow_AD_P], 16
  851. ldfe POW_P0 = [pow_AD_Q], 16
  852. (p15) fms.s1 POW_r = POW_B, POW_NORM_X,f1
  853. }
  854. ;;
  855. // p11 = TRUE ==> Y is a NaN
  856. { .mfi
  857. ldfe POW_P1 = [pow_AD_P], 16
  858. fmerge.s POW_ABS_NORM_X = f0, POW_NORM_X
  859. nop.i 999
  860. }
  861. { .mfb
  862. ldfpd POW_log2_hi, POW_log2_lo = [pow_AD_Q], 16
  863. fms.s1 POW_Xm1 = POW_abs_f8,f1,f1
  864. (p11) br.cond.spnt POW_Y_NAN
  865. }
  866. ;;
  867. { .mmb
  868. getf.exp pow_GR_signexp_X = POW_NORM_X
  869. ldfe POW_log2_by_128_hi = [pow_AD_Q], 16
  870. (p12) br.cond.spnt POW_X_0_Y_0
  871. }
  872. ;;
  873. // qnan snan inf norm unorm 0 -+
  874. // 1 1 0 0 0 0 11
  875. // c 3
  876. // p11 = TRUE ==> X is a NAN
  877. { .mmf
  878. getf.sig pow_GR_sig_X = POW_NORM_X
  879. nop.m 999
  880. fclass.m.unc p11,p0 = f8, 0xc3
  881. }
  882. ;;
  883. { .mfi
  884. nop.m 999
  885. nop.f 999
  886. and pow_GR_exp_X = pow_GR_signexp_X, pow_GR_17ones
  887. }
  888. ;;
  889. { .mfi
  890. ldfe POW_inv_log2_by_128 = [pow_AD_P], 16
  891. fma.s1 POW_rsq = POW_r, POW_r,f0
  892. shl pow_GR_offset = pow_GR_sig_X, 1
  893. }
  894. { .mfi
  895. (p15) sub pow_GR_true_exp_X = pow_GR_exp_X, pow_GR_16ones
  896. nop.f 999
  897. nop.i 999
  898. }
  899. ;;
  900. { .mfi
  901. setf.sig POW_int_K = pow_GR_true_exp_X
  902. fcvt.fx.s1 POW_int_Y = POW_NORM_Y
  903. shr.u pow_GR_offset = pow_GR_offset,56
  904. }
  905. { .mfi
  906. ldfe POW_log2_by_128_lo = [pow_AD_P], 16
  907. fma.s1 POW_r1sq = POW_r1, POW_r1,f0
  908. nop.i 999
  909. ;;
  910. }
  911. // qnan snan inf norm unorm 0 -+
  912. // 0 0 0 0 0 1 11
  913. // 0 7
  914. // p12 = TRUE ==> X is a NAN and Y is a zero
  915. // p13 = TRUE ==> X is a NAN and Y is anything else
  916. { .mfi
  917. nop.m 999
  918. (p11) fclass.m.unc p12,p13 = f9, 0x07
  919. shl pow_GR_offset = pow_GR_offset, 4
  920. }
  921. { .mfi
  922. ldfpd POW_Q2, POW_Q3 = [pow_AD_P], 16
  923. nop.f 999
  924. nop.i 999
  925. ;;
  926. }
  927. { .mfi
  928. add pow_AD_Tt = pow_AD_Tt, pow_GR_offset
  929. fma.s1 POW_v6 = POW_r, POW_P5, POW_P4
  930. nop.i 999
  931. }
  932. { .mfi
  933. ldfpd POW_Q0, POW_Q1 = [pow_AD_P], 16
  934. fma.s1 POW_v61 = POW_r1, POW_P5, POW_P4
  935. nop.i 999
  936. }
  937. ;;
  938. { .mfi
  939. getf.exp pow_GR_signexp_Xm1 = POW_Xm1
  940. fma.s1 POW_v4 = POW_P3, POW_r, POW_P2
  941. nop.i 999
  942. }
  943. { .mfb
  944. nop.m 999
  945. fma.s1 POW_v41 = POW_P3, POW_r1, POW_P2
  946. (p12) br.cond.spnt POW_X_NAN_Y_0
  947. }
  948. ;;
  949. { .mfi
  950. ldfpd POW_T, POW_Tt = [pow_AD_Tt], 16
  951. fma.s1 POW_v21 = POW_P1, POW_r1, POW_P0
  952. add pow_AD_tbl1 = r0, pow_AD_Q
  953. }
  954. { .mfi
  955. nop.m 999
  956. fma.s1 POW_v2 = POW_P1, POW_r, POW_P0
  957. nop.i 999
  958. }
  959. ;;
  960. { .mfi
  961. ldfd POW_Q4 = [pow_AD_P], 16
  962. fma POW_r1sq_by_2 = POW_r1sq, POW_half, f0
  963. and pow_GR_exp_Xm1 = pow_GR_signexp_Xm1, pow_GR_17ones
  964. }
  965. { .mfi
  966. nop.m 999
  967. fma POW_rsq_by_2 = POW_rsq, POW_half, f0
  968. nop.i 999
  969. }
  970. ;;
  971. .pred.rel "mutex",p6,p7
  972. { .mfi
  973. nop.m 999
  974. fma.s1 POW_rcub = POW_r, POW_rsq, f0
  975. cmp.lt.unc p6,p7 = pow_GR_exp_Xm1, pow_GR_FFF7
  976. }
  977. { .mfi
  978. nop.m 999
  979. fma.s1 POW_r1cub = POW_r1, POW_r1sq, f0
  980. nop.i 999
  981. }
  982. ;;
  983. { .mfi
  984. getf.exp pow_GR_signexp_Y = POW_NORM_Y
  985. (p6) fma.s1 POW_U = POW_NORM_Y,POW_r1,f0
  986. nop.i 999
  987. }
  988. { .mfi
  989. nop.m 999
  990. (p7) fma.s1 POW_U = POW_NORM_Y,POW_r,f0
  991. nop.i 999
  992. }
  993. ;;
  994. { .mfi
  995. getf.sig pow_GR_sig_int_Y = POW_int_Y
  996. (p6) fma.s1 POW_v3 = POW_v61, POW_r1sq, POW_v41
  997. nop.i 999
  998. }
  999. { .mfi
  1000. nop.m 999
  1001. (p7) fma.s1 POW_v3 = POW_v6, POW_rsq, POW_v4
  1002. nop.i 999
  1003. }
  1004. ;;
  1005. // p14 = TRUE ==> X is zero
  1006. // p15 = TRUE ==> X is zero AND Y is negative
  1007. // p10 = TRUE ==> X is zero AND Y is >= zero
  1008. { .mfi
  1009. nop.m 999
  1010. fcvt.xf POW_K = POW_int_K
  1011. nop.i 999
  1012. }
  1013. { .mfi
  1014. nop.m 999
  1015. (p6) fma.s1 POW_G = f0,f0,f0
  1016. nop.i 999
  1017. }
  1018. ;;
  1019. { .mmf
  1020. andcm pow_GR_sign_Y = pow_GR_signexp_Y, pow_GR_17ones
  1021. adds pow_AD_tbl2 = pow_tbl2 - pow_tbl1, pow_AD_tbl1
  1022. (p14) fcmp.lt.unc.s1 p15, p10 = f9,f0
  1023. }
  1024. ;;
  1025. // p15 = TRUE ==> X is ZERO and Y is negative
  1026. { .mfi
  1027. and pow_GR_exp_Y = pow_GR_signexp_Y, pow_GR_17ones
  1028. (p6) fnma.s1 POW_V = POW_NORM_Y, POW_r1sq_by_2,f0
  1029. nop.i 999
  1030. }
  1031. { .mfi
  1032. nop.m 999
  1033. (p7) fnma.s1 POW_V = POW_NORM_Y, POW_rsq_by_2,f0
  1034. nop.i 999
  1035. }
  1036. ;;
  1037. { .mfi
  1038. nop.m 999
  1039. (p6) fmerge.s POW_delta = f0,f0
  1040. nop.i 999
  1041. }
  1042. { .mfb
  1043. nop.m 999
  1044. (p13) fma.s f8 = f8,f1,f0
  1045. (p13) br.ret.spnt b0
  1046. }
  1047. ;;
  1048. { .mfi
  1049. nop.m 999
  1050. (p6) fma.s1 POW_p = POW_r1sq, POW_v3, POW_v21
  1051. nop.i 999
  1052. }
  1053. { .mfi
  1054. nop.m 999
  1055. (p7) fma.s1 POW_p = POW_rsq, POW_v3, POW_v2
  1056. nop.i 999
  1057. }
  1058. ;;
  1059. { .mfi
  1060. nop.m 999
  1061. (p7) fma.s1 POW_delta = POW_K, POW_log2_lo, POW_Tt
  1062. nop.i 999
  1063. }
  1064. { .mfi
  1065. nop.m 999
  1066. (p7) fma.s1 POW_G = POW_K, POW_log2_hi, POW_T
  1067. nop.i 999
  1068. }
  1069. ;;
  1070. { .mfi
  1071. nop.m 999
  1072. fcvt.xf POW_float_int_Y = POW_int_Y
  1073. nop.i 999
  1074. }
  1075. ;;
  1076. { .mfi
  1077. nop.m 999
  1078. (p7) fms.s1 POW_e2 = POW_NORM_Y, POW_r, POW_U
  1079. nop.i 999
  1080. }
  1081. { .mfi
  1082. nop.m 999
  1083. fma.s1 POW_Z2 = POW_U, f1, POW_V
  1084. nop.i 999
  1085. }
  1086. ;;
  1087. // qnan snan inf norm unorm 0 -+
  1088. // 0 0 0 1 0 0 10
  1089. // 1 2
  1090. // p11 = TRUE ==> X is NEGATIVE
  1091. // p8 = TRUE ==> X is zero AND Y is outside integer range (treat as even int)
  1092. // return +0
  1093. { .mfi
  1094. nop.m 999
  1095. fclass.m.unc p11,p0 = f8, 0x1a
  1096. nop.i 999
  1097. }
  1098. ;;
  1099. // DOUBLE 0x10033
  1100. // SINGLE 0x10016
  1101. { .mfi
  1102. addl pow_GR_10033 = 0x10033, r0
  1103. (p6) fma.s1 POW_p = POW_p, POW_r1cub, f0
  1104. nop.i 999
  1105. }
  1106. { .mfi
  1107. nop.m 999
  1108. (p7) fma.s1 POW_p = POW_p, POW_rcub, f0
  1109. nop.i 999
  1110. }
  1111. ;;
  1112. // p10 = TRUE ==> X is zero AND Y is positive
  1113. // p8 = TRUE ==> X is zero AND Y is outside integer range (treat as even int)
  1114. // return +0
  1115. // p9 = TRUE ==> X is zero AND Y is within integer range (may not be integer)
  1116. { .mfi
  1117. nop.m 999
  1118. (p6) fms.s1 POW_e2 = POW_NORM_Y, POW_r1, POW_U
  1119. (p10) cmp.gt.unc p8,p9 = pow_GR_exp_Y, pow_GR_10033
  1120. }
  1121. { .mfi
  1122. nop.m 999
  1123. fma.s1 POW_Z1 = POW_NORM_Y, POW_G, f0
  1124. nop.i 999
  1125. }
  1126. ;;
  1127. { .mfi
  1128. nop.m 999
  1129. fma.s1 POW_e3 = POW_NORM_Y, POW_delta, f0
  1130. nop.i 999
  1131. }
  1132. { .mfi
  1133. nop.m 999
  1134. (p7) fma.s1 POW_Gpr = POW_G, f1, POW_r
  1135. nop.i 999
  1136. }
  1137. ;;
  1138. { .mfi
  1139. nop.m 999
  1140. fma.s1 POW_W2 = POW_Z2, POW_inv_log2_by_128, f0
  1141. nop.i 999
  1142. }
  1143. { .mfi
  1144. nop.m 999
  1145. fms.s1 POW_UmZ2 = POW_U, f1, POW_Z2
  1146. nop.i 999
  1147. }
  1148. ;;
  1149. { .mfi
  1150. nop.m 999
  1151. (p6) fma.s1 POW_Gpr = POW_G, f1, POW_r1
  1152. nop.i 999
  1153. }
  1154. ;;
  1155. // p11 = TRUE ==> X is NEGATIVE
  1156. // p12 = TRUE ==> X is NEGATIVE AND Y already int
  1157. // p13 = TRUE ==> X is NEGATIVE AND Y possible int
  1158. // p8 = TRUE ==> X is zero AND Y is outside intger range (treat as even int)
  1159. // return +0
  1160. { .mfi
  1161. nop.m 999
  1162. fma.s1 POW_Z3 = POW_NORM_Y, POW_p, f0
  1163. nop.i 999
  1164. }
  1165. { .mfi
  1166. nop.m 999
  1167. (p8) fma.s f8 = f0,f0,f0
  1168. (p11) cmp.ge.unc p12,p13 = pow_GR_exp_Y, pow_GR_10033
  1169. }
  1170. ;;
  1171. { .mfi
  1172. nop.m 999
  1173. fms.s1 POW_e1 = POW_NORM_Y, POW_G, POW_Z1
  1174. nop.i 999
  1175. }
  1176. { .mfb
  1177. nop.m 999
  1178. fma.s1 POW_W1 = POW_Z1, POW_inv_log2_by_128, f0
  1179. (p8) br.ret.spnt b0
  1180. }
  1181. ;;
  1182. // p9 = TRUE ==> X is zero AND Y is within integer range (may not be integer)
  1183. // p6 = TRUE ==> X is zero AND Y is an integer (may be even or odd)
  1184. // p7 = TRUE ==> X is zero AND Y is NOT an integer, return +0
  1185. { .mfi
  1186. nop.m 999
  1187. (p9) fcmp.eq.unc.s1 p6,p7 = POW_float_int_Y, POW_NORM_Y
  1188. nop.i 999
  1189. }
  1190. ;;
  1191. // p15 = TRUE ==> X_0_Y_NEG
  1192. { .mfi
  1193. nop.m 999
  1194. fcvt.fx.s1 POW_int_W2 = POW_W2
  1195. nop.i 999
  1196. }
  1197. { .mfb
  1198. nop.m 999
  1199. fma.s1 POW_UmZ2pV = POW_UmZ2,f1,POW_V
  1200. (p15) br.cond.spnt POW_X_0_Y_NEG
  1201. }
  1202. ;;
  1203. { .mfi
  1204. nop.m 999
  1205. fma.s1 POW_Y_Gpr = POW_NORM_Y, POW_Gpr, f0
  1206. nop.i 999
  1207. }
  1208. ;;
  1209. // p6 = TRUE ==> X is zero AND Y is an integer (may be even or odd)
  1210. // p8 = TRUE ==> X is zero AND Y is an odd integer
  1211. // p9 = TRUE ==> X is zero AND Y is an even integer
  1212. { .mfi
  1213. nop.m 999
  1214. fma.s1 POW_Z3sq = POW_Z3, POW_Z3, f0
  1215. (p6) tbit.nz.unc p8,p9 = pow_GR_sig_int_Y,0
  1216. }
  1217. { .mfi
  1218. nop.m 999
  1219. fma.s1 POW_v4 = POW_Z3, POW_Q3, POW_Q2
  1220. nop.i 999
  1221. }
  1222. ;;
  1223. { .mfi
  1224. nop.m 999
  1225. fcvt.fx.s1 POW_int_W1 = POW_W1
  1226. nop.i 999
  1227. }
  1228. { .mfb
  1229. nop.m 999
  1230. fma.s1 POW_v2 = POW_Z3, POW_Q1, POW_Q0
  1231. (p8) br.ret.spnt b0
  1232. }
  1233. ;;
  1234. { .mfi
  1235. nop.m 999
  1236. (p7) fma.s f8 = f0,f0,f0
  1237. nop.i 999
  1238. }
  1239. ;;
  1240. // p13 = TRUE ==> X is NEGATIVE AND Y possible int
  1241. // p10 = TRUE ==> X is NEG and Y is an int
  1242. // p12 = TRUE ==> X is NEG and Y is not an int
  1243. { .mfi
  1244. nop.m 999
  1245. (p13) fcmp.eq.unc.s1 p10,p12 = POW_float_int_Y, POW_NORM_Y
  1246. nop.i 999
  1247. }
  1248. { .mfi
  1249. nop.m 999
  1250. (p9) fma.s f8 = f0,f0,f0
  1251. nop.i 999
  1252. }
  1253. ;;
  1254. // qnan snan inf norm unorm 0 -+
  1255. // 0 0 1 0 0 0 11
  1256. // 2 3
  1257. { .mfi
  1258. nop.m 999
  1259. fclass.m.unc p15,p0 = POW_NORM_X, 0x23
  1260. nop.i 999
  1261. }
  1262. { .mfi
  1263. nop.m 999
  1264. fma.s1 POW_e2 = POW_e2,f1,POW_UmZ2pV
  1265. nop.i 999
  1266. }
  1267. ;;
  1268. { .mfi
  1269. nop.m 999
  1270. fcvt.xf POW_N2float = POW_int_W2
  1271. nop.i 999
  1272. }
  1273. { .mfb
  1274. nop.m 999
  1275. fma.s1 POW_v3 = POW_Z3sq, POW_Q4, POW_v4
  1276. (p12) br.cond.spnt POW_X_NEG_Y_NONINT
  1277. }
  1278. ;;
  1279. { .mbb
  1280. getf.sig pow_GR_int_W2 = POW_int_W2
  1281. (p15) br.cond.spnt POW_X_INF
  1282. (p7) br.ret.spnt b0
  1283. }
  1284. ;;
  1285. { .mfb
  1286. getf.exp pow_GR_signexp_Y_Gpr = POW_Y_Gpr
  1287. fcvt.xf POW_N1float = POW_int_W1
  1288. (p9) br.ret.spnt b0
  1289. }
  1290. ;;
  1291. // p12 = TRUE ==> X is NEGATIVE AND Y is an odd integer
  1292. { .mfi
  1293. nop.m 999
  1294. fma.s1 POW_e12 = POW_e1,f1,POW_e2
  1295. (p10) tbit.nz.unc p12,p0 = pow_GR_sig_int_Y,0
  1296. }
  1297. ;;
  1298. { .mfi
  1299. getf.sig pow_GR_int_W1 = POW_int_W1
  1300. fnma.s1 POW_s2 = POW_N2float, POW_log2_by_128_hi, POW_Z2
  1301. and pow_GR_exp_Y_Gpr = pow_GR_signexp_Y_Gpr, pow_GR_17ones
  1302. }
  1303. ;;
  1304. { .mfi
  1305. sub pow_GR_true_exp_Y_Gpr = pow_GR_exp_Y_Gpr, pow_GR_16ones
  1306. fma.s1 POW_q = POW_Z3sq, POW_v3, POW_v2
  1307. andcm pow_GR_sign_Y_Gpr = pow_GR_signexp_Y_Gpr, pow_GR_17ones
  1308. }
  1309. ;;
  1310. // double: p8 TRUE ==> |Y(G + r)| >= 10
  1311. // single: p8 TRUE ==> |Y(G + r)| >= 7
  1312. // double
  1313. // -2^10 -2^9 2^9 2^10
  1314. // -----+-----+----+ ... +-----+-----+-----
  1315. // p8 | p9 | p8
  1316. // | | p10 | |
  1317. // single
  1318. // -2^7 -2^6 2^6 2^7
  1319. // -----+-----+----+ ... +-----+-----+-----
  1320. // p8 | p9 | p8
  1321. // | | p10 | |
  1322. { .mfi
  1323. add pow_GR_int_N = pow_GR_int_W1, pow_GR_int_W2
  1324. nop.f 999
  1325. (p0) cmp.le.unc p8,p9 = 7, pow_GR_true_exp_Y_Gpr
  1326. }
  1327. ;;
  1328. { .mfi
  1329. and pow_GR_index1 = 0x0f, pow_GR_int_N
  1330. fnma.s1 POW_s1 = POW_N1float, POW_log2_by_128_hi, POW_Z1
  1331. shr r2 = pow_GR_int_N, 7
  1332. }
  1333. { .mfi
  1334. and pow_GR_index2 = 0x70, pow_GR_int_N
  1335. nop.f 999
  1336. (p9) cmp.le.unc p0,p10 = 6, pow_GR_true_exp_Y_Gpr
  1337. }
  1338. ;;
  1339. { .mfi
  1340. shladd pow_AD_T1 = pow_GR_index1, 4, pow_AD_tbl1
  1341. nop.f 999
  1342. nop.i 999
  1343. }
  1344. { .mfb
  1345. nop.m 999
  1346. fma.s1 POW_e123 = POW_e12, f1, POW_e3
  1347. (p8) br.cond.spnt POW_OVER_UNDER_X_NOT_INF
  1348. }
  1349. ;;
  1350. { .mmi
  1351. ldfe POW_T1 = [pow_AD_T1],16
  1352. add pow_AD_T2 = pow_AD_tbl2, pow_GR_index2
  1353. nop.i 999
  1354. }
  1355. ;;
  1356. { .mmf
  1357. ldfe POW_T2 = [pow_AD_T2],16
  1358. addl pow_int_GR_M = 0xFFFF, r2
  1359. fma.s1 POW_q = POW_Z3sq, POW_q, POW_Z3
  1360. }
  1361. ;;
  1362. { .mfi
  1363. setf.exp POW_2M = pow_int_GR_M
  1364. fnma.s1 POW_f2 = POW_N2float, POW_log2_by_128_lo, f1
  1365. nop.i 999
  1366. }
  1367. { .mfi
  1368. nop.m 999
  1369. fnma.s1 POW_f1 = POW_N1float, POW_log2_by_128_lo, f1
  1370. nop.i 999
  1371. }
  1372. ;;
  1373. { .mfi
  1374. nop.m 999
  1375. fma.s1 POW_s = POW_s1, f1, POW_s2
  1376. nop.i 999
  1377. }
  1378. ;;
  1379. { .mfi
  1380. nop.m 999
  1381. fma.s1 POW_f3 = POW_e123,f1,f1
  1382. nop.i 999
  1383. }
  1384. ;;
  1385. { .mfi
  1386. nop.m 999
  1387. fma.s1 POW_f12 = POW_f1, POW_f2,f0
  1388. nop.i 999
  1389. }
  1390. ;;
  1391. { .mfi
  1392. nop.m 999
  1393. fma.s1 POW_ssq = POW_s, POW_s, f0
  1394. nop.i 999
  1395. }
  1396. { .mfi
  1397. nop.m 999
  1398. fma.s1 POW_v4 = POW_s, POW_Q3, POW_Q2
  1399. nop.i 999
  1400. }
  1401. ;;
  1402. { .mfi
  1403. nop.m 999
  1404. fma.s1 POW_v2 = POW_s, POW_Q1, POW_Q0
  1405. nop.i 999
  1406. }
  1407. { .mfi
  1408. nop.m 999
  1409. fma.s1 POW_T1T2 = POW_T1, POW_T2, f0
  1410. nop.i 999
  1411. }
  1412. ;;
  1413. { .mfi
  1414. nop.m 999
  1415. fma.s1 POW_1ps = f1,f1,POW_s
  1416. nop.i 999
  1417. }
  1418. { .mfi
  1419. nop.m 999
  1420. fma.s1 POW_f123 = POW_f12, POW_f3, f0
  1421. nop.i 999
  1422. }
  1423. ;;
  1424. { .mfi
  1425. nop.m 999
  1426. fma.s1 POW_v3 = POW_ssq, POW_Q4, POW_v4
  1427. nop.i 999
  1428. }
  1429. ;;
  1430. { .mfi
  1431. nop.m 999
  1432. fma.s1 POW_A = POW_2M, POW_T1T2, f0
  1433. nop.i 999
  1434. }
  1435. ;;
  1436. { .mfi
  1437. nop.m 999
  1438. (p12) fmerge.s POW_f123 = f8,POW_f123
  1439. nop.i 999
  1440. }
  1441. { .mfi
  1442. nop.m 999
  1443. fma.s1 POW_es = POW_ssq, POW_v3, POW_v2
  1444. nop.i 999
  1445. }
  1446. ;;
  1447. { .mfi
  1448. nop.m 999
  1449. fma.s1 POW_A = POW_A, POW_f123, f0
  1450. nop.i 999
  1451. }
  1452. { .mfi
  1453. nop.m 999
  1454. fma.s1 POW_es = POW_es, POW_ssq, POW_1ps
  1455. nop.i 999
  1456. }
  1457. ;;
  1458. { .mfi
  1459. nop.m 999
  1460. fma.s1 POW_A = POW_A, POW_es,f0
  1461. nop.i 999
  1462. }
  1463. ;;
  1464. { .mfb
  1465. nop.m 999
  1466. (p10) fma.s f8 = POW_A, POW_q, POW_A
  1467. (p10) br.ret.sptk b0
  1468. }
  1469. ;;
  1470. // POSSIBLE_OVER_UNDER
  1471. // p6 = TRUE ==> Y negative
  1472. { .mfi
  1473. nop.m 999
  1474. fmerge.s POW_abs_A = f0, POW_A
  1475. cmp.eq.unc p0,p6 = pow_GR_sign_Y, r0
  1476. }
  1477. ;;
  1478. { .mib
  1479. nop.m 999
  1480. nop.i 999
  1481. (p6) br.cond.spnt POW_POSSIBLE_UNDER
  1482. }
  1483. ;;
  1484. // POSSIBLE_OVER
  1485. // We got an answer.
  1486. // overflow is a possibility, not a certainty
  1487. // We define an overflow when the answer with
  1488. // WRE set
  1489. // user-defined rounding mode
  1490. // double
  1491. // Largest double is 7FE (biased double)
  1492. // 7FE - 3FF + FFFF = 103FE
  1493. // Create + largest_double_plus_ulp
  1494. // Create - largest_double_plus_ulp
  1495. // Calculate answer with WRE set.
  1496. // single
  1497. // Largest single is FE (biased double)
  1498. // FE - 7F + FFFF = 1007E
  1499. // Create + largest_single_plus_ulp
  1500. // Create - largest_single_plus_ulp
  1501. // Calculate answer with WRE set.
  1502. // Cases when answer is ldn+1 are as follows:
  1503. // ldn ldn+1
  1504. // --+----------|----------+------------
  1505. // |
  1506. // +inf +inf -inf
  1507. // RN RN
  1508. // RZ
  1509. // Put in s2 (td set, wre set)
  1510. { .mfi
  1511. mov pow_GR_gt_ln = 0x1007f
  1512. fsetc.s2 0x7F,0x42
  1513. nop.i 999
  1514. }
  1515. ;;
  1516. { .mfi
  1517. setf.exp POW_gt_pln = pow_GR_gt_ln
  1518. fma.s.s2 POW_wre_urm_f8 = POW_abs_A, POW_q, POW_abs_A
  1519. nop.i 999 ;;
  1520. }
  1521. // Return s2 to default
  1522. { .mfi
  1523. nop.m 999
  1524. fsetc.s2 0x7F,0x40
  1525. nop.i 999
  1526. }
  1527. ;;
  1528. // p7 = TRUE ==> yes, we have an overflow
  1529. { .mfi
  1530. nop.m 999
  1531. fcmp.ge.unc.s1 p7, p0 = POW_wre_urm_f8, POW_gt_pln
  1532. nop.i 999
  1533. }
  1534. ;;
  1535. { .mfb
  1536. (p7) mov pow_GR_tag = 30
  1537. fma.s f8 = POW_A, POW_q, POW_A
  1538. (p7) br.cond.spnt __libm_error_region
  1539. }
  1540. { .mfb
  1541. nop.m 999
  1542. nop.f 999
  1543. (p0) br.ret.sptk b0
  1544. }
  1545. ;;
  1546. POW_POSSIBLE_UNDER:
  1547. // We got an answer. input was < -2^9 but > -2^10 (double)
  1548. // We got an answer. input was < -2^6 but > -2^7 (float)
  1549. // underflow is a possibility, not a certainty
  1550. // We define an underflow when the answer with
  1551. // ftz set
  1552. // is zero (tiny numbers become zero)
  1553. // Notice (from below) that if we have an unlimited exponent range,
  1554. // then there is an extra machine number E between the largest denormal and
  1555. // the smallest normal.
  1556. // So if with unbounded exponent we round to E or below, then we are
  1557. // tiny and underflow has occurred.
  1558. // But notice that you can be in a situation where we are tiny, namely
  1559. // rounded to E, but when the exponent is bounded we round to smallest
  1560. // normal. So the answer can be the smallest normal with underflow.
  1561. // E
  1562. // -----+--------------------+--------------------+-----
  1563. // | | |
  1564. // 1.1...10 2^-3fff 1.1...11 2^-3fff 1.0...00 2^-3ffe
  1565. // 0.1...11 2^-3ffe (biased, 1)
  1566. // largest dn smallest normal
  1567. // Put in s2 (td set, ftz set)
  1568. { .mfi
  1569. nop.m 999
  1570. fsetc.s2 0x7F,0x41
  1571. nop.i 999
  1572. }
  1573. ;;
  1574. { .mfi
  1575. nop.m 999
  1576. fma.s.s2 POW_ftz_urm_f8 = POW_A, POW_q, POW_A
  1577. nop.i 999
  1578. }
  1579. ;;
  1580. // Return s2 to default
  1581. { .mfi
  1582. nop.m 999
  1583. fsetc.s2 0x7F,0x40
  1584. nop.i 999
  1585. }
  1586. ;;
  1587. // p7 = TRUE ==> yes, we have an underflow
  1588. { .mfi
  1589. nop.m 999
  1590. fcmp.eq.unc.s1 p7, p0 = POW_ftz_urm_f8, f0
  1591. nop.i 999
  1592. }
  1593. ;;
  1594. { .mfb
  1595. (p7) mov pow_GR_tag = 31
  1596. fma.s f8 = POW_A, POW_q, POW_A
  1597. (p7) br.cond.spnt __libm_error_region
  1598. }
  1599. ;;
  1600. { .mfb
  1601. nop.m 999
  1602. nop.f 999
  1603. br.ret.sptk b0
  1604. }
  1605. ;;
  1606. POW_X_0_Y_0:
  1607. // When X is +-0 and Y is +-0, IEEE returns 1.0
  1608. // We call error support with this value
  1609. { .mfb
  1610. mov pow_GR_tag = 32
  1611. fma.s f8 = f1,f1,f0
  1612. br.cond.sptk __libm_error_region
  1613. }
  1614. ;;
  1615. POW_X_INF:
  1616. // When X is +-inf and Y is +-, IEEE returns
  1617. // overflow
  1618. // X +inf Y +inf +inf
  1619. // X -inf Y +inf +inf
  1620. // X +inf Y >0 +inf
  1621. // X -inf Y >0, !odd integer +inf <== (-inf)^0.5 = +inf !!
  1622. // X -inf Y >0, odd integer -inf
  1623. // underflow
  1624. // X +inf Y -inf +0
  1625. // X -inf Y -inf +0
  1626. // X +inf Y <0 +0
  1627. // X -inf Y <0, !odd integer +0
  1628. // X -inf Y <0, odd integer -0
  1629. // X + inf Y=+0 +1
  1630. // X + inf Y=-0 +1
  1631. // X - inf Y=+0 +1
  1632. // X - inf Y=-0 +1
  1633. // p13 == Y negative
  1634. // p14 == Y positive
  1635. // p6 == Y is a floating point number outside the integer.
  1636. // Hence it is an integer and is even.
  1637. // p13 == (Y negative)
  1638. // return +inf
  1639. // p14 == (Y positive)
  1640. // return +0
  1641. // p7 == Y is a floating point number within the integer range.
  1642. // p9 == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
  1643. // p11 odd
  1644. // p13 == (Y negative)
  1645. // return (sign_of_x)inf
  1646. // p14 == (Y positive)
  1647. // return (sign_of_x)0
  1648. // pxx even
  1649. // p13 == (Y negative)
  1650. // return +inf
  1651. // p14 == (Y positive)
  1652. // return +0
  1653. // pxx == Y is not an integer
  1654. // p13 == (Y negative)
  1655. // return +inf
  1656. // p14 == (Y positive)
  1657. // return +0
  1658. //
  1659. { .mfi
  1660. nop.m 999
  1661. fcmp.lt p13,p14 = POW_NORM_Y,f0
  1662. cmp.gt.unc p6,p7 = pow_GR_exp_Y, pow_GR_10033
  1663. }
  1664. { .mfi
  1665. nop.m 999
  1666. fclass.m p12,p0 = f9, 0x23
  1667. nop.i 999
  1668. }
  1669. ;;
  1670. { .mfi
  1671. nop.m 999
  1672. fclass.m p15,p0 = f9, 0x07 //@zero
  1673. nop.i 999
  1674. }
  1675. ;;
  1676. { .mfb
  1677. nop.m 999
  1678. (p15) fmerge.s f8 = f1,f1
  1679. (p15) br.ret.spnt b0
  1680. }
  1681. ;;
  1682. { .mfi
  1683. (p13) mov pow_GR_tag = 31
  1684. (p14) frcpa.s1 f8,p10 = f1,f0
  1685. nop.i 999
  1686. }
  1687. { .mfb
  1688. (p14) mov pow_GR_tag = 30
  1689. (p13) fma.s1 f8 = f0,f0,f0
  1690. (p12) br.ret.spnt b0
  1691. }
  1692. ;;
  1693. { .mfb
  1694. nop.m 999
  1695. (p7) fcmp.eq.unc.s1 p9,p0 = POW_float_int_Y, POW_NORM_Y
  1696. nop.b 999
  1697. }
  1698. ;;
  1699. { .mfi
  1700. nop.m 999
  1701. nop.f 999
  1702. (p9) tbit.nz.unc p11,p0 = pow_GR_sig_int_Y,0
  1703. }
  1704. ;;
  1705. { .mfb
  1706. nop.m 999
  1707. (p11) fmerge.s f8 = POW_NORM_X,f8
  1708. br.ret.sptk b0
  1709. }
  1710. ;;
  1711. POW_X_0_Y_NEG:
  1712. // When X is +-0 and Y is negative, IEEE returns
  1713. // X Y answer
  1714. // +0 -odd int +inf
  1715. // -0 -odd int -inf
  1716. // +0 !-odd int +inf
  1717. // -0 !-odd int +inf
  1718. // p6 == Y is a floating point number outside the integer.
  1719. // Hence it is an integer and is even.
  1720. // return +inf
  1721. // p7 == Y is a floating point number within the integer range.
  1722. // p9 == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
  1723. // p11 odd
  1724. // return (sign_of_x)inf
  1725. // p12 even
  1726. // return +inf
  1727. // p10 == Y is not an integer
  1728. // return +inf
  1729. //
  1730. //
  1731. { .mfi
  1732. nop.m 999
  1733. nop.f 999
  1734. cmp.gt.unc p6,p7 = pow_GR_exp_Y, pow_GR_10033
  1735. }
  1736. ;;
  1737. { .mfi
  1738. mov pow_GR_tag = 33
  1739. (p7) fcmp.eq.unc.s1 p9,p10 = POW_float_int_Y, POW_NORM_Y
  1740. nop.i 999
  1741. }
  1742. ;;
  1743. { .mfb
  1744. nop.m 999
  1745. (p6) frcpa.s0 f8,p13 = f1, f0
  1746. (p6) br.cond.sptk __libm_error_region
  1747. }
  1748. ;;
  1749. { .mfb
  1750. nop.m 999
  1751. (p10) frcpa.s0 f8,p13 = f1, f0
  1752. (p10) br.cond.sptk __libm_error_region
  1753. }
  1754. ;;
  1755. { .mib
  1756. nop.m 999
  1757. (p9) tbit.nz.unc p11,p12 = pow_GR_sig_int_Y,0
  1758. nop.b 999
  1759. }
  1760. ;;
  1761. { .mfi
  1762. nop.m 999
  1763. (p12) frcpa.s0 f8,p13 = f1,f0
  1764. nop.i 999
  1765. }
  1766. ;;
  1767. { .mfb
  1768. nop.m 999
  1769. (p11) frcpa f8,p13 = f1,f8
  1770. br.cond.sptk __libm_error_region
  1771. }
  1772. ;;
  1773. POW_X_NEG_Y_NONINT:
  1774. // When X is negative and Y is a non-integer, IEEE
  1775. // returns a qnan indefinite.
  1776. // We call error support with this value
  1777. { .mfb
  1778. mov pow_GR_tag = 34
  1779. frcpa f8,p6 = f0,f0
  1780. br.cond.sptk __libm_error_region
  1781. }
  1782. ;;
  1783. POW_X_NAN_Y_0:
  1784. // When X is a NAN and Y is zero, IEEE returns 1.
  1785. // We call error support with this value.
  1786. { .mfi
  1787. nop.m 0
  1788. fma.s.s0 f10 = f8,f1,f0
  1789. nop.i 0
  1790. }
  1791. { .mfb
  1792. mov pow_GR_tag = 35
  1793. fma.s.s0 f8 = f0,f0,f1
  1794. br.cond.sptk __libm_error_region
  1795. }
  1796. ;;
  1797. POW_OVER_UNDER_X_NOT_INF:
  1798. // p8 is TRUE for overflow
  1799. // p9 is TRUE for underflow
  1800. // if y is infinity, we should not over/underflow
  1801. { .mfi
  1802. nop.m 999
  1803. fcmp.eq.unc.s1 p14, p13 = POW_ABS_NORM_X,f1
  1804. cmp.eq.unc p8,p9 = pow_GR_sign_Y_Gpr, r0
  1805. }
  1806. ;;
  1807. { .mfi
  1808. nop.m 999
  1809. (p14) fclass.m.unc p15, p0 = f9, 0x23
  1810. nop.i 999
  1811. }
  1812. { .mfi
  1813. nop.m 999
  1814. (p13) fclass.m.unc p11,p0 = f9, 0x23
  1815. nop.i 999
  1816. }
  1817. ;;
  1818. // p15 = TRUE if |x|=1, y=inf, return +1
  1819. { .mfb
  1820. nop.m 999
  1821. (p15) fma.s f8 = f1,f1,f0
  1822. (p15) br.ret.spnt b0
  1823. }
  1824. ;;
  1825. .pred.rel "mutex",p8,p9
  1826. { .mfb
  1827. (p8) setf.exp f8 = pow_GR_17ones
  1828. (p9) fmerge.s f8 = f0,f0
  1829. (p11) br.ret.sptk b0
  1830. }
  1831. { .mfb
  1832. nop.m 999
  1833. nop.f 999
  1834. br.cond.sptk POW_OVER_UNDER_ERROR
  1835. }
  1836. ;;
  1837. POW_Y_NAN:
  1838. // Is x = +1 then result is +1, else result is quiet Y
  1839. { .mfi
  1840. nop.m 999
  1841. fcmp.eq.s1 p10,p9 = POW_NORM_X, f1
  1842. nop.i 999
  1843. }
  1844. ;;
  1845. { .mfi
  1846. nop.m 999
  1847. (p10) fma.s f8 = f1,f1,f0
  1848. nop.i 999
  1849. }
  1850. { .mfb
  1851. nop.m 999
  1852. (p9) fma.s f8 = f9,f8,f0
  1853. br.ret.sptk b0
  1854. }
  1855. ;;
  1856. POW_OVER_UNDER_ERROR:
  1857. { .mfi
  1858. nop.m 999
  1859. fmerge.s f10 = POW_NORM_X,POW_NORM_X
  1860. nop.i 999
  1861. }
  1862. { .mfi
  1863. sub pow_GR_17ones_m1 = pow_GR_17ones, r0, 1
  1864. nop.f 999
  1865. mov pow_GR_one = 0x1
  1866. }
  1867. ;;
  1868. // overflow
  1869. { .mmb
  1870. (p8) mov pow_GR_tag = 30
  1871. (p8) setf.exp f11 = pow_GR_17ones_m1
  1872. nop.b 999
  1873. }
  1874. ;;
  1875. // underflow
  1876. { .mmi
  1877. (p9) mov pow_GR_tag = 31
  1878. (p9) setf.exp f11 = pow_GR_one
  1879. nop.i 999
  1880. }
  1881. ;;
  1882. // p12 x is negative and y is an odd integer
  1883. { .mfi
  1884. nop.m 999
  1885. fma.s f8 = f11, f11, f0
  1886. nop.i 999
  1887. }
  1888. ;;
  1889. { .mfi
  1890. nop.m 999
  1891. (p12) fmerge.ns f8 = f8, f8
  1892. nop.i 999
  1893. }
  1894. ;;
  1895. .endp powf
  1896. // Stack operations when calling error support.
  1897. // (1) (2) (3) (call) (4)
  1898. // sp -> + psp -> + psp -> + sp -> +
  1899. // | | | |
  1900. // | | <- GR_Y R3 ->| <- GR_RESULT | -> f8
  1901. // | | | |
  1902. // | <-GR_Y Y2->| Y2 ->| <- GR_Y |
  1903. // | | | |
  1904. // | | <- GR_X X1 ->| |
  1905. // | | | |
  1906. // sp-64 -> + sp -> + sp -> + +
  1907. // save ar.pfs save b0 restore gp
  1908. // save gp restore ar.pfs
  1909. .proc __libm_error_region
  1910. __libm_error_region:
  1911. // Answer is inf for overflow and 0 for underflow.
  1912. .prologue
  1913. // (1)
  1914. { .mfi
  1915. add GR_Parameter_Y=-32,sp // Parameter 2 value
  1916. nop.f 0
  1917. .save ar.pfs,GR_SAVE_PFS
  1918. mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
  1919. }
  1920. { .mfi
  1921. .fframe 64
  1922. add sp=-64,sp // Create new stack
  1923. nop.f 0
  1924. mov GR_SAVE_GP=gp // Save gp
  1925. };;
  1926. // (2)
  1927. { .mmi
  1928. stfs [GR_Parameter_Y] = POW_NORM_Y,16 // STORE Parameter 2 on stack
  1929. add GR_Parameter_X = 16,sp // Parameter 1 address
  1930. .save b0, GR_SAVE_B0
  1931. mov GR_SAVE_B0=b0 // Save b0
  1932. };;
  1933. .body
  1934. // (3)
  1935. { .mib
  1936. stfs [GR_Parameter_X] = POW_NORM_X // STORE Parameter 1 on stack
  1937. add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
  1938. nop.b 0
  1939. }
  1940. { .mib
  1941. stfs [GR_Parameter_Y] = f8 // STORE Parameter 3 on stack
  1942. add GR_Parameter_Y = -16,GR_Parameter_Y
  1943. br.call.sptk b0=__libm_error_support# // Call error handling function
  1944. };;
  1945. { .mmi
  1946. nop.m 0
  1947. nop.m 0
  1948. add GR_Parameter_RESULT = 48,sp
  1949. };;
  1950. // (4)
  1951. { .mmi
  1952. ldfs f8 = [GR_Parameter_RESULT] // Get return result off stack
  1953. .restore
  1954. add sp = 64,sp // Restore stack pointer
  1955. mov b0 = GR_SAVE_B0 // Restore return address
  1956. };;
  1957. { .mib
  1958. mov gp = GR_SAVE_GP // Restore gp
  1959. mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
  1960. br.ret.sptk b0 // Return
  1961. };;
  1962. .endp __libm_error_region
  1963. .type __libm_error_support#,@function
  1964. .global __libm_error_support#