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.

606 lines
16 KiB

  1. .file "sincosf.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 revision
  28. // 4/02/00 Unwind support added.
  29. // 5/10/00 Improved speed with new algorithm.
  30. // 8/08/00 Improved speed by avoiding SIR flush.
  31. // 8/17/00 Changed predicate register macro-usage to direct predicate
  32. // names due to an assembler bug.
  33. // 8/30/00 Put sin_of_r before sin_tbl_S_cos_of_r to gain a cycle
  34. //
  35. // API
  36. //==============================================================
  37. // float sinf( float x);
  38. // float cosf( float x);
  39. //
  40. // Assembly macros
  41. //==============================================================
  42. // SIN_Sin_Flag = p6
  43. // SIN_Cos_Flag = p7
  44. // integer registers used
  45. SIN_AD_PQ_1 = r33
  46. SIN_AD_PQ_2 = r34
  47. sin_GR_Mint = r35
  48. sin_GR_index = r36
  49. GR_SAVE_B0 = r37
  50. GR_SAVE_GP = r38
  51. GR_SAVE_PFS = r39
  52. // floating point registers used
  53. sin_coeff_P1 = f32
  54. sin_coeff_P2 = f33
  55. sin_coeff_Q1 = f34
  56. sin_coeff_Q2 = f35
  57. sin_coeff_P4 = f36
  58. sin_coeff_P5 = f37
  59. sin_coeff_Q4 = f38
  60. sin_coeff_Q5 = f39
  61. sin_Mx = f40
  62. sin_Mfloat = f41
  63. sin_tbl_S = f42
  64. sin_tbl_C = f43
  65. sin_r = f44
  66. sin_rcube = f45
  67. sin_tsq = f46
  68. sin_r7 = f47
  69. sin_t = f48
  70. sin_poly_p2 = f49
  71. sin_poly_p1 = f50
  72. // f51
  73. sin_poly_p3 = f52
  74. sin_poly_p4 = f53
  75. sin_of_r = f54
  76. sin_S_t = f55
  77. sin_poly_q2 = f56
  78. sin_poly_q1 = f57
  79. sin_S_tcube = f58
  80. sin_poly_q3 = f59
  81. sin_poly_q4 = f60
  82. sin_tbl_S_tcube = f61
  83. sin_tbl_S_cos_of_r = f62
  84. sin_coeff_Q3 = f63
  85. sin_coeff_P3 = f64
  86. sin_coeff_Q6 = f65
  87. sin_poly_q5 = f66
  88. sin_poly_q12 = f67
  89. sin_poly_q3456 = f68
  90. .data
  91. .align 16
  92. sin_coeff_1_table:
  93. data8 0xBFC55555555554CA // p1
  94. data8 0x3F811111110F2395 // p2
  95. data8 0x3EC71DD1D5E421A4 // p4
  96. data8 0xBE5AC5C9D0ACF95A // p5
  97. data8 0xBE927E42FDF33FFE // q5
  98. data8 0xBF2A01A011232913 // p3
  99. sin_coeff_2_table:
  100. data8 0xBFE0000000000000 // q1
  101. data8 0x3FA55555555554EF // q2
  102. data8 0xBF56C16C16BF6462 // q3
  103. data8 0x3EFA01A0128B9EBC // q4
  104. data8 0x3E21DA5C72A446F3 // q6
  105. data8 0x0000000000000000 // pad
  106. /////////////////////////////////////////
  107. data8 0xBFE1A54991426566 //sin(-32)
  108. data8 0x3FEAB1F5305DE8E5 //cos(-32)
  109. data8 0x3FD9DBC0B640FC81 //sin(-31)
  110. data8 0x3FED4591C3E12A20 //cos(-31)
  111. data8 0x3FEF9DF47F1C903D //sin(-30)
  112. data8 0x3FC3BE82F2505A52 //cos(-30)
  113. data8 0x3FE53C7D20A6C9E7 //sin(-29)
  114. data8 0xBFE7F01658314E47 //cos(-29)
  115. data8 0xBFD156853B4514D6 //sin(-28)
  116. data8 0xBFEECDAAD1582500 //cos(-28)
  117. data8 0xBFEE9AA1B0E5BA30 //sin(-27)
  118. data8 0xBFD2B266F959DED5 //cos(-27)
  119. data8 0xBFE866E0FAC32583 //sin(-26)
  120. data8 0x3FE4B3902691A9ED //cos(-26)
  121. data8 0x3FC0F0E6F31E809D //sin(-25)
  122. data8 0x3FEFB7EEF59504FF //cos(-25)
  123. data8 0x3FECFA7F7919140F //sin(-24)
  124. data8 0x3FDB25BFB50A609A //cos(-24)
  125. data8 0x3FEB143CD0247D02 //sin(-23)
  126. data8 0xBFE10CF7D591F272 //cos(-23)
  127. data8 0x3F8220A29F6EB9F4 //sin(-22)
  128. data8 0xBFEFFFADD8D4ACDA //cos(-22)
  129. data8 0xBFEAC5E20BB0D7ED //sin(-21)
  130. data8 0xBFE186FF83773759 //cos(-21)
  131. data8 0xBFED36D8F55D3CE0 //sin(-20)
  132. data8 0x3FDA1E043964A83F //cos(-20)
  133. data8 0xBFC32F2D28F584CF //sin(-19)
  134. data8 0x3FEFA377DE108258 //cos(-19)
  135. data8 0x3FE8081668131E26 //sin(-18)
  136. data8 0x3FE52150815D2470 //cos(-18)
  137. data8 0x3FEEC3C4AC42882B //sin(-17)
  138. data8 0xBFD19C46B07F58E7 //cos(-17)
  139. data8 0x3FD26D02085F20F8 //sin(-16)
  140. data8 0xBFEEA5257E962F74 //cos(-16)
  141. data8 0xBFE4CF2871CEC2E8 //sin(-15)
  142. data8 0xBFE84F5D069CA4F3 //cos(-15)
  143. data8 0xBFEFB30E327C5E45 //sin(-14)
  144. data8 0x3FC1809AEC2CA0ED //cos(-14)
  145. data8 0xBFDAE4044881C506 //sin(-13)
  146. data8 0x3FED09CDD5260CB7 //cos(-13)
  147. data8 0x3FE12B9AF7D765A5 //sin(-12)
  148. data8 0x3FEB00DA046B65E3 //cos(-12)
  149. data8 0x3FEFFFEB762E93EB //sin(-11)
  150. data8 0x3F7220AE41EE2FDF //cos(-11)
  151. data8 0x3FE1689EF5F34F52 //sin(-10)
  152. data8 0xBFEAD9AC890C6B1F //cos(-10)
  153. data8 0xBFDA6026360C2F91 //sin( -9)
  154. data8 0xBFED27FAA6A6196B //cos( -9)
  155. data8 0xBFEFA8D2A028CF7B //sin( -8)
  156. data8 0xBFC29FBEBF632F94 //cos( -8)
  157. data8 0xBFE50608C26D0A08 //sin( -7)
  158. data8 0x3FE81FF79ED92017 //cos( -7)
  159. data8 0x3FD1E1F18AB0A2C0 //sin( -6)
  160. data8 0x3FEEB9B7097822F5 //cos( -6)
  161. data8 0x3FEEAF81F5E09933 //sin( -5)
  162. data8 0x3FD22785706B4AD9 //cos( -5)
  163. data8 0x3FE837B9DDDC1EAE //sin( -4)
  164. data8 0xBFE4EAA606DB24C1 //cos( -4)
  165. data8 0xBFC210386DB6D55B //sin( -3)
  166. data8 0xBFEFAE04BE85E5D2 //cos( -3)
  167. data8 0xBFED18F6EAD1B446 //sin( -2)
  168. data8 0xBFDAA22657537205 //cos( -2)
  169. data8 0xBFEAED548F090CEE //sin( -1)
  170. data8 0x3FE14A280FB5068C //cos( -1)
  171. data8 0x0000000000000000 //sin( 0)
  172. data8 0x3FF0000000000000 //cos( 0)
  173. data8 0x3FEAED548F090CEE //sin( 1)
  174. data8 0x3FE14A280FB5068C //cos( 1)
  175. data8 0x3FED18F6EAD1B446 //sin( 2)
  176. data8 0xBFDAA22657537205 //cos( 2)
  177. data8 0x3FC210386DB6D55B //sin( 3)
  178. data8 0xBFEFAE04BE85E5D2 //cos( 3)
  179. data8 0xBFE837B9DDDC1EAE //sin( 4)
  180. data8 0xBFE4EAA606DB24C1 //cos( 4)
  181. data8 0xBFEEAF81F5E09933 //sin( 5)
  182. data8 0x3FD22785706B4AD9 //cos( 5)
  183. data8 0xBFD1E1F18AB0A2C0 //sin( 6)
  184. data8 0x3FEEB9B7097822F5 //cos( 6)
  185. data8 0x3FE50608C26D0A08 //sin( 7)
  186. data8 0x3FE81FF79ED92017 //cos( 7)
  187. data8 0x3FEFA8D2A028CF7B //sin( 8)
  188. data8 0xBFC29FBEBF632F94 //cos( 8)
  189. data8 0x3FDA6026360C2F91 //sin( 9)
  190. data8 0xBFED27FAA6A6196B //cos( 9)
  191. data8 0xBFE1689EF5F34F52 //sin( 10)
  192. data8 0xBFEAD9AC890C6B1F //cos( 10)
  193. data8 0xBFEFFFEB762E93EB //sin( 11)
  194. data8 0x3F7220AE41EE2FDF //cos( 11)
  195. data8 0xBFE12B9AF7D765A5 //sin( 12)
  196. data8 0x3FEB00DA046B65E3 //cos( 12)
  197. data8 0x3FDAE4044881C506 //sin( 13)
  198. data8 0x3FED09CDD5260CB7 //cos( 13)
  199. data8 0x3FEFB30E327C5E45 //sin( 14)
  200. data8 0x3FC1809AEC2CA0ED //cos( 14)
  201. data8 0x3FE4CF2871CEC2E8 //sin( 15)
  202. data8 0xBFE84F5D069CA4F3 //cos( 15)
  203. data8 0xBFD26D02085F20F8 //sin( 16)
  204. data8 0xBFEEA5257E962F74 //cos( 16)
  205. data8 0xBFEEC3C4AC42882B //sin( 17)
  206. data8 0xBFD19C46B07F58E7 //cos( 17)
  207. data8 0xBFE8081668131E26 //sin( 18)
  208. data8 0x3FE52150815D2470 //cos( 18)
  209. data8 0x3FC32F2D28F584CF //sin( 19)
  210. data8 0x3FEFA377DE108258 //cos( 19)
  211. data8 0x3FED36D8F55D3CE0 //sin( 20)
  212. data8 0x3FDA1E043964A83F //cos( 20)
  213. data8 0x3FEAC5E20BB0D7ED //sin( 21)
  214. data8 0xBFE186FF83773759 //cos( 21)
  215. data8 0xBF8220A29F6EB9F4 //sin( 22)
  216. data8 0xBFEFFFADD8D4ACDA //cos( 22)
  217. data8 0xBFEB143CD0247D02 //sin( 23)
  218. data8 0xBFE10CF7D591F272 //cos( 23)
  219. data8 0xBFECFA7F7919140F //sin( 24)
  220. data8 0x3FDB25BFB50A609A //cos( 24)
  221. data8 0xBFC0F0E6F31E809D //sin( 25)
  222. data8 0x3FEFB7EEF59504FF //cos( 25)
  223. data8 0x3FE866E0FAC32583 //sin( 26)
  224. data8 0x3FE4B3902691A9ED //cos( 26)
  225. data8 0x3FEE9AA1B0E5BA30 //sin( 27)
  226. data8 0xBFD2B266F959DED5 //cos( 27)
  227. data8 0x3FD156853B4514D6 //sin( 28)
  228. data8 0xBFEECDAAD1582500 //cos( 28)
  229. data8 0xBFE53C7D20A6C9E7 //sin( 29)
  230. data8 0xBFE7F01658314E47 //cos( 29)
  231. data8 0xBFEF9DF47F1C903D //sin( 30)
  232. data8 0x3FC3BE82F2505A52 //cos( 30)
  233. data8 0xBFD9DBC0B640FC81 //sin( 31)
  234. data8 0x3FED4591C3E12A20 //cos( 31)
  235. data8 0x3FE1A54991426566 //sin( 32)
  236. data8 0x3FEAB1F5305DE8E5 //cos( 32)
  237. //////////////////////////////////////////
  238. // SIN_Sin_Flag is set to 0 for sin, and 1 for cosine
  239. .global sinf
  240. .global cosf
  241. .text
  242. .proc cosf
  243. .align 32
  244. cosf:
  245. { .mfi
  246. alloc r32 = ar.pfs,1,7,0,0
  247. fcvt.fx.s1 sin_Mx = f8
  248. addl SIN_AD_PQ_1 = @ltoff(sin_coeff_1_table),gp
  249. }
  250. { .mfi
  251. // cmp.ne SIN_Sin_Flag,SIN_Cos_Flag = r0,r0
  252. cmp.ne p6,p7 = r0,r0
  253. nop.f 999
  254. addl SIN_AD_PQ_2 = @ltoff(sin_coeff_2_table),gp
  255. }
  256. ;;
  257. { .mmb
  258. ld8 SIN_AD_PQ_1 = [SIN_AD_PQ_1]
  259. ld8 SIN_AD_PQ_2 = [SIN_AD_PQ_2]
  260. br.sptk SINCOSF_COMMON
  261. }
  262. .endp cosf
  263. .text
  264. .proc sinf
  265. .align 32
  266. sinf:
  267. { .mfi
  268. alloc r32 = ar.pfs,1,7,0,0
  269. fcvt.fx.s1 sin_Mx = f8
  270. addl SIN_AD_PQ_1 = @ltoff(sin_coeff_1_table),gp
  271. }
  272. { .mfi
  273. // cmp.eq SIN_Sin_Flag,SIN_Cos_Flag = r0,r0
  274. cmp.eq p6,p7 = r0,r0
  275. nop.f 999
  276. addl SIN_AD_PQ_2 = @ltoff(sin_coeff_2_table),gp
  277. }
  278. ;;
  279. { .mmf
  280. ld8 SIN_AD_PQ_1 = [SIN_AD_PQ_1]
  281. ld8 SIN_AD_PQ_2 = [SIN_AD_PQ_2]
  282. nop.f 999
  283. }
  284. ;;
  285. SINCOSF_COMMON:
  286. ////////////////////////////////////////////
  287. // need to special case Cos(0) = 1.0
  288. // (SIN_Cos_Flag) fclass.m.unc p8,p0 = f8, 0x07
  289. // (p8) fmerge.s f8 = f1,f1
  290. // (p8) br.ret.spnt b0
  291. // need to special case sin(-0) = -0
  292. //
  293. //
  294. //////////////////////////////////////////////////////////////////////
  295. // We dont really have to test for Nan because an input Nan does return
  296. // quiet version
  297. // fclass.m.unc p10,p0 = f8, 0xc3 //@snan | @qnan
  298. // (p10) fma.s f8 = f8,f1,f0
  299. // (p10 br.ret.spnt b0
  300. //
  301. //////////////////////////////////////////////////////////////////////
  302. // Same for +- infinity
  303. // fclass.m.unc p11,p0 = f8, 0x23 //@inf
  304. // (p11) frcpa.s1 f8,p12 = f0,f0
  305. // (p11) br.ret.spnt b0
  306. { .mmf
  307. ldfpd sin_coeff_P1, sin_coeff_P2 = [SIN_AD_PQ_1], 16
  308. ldfpd sin_coeff_Q1, sin_coeff_Q2 = [SIN_AD_PQ_2], 16
  309. //(SIN_Sin_Flag) fclass.m.unc p13,p0 = f8, 0x07
  310. (p6) fclass.m.unc p13,p0 = f8, 0x07
  311. }
  312. ;;
  313. { .mmf
  314. ldfpd sin_coeff_P4, sin_coeff_P5 = [SIN_AD_PQ_1], 16
  315. ldfpd sin_coeff_Q3, sin_coeff_Q4 = [SIN_AD_PQ_2], 16
  316. //(SIN_Cos_Flag) fclass.m.unc p8,p0 = f8, 0x07
  317. (p7) fclass.m.unc p8,p0 = f8, 0x07
  318. }
  319. ;;
  320. { .mmf
  321. ldfpd sin_coeff_Q5, sin_coeff_P3 = [SIN_AD_PQ_1], 16
  322. ldfd sin_coeff_Q6 = [SIN_AD_PQ_2], 16
  323. fcvt.xf sin_Mfloat = sin_Mx
  324. }
  325. ;;
  326. { .mfb
  327. getf.sig sin_GR_Mint = sin_Mx
  328. nop.f 999
  329. (p13) br.ret.spnt b0
  330. }
  331. ;;
  332. { .mfb
  333. nop.m 999
  334. (p8) fma.s f8 = f1,f1,f0
  335. (p8) br.ret.spnt b0
  336. }
  337. ;;
  338. { .mfi
  339. add sin_GR_index = 32,sin_GR_Mint
  340. nop.f 999
  341. cmp.ge p8,p9 = -33,sin_GR_Mint
  342. }
  343. ;;
  344. { .mfi
  345. (p9) cmp.le p10,p11 = 33, sin_GR_Mint
  346. nop.f 999
  347. shl sin_GR_index = sin_GR_index,4
  348. }
  349. ;;
  350. { .mfb
  351. nop.m 999
  352. fnma.s1 sin_r = f1,sin_Mfloat,f8
  353. (p8) br.cond.spnt SIN_DOUBLE
  354. }
  355. { .mfb
  356. nop.m 999
  357. nop.f 999
  358. (p10) br.cond.spnt SIN_DOUBLE
  359. }
  360. ;;
  361. { .mfi
  362. nop.m 999
  363. nop.f 999
  364. add SIN_AD_PQ_2 = sin_GR_index,SIN_AD_PQ_2
  365. }
  366. ;;
  367. { .mfi
  368. nop.m 999
  369. fma.s1 sin_t = sin_r,sin_r,f0
  370. nop.i 999
  371. }
  372. ;;
  373. .pred.rel "mutex",p6,p7 //SIN_Sin_Flag, SIN_Cos_Flag
  374. { .mmi
  375. //(SIN_Sin_Flag) ldfpd sin_tbl_S,sin_tbl_C = [SIN_AD_PQ_2]
  376. (p6) ldfpd sin_tbl_S,sin_tbl_C = [SIN_AD_PQ_2]
  377. //(SIN_Cos_Flag) ldfpd sin_tbl_C,sin_tbl_S = [SIN_AD_PQ_2]
  378. (p7) ldfpd sin_tbl_C,sin_tbl_S = [SIN_AD_PQ_2]
  379. nop.i 999
  380. }
  381. ;;
  382. { .mfi
  383. nop.m 999
  384. fma.s1 sin_rcube = sin_t,sin_r,f0
  385. nop.i 999
  386. }
  387. { .mfi
  388. nop.m 999
  389. fma.s1 sin_tsq = sin_t,sin_t,f0
  390. nop.i 999
  391. }
  392. ;;
  393. { .mfi
  394. nop.m 999
  395. fma.s1 sin_poly_q3 = sin_t,sin_coeff_Q4,sin_coeff_Q3
  396. nop.i 999
  397. }
  398. { .mfi
  399. nop.m 999
  400. fma.s1 sin_poly_q5 = sin_t,sin_coeff_Q6,sin_coeff_Q5
  401. nop.i 999
  402. }
  403. ;;
  404. { .mfi
  405. nop.m 999
  406. fma.s1 sin_poly_p1 = sin_t,sin_coeff_P5,sin_coeff_P4
  407. nop.i 999
  408. }
  409. { .mfi
  410. nop.m 999
  411. fma.s1 sin_poly_q1 = sin_t,sin_coeff_Q2,sin_coeff_Q1
  412. nop.i 999
  413. }
  414. ;;
  415. { .mfi
  416. nop.m 999
  417. fma.s1 sin_poly_p2 = sin_t,sin_coeff_P2,sin_coeff_P1
  418. nop.i 999
  419. }
  420. ;;
  421. { .mfi
  422. nop.m 999
  423. fma.s1 sin_S_t = sin_t,sin_tbl_S,f0
  424. nop.i 999
  425. }
  426. { .mfi
  427. nop.m 999
  428. fma.s1 sin_r7 = sin_rcube,sin_tsq,f0
  429. nop.i 999
  430. }
  431. ;;
  432. { .mfi
  433. nop.m 999
  434. fma.s1 sin_poly_q3456 = sin_tsq,sin_poly_q5,sin_poly_q3
  435. nop.i 999
  436. }
  437. ;;
  438. { .mfi
  439. nop.m 999
  440. fma.s1 sin_poly_p3 = sin_t,sin_poly_p1,sin_coeff_P3
  441. nop.i 999
  442. }
  443. ;;
  444. { .mfi
  445. nop.m 999
  446. fma.s1 sin_poly_p4 = sin_rcube,sin_poly_p2,sin_r
  447. nop.i 999
  448. }
  449. ;;
  450. { .mfi
  451. nop.m 999
  452. fma.s1 sin_tbl_S_tcube = sin_S_t,sin_tsq,f0
  453. nop.i 999
  454. }
  455. { .mfi
  456. nop.m 999
  457. fma.s1 sin_poly_q12 = sin_S_t,sin_poly_q1,sin_tbl_S
  458. nop.i 999
  459. }
  460. ;;
  461. { .mfi
  462. nop.m 999
  463. fma.d.s1 sin_of_r = sin_r7,sin_poly_p3,sin_poly_p4
  464. nop.i 999
  465. }
  466. ;;
  467. { .mfi
  468. nop.m 999
  469. fma.d.s1 sin_tbl_S_cos_of_r = sin_tbl_S_tcube,sin_poly_q3456,sin_poly_q12
  470. nop.i 999
  471. }
  472. ;;
  473. .pred.rel "mutex",p6,p7 //SIN_Sin_Flag, SIN_Cos_Flag
  474. { .mfi
  475. nop.m 999
  476. //(SIN_Sin_Flag) fma.s f8 = sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
  477. (p6) fma.s f8 = sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
  478. nop.i 999
  479. }
  480. { .mfb
  481. nop.m 999
  482. //(SIN_Cos_Flag) fnma.s f8 = sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
  483. (p7) fnma.s f8 = sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
  484. br.ret.sptk b0
  485. }
  486. .endp sinf
  487. .proc SIN_DOUBLE
  488. SIN_DOUBLE:
  489. .prologue
  490. { .mfi
  491. nop.m 0
  492. nop.f 0
  493. .save ar.pfs,GR_SAVE_PFS
  494. mov GR_SAVE_PFS=ar.pfs
  495. }
  496. ;;
  497. { .mfi
  498. mov GR_SAVE_GP=gp
  499. nop.f 0
  500. .save b0, GR_SAVE_B0
  501. mov GR_SAVE_B0=b0
  502. }
  503. .body
  504. { .mbb
  505. nop.m 999
  506. (p6) br.call.sptk.many b0=sin
  507. (p7) br.call.sptk.many b0=cos
  508. }
  509. ;;
  510. { .mfi
  511. (p0) mov gp = GR_SAVE_GP
  512. nop.f 999
  513. (p0) mov b0 = GR_SAVE_B0
  514. }
  515. ;;
  516. { .mfi
  517. nop.m 999
  518. fma.s f8 = f8,f1,f0
  519. (p0) mov ar.pfs = GR_SAVE_PFS
  520. }
  521. { .mib
  522. nop.m 999
  523. nop.i 999
  524. (p0) br.ret.sptk b0
  525. }
  526. .endp SIN_DOUBLE
  527. .type sin,@function
  528. .global sin
  529. .type cos,@function
  530. .global cos