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.

893 lines
24 KiB

  1. .file "acos.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. // 2/02/00 Initial version
  28. // 8/17/00 New and much faster algorithm.
  29. // 8/30/00 Avoided bank conflicts on loads, shortened |x|=1 and x=0 paths,
  30. // fixed mfb split issue stalls.
  31. // Description
  32. //=========================================
  33. // The acos function computes the principle value of the arc sine of x.
  34. // A doman error occurs for arguments not in the range [-1,+1].
  35. // The acos function returns the arc cosine in the range [0, +pi] radians.
  36. // acos(1) returns +0, acos(-1) returns pi, acos(0) returns pi/2.
  37. // acos(x) returns a Nan and raises the invalid exception for |x| >1
  38. // The acos function is just like asin except that pi/2 is added at the end.
  39. //
  40. // Assembly macros
  41. //=========================================
  42. // predicate registers
  43. //acos_pred_LEsqrt2by2 = p7
  44. //acos_pred_GTsqrt2by2 = p8
  45. // integer registers
  46. ASIN_Addr1 = r33
  47. ASIN_Addr2 = r34
  48. ASIN_FFFE = r35
  49. GR_SAVE_B0 = r36
  50. GR_SAVE_PFS = r37
  51. GR_SAVE_GP = r38
  52. GR_Parameter_X = r39
  53. GR_Parameter_Y = r40
  54. GR_Parameter_RESULT = r41
  55. GR_Parameter_Tag = r42
  56. // floating point registers
  57. acos_coeff_P1 = f32
  58. acos_coeff_P2 = f33
  59. acos_coeff_P3 = f34
  60. acos_coeff_P4 = f35
  61. acos_coeff_P5 = f36
  62. acos_coeff_P6 = f37
  63. acos_coeff_P7 = f38
  64. acos_coeff_P8 = f39
  65. acos_coeff_P9 = f40
  66. acos_coeff_P10 = f41
  67. acos_coeff_P11 = f42
  68. acos_coeff_P12 = f43
  69. acos_coeff_P13 = f44
  70. acos_coeff_P14 = f45
  71. acos_coeff_P15 = f46
  72. acos_coeff_P16 = f47
  73. acos_coeff_P17 = f48
  74. acos_coeff_P18 = f49
  75. acos_coeff_P19 = f50
  76. acos_coeff_P20 = f51
  77. acos_coeff_P21 = f52
  78. acos_const_sqrt2by2 = f53
  79. acos_const_piby2 = f54
  80. acos_abs_x = f55
  81. acos_tx = f56
  82. acos_tx2 = f57
  83. acos_tx3 = f58
  84. acos_tx4 = f59
  85. acos_tx8 = f60
  86. acos_tx11 = f61
  87. acos_1poly_p8 = f62
  88. acos_1poly_p19 = f63
  89. acos_1poly_p4 = f64
  90. acos_1poly_p15 = f65
  91. acos_1poly_p6 = f66
  92. acos_1poly_p17 = f67
  93. acos_1poly_p0 = f68
  94. acos_1poly_p11 = f69
  95. acos_1poly_p2 = f70
  96. acos_1poly_p13 = f71
  97. acos_series_tx = f72
  98. acos_t = f73
  99. acos_t2 = f74
  100. acos_t3 = f75
  101. acos_t4 = f76
  102. acos_t8 = f77
  103. acos_t11 = f78
  104. acos_poly_p8 = f79
  105. acos_poly_p19 = f80
  106. acos_poly_p4 = f81
  107. acos_poly_p15 = f82
  108. acos_poly_p6 = f83
  109. acos_poly_p17 = f84
  110. acos_poly_p0 = f85
  111. acos_poly_p11 = f86
  112. acos_poly_p2 = f87
  113. acos_poly_p13 = f88
  114. acos_series_t = f89
  115. acos_1by2 = f90
  116. acos_3by2 = f91
  117. acos_5by2 = f92
  118. acos_11by4 = f93
  119. acos_35by8 = f94
  120. acos_63by8 = f95
  121. acos_231by16 = f96
  122. acos_y0 = f97
  123. acos_H0 = f98
  124. acos_S0 = f99
  125. acos_d = f100
  126. acos_l1 = f101
  127. acos_d2 = f102
  128. acos_T0 = f103
  129. acos_d1 = f104
  130. acos_e0 = f105
  131. acos_l2 = f106
  132. acos_d3 = f107
  133. acos_T3 = f108
  134. acos_S1 = f109
  135. acos_e1 = f110
  136. acos_z = f111
  137. answer2 = f112
  138. acos_sgn_x = f113
  139. acos_429by16 = f114
  140. acos_18by4 = f115
  141. acos_3by4 = f116
  142. acos_l3 = f117
  143. acos_T6 = f118
  144. acos_const_add = f119
  145. // Data tables
  146. //==============================================================
  147. .data
  148. .align 16
  149. acos_coeff_1_table:
  150. data8 0xE4E7E0A423A21249 , 0x00003FF8 //P7
  151. data8 0xC2F7EE0200FCE2A5 , 0x0000C003 //P18
  152. data8 0xB745D7F6C65C20E0 , 0x00003FF9 //P5
  153. data8 0xF75E381A323D4D94 , 0x0000C002 //P16
  154. data8 0x8959C2629C1024C0 , 0x0000C002 //P20
  155. data8 0xAFF68E7D241292C5 , 0x00003FF8 //P9
  156. data8 0xB6DB6DB7260AC30D , 0x00003FFA //P3
  157. data8 0xD0417CE2B41CB7BF , 0x0000C000 //P14
  158. data8 0x81D570FEA724E3E4 , 0x0000BFFD //P12
  159. data8 0xAAAAAAAAAAAAC277 , 0x00003FFC //P1
  160. data8 0xF534912FF3E7B76F , 0x00003FFF //P21
  161. data8 0xc90fdaa22168c235 , 0x00003fff // pi/2
  162. data8 0x0000000000000000 , 0x00000000 // pad to avoid bank conflicts
  163. acos_coeff_2_table:
  164. data8 0x8E26AF5F29B39A2A , 0x00003FF9 //P6
  165. data8 0xB4F118A4B1015470 , 0x00004003 //P17
  166. data8 0xF8E38E10C25990E0 , 0x00003FF9 //P4
  167. data8 0x80F50489AEF1CAC6 , 0x00004002 //P15
  168. data8 0x92728015172CFE1C , 0x00004003 //P19
  169. data8 0xBBC3D831D4595971 , 0x00003FF8 //P8
  170. data8 0x999999999952A5C3 , 0x00003FFB //P2
  171. data8 0x855576BE6F0975EC , 0x00003FFF //P13
  172. data8 0xF12420E778077D89 , 0x00003FFA //P11
  173. data8 0xB6590FF4D23DE003 , 0x00003FF3 //P10
  174. data8 0xb504f333f9de6484 , 0x00003ffe // sqrt(2)/2
  175. .align 32
  176. .global acos
  177. .section .text
  178. .proc acos
  179. .align 32
  180. acos:
  181. { .mfi
  182. alloc r32 = ar.pfs,1,6,4,0
  183. fma.s1 acos_tx = f8,f8,f0
  184. addl ASIN_Addr2 = @ltoff(acos_coeff_2_table),gp
  185. }
  186. { .mfi
  187. mov ASIN_FFFE = 0xFFFE
  188. fnma.s1 acos_t = f8,f8,f1
  189. addl ASIN_Addr1 = @ltoff(acos_coeff_1_table),gp
  190. }
  191. ;;
  192. { .mfi
  193. setf.exp acos_1by2 = ASIN_FFFE
  194. fmerge.s acos_abs_x = f1,f8
  195. nop.i 999 ;;
  196. }
  197. { .mmf
  198. ld8 ASIN_Addr1 = [ASIN_Addr1]
  199. ld8 ASIN_Addr2 = [ASIN_Addr2]
  200. fmerge.s acos_sgn_x = f8,f1
  201. }
  202. ;;
  203. { .mfi
  204. nop.m 999
  205. fcmp.lt.s1 p11,p12 = f8, f0
  206. nop.i 999 ;;
  207. }
  208. { .mfi
  209. ldfe acos_coeff_P7 = [ASIN_Addr1],16
  210. fma.s1 acos_tx2 = acos_tx,acos_tx,f0
  211. nop.i 999
  212. }
  213. { .mfi
  214. ldfe acos_coeff_P6 = [ASIN_Addr2],16
  215. fma.s1 acos_t2 = acos_t,acos_t,f0
  216. nop.i 999;;
  217. }
  218. { .mmf
  219. ldfe acos_coeff_P18 = [ASIN_Addr1],16
  220. ldfe acos_coeff_P17 = [ASIN_Addr2],16
  221. fclass.m.unc p8,p0 = f8, 0xc3 //@qnan |@snan
  222. }
  223. ;;
  224. { .mmf
  225. ldfe acos_coeff_P5 = [ASIN_Addr1],16
  226. ldfe acos_coeff_P4 = [ASIN_Addr2],16
  227. frsqrta.s1 acos_y0,p0 = acos_t
  228. }
  229. ;;
  230. { .mfi
  231. ldfe acos_coeff_P16 = [ASIN_Addr1],16
  232. fcmp.gt.s1 p9,p0 = acos_abs_x,f1
  233. nop.i 999
  234. }
  235. { .mfb
  236. ldfe acos_coeff_P15 = [ASIN_Addr2],16
  237. (p8) fma.d f8 = f8,f1,f0
  238. (p8) br.ret.spnt b0
  239. }
  240. ;;
  241. { .mmf
  242. ldfe acos_coeff_P20 = [ASIN_Addr1],16
  243. ldfe acos_coeff_P19 = [ASIN_Addr2],16
  244. fclass.m.unc p10,p0 = f8, 0x07 //@zero
  245. }
  246. ;;
  247. { .mfi
  248. ldfe acos_coeff_P9 = [ASIN_Addr1],16
  249. fma.s1 acos_t4 = acos_t2,acos_t2,f0
  250. (p9) mov GR_Parameter_Tag = 58
  251. }
  252. { .mfi
  253. ldfe acos_coeff_P8 = [ASIN_Addr2],16
  254. fma.s1 acos_3by2 = acos_1by2,f1,f1
  255. nop.i 999;;
  256. }
  257. { .mfi
  258. ldfe acos_coeff_P2 = [ASIN_Addr2],16
  259. fma.s1 acos_tx4 = acos_tx2,acos_tx2,f0
  260. nop.i 999
  261. }
  262. { .mfb
  263. ldfe acos_coeff_P3 = [ASIN_Addr1],16
  264. fma.s1 acos_t3 = acos_t,acos_t2,f0
  265. (p9) br.cond.spnt __libm_error_region
  266. }
  267. ;;
  268. { .mfi
  269. ldfe acos_coeff_P13 = [ASIN_Addr2],16
  270. fma.s1 acos_H0 = acos_y0,acos_1by2,f0
  271. nop.i 999
  272. }
  273. { .mfi
  274. ldfe acos_coeff_P14 = [ASIN_Addr1],16
  275. fma.s1 acos_S0 = acos_y0,acos_t,f0
  276. nop.i 999;;
  277. }
  278. { .mfi
  279. ldfe acos_coeff_P11 = [ASIN_Addr2],16
  280. fcmp.eq.s1 p6,p0 = acos_abs_x, f1
  281. nop.i 999
  282. }
  283. { .mfi
  284. ldfe acos_coeff_P12 = [ASIN_Addr1],16
  285. fma.s1 acos_tx3 = acos_tx,acos_tx2,f0
  286. nop.i 999
  287. }
  288. ;;
  289. { .mfi
  290. ldfe acos_coeff_P10 = [ASIN_Addr2],16
  291. fma.s1 acos_1poly_p6 = acos_tx,acos_coeff_P7,acos_coeff_P6
  292. nop.i 999
  293. }
  294. { .mfi
  295. ldfe acos_coeff_P1 = [ASIN_Addr1],16
  296. fma.s1 acos_poly_p6 = acos_t,acos_coeff_P7,acos_coeff_P6
  297. nop.i 999;;
  298. }
  299. { .mfi
  300. ldfe acos_const_sqrt2by2 = [ASIN_Addr2],16
  301. fma.s1 acos_5by2 = acos_3by2,f1,f1
  302. nop.i 999
  303. }
  304. { .mfi
  305. ldfe acos_coeff_P21 = [ASIN_Addr1],16
  306. fma.s1 acos_11by4 = acos_3by2,acos_3by2,acos_1by2
  307. nop.i 999;;
  308. }
  309. { .mfi
  310. ldfe acos_const_piby2 = [ASIN_Addr1],16
  311. fma.s1 acos_poly_p17 = acos_t,acos_coeff_P18,acos_coeff_P17
  312. nop.i 999
  313. }
  314. { .mfb
  315. nop.m 999
  316. fma.s1 acos_3by4 = acos_3by2,acos_1by2,f0
  317. (p10) br.cond.spnt ACOS_ZERO // Branch to short path if x=0
  318. }
  319. ;;
  320. { .mfi
  321. nop.m 999
  322. fma.s1 acos_poly_p15 = acos_t,acos_coeff_P16,acos_coeff_P15
  323. nop.i 999
  324. }
  325. { .mfb
  326. nop.m 999
  327. fnma.s1 acos_d = acos_S0,acos_H0,acos_1by2
  328. (p6) br.cond.spnt ACOS_ABS_ONE // Branch to short path if |x|=1
  329. }
  330. ;;
  331. { .mfi
  332. nop.m 999
  333. fma.s1 acos_poly_p19 = acos_t,acos_coeff_P20,acos_coeff_P19
  334. nop.i 999
  335. }
  336. { .mfi
  337. nop.m 999
  338. fma.s1 acos_poly_p4 = acos_t,acos_coeff_P5,acos_coeff_P4
  339. nop.i 999;;
  340. }
  341. { .mfi
  342. nop.m 999
  343. fma.s1 acos_1poly_p17 = acos_tx,acos_coeff_P18,acos_coeff_P17
  344. nop.i 999
  345. }
  346. { .mfi
  347. nop.m 999
  348. fma.s1 acos_poly_p8 = acos_t,acos_coeff_P9,acos_coeff_P8
  349. nop.i 999;;
  350. }
  351. { .mfi
  352. nop.m 999
  353. fms.s1 acos_35by8 = acos_5by2,acos_11by4,acos_5by2
  354. nop.i 999
  355. }
  356. { .mfi
  357. nop.m 999
  358. fma.s1 acos_63by8 = acos_5by2,acos_11by4,f1
  359. nop.i 999;;
  360. }
  361. { .mfi
  362. nop.m 999
  363. fma.s1 acos_poly_p13 = acos_t,acos_coeff_P14,acos_coeff_P13
  364. nop.i 999
  365. }
  366. { .mfi
  367. nop.m 999
  368. fma.s1 acos_18by4 = acos_3by2,acos_5by2,acos_3by4
  369. nop.i 999;;
  370. }
  371. { .mfi
  372. nop.m 999
  373. fma.s1 acos_l1 = acos_5by2,acos_d,acos_3by2
  374. nop.i 999
  375. }
  376. { .mfi
  377. nop.m 999
  378. fma.s1 acos_d2 = acos_d,acos_d,f0
  379. nop.i 999;;
  380. }
  381. { .mfi
  382. nop.m 999
  383. fma.s1 acos_poly_p15 = acos_t2,acos_poly_p17,acos_poly_p15
  384. nop.i 999
  385. }
  386. { .mfi
  387. nop.m 999
  388. fma.s1 acos_T0 = acos_d,acos_S0,f0
  389. nop.i 999;;
  390. }
  391. { .mfi
  392. nop.m 999
  393. fma.s1 acos_poly_p19 = acos_t2,acos_coeff_P21,acos_poly_p19
  394. nop.i 999
  395. }
  396. { .mfi
  397. nop.m 999
  398. fma.s1 acos_poly_p4 = acos_t2,acos_poly_p6,acos_poly_p4
  399. nop.i 999;;
  400. }
  401. { .mfi
  402. nop.m 999
  403. fma.s1 acos_d1 = acos_35by8,acos_d,f0
  404. nop.i 999
  405. }
  406. { .mfi
  407. nop.m 999
  408. fma.s1 acos_231by16 = acos_3by2,acos_35by8,acos_63by8
  409. nop.i 999;;
  410. }
  411. { .mfi
  412. nop.m 999
  413. fma.s1 acos_poly_p2 = acos_t,acos_coeff_P3,acos_coeff_P2
  414. nop.i 999
  415. }
  416. { .mfi
  417. nop.m 999
  418. fma.s1 acos_poly_p8 = acos_t2,acos_coeff_P10,acos_poly_p8
  419. nop.i 999;;
  420. }
  421. { .mfi
  422. nop.m 999
  423. fma.s1 acos_poly_p11 = acos_t,acos_coeff_P12,acos_coeff_P11
  424. nop.i 999
  425. }
  426. { .mfi
  427. nop.m 999
  428. fma.s1 acos_e0 = acos_d2,acos_l1,acos_d
  429. nop.i 999;;
  430. }
  431. { .mfi
  432. nop.m 999
  433. fma.s1 acos_1poly_p15 = acos_tx,acos_coeff_P16,acos_coeff_P15
  434. nop.i 999
  435. }
  436. { .mfi
  437. nop.m 999
  438. fma.s1 acos_poly_p0 = acos_t,acos_coeff_P1,f1
  439. nop.i 999;;
  440. }
  441. { .mfi
  442. nop.m 999
  443. fma.s1 acos_1poly_p19 = acos_tx,acos_coeff_P20,acos_coeff_P19
  444. nop.i 999
  445. }
  446. { .mfi
  447. nop.m 999
  448. fma.s1 acos_1poly_p4 = acos_tx,acos_coeff_P5,acos_coeff_P4
  449. nop.i 999;;
  450. }
  451. { .mfi
  452. nop.m 999
  453. fma.s1 acos_1poly_p8 = acos_tx,acos_coeff_P9,acos_coeff_P8
  454. nop.i 999
  455. }
  456. { .mfi
  457. nop.m 999
  458. fma.s1 acos_l2 = acos_231by16,acos_d,acos_63by8
  459. nop.i 999;;
  460. }
  461. { .mfi
  462. nop.m 999
  463. fma.s1 acos_d3 = acos_d2,acos_d,f0
  464. nop.i 999
  465. }
  466. { .mfi
  467. nop.m 999
  468. fma.s1 acos_T3 = acos_d2,acos_T0,f0
  469. nop.i 999;;
  470. }
  471. { .mfi
  472. nop.m 999
  473. fma.s1 acos_429by16 = acos_18by4,acos_11by4,acos_231by16
  474. nop.i 999
  475. }
  476. { .mfi
  477. nop.m 999
  478. fma.s1 acos_S1 = acos_e0,acos_S0,acos_S0
  479. nop.i 999;;
  480. }
  481. { .mfi
  482. nop.m 999
  483. fma.s1 acos_poly_p4 = acos_t4,acos_poly_p8,acos_poly_p4
  484. nop.i 999
  485. }
  486. { .mfi
  487. nop.m 999
  488. fma.s1 acos_poly_p15 = acos_t4,acos_poly_p19,acos_poly_p15
  489. nop.i 999;;
  490. }
  491. { .mfi
  492. nop.m 999
  493. fma.s1 acos_poly_p0 = acos_t2,acos_poly_p2,acos_poly_p0
  494. nop.i 999
  495. }
  496. { .mfi
  497. nop.m 999
  498. fma.s1 acos_poly_p11 = acos_t2,acos_poly_p13,acos_poly_p11
  499. nop.i 999;;
  500. }
  501. { .mfi
  502. nop.m 999
  503. fma.s1 acos_t8 = acos_t4,acos_t4,f0
  504. nop.i 999
  505. }
  506. { .mfi
  507. nop.m 999
  508. fma.s1 acos_e1 = acos_d2,acos_l2,acos_d1
  509. nop.i 999;;
  510. }
  511. { .mfi
  512. nop.m 999
  513. fma.s1 acos_1poly_p4 = acos_tx2,acos_1poly_p6,acos_1poly_p4
  514. nop.i 999
  515. }
  516. { .mfi
  517. nop.m 999
  518. fma.s1 acos_1poly_p15 = acos_tx2,acos_1poly_p17,acos_1poly_p15
  519. nop.i 999;;
  520. }
  521. { .mfi
  522. nop.m 999
  523. fma.s1 acos_1poly_p8 = acos_tx2,acos_coeff_P10,acos_1poly_p8
  524. nop.i 999
  525. }
  526. { .mfi
  527. nop.m 999
  528. fma.s1 acos_1poly_p19 = acos_tx2,acos_coeff_P21,acos_1poly_p19
  529. nop.i 999;;
  530. }
  531. { .mfi
  532. nop.m 999
  533. fma.s1 acos_1poly_p2 = acos_tx,acos_coeff_P3,acos_coeff_P2
  534. nop.i 999
  535. }
  536. { .mfi
  537. nop.m 999
  538. fma.s1 acos_1poly_p13 = acos_tx,acos_coeff_P14,acos_coeff_P13
  539. nop.i 999;;
  540. }
  541. { .mfi
  542. nop.m 999
  543. fma.s1 acos_1poly_p0 = acos_tx,acos_coeff_P1,f1
  544. nop.i 999
  545. }
  546. { .mfi
  547. nop.m 999
  548. fma.s1 acos_1poly_p11 = acos_tx,acos_coeff_P12,acos_coeff_P11
  549. nop.i 999;;
  550. }
  551. { .mfi
  552. nop.m 999
  553. fma.s1 acos_l3 = acos_429by16,acos_d,f0
  554. nop.i 999
  555. }
  556. { .mfi
  557. nop.m 999
  558. fma.s1 acos_z = acos_e1,acos_T3,acos_S1
  559. nop.i 999;;
  560. }
  561. { .mfi
  562. nop.m 999
  563. fma.s1 acos_poly_p11 = acos_t4,acos_poly_p15,acos_poly_p11
  564. nop.i 999
  565. }
  566. { .mfi
  567. nop.m 999
  568. fma.s1 acos_T6 = acos_T3,acos_d3,f0
  569. nop.i 999;;
  570. }
  571. { .mfi
  572. nop.m 999
  573. fma.s1 acos_t11 = acos_t8,acos_t3,f0
  574. nop.i 999
  575. }
  576. { .mfi
  577. nop.m 999
  578. fma.s1 acos_poly_p0 = acos_t4,acos_poly_p4,acos_poly_p0
  579. nop.i 999;;
  580. }
  581. { .mfi
  582. nop.m 999
  583. fma.s1 acos_1poly_p4 = acos_tx4,acos_1poly_p8,acos_1poly_p4
  584. nop.i 999
  585. }
  586. { .mfi
  587. nop.m 999
  588. fma.s1 acos_1poly_p15 = acos_tx4,acos_1poly_p19,acos_1poly_p15
  589. nop.i 999;;
  590. }
  591. { .mfi
  592. nop.m 999
  593. fma.s1 acos_1poly_p0 = acos_tx2,acos_1poly_p2,acos_1poly_p0
  594. nop.i 999
  595. }
  596. { .mfi
  597. nop.m 999
  598. fma.s1 acos_1poly_p11 = acos_tx2,acos_1poly_p13,acos_1poly_p11
  599. nop.i 999;;
  600. }
  601. { .mfi
  602. nop.m 999
  603. // fcmp.le.s1 acos_pred_LEsqrt2by2,acos_pred_GTsqrt2by2 = acos_abs_x,acos_const_sqrt2by2
  604. fcmp.le.s1 p7,p8 = acos_abs_x,acos_const_sqrt2by2
  605. nop.i 999
  606. }
  607. { .mfi
  608. nop.m 999
  609. fma.s1 acos_tx8 = acos_tx4,acos_tx4,f0
  610. nop.i 999;;
  611. }
  612. { .mfi
  613. nop.m 999
  614. fma.s1 acos_z = acos_l3,acos_T6,acos_z
  615. nop.i 999;;
  616. }
  617. { .mfi
  618. nop.m 999
  619. fma.s1 acos_series_t = acos_t11,acos_poly_p11,acos_poly_p0
  620. nop.i 999
  621. }
  622. { .mfi
  623. nop.m 999
  624. (p11) fma.s1 acos_const_add = acos_const_piby2, f1, acos_const_piby2
  625. nop.i 999
  626. }
  627. ;;
  628. { .mfi
  629. nop.m 999
  630. (p12) fma.s1 acos_const_add = f1,f0,f0
  631. nop.i 999
  632. }
  633. ;;
  634. { .mfi
  635. nop.m 999
  636. fma.s1 acos_1poly_p0 = acos_tx4,acos_1poly_p4,acos_1poly_p0
  637. nop.i 999
  638. }
  639. { .mfi
  640. nop.m 999
  641. fma.s1 acos_1poly_p11 = acos_tx4,acos_1poly_p15,acos_1poly_p11
  642. nop.i 999;;
  643. }
  644. { .mfi
  645. nop.m 999
  646. fma.s1 acos_tx11 = acos_tx8,acos_tx3,f0
  647. nop.i 999;;
  648. }
  649. { .mfi
  650. nop.m 999
  651. //(acos_pred_GTsqrt2by2) fnma.s1 answer2 = acos_z,acos_series_t,acos_const_piby2
  652. (p8) fnma.s1 answer2 = acos_z,acos_series_t,f0
  653. nop.i 999;;
  654. }
  655. { .mfi
  656. nop.m 999
  657. fma.s1 acos_series_tx = acos_tx11,acos_1poly_p11,acos_1poly_p0
  658. nop.i 999;;
  659. }
  660. { .mfi
  661. nop.m 999
  662. //(acos_pred_GTsqrt2by2) fnma.d f8 = acos_sgn_x,answer2,acos_const_piby2
  663. (p8) fnma.d f8 = acos_sgn_x,answer2,acos_const_add
  664. nop.i 999;;
  665. }
  666. { .mfb
  667. nop.m 999
  668. //(acos_pred_LEsqrt2by2) fnma.d f8 = f8,acos_series_tx,acos_const_piby2
  669. (p7) fnma.d f8 = f8,acos_series_tx,acos_const_piby2
  670. br.ret.sptk b0 ;;
  671. }
  672. ACOS_ZERO:
  673. // Here if x=0
  674. { .mfb
  675. nop.m 999
  676. fma.d f8 = acos_const_piby2,f1,f0
  677. br.ret.sptk b0 ;;
  678. }
  679. .pred.rel "mutex",p11,p12
  680. ACOS_ABS_ONE:
  681. // Here if |x|=1
  682. { .mfi
  683. nop.m 999
  684. (p11) fma.d f8 = acos_const_piby2,f1,acos_const_piby2 // acos(-1)=pi
  685. nop.i 999
  686. }
  687. { .mfb
  688. nop.m 999
  689. (p12) fma.d f8 = f1,f0,f0 // acos(1)=0
  690. br.ret.sptk b0 ;;
  691. }
  692. .endp acos
  693. .proc __libm_error_region
  694. __libm_error_region:
  695. .prologue
  696. { .mfi
  697. add GR_Parameter_Y=-32,sp // Parameter 2 value
  698. nop.f 999
  699. .save ar.pfs,GR_SAVE_PFS
  700. mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
  701. }
  702. { .mfi
  703. .fframe 64
  704. add sp=-64,sp // Create new stack
  705. nop.f 0
  706. mov GR_SAVE_GP=gp // Save gp
  707. };;
  708. { .mmi
  709. stfs [GR_Parameter_Y] = f1,16 // Store Parameter 2 on stack
  710. add GR_Parameter_X = 16,sp // Parameter 1 address
  711. .save b0, GR_SAVE_B0
  712. mov GR_SAVE_B0=b0 // Save b0
  713. };;
  714. .body
  715. frcpa.s0 f9,p0 = f0,f0
  716. ;;
  717. { .mib
  718. stfd [GR_Parameter_X] = f8 // Store Parameter 1 on stack
  719. add GR_Parameter_RESULT = 0,GR_Parameter_Y
  720. nop.b 0 // Parameter 3 address
  721. }
  722. { .mib
  723. stfd [GR_Parameter_Y] = f9,-16 // Store Parameter 3 on stack
  724. adds r32 = 48,sp
  725. br.call.sptk b0=__libm_error_support# // Call error handling function
  726. };;
  727. { .mmi
  728. ldfd f8 = [r32] // Get return result off stack
  729. .restore
  730. add sp = 64,sp // Restore stack pointer
  731. mov b0 = GR_SAVE_B0 // Restore return address
  732. };;
  733. { .mib
  734. mov gp = GR_SAVE_GP // Restore gp
  735. mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
  736. br.ret.sptk b0 // Return
  737. };;
  738. .endp __libm_error_region
  739. .type __libm_error_support,@function
  740. .global __libm_error_support