1.file "acosl.s" 2 3 4// Copyright (c) 2001 - 2003, Intel Corporation 5// All rights reserved. 6// 7// 8// Redistribution and use in source and binary forms, with or without 9// modification, are permitted provided that the following conditions are 10// met: 11// 12// * Redistributions of source code must retain the above copyright 13// notice, this list of conditions and the following disclaimer. 14// 15// * Redistributions in binary form must reproduce the above copyright 16// notice, this list of conditions and the following disclaimer in the 17// documentation and/or other materials provided with the distribution. 18// 19// * The name of Intel Corporation may not be used to endorse or promote 20// products derived from this software without specific prior written 21// permission. 22 23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 27// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 31// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING 32// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34// 35// Intel Corporation is the author of this code, and requests that all 36// problem reports or change requests be submitted to it directly at 37// http://www.intel.com/software/products/opensource/libraries/num.htm. 38// 39// History 40//============================================================== 41// 08/28/01 New version 42// 05/20/02 Cleaned up namespace and sf0 syntax 43// 02/06/03 Reordered header: .section, .global, .proc, .align 44// 45// API 46//============================================================== 47// long double acosl(long double) 48// 49// Overview of operation 50//============================================================== 51// Background 52// 53// Implementation 54// 55// For |s| in [2^{-4}, sqrt(2)/2]: 56// Let t= 2^k*1.b1 b2..b6 1, where s= 2^k*1.b1 b2.. b52 57// acos(s)= pi/2-asin(t)-asin(r), where r= s*sqrt(1-t^2)-t*sqrt(1-s^2), i.e. 58// r= (s-t)*sqrt(1-t^2)-t*sqrt(1-t^2)*(sqrt((1-s^2)/(1-t^2))-1) 59// asin(r)-r evaluated as 9-degree polynomial (c3*r^3+c5*r^5+c7*r^7+c9*r^9) 60// The 64-bit significands of sqrt(1-t^2), 1/(1-t^2) are read from the table, 61// along with the high and low parts of asin(t) (stored as two double precision 62// values) 63// 64// |s| in (sqrt(2)/2, sqrt(255/256)): 65// Let t= 2^k*1.b1 b2..b6 1, where (1-s^2)*frsqrta(1-s^2)= 2^k*1.b1 b2..b6.. 66// acos(|s|)= asin(t)-asin(r) 67// acos(-|s|)=pi-asin(t)+asin(r), r= s*t-sqrt(1-s^2)*sqrt(1-t^2) 68// To minimize accumulated errors, r is computed as 69// r= (t*s)_s-t^2*y*z+z*y*(t^2-1+s^2)_s+z*y*(1-s^2)_s*x+z'*y*(1-s^2)*PS29+ 70// +(t*s-(t*s)_s)+z*y*((t^2-1-(t^2-1+s^2)_s)+s^2)+z*y*(1-s^2-(1-s^2)_s)+ 71// +ez*z'*y*(1-s^2)*(1-x), 72// where y= frsqrta(1-s^2), z= (sqrt(1-t^2))_s (rounded to 24 significant bits) 73// z'= sqrt(1-t^2), x= ((1-s^2)*y^2-1)/2 74// 75// |s|<2^{-4}: evaluate asin(s) as 17-degree polynomial, return pi/2-asin(s) 76// (or simply return pi/2-s, if|s|<2^{-64}) 77// 78// |s| in [sqrt(255/256), 1): acos(|s|)= asin(sqrt(1-s^2)) 79// acos(-|s|)= pi-asin(sqrt(1-s^2)) 80// use 17-degree polynomial for asin(sqrt(1-s^2)), 81// 9-degree polynomial to evaluate sqrt(1-s^2) 82// High order term is (pi)_high-(y*(1-s^2))_high, for s<0, 83// or y*(1-s^2)_s, for s>0 84// 85 86 87 88// Registers used 89//============================================================== 90// f6-f15, f32-f36 91// r2-r3, r23-r23 92// p6, p7, p8, p12 93// 94 95 96 GR_SAVE_B0= r33 97 GR_SAVE_PFS= r34 98 GR_SAVE_GP= r35 // This reg. can safely be used 99 GR_SAVE_SP= r36 100 101 GR_Parameter_X= r37 102 GR_Parameter_Y= r38 103 GR_Parameter_RESULT= r39 104 GR_Parameter_TAG= r40 105 106 FR_X= f10 107 FR_Y= f1 108 FR_RESULT= f8 109 110 111 112RODATA 113 114.align 16 115 116LOCAL_OBJECT_START(T_table) 117 118// stores 64-bit significand of 1/(1-t^2), 64-bit significand of sqrt(1-t^2), 119// asin(t)_high (double precision), asin(t)_low (double precision) 120 121data8 0x80828692b71c4391, 0xff7ddcec2d87e879 122data8 0x3fb022bc0ae531a0, 0x3c9f599c7bb42af6 123data8 0x80869f0163d0b082, 0xff79cad2247914d3 124data8 0x3fb062dd26afc320, 0x3ca4eff21bd49c5c 125data8 0x808ac7d5a8690705, 0xff75a89ed6b626b9 126data8 0x3fb0a2ff4a1821e0, 0x3cb7e33b58f164cc 127data8 0x808f0112ad8ad2e0, 0xff7176517c2cc0cb 128data8 0x3fb0e32279319d80, 0x3caee31546582c43 129data8 0x80934abba8a1da0a, 0xff6d33e949b1ed31 130data8 0x3fb12346b8101da0, 0x3cb8bfe463d087cd 131data8 0x8097a4d3dbe63d8f, 0xff68e16571015c63 132data8 0x3fb1636c0ac824e0, 0x3c8870a7c5a3556f 133data8 0x809c0f5e9662b3dd, 0xff647ec520bca0f0 134data8 0x3fb1a392756ed280, 0x3c964f1a927461ae 135data8 0x80a08a5f33fadc66, 0xff600c07846a6830 136data8 0x3fb1e3b9fc19e580, 0x3c69eb3576d56332 137data8 0x80a515d91d71acd4, 0xff5b892bc475affa 138data8 0x3fb223e2a2dfbe80, 0x3c6a4e19fd972fb6 139data8 0x80a9b1cfc86ff7cd, 0xff56f631062cf93d 140data8 0x3fb2640c6dd76260, 0x3c62041160e0849e 141data8 0x80ae5e46b78b0d68, 0xff5253166bc17794 142data8 0x3fb2a43761187c80, 0x3cac61651af678c0 143data8 0x80b31b417a4b756b, 0xff4d9fdb14463dc8 144data8 0x3fb2e46380bb6160, 0x3cb06ef23eeba7a1 145data8 0x80b7e8c3ad33c369, 0xff48dc7e1baf6738 146data8 0x3fb32490d0d910c0, 0x3caa05f480b300d5 147data8 0x80bcc6d0f9c784d6, 0xff4408fe9ad13e37 148data8 0x3fb364bf558b3820, 0x3cb01e7e403aaab9 149data8 0x80c1b56d1692492d, 0xff3f255ba75f5f4e 150data8 0x3fb3a4ef12ec3540, 0x3cb4fe8fcdf5f5f1 151data8 0x80c6b49bc72ec446, 0xff3a319453ebd961 152data8 0x3fb3e5200d171880, 0x3caf2dc089b2b7e2 153data8 0x80cbc460dc4e0ae8, 0xff352da7afe64ac6 154data8 0x3fb425524827a720, 0x3cb75a855e7c6053 155data8 0x80d0e4c033bee9c4, 0xff301994c79afb32 156data8 0x3fb46585c83a5e00, 0x3cb3264981c019ab 157data8 0x80d615bdb87556db, 0xff2af55aa431f291 158data8 0x3fb4a5ba916c73c0, 0x3c994251d94427b5 159data8 0x80db575d6291fd8a, 0xff25c0f84bae0cb9 160data8 0x3fb4e5f0a7dbdb20, 0x3cbee2fcc4c786cb 161data8 0x80e0a9a33769e535, 0xff207c6cc0ec09fd 162data8 0x3fb526280fa74620, 0x3c940656e5549b91 163data8 0x80e60c93498e32cd, 0xff1b27b703a19c98 164data8 0x3fb56660ccee2740, 0x3ca7082374d7b2cd 165data8 0x80eb8031b8d4052d, 0xff15c2d6105c72f8 166data8 0x3fb5a69ae3d0b520, 0x3c7c4d46e09ac68a 167data8 0x80f10482b25c6c8a, 0xff104dc8e0813ed4 168data8 0x3fb5e6d6586fec20, 0x3c9aa84ffd9b4958 169data8 0x80f6998a709c7cfb, 0xff0ac88e6a4ab926 170data8 0x3fb627132eed9140, 0x3cbced2cbbbe7d16 171data8 0x80fc3f4d3b657c44, 0xff053325a0c8a2ec 172data8 0x3fb667516b6c34c0, 0x3c6489c5fc68595a 173data8 0x8101f5cf67ed2af8, 0xfeff8d8d73dec2bb 174data8 0x3fb6a791120f33a0, 0x3cbe12acf159dfad 175data8 0x8107bd1558d6291f, 0xfef9d7c4d043df29 176data8 0x3fb6e7d226fabba0, 0x3ca386d099cd0dc7 177data8 0x810d95237e38766a, 0xfef411ca9f80b5f7 178data8 0x3fb72814ae53cc20, 0x3cb9f35731e71dd6 179data8 0x81137dfe55aa0e29, 0xfeee3b9dc7eef009 180data8 0x3fb76858ac403a00, 0x3c74df3dd959141a 181data8 0x811977aa6a479f0f, 0xfee8553d2cb8122c 182data8 0x3fb7a89e24e6b0e0, 0x3ca6034406ee42bc 183data8 0x811f822c54bd5ef8, 0xfee25ea7add46a91 184data8 0x3fb7e8e51c6eb6a0, 0x3cb82f8f78e68ed7 185data8 0x81259d88bb4ffac1, 0xfedc57dc2809fb1d 186data8 0x3fb8292d9700ad60, 0x3cbebb73c0e653f9 187data8 0x812bc9c451e5a257, 0xfed640d974eb6068 188data8 0x3fb8697798c5d620, 0x3ca2feee76a9701b 189data8 0x813206e3da0f3124, 0xfed0199e6ad6b585 190data8 0x3fb8a9c325e852e0, 0x3cb9e88f2f4d0efe 191data8 0x813854ec231172f9, 0xfec9e229dcf4747d 192data8 0x3fb8ea1042932a00, 0x3ca5ff40d81f66fd 193data8 0x813eb3e209ee858f, 0xfec39a7a9b36538b 194data8 0x3fb92a5ef2f247c0, 0x3cb5e3bece4d6b07 195data8 0x814523ca796f56ce, 0xfebd428f72561efe 196data8 0x3fb96aaf3b3281a0, 0x3cb7b9e499436d7c 197data8 0x814ba4aa6a2d3ff9, 0xfeb6da672bd48fe4 198data8 0x3fb9ab011f819860, 0x3cb9168143cc1a7f 199data8 0x81523686e29bbdd7, 0xfeb062008df81f50 200data8 0x3fb9eb54a40e3ac0, 0x3cb6e544197eb1e1 201data8 0x8158d964f7124614, 0xfea9d95a5bcbd65a 202data8 0x3fba2ba9cd080800, 0x3ca9a717be8f7446 203data8 0x815f8d49c9d639e4, 0xfea34073551e1ac8 204data8 0x3fba6c009e9f9260, 0x3c741e989a60938a 205data8 0x8166523a8b24f626, 0xfe9c974a367f785c 206data8 0x3fbaac591d0661a0, 0x3cb2c1290107e57d 207data8 0x816d283c793e0114, 0xfe95ddddb94166cb 208data8 0x3fbaecb34c6ef600, 0x3c9c7d5fbaec405d 209data8 0x81740f54e06d55bd, 0xfe8f142c93750c50 210data8 0x3fbb2d0f310cca00, 0x3cbc09479a9cbcfb 211data8 0x817b07891b15cd5e, 0xfe883a3577e9fceb 212data8 0x3fbb6d6ccf1455e0, 0x3cb9450bff4ee307 213data8 0x818210de91bba6c8, 0xfe814ff7162cf62f 214data8 0x3fbbadcc2abb1180, 0x3c9227fda12a8d24 215data8 0x81892b5abb0f2bf9, 0xfe7a55701a8697b1 216data8 0x3fbbee2d48377700, 0x3cb6fad72acfe356 217data8 0x819057031bf7760e, 0xfe734a9f2dfa1810 218data8 0x3fbc2e902bc10600, 0x3cb4465b588d16ad 219data8 0x819793dd479d4fbe, 0xfe6c2f82f643f68b 220data8 0x3fbc6ef4d9904580, 0x3c8b9ac54823960d 221data8 0x819ee1eedf76367a, 0xfe65041a15d8a92c 222data8 0x3fbcaf5b55dec6a0, 0x3ca2b8d28a954db2 223data8 0x81a6413d934f7a66, 0xfe5dc8632be3477f 224data8 0x3fbcefc3a4e727a0, 0x3c9380da83713ab4 225data8 0x81adb1cf21597d4b, 0xfe567c5cd44431d5 226data8 0x3fbd302dcae51600, 0x3ca995b83421756a 227data8 0x81b533a9563310b8, 0xfe4f2005a78fb50f 228data8 0x3fbd7099cc155180, 0x3caefa2f7a817d5f 229data8 0x81bcc6d20cf4f373, 0xfe47b35c3b0caaeb 230data8 0x3fbdb107acb5ae80, 0x3cb455fc372dd026 231data8 0x81c46b4f2f3d6e68, 0xfe40365f20b316d6 232data8 0x3fbdf177710518c0, 0x3cbee3dcc5b01434 233data8 0x81cc2126b53c1144, 0xfe38a90ce72abf36 234data8 0x3fbe31e91d439620, 0x3cb3e131c950aebd 235data8 0x81d3e85ea5bd8ee2, 0xfe310b6419c9c33a 236data8 0x3fbe725cb5b24900, 0x3c01d3fac6029027 237data8 0x81dbc0fd1637b9c1, 0xfe295d6340932d15 238data8 0x3fbeb2d23e937300, 0x3c6304cc44aeedd1 239data8 0x81e3ab082ad5a0a4, 0xfe219f08e03580b3 240data8 0x3fbef349bc2a77e0, 0x3cac1d2d6abe9c72 241data8 0x81eba6861683cb97, 0xfe19d0537a0946e2 242data8 0x3fbf33c332bbe020, 0x3ca0909dba4e96ca 243data8 0x81f3b37d1afc9979, 0xfe11f1418c0f94e2 244data8 0x3fbf743ea68d5b60, 0x3c937fc12a2a779a 245data8 0x81fbd1f388d4be45, 0xfe0a01d190f09063 246data8 0x3fbfb4bc1be5c340, 0x3cbf51a504b55813 247data8 0x820401efbf87e248, 0xfe020201fff9efea 248data8 0x3fbff53b970d1e80, 0x3ca625444b260078 249data8 0x82106ad2ffdca049, 0xfdf5e3940a49135e 250data8 0x3fc02aff52065460, 0x3c9125d113e22a57 251data8 0x8221343d6ea1d3e2, 0xfde581a45429b0a0 252data8 0x3fc06b84f8e03220, 0x3caccf362295894b 253data8 0x82324434adbf99c2, 0xfdd4de1a001fb775 254data8 0x3fc0ac0ed1fe7240, 0x3cc22f676096b0af 255data8 0x82439aee8d0c7747, 0xfdc3f8e8269d1f03 256data8 0x3fc0ec9cee9e4820, 0x3cca147e2886a628 257data8 0x825538a1d0fcb2f0, 0xfdb2d201a9b1ba66 258data8 0x3fc12d2f6006f0a0, 0x3cc72b36633bc2d4 259data8 0x82671d86345c5cee, 0xfda1695934d723e7 260data8 0x3fc16dc63789de60, 0x3cb11f9c47c7b83f 261data8 0x827949d46a121770, 0xfd8fbee13cbbb823 262data8 0x3fc1ae618682e620, 0x3cce1b59020cef8e 263data8 0x828bbdc61eeab9ba, 0xfd7dd28bff0c9f34 264data8 0x3fc1ef015e586c40, 0x3cafec043e0225ee 265data8 0x829e7995fb6de9e1, 0xfd6ba44b823ee1ca 266data8 0x3fc22fa5d07b90c0, 0x3cba905409caf8e3 267data8 0x82b17d7fa5bbc982, 0xfd5934119557883a 268data8 0x3fc2704eee685da0, 0x3cb5ef21838a823e 269data8 0x82c4c9bfc373d276, 0xfd4681cfcfb2c161 270data8 0x3fc2b0fcc9a5f3e0, 0x3ccc7952c5e0e312 271data8 0x82d85e93fba50136, 0xfd338d7790ca0f41 272data8 0x3fc2f1af73c6ba00, 0x3cbecf5f977d1ca9 273data8 0x82ec3c3af8c76b32, 0xfd2056f9fff97727 274data8 0x3fc33266fe6889a0, 0x3c9d329c022ebdb5 275data8 0x830062f46abf6022, 0xfd0cde480c43b327 276data8 0x3fc373237b34de60, 0x3cc95806d4928adb 277data8 0x8314d30108ea35f0, 0xfcf923526c1562b2 278data8 0x3fc3b3e4fbe10520, 0x3cbc299fe7223d54 279data8 0x83298ca29434df97, 0xfce526099d0737ed 280data8 0x3fc3f4ab922e4a60, 0x3cb59d8bb8fdbccc 281data8 0x833e901bd93c7009, 0xfcd0e65de39f1f7c 282data8 0x3fc435774fea2a60, 0x3c9ec18b43340914 283data8 0x8353ddb0b278aad8, 0xfcbc643f4b106055 284data8 0x3fc4764846ee80a0, 0x3cb90402efd87ed6 285data8 0x836975a60a70c52e, 0xfca79f9da4fab13a 286data8 0x3fc4b71e8921b860, 0xbc58f23449ed6365 287data8 0x837f5841ddfa7a46, 0xfc92986889284148 288data8 0x3fc4f7fa2876fca0, 0xbc6294812bf43acd 289data8 0x839585cb3e839773, 0xfc7d4e8f554ab12f 290data8 0x3fc538db36ee6960, 0x3cb910b773d4c578 291data8 0x83abfe8a5466246f, 0xfc67c2012cb6fa68 292data8 0x3fc579c1c6953cc0, 0x3cc5ede909fc47fc 293data8 0x83c2c2c861474d91, 0xfc51f2acf82041d5 294data8 0x3fc5baade9860880, 0x3cac63cdfc3588e5 295data8 0x83d9d2cfc2813637, 0xfc3be08165519325 296data8 0x3fc5fb9fb1e8e3a0, 0x3cbf7c8466578c29 297data8 0x83f12eebf397daac, 0xfc258b6ce6e6822f 298data8 0x3fc63c9731f39d40, 0x3cb6d2a7ffca3e9e 299data8 0x8408d76990b9296e, 0xfc0ef35db402af94 300data8 0x3fc67d947be9eec0, 0x3cb1980da09e6566 301data8 0x8420cc9659487cd7, 0xfbf81841c8082dc4 302data8 0x3fc6be97a21daf00, 0x3cc2ac8330e59aa5 303data8 0x84390ec132759ecb, 0xfbe0fa06e24cc390 304data8 0x3fc6ffa0b6ef05e0, 0x3ccc1a030fee56c4 305data8 0x84519e3a29df811a, 0xfbc9989a85ce0954 306data8 0x3fc740afcccca000, 0x3cc19692a5301ca6 307data8 0x846a7b527842d61b, 0xfbb1f3e9f8e45dc4 308data8 0x3fc781c4f633e2c0, 0x3cc0e98f3868a508 309data8 0x8483a65c8434b5f0, 0xfb9a0be244f4af45 310data8 0x3fc7c2e045b12140, 0x3cb2a8d309754420 311data8 0x849d1fabe4e97dd7, 0xfb81e070362116d1 312data8 0x3fc80401cddfd120, 0x3ca7a44544aa4ce6 313data8 0x84b6e795650817ea, 0xfb6971805af8411e 314data8 0x3fc84529a16ac020, 0x3c9e3b709c7d6f94 315data8 0x84d0fe6f0589da92, 0xfb50beff0423a2f5 316data8 0x3fc88657d30c49e0, 0x3cc60d65a7f0a278 317data8 0x84eb649000a73014, 0xfb37c8d84414755c 318data8 0x3fc8c78c758e8e80, 0x3cc94b2ee984c2b7 319data8 0x85061a50ccd13781, 0xfb1e8ef7eeaf764b 320data8 0x3fc908c79bcba900, 0x3cc8540ae794a2fe 321data8 0x8521200b1fb8916e, 0xfb05114998f76a83 322data8 0x3fc94a0958ade6c0, 0x3ca127f49839fa9c 323data8 0x853c7619f1618bf6, 0xfaeb4fb898b65d19 324data8 0x3fc98b51bf2ffee0, 0x3c8c9ba7a803909a 325data8 0x85581cd97f45e274, 0xfad14a3004259931 326data8 0x3fc9cca0e25d4ac0, 0x3cba458e91d3bf54 327data8 0x857414a74f8446b4, 0xfab7009ab1945a54 328data8 0x3fca0df6d551fe80, 0x3cc78ea1d329d2b2 329data8 0x85905de2341dea46, 0xfa9c72e3370d2fbc 330data8 0x3fca4f53ab3b6200, 0x3ccf60dca86d57ef 331data8 0x85acf8ea4e423ff8, 0xfa81a0f3e9fa0ee9 332data8 0x3fca90b777580aa0, 0x3ca4c4e2ec8a867e 333data8 0x85c9e62111a92e7d, 0xfa668ab6dec711b1 334data8 0x3fcad2224cf814e0, 0x3c303de5980d071c 335data8 0x85e725e947fbee97, 0xfa4b3015e883dbfe 336data8 0x3fcb13943f7d5f80, 0x3cc29d4eefa5cb1e 337data8 0x8604b8a7144cd054, 0xfa2f90fa9883a543 338data8 0x3fcb550d625bc6a0, 0x3c9e01a746152daf 339data8 0x86229ebff69e2415, 0xfa13ad4e3dfbe1c1 340data8 0x3fcb968dc9195ea0, 0x3ccc091bd73ae518 341data8 0x8640d89acf78858c, 0xf9f784f9e5a1877b 342data8 0x3fcbd815874eb160, 0x3cb5f4b89875e187 343data8 0x865f669fe390c7f5, 0xf9db17e65944eacf 344data8 0x3fcc19a4b0a6f9c0, 0x3cc5c0bc2b0bbf14 345data8 0x867e4938df7dc45f, 0xf9be65fc1f6c2e6e 346data8 0x3fcc5b3b58e061e0, 0x3cc1ca70df8f57e7 347data8 0x869d80d0db7e4c0c, 0xf9a16f237aec427a 348data8 0x3fcc9cd993cc4040, 0x3cbae93acc85eccf 349data8 0x86bd0dd45f4f8265, 0xf98433446a806e70 350data8 0x3fccde7f754f5660, 0x3cb22f70e64568d0 351data8 0x86dcf0b16613e37a, 0xf966b246a8606170 352data8 0x3fcd202d11620fa0, 0x3c962030e5d4c849 353data8 0x86fd29d7624b3d5d, 0xf948ec11a9d4c45b 354data8 0x3fcd61e27c10c0a0, 0x3cc7083c91d59217 355data8 0x871db9b741dbe44a, 0xf92ae08c9eca4941 356data8 0x3fcda39fc97be7c0, 0x3cc9258579e57211 357data8 0x873ea0c3722d6af2, 0xf90c8f9e71633363 358data8 0x3fcde5650dd86d60, 0x3ca4755a9ea582a9 359data8 0x875fdf6fe45529e8, 0xf8edf92dc5875319 360data8 0x3fce27325d6fe520, 0x3cbc1e2b6c1954f9 361data8 0x878176321154e2bc, 0xf8cf1d20f87270b8 362data8 0x3fce6907cca0d060, 0x3cb6ca4804750830 363data8 0x87a36580fe6bccf5, 0xf8affb5e20412199 364data8 0x3fceaae56fdee040, 0x3cad6b310d6fd46c 365data8 0x87c5add5417a5cb9, 0xf89093cb0b7c0233 366data8 0x3fceeccb5bb33900, 0x3cc16e99cedadb20 367data8 0x87e84fa9057914ca, 0xf870e64d40a15036 368data8 0x3fcf2eb9a4bcb600, 0x3cc75ee47c8b09e9 369data8 0x880b4b780f02b709, 0xf850f2c9fdacdf78 370data8 0x3fcf70b05fb02e20, 0x3cad6350d379f41a 371data8 0x882ea1bfc0f228ac, 0xf830b926379e6465 372data8 0x3fcfb2afa158b8a0, 0x3cce0ccd9f829985 373data8 0x885252ff21146108, 0xf810394699fe0e8e 374data8 0x3fcff4b77e97f3e0, 0x3c9b30faa7a4c703 375data8 0x88765fb6dceebbb3, 0xf7ef730f865f6df0 376data8 0x3fd01b6406332540, 0x3cdc5772c9e0b9bd 377data8 0x88ad1f69be2cc730, 0xf7bdc59bc9cfbd97 378data8 0x3fd04cf8ad203480, 0x3caeef44fe21a74a 379data8 0x88f763f70ae2245e, 0xf77a91c868a9c54e 380data8 0x3fd08f23ce0162a0, 0x3cd6290ab3fe5889 381data8 0x89431fc7bc0c2910, 0xf73642973c91298e 382data8 0x3fd0d1610f0c1ec0, 0x3cc67401a01f08cf 383data8 0x8990573407c7738e, 0xf6f0d71d1d7a2dd6 384data8 0x3fd113b0c65d88c0, 0x3cc7aa4020fe546f 385data8 0x89df0eb108594653, 0xf6aa4e6a05cfdef2 386data8 0x3fd156134ada6fe0, 0x3cc87369da09600c 387data8 0x8a2f4ad16e0ed78a, 0xf662a78900c35249 388data8 0x3fd19888f43427a0, 0x3cc62b220f38e49c 389data8 0x8a811046373e0819, 0xf619e180181d97cc 390data8 0x3fd1db121aed7720, 0x3ca3ede7490b52f4 391data8 0x8ad463df6ea0fa2c, 0xf5cffb504190f9a2 392data8 0x3fd21daf185fa360, 0x3caafad98c1d6c1b 393data8 0x8b294a8cf0488daf, 0xf584f3f54b8604e6 394data8 0x3fd2606046bf95a0, 0x3cdb2d704eeb08fa 395data8 0x8b7fc95f35647757, 0xf538ca65c960b582 396data8 0x3fd2a32601231ec0, 0x3cc661619fa2f126 397data8 0x8bd7e588272276f8, 0xf4eb7d92ff39fccb 398data8 0x3fd2e600a3865760, 0x3c8a2a36a99aca4a 399data8 0x8c31a45bf8e9255e, 0xf49d0c68cd09b689 400data8 0x3fd328f08ad12000, 0x3cb9efaf1d7ab552 401data8 0x8c8d0b520a35eb18, 0xf44d75cd993cfad2 402data8 0x3fd36bf614dcc040, 0x3ccacbb590bef70d 403data8 0x8cea2005d068f23d, 0xf3fcb8a23ab4942b 404data8 0x3fd3af11a079a6c0, 0x3cd9775872cf037d 405data8 0x8d48e837c8cd5027, 0xf3aad3c1e2273908 406data8 0x3fd3f2438d754b40, 0x3ca03304f667109a 407data8 0x8da969ce732f3ac7, 0xf357c60202e2fd7e 408data8 0x3fd4358c3ca032e0, 0x3caecf2504ff1a9d 409data8 0x8e0baad75555e361, 0xf3038e323ae9463a 410data8 0x3fd478ec0fd419c0, 0x3cc64bdc3d703971 411data8 0x8e6fb18807ba877e, 0xf2ae2b1c3a6057f7 412data8 0x3fd4bc6369fa40e0, 0x3cbb7122ec245cf2 413data8 0x8ed5843f4bda74d5, 0xf2579b83aa556f0c 414data8 0x3fd4fff2af11e2c0, 0x3c9cfa2dc792d394 415data8 0x8f3d29862c861fef, 0xf1ffde2612ca1909 416data8 0x3fd5439a4436d000, 0x3cc38d46d310526b 417data8 0x8fa6a81128940b2d, 0xf1a6f1bac0075669 418data8 0x3fd5875a8fa83520, 0x3cd8bf59b8153f8a 419data8 0x901206c1686317a6, 0xf14cd4f2a730d480 420data8 0x3fd5cb33f8cf8ac0, 0x3c9502b5c4d0e431 421data8 0x907f4ca5fe9cf739, 0xf0f186784a125726 422data8 0x3fd60f26e847b120, 0x3cc8a1a5e0acaa33 423data8 0x90ee80fd34aeda5e, 0xf09504ef9a212f18 424data8 0x3fd65333c7e43aa0, 0x3cae5b029cb1f26e 425data8 0x915fab35e37421c6, 0xf0374ef5daab5c45 426data8 0x3fd6975b02b8e360, 0x3cd5aa1c280c45e6 427data8 0x91d2d2f0d894d73c, 0xefd86321822dbb51 428data8 0x3fd6db9d05213b20, 0x3cbecf2c093ccd8b 429data8 0x9248000249200009, 0xef7840021aca5a72 430data8 0x3fd71ffa3cc87fc0, 0x3cb8d273f08d00d9 431data8 0x92bf3a7351f081d2, 0xef16e42021d7cbd5 432data8 0x3fd7647318b1ad20, 0x3cbce099d79cdc46 433data8 0x93388a8386725713, 0xeeb44dfce6820283 434data8 0x3fd7a908093fc1e0, 0x3ccb033ec17a30d9 435data8 0x93b3f8aa8e653812, 0xee507c126774fa45 436data8 0x3fd7edb9803e3c20, 0x3cc10aedb48671eb 437data8 0x94318d99d341ade4, 0xedeb6cd32f891afb 438data8 0x3fd83287f0e9cf80, 0x3c994c0c1505cd2a 439data8 0x94b1523e3dedc630, 0xed851eaa3168f43c 440data8 0x3fd87773cff956e0, 0x3cda3b7bce6a6b16 441data8 0x95334fc20577563f, 0xed1d8ffaa2279669 442data8 0x3fd8bc7d93a70440, 0x3cd4922edc792ce2 443data8 0x95b78f8e8f92f274, 0xecb4bf1fd2be72da 444data8 0x3fd901a5b3b9cf40, 0x3cd3fea1b00f9d0d 445data8 0x963e1b4e63a87c3f, 0xec4aaa6d08694cc1 446data8 0x3fd946eca98f2700, 0x3cdba4032d968ff1 447data8 0x96c6fcef314074fc, 0xebdf502d53d65fea 448data8 0x3fd98c52f024e800, 0x3cbe7be1ab8c95c9 449data8 0x97523ea3eab028b2, 0xeb72aea36720793e 450data8 0x3fd9d1d904239860, 0x3cd72d08a6a22b70 451data8 0x97dfeae6f4ee4a9a, 0xeb04c4096a884e94 452data8 0x3fda177f63e8ef00, 0x3cd818c3c1ebfac7 453data8 0x98700c7c6d85d119, 0xea958e90cfe1efd7 454data8 0x3fda5d468f92a540, 0x3cdf45fbfaa080fe 455data8 0x9902ae7487a9caa1, 0xea250c6224aab21a 456data8 0x3fdaa32f090998e0, 0x3cd715a9353cede4 457data8 0x9997dc2e017a9550, 0xe9b33b9ce2bb7638 458data8 0x3fdae939540d3f00, 0x3cc545c014943439 459data8 0x9a2fa158b29b649b, 0xe9401a573f8aa706 460data8 0x3fdb2f65f63f6c60, 0x3cd4a63c2f2ca8e2 461data8 0x9aca09f835466186, 0xe8cba69df9f0bf35 462data8 0x3fdb75b5773075e0, 0x3cda310ce1b217ec 463data8 0x9b672266ab1e0136, 0xe855de74266193d4 464data8 0x3fdbbc28606babc0, 0x3cdc84b75cca6c44 465data8 0x9c06f7579f0b7bd5, 0xe7debfd2f98c060b 466data8 0x3fdc02bf3d843420, 0x3cd225d967ffb922 467data8 0x9ca995db058cabdc, 0xe76648a991511c6e 468data8 0x3fdc497a9c224780, 0x3cde08101c5b825b 469data8 0x9d4f0b605ce71e88, 0xe6ec76dcbc02d9a7 470data8 0x3fdc905b0c10d420, 0x3cb1abbaa3edf120 471data8 0x9df765b9eecad5e6, 0xe6714846bdda7318 472data8 0x3fdcd7611f4b8a00, 0x3cbf6217ae80aadf 473data8 0x9ea2b320350540fe, 0xe5f4bab71494cd6b 474data8 0x3fdd1e8d6a0d56c0, 0x3cb726e048cc235c 475data8 0x9f51023562fc5676, 0xe576cbf239235ecb 476data8 0x3fdd65e082df5260, 0x3cd9e66872bd5250 477data8 0xa002620915c2a2f6, 0xe4f779b15f5ec5a7 478data8 0x3fddad5b02a82420, 0x3c89743b0b57534b 479data8 0xa0b6e21c2caf9992, 0xe476c1a233a7873e 480data8 0x3fddf4fd84bbe160, 0x3cbf7adea9ee3338 481data8 0xa16e9264cc83a6b2, 0xe3f4a16696608191 482data8 0x3fde3cc8a6ec6ee0, 0x3cce46f5a51f49c6 483data8 0xa22983528f3d8d49, 0xe3711694552da8a8 484data8 0x3fde84bd099a6600, 0x3cdc78f6490a2d31 485data8 0xa2e7c5d2e2e69460, 0xe2ec1eb4e1e0a5fb 486data8 0x3fdeccdb4fc685c0, 0x3cdd3aedb56a4825 487data8 0xa3a96b5599bd2532, 0xe265b74506fbe1c9 488data8 0x3fdf15241f23b3e0, 0x3cd440f3c6d65f65 489data8 0xa46e85d1ae49d7de, 0xe1ddddb499b3606f 490data8 0x3fdf5d98202994a0, 0x3cd6c44bd3fb745a 491data8 0xa53727ca3e11b99e, 0xe1548f662951b00d 492data8 0x3fdfa637fe27bf60, 0x3ca8ad1cd33054dd 493data8 0xa6036453bdc20186, 0xe0c9c9aeabe5e481 494data8 0x3fdfef0467599580, 0x3cc0f1ac0685d78a 495data8 0xa6d34f1969dda338, 0xe03d89d5281e4f81 496data8 0x3fe01bff067d6220, 0x3cc0731e8a9ef057 497data8 0xa7a6fc62f7246ff3, 0xdfafcd125c323f54 498data8 0x3fe04092d1ae3b40, 0x3ccabda24b59906d 499data8 0xa87e811a861df9b9, 0xdf20909061bb9760 500data8 0x3fe0653df0fd9fc0, 0x3ce94c8dcc722278 501data8 0xa959f2d2dd687200, 0xde8fd16a4e5f88bd 502data8 0x3fe08a00c1cae320, 0x3ce6b888bb60a274 503data8 0xaa3967cdeea58bda, 0xddfd8cabd1240d22 504data8 0x3fe0aedba3221c00, 0x3ced5941cd486e46 505data8 0xab904fd587263c84, 0xdd1f4472e1cf64ed 506data8 0x3fe0e651e85229c0, 0x3cdb6701042299b1 507data8 0xad686d44dd5a74bb, 0xdbf173e1f6b46e92 508data8 0x3fe1309cbf4cdb20, 0x3cbf1be7bb3f0ec5 509data8 0xaf524e15640ebee4, 0xdabd54896f1029f6 510data8 0x3fe17b4ee1641300, 0x3ce81dd055b792f1 511data8 0xb14eca24ef7db3fa, 0xd982cb9ae2f47e41 512data8 0x3fe1c66b9ffd6660, 0x3cd98ea31eb5ddc7 513data8 0xb35ec807669920ce, 0xd841bd1b8291d0b6 514data8 0x3fe211f66db3a5a0, 0x3ca480c35a27b4a2 515data8 0xb5833e4755e04dd1, 0xd6fa0bd3150b6930 516data8 0x3fe25df2e05b6c40, 0x3ca4bc324287a351 517data8 0xb7bd34c8000b7bd3, 0xd5ab9939a7d23aa1 518data8 0x3fe2aa64b32f7780, 0x3cba67314933077c 519data8 0xba0dc64d126cc135, 0xd4564563ce924481 520data8 0x3fe2f74fc9289ac0, 0x3cec1a1dc0efc5ec 521data8 0xbc76222cbbfa74a6, 0xd2f9eeed501125a8 522data8 0x3fe344b82f859ac0, 0x3ceeef218de413ac 523data8 0xbef78e31985291a9, 0xd19672e2182f78be 524data8 0x3fe392a22087b7e0, 0x3cd2619ba201204c 525data8 0xc19368b2b0629572, 0xd02baca5427e436a 526data8 0x3fe3e11206694520, 0x3cb5d0b3143fe689 527data8 0xc44b2ae8c6733e51, 0xceb975d60b6eae5d 528data8 0x3fe4300c7e945020, 0x3cbd367143da6582 529data8 0xc7206b894212dfef, 0xcd3fa6326ff0ac9a 530data8 0x3fe47f965d201d60, 0x3ce797c7a4ec1d63 531data8 0xca14e1b0622de526, 0xcbbe13773c3c5338 532data8 0x3fe4cfb4b09d1a20, 0x3cedfadb5347143c 533data8 0xcd2a6825eae65f82, 0xca34913d425a5ae9 534data8 0x3fe5206cc637e000, 0x3ce2798b38e54193 535data8 0xd06301095e1351ee, 0xc8a2f0d3679c08c0 536data8 0x3fe571c42e3d0be0, 0x3ccd7cb9c6c2ca68 537data8 0xd3c0d9f50057adda, 0xc70901152d59d16b 538data8 0x3fe5c3c0c108f940, 0x3ceb6c13563180ab 539data8 0xd74650a98cc14789, 0xc5668e3d4cbf8828 540data8 0x3fe61668a46ffa80, 0x3caa9092e9e3c0e5 541data8 0xdaf5f8579dcc8f8f, 0xc3bb61b3eed42d02 542data8 0x3fe669c251ad69e0, 0x3cccf896ef3b4fee 543data8 0xded29f9f9a6171b4, 0xc20741d7f8e8e8af 544data8 0x3fe6bdd49bea05c0, 0x3cdc6b29937c575d 545data8 0xe2df5765854ccdb0, 0xc049f1c2d1b8014b 546data8 0x3fe712a6b76c6e80, 0x3ce1ddc6f2922321 547data8 0xe71f7a9b94fcb4c3, 0xbe833105ec291e91 548data8 0x3fe76840418978a0, 0x3ccda46e85432c3d 549data8 0xeb96b72d3374b91e, 0xbcb2bb61493b28b3 550data8 0x3fe7bea9496d5a40, 0x3ce37b42ec6e17d3 551data8 0xf049183c3f53c39b, 0xbad848720223d3a8 552data8 0x3fe815ea59dab0a0, 0x3cb03ad41bfc415b 553data8 0xf53b11ec7f415f15, 0xb8f38b57c53c9c48 554data8 0x3fe86e0c84010760, 0x3cc03bfcfb17fe1f 555data8 0xfa718f05adbf2c33, 0xb70432500286b185 556data8 0x3fe8c7196b9225c0, 0x3ced99fcc6866ba9 557data8 0xfff200c3f5489608, 0xb509e6454dca33cc 558data8 0x3fe9211b54441080, 0x3cb789cb53515688 559// The following table entries are not used 560//data8 0x82e138a0fac48700, 0xb3044a513a8e6132 561//data8 0x3fe97c1d30f5b7c0, 0x3ce1eb765612d1d0 562//data8 0x85f4cc7fc670d021, 0xb0f2fb2ea6cbbc88 563//data8 0x3fe9d82ab4b5fde0, 0x3ced3fe6f27e8039 564//data8 0x89377c1387d5b908, 0xaed58e9a09014d5c 565//data8 0x3fea355065f87fa0, 0x3cbef481d25f5b58 566//data8 0x8cad7a2c98dec333, 0xacab929ce114d451 567//data8 0x3fea939bb451e2a0, 0x3c8e92b4fbf4560f 568//data8 0x905b7dfc99583025, 0xaa748cc0dbbbc0ec 569//data8 0x3feaf31b11270220, 0x3cdced8c61bd7bd5 570//data8 0x9446d8191f80dd42, 0xa82ff92687235baf 571//data8 0x3feb53de0bcffc20, 0x3cbe1722fb47509e 572//data8 0x98758ba086e4000a, 0xa5dd497a9c184f58 573//data8 0x3febb5f571cb0560, 0x3ce0c7774329a613 574//data8 0x9cee6c7bf18e4e24, 0xa37be3c3cd1de51b 575//data8 0x3fec197373bc7be0, 0x3ce08ebdb55c3177 576//data8 0xa1b944000a1b9440, 0xa10b2101b4f27e03 577//data8 0x3fec7e6bd023da60, 0x3ce5fc5fd4995959 578//data8 0xa6defd8ba04d3e38, 0x9e8a4b93cad088ec 579//data8 0x3fece4f404e29b20, 0x3cea3413401132b5 580//data8 0xac69dd408a10c62d, 0x9bf89d5d17ddae8c 581//data8 0x3fed4d2388f63600, 0x3cd5a7fb0d1d4276 582//data8 0xb265c39cbd80f97a, 0x99553d969fec7beb 583//data8 0x3fedb714101e0a00, 0x3cdbda21f01193f2 584//data8 0xb8e081a16ae4ae73, 0x969f3e3ed2a0516c 585//data8 0x3fee22e1da97bb00, 0x3ce7231177f85f71 586//data8 0xbfea427678945732, 0x93d5990f9ee787af 587//data8 0x3fee90ac13b18220, 0x3ce3c8a5453363a5 588//data8 0xc79611399b8c90c5, 0x90f72bde80febc31 589//data8 0x3fef009542b712e0, 0x3ce218fd79e8cb56 590//data8 0xcffa8425040624d7, 0x8e02b4418574ebed 591//data8 0x3fef72c3d2c57520, 0x3cd32a717f82203f 592//data8 0xd93299cddcf9cf23, 0x8af6ca48e9c44024 593//data8 0x3fefe762b77744c0, 0x3ce53478a6bbcf94 594//data8 0xe35eda760af69ad9, 0x87d1da0d7f45678b 595//data8 0x3ff02f511b223c00, 0x3ced6e11782c28fc 596//data8 0xeea6d733421da0a6, 0x84921bbe64ae029a 597//data8 0x3ff06c5c6f8ce9c0, 0x3ce71fc71c1ffc02 598//data8 0xfb3b2c73fc6195cc, 0x813589ba3a5651b6 599//data8 0x3ff0aaf2613700a0, 0x3cf2a72d2fd94ef3 600//data8 0x84ac1fcec4203245, 0xfb73a828893df19e 601//data8 0x3ff0eb367c3fd600, 0x3cf8054c158610de 602//data8 0x8ca50621110c60e6, 0xf438a14c158d867c 603//data8 0x3ff12d51caa6b580, 0x3ce6bce9748739b6 604//data8 0x95b8c2062d6f8161, 0xecb3ccdd37b369da 605//data8 0x3ff1717418520340, 0x3ca5c2732533177c 606//data8 0xa0262917caab4ad1, 0xe4dde4ddc81fd119 607//data8 0x3ff1b7d59dd40ba0, 0x3cc4c7c98e870ff5 608//data8 0xac402c688b72f3f4, 0xdcae469be46d4c8d 609//data8 0x3ff200b93cc5a540, 0x3c8dd6dc1bfe865a 610//data8 0xba76968b9eabd9ab, 0xd41a8f3df1115f7f 611//data8 0x3ff24c6f8f6affa0, 0x3cf1acb6d2a7eff7 612//data8 0xcb63c87c23a71dc5, 0xcb161074c17f54ec 613//data8 0x3ff29b5b338b7c80, 0x3ce9b5845f6ec746 614//data8 0xdfe323b8653af367, 0xc19107d99ab27e42 615//data8 0x3ff2edf6fac7f5a0, 0x3cf77f961925fa02 616//data8 0xf93746caaba3e1f1, 0xb777744a9df03bff 617//data8 0x3ff344df237486c0, 0x3cf6ddf5f6ddda43 618//data8 0x8ca77052f6c340f0, 0xacaf476f13806648 619//data8 0x3ff3a0dfa4bb4ae0, 0x3cfee01bbd761bff 620//data8 0xa1a48604a81d5c62, 0xa11575d30c0aae50 621//data8 0x3ff4030b73c55360, 0x3cf1cf0e0324d37c 622//data8 0xbe45074b05579024, 0x9478e362a07dd287 623//data8 0x3ff46ce4c738c4e0, 0x3ce3179555367d12 624//data8 0xe7a08b5693d214ec, 0x8690e3575b8a7c3b 625//data8 0x3ff4e0a887c40a80, 0x3cfbd5d46bfefe69 626//data8 0x94503d69396d91c7, 0xedd2ce885ff04028 627//data8 0x3ff561ebd9c18cc0, 0x3cf331bd176b233b 628//data8 0xced1d96c5bb209e6, 0xc965278083808702 629//data8 0x3ff5f71d7ff42c80, 0x3ce3301cc0b5a48c 630//data8 0xabac2cee0fc24e20, 0x9c4eb1136094cbbd 631//data8 0x3ff6ae4c63222720, 0x3cf5ff46874ee51e 632//data8 0x8040201008040201, 0xb4d7ac4d9acb1bf4 633//data8 0x3ff7b7d33b928c40, 0x3cfacdee584023bb 634LOCAL_OBJECT_END(T_table) 635 636 637 638.align 16 639 640LOCAL_OBJECT_START(poly_coeffs) 641 // C_3 642data8 0xaaaaaaaaaaaaaaab, 0x0000000000003ffc 643 // C_5 644data8 0x999999999999999a, 0x0000000000003ffb 645 // C_7, C_9 646data8 0x3fa6db6db6db6db7, 0x3f9f1c71c71c71c8 647 // pi/2 (low, high) 648data8 0x3C91A62633145C07, 0x3FF921FB54442D18 649 // C_11, C_13 650data8 0x3f96e8ba2e8ba2e9, 0x3f91c4ec4ec4ec4e 651 // C_15, C_17 652data8 0x3f8c99999999999a, 0x3f87a87878787223 653 // pi (low, high) 654data8 0x3CA1A62633145C07, 0x400921FB54442D18 655LOCAL_OBJECT_END(poly_coeffs) 656 657 658R_DBL_S = r21 659R_EXP0 = r22 660R_EXP = r15 661R_SGNMASK = r23 662R_TMP = r24 663R_TMP2 = r25 664R_INDEX = r26 665R_TMP3 = r27 666R_TMP03 = r27 667R_TMP4 = r28 668R_TMP5 = r23 669R_TMP6 = r22 670R_TMP7 = r21 671R_T = r29 672R_BIAS = r20 673 674F_T = f6 675F_1S2 = f7 676F_1S2_S = f9 677F_INV_1T2 = f10 678F_SQRT_1T2 = f11 679F_S2T2 = f12 680F_X = f13 681F_D = f14 682F_2M64 = f15 683 684F_CS2 = f32 685F_CS3 = f33 686F_CS4 = f34 687F_CS5 = f35 688F_CS6 = f36 689F_CS7 = f37 690F_CS8 = f38 691F_CS9 = f39 692F_S23 = f40 693F_S45 = f41 694F_S67 = f42 695F_S89 = f43 696F_S25 = f44 697F_S69 = f45 698F_S29 = f46 699F_X2 = f47 700F_X4 = f48 701F_TSQRT = f49 702F_DTX = f50 703F_R = f51 704F_R2 = f52 705F_R3 = f53 706F_R4 = f54 707 708F_C3 = f55 709F_C5 = f56 710F_C7 = f57 711F_C9 = f58 712F_P79 = f59 713F_P35 = f60 714F_P39 = f61 715 716F_ATHI = f62 717F_ATLO = f63 718 719F_T1 = f64 720F_Y = f65 721F_Y2 = f66 722F_ANDMASK = f67 723F_ORMASK = f68 724F_S = f69 725F_05 = f70 726F_SQRT_1S2 = f71 727F_DS = f72 728F_Z = f73 729F_1T2 = f74 730F_DZ = f75 731F_ZE = f76 732F_YZ = f77 733F_Y1S2 = f78 734F_Y1S2X = f79 735F_1X = f80 736F_ST = f81 737F_1T2_ST = f82 738F_TSS = f83 739F_Y1S2X2 = f84 740F_DZ_TERM = f85 741F_DTS = f86 742F_DS2X = f87 743F_T2 = f88 744F_ZY1S2S = f89 745F_Y1S2_1X = f90 746F_TS = f91 747F_PI2_LO = f92 748F_PI2_HI = f93 749F_S19 = f94 750F_INV1T2_2 = f95 751F_CORR = f96 752F_DZ0 = f97 753 754F_C11 = f98 755F_C13 = f99 756F_C15 = f100 757F_C17 = f101 758F_P1113 = f102 759F_P1517 = f103 760F_P1117 = f104 761F_P317 = f105 762F_R8 = f106 763F_HI = f107 764F_1S2_HI = f108 765F_DS2 = f109 766F_Y2_2 = f110 767//F_S2 = f111 768//F_S_DS2 = f112 769F_S_1S2S = f113 770F_XL = f114 771F_2M128 = f115 772F_1AS = f116 773F_AS = f117 774 775 776 777.section .text 778GLOBAL_LIBM_ENTRY(acosl) 779 780{.mfi 781 // get exponent, mantissa (rounded to double precision) of s 782 getf.d R_DBL_S = f8 783 // 1-s^2 784 fnma.s1 F_1S2 = f8, f8, f1 785 // r2 = pointer to T_table 786 addl r2 = @ltoff(T_table), gp 787} 788 789{.mfi 790 // sign mask 791 mov R_SGNMASK = 0x20000 792 nop.f 0 793 // bias-63-1 794 mov R_TMP03 = 0xffff-64;; 795} 796 797 798{.mfi 799 // get exponent of s 800 getf.exp R_EXP = f8 801 nop.f 0 802 // R_TMP4 = 2^45 803 shl R_TMP4 = R_SGNMASK, 45-17 804} 805 806{.mlx 807 // load bias-4 808 mov R_TMP = 0xffff-4 809 // load RU(sqrt(2)/2) to integer register (in double format, shifted left by 1) 810 movl R_TMP2 = 0x7fcd413cccfe779a;; 811} 812 813 814{.mfi 815 // load 2^{-64} in FP register 816 setf.exp F_2M64 = R_TMP03 817 nop.f 0 818 // index = (0x7-exponent)|b1 b2.. b6 819 extr.u R_INDEX = R_DBL_S, 46, 9 820} 821 822{.mfi 823 // get t = sign|exponent|b1 b2.. b6 1 x.. x 824 or R_T = R_DBL_S, R_TMP4 825 nop.f 0 826 // R_TMP4 = 2^45-1 827 sub R_TMP4 = R_TMP4, r0, 1;; 828} 829 830 831{.mfi 832 // get t = sign|exponent|b1 b2.. b6 1 0.. 0 833 andcm R_T = R_T, R_TMP4 834 nop.f 0 835 // eliminate sign from R_DBL_S (shift left by 1) 836 shl R_TMP3 = R_DBL_S, 1 837} 838 839{.mfi 840 // R_BIAS = 3*2^6 841 mov R_BIAS = 0xc0 842 nop.f 0 843 // eliminate sign from R_EXP 844 andcm R_EXP0 = R_EXP, R_SGNMASK;; 845} 846 847 848 849{.mfi 850 // load start address for T_table 851 ld8 r2 = [r2] 852 nop.f 0 853 // p8 = 1 if |s|> = sqrt(2)/2 854 cmp.geu p8, p0 = R_TMP3, R_TMP2 855} 856 857{.mlx 858 // p7 = 1 if |s|<2^{-4} (exponent of s<bias-4) 859 cmp.lt p7, p0 = R_EXP0, R_TMP 860 // sqrt coefficient cs8 = -33*13/128 861 movl R_TMP2 = 0xc0568000;; 862} 863 864 865 866{.mbb 867 // load t in FP register 868 setf.d F_T = R_T 869 // if |s|<2^{-4}, take alternate path 870 (p7) br.cond.spnt SMALL_S 871 // if |s|> = sqrt(2)/2, take alternate path 872 (p8) br.cond.sptk LARGE_S 873} 874 875{.mlx 876 // index = (4-exponent)|b1 b2.. b6 877 sub R_INDEX = R_INDEX, R_BIAS 878 // sqrt coefficient cs9 = 55*13/128 879 movl R_TMP = 0x40b2c000;; 880} 881 882 883{.mfi 884 // sqrt coefficient cs8 = -33*13/128 885 setf.s F_CS8 = R_TMP2 886 nop.f 0 887 // shift R_INDEX by 5 888 shl R_INDEX = R_INDEX, 5 889} 890 891{.mfi 892 // sqrt coefficient cs3 = 0.5 (set exponent = bias-1) 893 mov R_TMP4 = 0xffff - 1 894 nop.f 0 895 // sqrt coefficient cs6 = -21/16 896 mov R_TMP6 = 0xbfa8;; 897} 898 899 900{.mlx 901 // table index 902 add r2 = r2, R_INDEX 903 // sqrt coefficient cs7 = 33/16 904 movl R_TMP2 = 0x40040000;; 905} 906 907 908{.mmi 909 // load cs9 = 55*13/128 910 setf.s F_CS9 = R_TMP 911 // sqrt coefficient cs5 = 7/8 912 mov R_TMP3 = 0x3f60 913 // sqrt coefficient cs6 = 21/16 914 shl R_TMP6 = R_TMP6, 16;; 915} 916 917 918{.mmi 919 // load significand of 1/(1-t^2) 920 ldf8 F_INV_1T2 = [r2], 8 921 // sqrt coefficient cs7 = 33/16 922 setf.s F_CS7 = R_TMP2 923 // sqrt coefficient cs4 = -5/8 924 mov R_TMP5 = 0xbf20;; 925} 926 927 928{.mmi 929 // load significand of sqrt(1-t^2) 930 ldf8 F_SQRT_1T2 = [r2], 8 931 // sqrt coefficient cs6 = 21/16 932 setf.s F_CS6 = R_TMP6 933 // sqrt coefficient cs5 = 7/8 934 shl R_TMP3 = R_TMP3, 16;; 935} 936 937 938{.mmi 939 // sqrt coefficient cs3 = 0.5 (set exponent = bias-1) 940 setf.exp F_CS3 = R_TMP4 941 // r3 = pointer to polynomial coefficients 942 addl r3 = @ltoff(poly_coeffs), gp 943 // sqrt coefficient cs4 = -5/8 944 shl R_TMP5 = R_TMP5, 16;; 945} 946 947 948{.mfi 949 // sqrt coefficient cs5 = 7/8 950 setf.s F_CS5 = R_TMP3 951 // d = s-t 952 fms.s1 F_D = f8, f1, F_T 953 // set p6 = 1 if s<0, p11 = 1 if s> = 0 954 cmp.ge p6, p11 = R_EXP, R_DBL_S 955} 956 957{.mfi 958 // r3 = load start address to polynomial coefficients 959 ld8 r3 = [r3] 960 // s+t 961 fma.s1 F_S2T2 = f8, f1, F_T 962 nop.i 0;; 963} 964 965 966{.mfi 967 // sqrt coefficient cs4 = -5/8 968 setf.s F_CS4 = R_TMP5 969 // s^2-t^2 970 fma.s1 F_S2T2 = F_S2T2, F_D, f0 971 nop.i 0;; 972} 973 974 975{.mfi 976 // load C3 977 ldfe F_C3 = [r3], 16 978 // 0.5/(1-t^2) = 2^{-64}*(2^63/(1-t^2)) 979 fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0 980 nop.i 0;; 981} 982 983{.mfi 984 // load C_5 985 ldfe F_C5 = [r3], 16 986 // set correct exponent for sqrt(1-t^2) 987 fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0 988 nop.i 0;; 989} 990 991 992{.mfi 993 // load C_7, C_9 994 ldfpd F_C7, F_C9 = [r3], 16 995 // x = -(s^2-t^2)/(1-t^2)/2 996 fnma.s1 F_X = F_INV_1T2, F_S2T2, f0 997 nop.i 0;; 998} 999 1000 1001{.mmf 1002 // load asin(t)_high, asin(t)_low 1003 ldfpd F_ATHI, F_ATLO = [r2] 1004 // load pi/2 1005 ldfpd F_PI2_LO, F_PI2_HI = [r3] 1006 // t*sqrt(1-t^2) 1007 fma.s1 F_TSQRT = F_T, F_SQRT_1T2, f0;; 1008} 1009 1010 1011{.mfi 1012 nop.m 0 1013 // cs9*x+cs8 1014 fma.s1 F_S89 = F_CS9, F_X, F_CS8 1015 nop.i 0 1016} 1017 1018{.mfi 1019 nop.m 0 1020 // cs7*x+cs6 1021 fma.s1 F_S67 = F_CS7, F_X, F_CS6 1022 nop.i 0;; 1023} 1024 1025{.mfi 1026 nop.m 0 1027 // cs5*x+cs4 1028 fma.s1 F_S45 = F_CS5, F_X, F_CS4 1029 nop.i 0 1030} 1031 1032{.mfi 1033 nop.m 0 1034 // x*x 1035 fma.s1 F_X2 = F_X, F_X, f0 1036 nop.i 0;; 1037} 1038 1039 1040{.mfi 1041 nop.m 0 1042 // (s-t)-t*x 1043 fnma.s1 F_DTX = F_T, F_X, F_D 1044 nop.i 0 1045} 1046 1047{.mfi 1048 nop.m 0 1049 // cs3*x+cs2 (cs2 = -0.5 = -cs3) 1050 fms.s1 F_S23 = F_CS3, F_X, F_CS3 1051 nop.i 0;; 1052} 1053 1054{.mfi 1055 nop.m 0 1056 // if sign is negative, negate table values: asin(t)_low 1057 (p6) fnma.s1 F_ATLO = F_ATLO, f1, f0 1058 nop.i 0 1059} 1060 1061{.mfi 1062 nop.m 0 1063 // if sign is negative, negate table values: asin(t)_high 1064 (p6) fnma.s1 F_ATHI = F_ATHI, f1, f0 1065 nop.i 0;; 1066} 1067 1068 1069{.mfi 1070 nop.m 0 1071 // cs9*x^3+cs8*x^2+cs7*x+cs6 1072 fma.s1 F_S69 = F_S89, F_X2, F_S67 1073 nop.i 0 1074} 1075 1076{.mfi 1077 nop.m 0 1078 // x^4 1079 fma.s1 F_X4 = F_X2, F_X2, f0 1080 nop.i 0;; 1081} 1082 1083 1084{.mfi 1085 nop.m 0 1086 // t*sqrt(1-t^2)*x^2 1087 fma.s1 F_TSQRT = F_TSQRT, F_X2, f0 1088 nop.i 0 1089} 1090 1091{.mfi 1092 nop.m 0 1093 // cs5*x^3+cs4*x^2+cs3*x+cs2 1094 fma.s1 F_S25 = F_S45, F_X2, F_S23 1095 nop.i 0;; 1096} 1097 1098 1099{.mfi 1100 nop.m 0 1101 // ((s-t)-t*x)*sqrt(1-t^2) 1102 fma.s1 F_DTX = F_DTX, F_SQRT_1T2, f0 1103 nop.i 0;; 1104} 1105 1106{.mfi 1107 nop.m 0 1108 // (pi/2)_high - asin(t)_high 1109 fnma.s1 F_ATHI = F_ATHI, f1, F_PI2_HI 1110 nop.i 0 1111} 1112 1113{.mfi 1114 nop.m 0 1115 // asin(t)_low - (pi/2)_low 1116 fnma.s1 F_ATLO = F_PI2_LO, f1, F_ATLO 1117 nop.i 0;; 1118} 1119 1120 1121{.mfi 1122 nop.m 0 1123 // PS29 = cs9*x^7+..+cs5*x^3+cs4*x^2+cs3*x+cs2 1124 fma.s1 F_S29 = F_S69, F_X4, F_S25 1125 nop.i 0;; 1126} 1127 1128 1129 1130{.mfi 1131 nop.m 0 1132 // R = ((s-t)-t*x)*sqrt(1-t^2)-t*sqrt(1-t^2)*x^2*PS29 1133 fnma.s1 F_R = F_S29, F_TSQRT, F_DTX 1134 nop.i 0;; 1135} 1136 1137 1138{.mfi 1139 nop.m 0 1140 // R^2 1141 fma.s1 F_R2 = F_R, F_R, f0 1142 nop.i 0;; 1143} 1144 1145 1146{.mfi 1147 nop.m 0 1148 // c7+c9*R^2 1149 fma.s1 F_P79 = F_C9, F_R2, F_C7 1150 nop.i 0 1151} 1152 1153{.mfi 1154 nop.m 0 1155 // c3+c5*R^2 1156 fma.s1 F_P35 = F_C5, F_R2, F_C3 1157 nop.i 0;; 1158} 1159 1160{.mfi 1161 nop.m 0 1162 // R^3 1163 fma.s1 F_R4 = F_R2, F_R2, f0 1164 nop.i 0;; 1165} 1166 1167{.mfi 1168 nop.m 0 1169 // R^3 1170 fma.s1 F_R3 = F_R2, F_R, f0 1171 nop.i 0;; 1172} 1173 1174 1175 1176{.mfi 1177 nop.m 0 1178 // c3+c5*R^2+c7*R^4+c9*R^6 1179 fma.s1 F_P39 = F_P79, F_R4, F_P35 1180 nop.i 0;; 1181} 1182 1183 1184{.mfi 1185 nop.m 0 1186 // asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1187 fma.s1 F_P39 = F_P39, F_R3, F_ATLO 1188 nop.i 0;; 1189} 1190 1191 1192{.mfi 1193 nop.m 0 1194 // R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1195 fma.s1 F_P39 = F_P39, f1, F_R 1196 nop.i 0;; 1197} 1198 1199 1200{.mfb 1201 nop.m 0 1202 // result = (pi/2)-asin(t)_high+R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1203 fnma.s0 f8 = F_P39, f1, F_ATHI 1204 // return 1205 br.ret.sptk b0;; 1206} 1207 1208 1209 1210 1211LARGE_S: 1212 1213{.mfi 1214 // bias-1 1215 mov R_TMP3 = 0xffff - 1 1216 // y ~ 1/sqrt(1-s^2) 1217 frsqrta.s1 F_Y, p7 = F_1S2 1218 // c9 = 55*13*17/128 1219 mov R_TMP4 = 0x10af7b 1220} 1221 1222{.mlx 1223 // c8 = -33*13*15/128 1224 mov R_TMP5 = 0x184923 1225 movl R_TMP2 = 0xff00000000000000;; 1226} 1227 1228{.mfi 1229 // set p6 = 1 if s<0, p11 = 1 if s>0 1230 cmp.ge p6, p11 = R_EXP, R_DBL_S 1231 // 1-s^2 1232 fnma.s1 F_1S2 = f8, f8, f1 1233 // set p9 = 1 1234 cmp.eq p9, p0 = r0, r0;; 1235} 1236 1237 1238{.mfi 1239 // load 0.5 1240 setf.exp F_05 = R_TMP3 1241 // (1-s^2) rounded to single precision 1242 fnma.s.s1 F_1S2_S = f8, f8, f1 1243 // c9 = 55*13*17/128 1244 shl R_TMP4 = R_TMP4, 10 1245} 1246 1247{.mlx 1248 // AND mask for getting t ~ sqrt(1-s^2) 1249 setf.sig F_ANDMASK = R_TMP2 1250 // OR mask 1251 movl R_TMP2 = 0x0100000000000000;; 1252} 1253 1254.pred.rel "mutex", p6, p11 1255{.mfi 1256 nop.m 0 1257 // 1-|s| 1258 (p6) fma.s1 F_1AS = f8, f1, f1 1259 nop.i 0 1260} 1261 1262{.mfi 1263 nop.m 0 1264 // 1-|s| 1265 (p11) fnma.s1 F_1AS = f8, f1, f1 1266 nop.i 0;; 1267} 1268 1269 1270{.mfi 1271 // c9 = 55*13*17/128 1272 setf.s F_CS9 = R_TMP4 1273 // |s| 1274 (p6) fnma.s1 F_AS = f8, f1, f0 1275 // c8 = -33*13*15/128 1276 shl R_TMP5 = R_TMP5, 11 1277} 1278 1279{.mfi 1280 // c7 = 33*13/16 1281 mov R_TMP4 = 0x41d68 1282 // |s| 1283 (p11) fma.s1 F_AS = f8, f1, f0 1284 nop.i 0;; 1285} 1286 1287 1288{.mfi 1289 setf.sig F_ORMASK = R_TMP2 1290 // y^2 1291 fma.s1 F_Y2 = F_Y, F_Y, f0 1292 // c7 = 33*13/16 1293 shl R_TMP4 = R_TMP4, 12 1294} 1295 1296{.mfi 1297 // c6 = -33*7/16 1298 mov R_TMP6 = 0xc1670 1299 // y' ~ sqrt(1-s^2) 1300 fma.s1 F_T1 = F_Y, F_1S2, f0 1301 // c5 = 63/8 1302 mov R_TMP7 = 0x40fc;; 1303} 1304 1305 1306{.mlx 1307 // load c8 = -33*13*15/128 1308 setf.s F_CS8 = R_TMP5 1309 // c4 = -35/8 1310 movl R_TMP5 = 0xc08c0000;; 1311} 1312 1313{.mfi 1314 // r3 = pointer to polynomial coefficients 1315 addl r3 = @ltoff(poly_coeffs), gp 1316 // 1-s-(1-s^2)_s 1317 fnma.s1 F_DS = F_1S2_S, f1, F_1AS 1318 // p9 = 0 if p7 = 1 (p9 = 1 for special cases only) 1319 (p7) cmp.ne p9, p0 = r0, r0 1320} 1321 1322{.mlx 1323 // load c7 = 33*13/16 1324 setf.s F_CS7 = R_TMP4 1325 // c3 = 5/2 1326 movl R_TMP4 = 0x40200000;; 1327} 1328 1329 1330{.mlx 1331 // load c4 = -35/8 1332 setf.s F_CS4 = R_TMP5 1333 // c2 = -3/2 1334 movl R_TMP5 = 0xbfc00000;; 1335} 1336 1337 1338{.mfi 1339 // load c3 = 5/2 1340 setf.s F_CS3 = R_TMP4 1341 // x = (1-s^2)_s*y^2-1 1342 fms.s1 F_X = F_1S2_S, F_Y2, f1 1343 // c6 = -33*7/16 1344 shl R_TMP6 = R_TMP6, 12 1345} 1346 1347{.mfi 1348 nop.m 0 1349 // y^2/2 1350 fma.s1 F_Y2_2 = F_Y2, F_05, f0 1351 nop.i 0;; 1352} 1353 1354 1355{.mfi 1356 // load c6 = -33*7/16 1357 setf.s F_CS6 = R_TMP6 1358 // eliminate lower bits from y' 1359 fand F_T = F_T1, F_ANDMASK 1360 // c5 = 63/8 1361 shl R_TMP7 = R_TMP7, 16 1362} 1363 1364 1365{.mfb 1366 // r3 = load start address to polynomial coefficients 1367 ld8 r3 = [r3] 1368 // 1-(1-s^2)_s-s^2 1369 fma.s1 F_DS = F_AS, F_1AS, F_DS 1370 // p9 = 1 if s is a special input (NaN, or |s|> = 1) 1371 (p9) br.cond.spnt acosl_SPECIAL_CASES;; 1372} 1373 1374{.mmf 1375 // get exponent, significand of y' (in single prec.) 1376 getf.s R_TMP = F_T1 1377 // load c3 = -3/2 1378 setf.s F_CS2 = R_TMP5 1379 // y*(1-s^2) 1380 fma.s1 F_Y1S2 = F_Y, F_1S2, f0;; 1381} 1382 1383 1384 1385{.mfi 1386 nop.m 0 1387 // if s<0, set s = -s 1388 (p6) fnma.s1 f8 = f8, f1, f0 1389 nop.i 0;; 1390} 1391 1392 1393{.mfi 1394 // load c5 = 63/8 1395 setf.s F_CS5 = R_TMP7 1396 // x = (1-s^2)_s*y^2-1+(1-(1-s^2)_s-s^2)*y^2 1397 fma.s1 F_X = F_DS, F_Y2, F_X 1398 // for t = 2^k*1.b1 b2.., get 7-k|b1.. b6 1399 extr.u R_INDEX = R_TMP, 17, 9;; 1400} 1401 1402 1403{.mmi 1404 // index = (4-exponent)|b1 b2.. b6 1405 sub R_INDEX = R_INDEX, R_BIAS 1406 nop.m 0 1407 // get exponent of y 1408 shr.u R_TMP2 = R_TMP, 23;; 1409} 1410 1411{.mmi 1412 // load C3 1413 ldfe F_C3 = [r3], 16 1414 // set p8 = 1 if y'<2^{-4} 1415 cmp.gt p8, p0 = 0x7b, R_TMP2 1416 // shift R_INDEX by 5 1417 shl R_INDEX = R_INDEX, 5;; 1418} 1419 1420 1421{.mfb 1422 // get table index for sqrt(1-t^2) 1423 add r2 = r2, R_INDEX 1424 // get t = 2^k*1.b1 b2.. b7 1 1425 for F_T = F_T, F_ORMASK 1426 (p8) br.cond.spnt VERY_LARGE_INPUT;; 1427} 1428 1429 1430 1431{.mmf 1432 // load C5 1433 ldfe F_C5 = [r3], 16 1434 // load 1/(1-t^2) 1435 ldfp8 F_INV_1T2, F_SQRT_1T2 = [r2], 16 1436 // x = ((1-s^2)*y^2-1)/2 1437 fma.s1 F_X = F_X, F_05, f0;; 1438} 1439 1440 1441 1442{.mmf 1443 nop.m 0 1444 // C7, C9 1445 ldfpd F_C7, F_C9 = [r3], 16 1446 // set correct exponent for t 1447 fmerge.se F_T = F_T1, F_T;; 1448} 1449 1450 1451 1452{.mfi 1453 // get address for loading pi 1454 add r3 = 48, r3 1455 // c9*x+c8 1456 fma.s1 F_S89 = F_X, F_CS9, F_CS8 1457 nop.i 0 1458} 1459 1460{.mfi 1461 nop.m 0 1462 // x^2 1463 fma.s1 F_X2 = F_X, F_X, f0 1464 nop.i 0;; 1465} 1466 1467 1468{.mfi 1469 // pi (low, high) 1470 ldfpd F_PI2_LO, F_PI2_HI = [r3] 1471 // y*(1-s^2)*x 1472 fma.s1 F_Y1S2X = F_Y1S2, F_X, f0 1473 nop.i 0 1474} 1475 1476{.mfi 1477 nop.m 0 1478 // c7*x+c6 1479 fma.s1 F_S67 = F_X, F_CS7, F_CS6 1480 nop.i 0;; 1481} 1482 1483 1484{.mfi 1485 nop.m 0 1486 // 1-x 1487 fnma.s1 F_1X = F_X, f1, f1 1488 nop.i 0 1489} 1490 1491{.mfi 1492 nop.m 0 1493 // c3*x+c2 1494 fma.s1 F_S23 = F_X, F_CS3, F_CS2 1495 nop.i 0;; 1496} 1497 1498 1499{.mfi 1500 nop.m 0 1501 // 1-t^2 1502 fnma.s1 F_1T2 = F_T, F_T, f1 1503 nop.i 0 1504} 1505 1506{.mfi 1507 // load asin(t)_high, asin(t)_low 1508 ldfpd F_ATHI, F_ATLO = [r2] 1509 // c5*x+c4 1510 fma.s1 F_S45 = F_X, F_CS5, F_CS4 1511 nop.i 0;; 1512} 1513 1514 1515 1516{.mfi 1517 nop.m 0 1518 // t*s 1519 fma.s1 F_TS = F_T, f8, f0 1520 nop.i 0 1521} 1522 1523{.mfi 1524 nop.m 0 1525 // 0.5/(1-t^2) 1526 fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0 1527 nop.i 0;; 1528} 1529 1530{.mfi 1531 nop.m 0 1532 // z~sqrt(1-t^2), rounded to 24 significant bits 1533 fma.s.s1 F_Z = F_SQRT_1T2, F_2M64, f0 1534 nop.i 0 1535} 1536 1537{.mfi 1538 nop.m 0 1539 // sqrt(1-t^2) 1540 fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0 1541 nop.i 0;; 1542} 1543 1544 1545{.mfi 1546 nop.m 0 1547 // y*(1-s^2)*x^2 1548 fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0 1549 nop.i 0 1550} 1551 1552{.mfi 1553 nop.m 0 1554 // x^4 1555 fma.s1 F_X4 = F_X2, F_X2, f0 1556 nop.i 0;; 1557} 1558 1559 1560{.mfi 1561 nop.m 0 1562 // s*t rounded to 24 significant bits 1563 fma.s.s1 F_TSS = F_T, f8, f0 1564 nop.i 0 1565} 1566 1567{.mfi 1568 nop.m 0 1569 // c9*x^3+..+c6 1570 fma.s1 F_S69 = F_X2, F_S89, F_S67 1571 nop.i 0;; 1572} 1573 1574 1575{.mfi 1576 nop.m 0 1577 // ST = (t^2-1+s^2) rounded to 24 significant bits 1578 fms.s.s1 F_ST = f8, f8, F_1T2 1579 nop.i 0 1580} 1581 1582{.mfi 1583 nop.m 0 1584 // c5*x^3+..+c2 1585 fma.s1 F_S25 = F_X2, F_S45, F_S23 1586 nop.i 0;; 1587} 1588 1589 1590{.mfi 1591 nop.m 0 1592 // 0.25/(1-t^2) 1593 fma.s1 F_INV1T2_2 = F_05, F_INV_1T2, f0 1594 nop.i 0 1595} 1596 1597{.mfi 1598 nop.m 0 1599 // t*s-sqrt(1-t^2)*(1-s^2)*y 1600 fnma.s1 F_TS = F_Y1S2, F_SQRT_1T2, F_TS 1601 nop.i 0;; 1602} 1603 1604 1605{.mfi 1606 nop.m 0 1607 // z*0.5/(1-t^2) 1608 fma.s1 F_ZE = F_INV_1T2, F_SQRT_1T2, f0 1609 nop.i 0 1610} 1611 1612{.mfi 1613 nop.m 0 1614 // z^2+t^2-1 1615 fms.s1 F_DZ0 = F_Z, F_Z, F_1T2 1616 nop.i 0;; 1617} 1618 1619 1620{.mfi 1621 nop.m 0 1622 // (1-s^2-(1-s^2)_s)*x 1623 fma.s1 F_DS2X = F_X, F_DS, f0 1624 nop.i 0;; 1625} 1626 1627 1628{.mfi 1629 nop.m 0 1630 // t*s-(t*s)_s 1631 fms.s1 F_DTS = F_T, f8, F_TSS 1632 nop.i 0 1633} 1634 1635{.mfi 1636 nop.m 0 1637 // c9*x^7+..+c2 1638 fma.s1 F_S29 = F_X4, F_S69, F_S25 1639 nop.i 0;; 1640} 1641 1642 1643{.mfi 1644 nop.m 0 1645 // y*z 1646 fma.s1 F_YZ = F_Z, F_Y, f0 1647 nop.i 0 1648} 1649 1650{.mfi 1651 nop.m 0 1652 // t^2 1653 fma.s1 F_T2 = F_T, F_T, f0 1654 nop.i 0;; 1655} 1656 1657 1658{.mfi 1659 nop.m 0 1660 // 1-t^2+ST 1661 fma.s1 F_1T2_ST = F_ST, f1, F_1T2 1662 nop.i 0;; 1663} 1664 1665 1666{.mfi 1667 nop.m 0 1668 // y*(1-s^2)(1-x) 1669 fma.s1 F_Y1S2_1X = F_Y1S2, F_1X, f0 1670 nop.i 0 1671} 1672 1673{.mfi 1674 nop.m 0 1675 // dz ~ sqrt(1-t^2)-z 1676 fma.s1 F_DZ = F_DZ0, F_ZE, f0 1677 nop.i 0;; 1678} 1679 1680 1681{.mfi 1682 nop.m 0 1683 // -1+correction for sqrt(1-t^2)-z 1684 fnma.s1 F_CORR = F_INV1T2_2, F_DZ0, f0 1685 nop.i 0;; 1686} 1687 1688 1689{.mfi 1690 nop.m 0 1691 // (PS29*x^2+x)*y*(1-s^2) 1692 fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X 1693 nop.i 0;; 1694} 1695 1696{.mfi 1697 nop.m 0 1698 // z*y*(1-s^2)_s 1699 fma.s1 F_ZY1S2S = F_YZ, F_1S2_S, f0 1700 nop.i 0 1701} 1702 1703{.mfi 1704 nop.m 0 1705 // s^2-(1-t^2+ST) 1706 fms.s1 F_1T2_ST = f8, f8, F_1T2_ST 1707 nop.i 0;; 1708} 1709 1710 1711{.mfi 1712 nop.m 0 1713 // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x 1714 fma.s1 F_DTS = F_YZ, F_DS2X, F_DTS 1715 nop.i 0 1716} 1717 1718{.mfi 1719 nop.m 0 1720 // dz*y*(1-s^2)*(1-x) 1721 fma.s1 F_DZ_TERM = F_DZ, F_Y1S2_1X, f0 1722 nop.i 0;; 1723} 1724 1725 1726{.mfi 1727 nop.m 0 1728 // R = t*s-sqrt(1-t^2)*(1-s^2)*y+sqrt(1-t^2)*(1-s^2)*y*PS19 1729 // (used for polynomial evaluation) 1730 fma.s1 F_R = F_S19, F_SQRT_1T2, F_TS 1731 nop.i 0;; 1732} 1733 1734 1735{.mfi 1736 nop.m 0 1737 // (PS29*x^2)*y*(1-s^2) 1738 fma.s1 F_S29 = F_Y1S2X2, F_S29, f0 1739 nop.i 0 1740} 1741 1742{.mfi 1743 nop.m 0 1744 // apply correction to dz*y*(1-s^2)*(1-x) 1745 fma.s1 F_DZ_TERM = F_DZ_TERM, F_CORR, F_DZ_TERM 1746 nop.i 0;; 1747} 1748 1749 1750{.mfi 1751 nop.m 0 1752 // R^2 1753 fma.s1 F_R2 = F_R, F_R, f0 1754 nop.i 0;; 1755} 1756 1757 1758{.mfi 1759 nop.m 0 1760 // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x+dz*y*(1-s^2)*(1-x) 1761 fma.s1 F_DZ_TERM = F_DZ_TERM, f1, F_DTS 1762 nop.i 0;; 1763} 1764 1765 1766{.mfi 1767 nop.m 0 1768 // c7+c9*R^2 1769 fma.s1 F_P79 = F_C9, F_R2, F_C7 1770 nop.i 0 1771} 1772 1773{.mfi 1774 nop.m 0 1775 // c3+c5*R^2 1776 fma.s1 F_P35 = F_C5, F_R2, F_C3 1777 nop.i 0;; 1778} 1779 1780{.mfi 1781 nop.m 0 1782 // asin(t)_low-(pi)_low (if s<0) 1783 (p6) fms.s1 F_ATLO = F_ATLO, f1, F_PI2_LO 1784 nop.i 0 1785} 1786 1787{.mfi 1788 nop.m 0 1789 // R^4 1790 fma.s1 F_R4 = F_R2, F_R2, f0 1791 nop.i 0;; 1792} 1793 1794{.mfi 1795 nop.m 0 1796 // R^3 1797 fma.s1 F_R3 = F_R2, F_R, f0 1798 nop.i 0;; 1799} 1800 1801 1802{.mfi 1803 nop.m 0 1804 // (t*s)_s-t^2*y*z 1805 fnma.s1 F_TSS = F_T2, F_YZ, F_TSS 1806 nop.i 0 1807} 1808 1809{.mfi 1810 nop.m 0 1811 // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) 1812 fma.s1 F_DZ_TERM = F_YZ, F_1T2_ST, F_DZ_TERM 1813 nop.i 0;; 1814} 1815 1816 1817{.mfi 1818 nop.m 0 1819 // (pi)_hi-asin(t)_hi (if s<0) 1820 (p6) fms.s1 F_ATHI = F_PI2_HI, f1, F_ATHI 1821 nop.i 0 1822} 1823 1824{.mfi 1825 nop.m 0 1826 // c3+c5*R^2+c7*R^4+c9*R^6 1827 fma.s1 F_P39 = F_P79, F_R4, F_P35 1828 nop.i 0;; 1829} 1830 1831 1832{.mfi 1833 nop.m 0 1834 // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST)+ 1835 // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 1836 fma.s1 F_DZ_TERM = F_SQRT_1T2, F_S29, F_DZ_TERM 1837 nop.i 0;; 1838} 1839 1840 1841{.mfi 1842 nop.m 0 1843 // (t*s)_s-t^2*y*z+z*y*ST 1844 fma.s1 F_TSS = F_YZ, F_ST, F_TSS 1845 nop.i 0 1846} 1847 1848{.mfi 1849 nop.m 0 1850 // -asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1851 fms.s1 F_P39 = F_P39, F_R3, F_ATLO 1852 nop.i 0;; 1853} 1854 1855 1856{.mfi 1857 nop.m 0 1858 // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) + 1859 // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + 1860 // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1861 fma.s1 F_DZ_TERM = F_P39, f1, F_DZ_TERM 1862 nop.i 0;; 1863} 1864 1865 1866{.mfi 1867 nop.m 0 1868 // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) + 1869 // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x + 1870 // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) 1871 fma.s1 F_DZ_TERM = F_ZY1S2S, F_X, F_DZ_TERM 1872 nop.i 0;; 1873} 1874 1875 1876{.mfi 1877 nop.m 0 1878 // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) + 1879 // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x + 1880 // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) + 1881 // + (t*s)_s-t^2*y*z+z*y*ST 1882 fma.s1 F_DZ_TERM = F_TSS, f1, F_DZ_TERM 1883 nop.i 0;; 1884} 1885 1886 1887.pred.rel "mutex", p6, p11 1888{.mfi 1889 nop.m 0 1890 // result: add high part of table value 1891 // s>0 in this case 1892 (p11) fnma.s0 f8 = F_DZ_TERM, f1, F_ATHI 1893 nop.i 0 1894} 1895 1896{.mfb 1897 nop.m 0 1898 // result: add high part of pi-table value 1899 // if s<0 1900 (p6) fma.s0 f8 = F_DZ_TERM, f1, F_ATHI 1901 br.ret.sptk b0;; 1902} 1903 1904 1905 1906 1907 1908 1909SMALL_S: 1910 1911 // use 15-term polynomial approximation 1912 1913{.mmi 1914 // r3 = pointer to polynomial coefficients 1915 addl r3 = @ltoff(poly_coeffs), gp;; 1916 // load start address for coefficients 1917 ld8 r3 = [r3] 1918 mov R_TMP = 0x3fbf;; 1919} 1920 1921 1922{.mmi 1923 add r2 = 64, r3 1924 ldfe F_C3 = [r3], 16 1925 // p7 = 1 if |s|<2^{-64} (exponent of s<bias-64) 1926 cmp.lt p7, p0 = R_EXP0, R_TMP;; 1927} 1928 1929{.mmf 1930 ldfe F_C5 = [r3], 16 1931 ldfpd F_C11, F_C13 = [r2], 16 1932 nop.f 0;; 1933} 1934 1935{.mmf 1936 ldfpd F_C7, F_C9 = [r3], 16 1937 ldfpd F_C15, F_C17 = [r2] 1938 nop.f 0;; 1939} 1940 1941 1942 1943{.mfb 1944 // load pi/2 1945 ldfpd F_PI2_LO, F_PI2_HI = [r3] 1946 // s^2 1947 fma.s1 F_R2 = f8, f8, f0 1948 // |s|<2^{-64} 1949 (p7) br.cond.spnt RETURN_PI2;; 1950} 1951 1952 1953{.mfi 1954 nop.m 0 1955 // s^3 1956 fma.s1 F_R3 = f8, F_R2, f0 1957 nop.i 0 1958} 1959 1960{.mfi 1961 nop.m 0 1962 // s^4 1963 fma.s1 F_R4 = F_R2, F_R2, f0 1964 nop.i 0;; 1965} 1966 1967 1968{.mfi 1969 nop.m 0 1970 // c3+c5*s^2 1971 fma.s1 F_P35 = F_C5, F_R2, F_C3 1972 nop.i 0 1973} 1974 1975{.mfi 1976 nop.m 0 1977 // c11+c13*s^2 1978 fma.s1 F_P1113 = F_C13, F_R2, F_C11 1979 nop.i 0;; 1980} 1981 1982 1983{.mfi 1984 nop.m 0 1985 // c7+c9*s^2 1986 fma.s1 F_P79 = F_C9, F_R2, F_C7 1987 nop.i 0 1988} 1989 1990{.mfi 1991 nop.m 0 1992 // c15+c17*s^2 1993 fma.s1 F_P1517 = F_C17, F_R2, F_C15 1994 nop.i 0;; 1995} 1996 1997{.mfi 1998 nop.m 0 1999 // (pi/2)_high-s_high 2000 fnma.s1 F_T = f8, f1, F_PI2_HI 2001 nop.i 0 2002} 2003{.mfi 2004 nop.m 0 2005 // s^8 2006 fma.s1 F_R8 = F_R4, F_R4, f0 2007 nop.i 0;; 2008} 2009 2010 2011{.mfi 2012 nop.m 0 2013 // c3+c5*s^2+c7*s^4+c9*s^6 2014 fma.s1 F_P39 = F_P79, F_R4, F_P35 2015 nop.i 0 2016} 2017 2018{.mfi 2019 nop.m 0 2020 // c11+c13*s^2+c15*s^4+c17*s^6 2021 fma.s1 F_P1117 = F_P1517, F_R4, F_P1113 2022 nop.i 0;; 2023} 2024 2025{.mfi 2026 nop.m 0 2027 // -s_high 2028 fms.s1 F_S = F_T, f1, F_PI2_HI 2029 nop.i 0;; 2030} 2031 2032{.mfi 2033 nop.m 0 2034 // c3+..+c17*s^14 2035 fma.s1 F_P317 = F_R8, F_P1117, F_P39 2036 nop.i 0;; 2037} 2038 2039{.mfi 2040 nop.m 0 2041 // s_low 2042 fma.s1 F_DS = f8, f1, F_S 2043 nop.i 0;; 2044} 2045 2046{.mfi 2047 nop.m 0 2048 // (pi/2)_low-s^3*(c3+..+c17*s^14) 2049 fnma.s0 F_P317 = F_P317, F_R3, F_PI2_LO 2050 nop.i 0;; 2051} 2052 2053{.mfi 2054 nop.m 0 2055 // (pi/2)_low-s_low-s^3*(c3+..+c17*s^14) 2056 fms.s1 F_P317 = F_P317, f1, F_DS 2057 nop.i 0;; 2058} 2059 2060{.mfb 2061 nop.m 0 2062 // result: pi/2-s-c3*s^3-..-c17*s^17 2063 fma.s0 f8 = F_T, f1, F_P317 2064 br.ret.sptk b0;; 2065} 2066 2067 2068 2069 2070 2071RETURN_PI2: 2072 2073{.mfi 2074 nop.m 0 2075 // (pi/2)_low-s 2076 fms.s0 F_PI2_LO = F_PI2_LO, f1, f8 2077 nop.i 0;; 2078} 2079 2080{.mfb 2081 nop.m 0 2082 // (pi/2)-s 2083 fma.s0 f8 = F_PI2_HI, f1, F_PI2_LO 2084 br.ret.sptk b0;; 2085} 2086 2087 2088 2089 2090 2091VERY_LARGE_INPUT: 2092 2093 2094{.mmf 2095 // pointer to pi_low, pi_high 2096 add r2 = 80, r3 2097 // load C5 2098 ldfe F_C5 = [r3], 16 2099 // x = ((1-(s^2)_s)*y^2-1)/2-(s^2-(s^2)_s)*y^2/2 2100 fma.s1 F_X = F_X, F_05, f0;; 2101} 2102 2103.pred.rel "mutex", p6, p11 2104{.mmf 2105 // load pi (low, high), if s<0 2106 (p6) ldfpd F_PI2_LO, F_PI2_HI = [r2] 2107 // C7, C9 2108 ldfpd F_C7, F_C9 = [r3], 16 2109 // if s>0, set F_PI2_LO=0 2110 (p11) fma.s1 F_PI2_HI = f0, f0, f0;; 2111} 2112 2113{.mfi 2114 nop.m 0 2115 (p11) fma.s1 F_PI2_LO = f0, f0, f0 2116 nop.i 0;; 2117} 2118 2119{.mfi 2120 // adjust address for C_11 2121 add r3 = 16, r3 2122 // c9*x+c8 2123 fma.s1 F_S89 = F_X, F_CS9, F_CS8 2124 nop.i 0 2125} 2126 2127{.mfi 2128 nop.m 0 2129 // x^2 2130 fma.s1 F_X2 = F_X, F_X, f0 2131 nop.i 0;; 2132} 2133 2134 2135{.mfi 2136 nop.m 0 2137 // y*(1-s^2)*x 2138 fma.s1 F_Y1S2X = F_Y1S2, F_X, f0 2139 nop.i 0 2140} 2141 2142{.mfi 2143 // C11, C13 2144 ldfpd F_C11, F_C13 = [r3], 16 2145 // c7*x+c6 2146 fma.s1 F_S67 = F_X, F_CS7, F_CS6 2147 nop.i 0;; 2148} 2149 2150 2151{.mfi 2152 // C15, C17 2153 ldfpd F_C15, F_C17 = [r3], 16 2154 // c3*x+c2 2155 fma.s1 F_S23 = F_X, F_CS3, F_CS2 2156 nop.i 0;; 2157} 2158 2159 2160{.mfi 2161 nop.m 0 2162 // c5*x+c4 2163 fma.s1 F_S45 = F_X, F_CS5, F_CS4 2164 nop.i 0;; 2165} 2166 2167 2168 2169 2170{.mfi 2171 nop.m 0 2172 // y*(1-s^2)*x^2 2173 fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0 2174 nop.i 0 2175} 2176 2177{.mfi 2178 nop.m 0 2179 // x^4 2180 fma.s1 F_X4 = F_X2, F_X2, f0 2181 nop.i 0;; 2182} 2183 2184 2185{.mfi 2186 nop.m 0 2187 // c9*x^3+..+c6 2188 fma.s1 F_S69 = F_X2, F_S89, F_S67 2189 nop.i 0;; 2190} 2191 2192 2193{.mfi 2194 nop.m 0 2195 // c5*x^3+..+c2 2196 fma.s1 F_S25 = F_X2, F_S45, F_S23 2197 nop.i 0;; 2198} 2199 2200 2201 2202{.mfi 2203 nop.m 0 2204 // (pi)_high-y*(1-s^2)_s 2205 fnma.s1 F_HI = F_Y, F_1S2_S, F_PI2_HI 2206 nop.i 0;; 2207} 2208 2209 2210{.mfi 2211 nop.m 0 2212 // c9*x^7+..+c2 2213 fma.s1 F_S29 = F_X4, F_S69, F_S25 2214 nop.i 0;; 2215} 2216 2217 2218{.mfi 2219 nop.m 0 2220 // -(y*(1-s^2)_s)_high 2221 fms.s1 F_1S2_HI = F_HI, f1, F_PI2_HI 2222 nop.i 0;; 2223} 2224 2225 2226{.mfi 2227 nop.m 0 2228 // (PS29*x^2+x)*y*(1-s^2) 2229 fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X 2230 nop.i 0;; 2231} 2232 2233 2234{.mfi 2235 nop.m 0 2236 // y*(1-s^2)_s-(y*(1-s^2))_high 2237 fma.s1 F_DS2 = F_Y, F_1S2_S, F_1S2_HI 2238 nop.i 0;; 2239} 2240 2241 2242 2243{.mfi 2244 nop.m 0 2245 // R ~ sqrt(1-s^2) 2246 // (used for polynomial evaluation) 2247 fnma.s1 F_R = F_S19, f1, F_Y1S2 2248 nop.i 0;; 2249} 2250 2251 2252{.mfi 2253 nop.m 0 2254 // y*(1-s^2)-(y*(1-s^2))_high 2255 fma.s1 F_DS2 = F_Y, F_DS, F_DS2 2256 nop.i 0 2257} 2258 2259{.mfi 2260 nop.m 0 2261 // (pi)_low+(PS29*x^2)*y*(1-s^2) 2262 fma.s1 F_S29 = F_Y1S2X2, F_S29, F_PI2_LO 2263 nop.i 0;; 2264} 2265 2266 2267{.mfi 2268 nop.m 0 2269 // R^2 2270 fma.s1 F_R2 = F_R, F_R, f0 2271 nop.i 0;; 2272} 2273 2274 2275{.mfi 2276 nop.m 0 2277 // if s<0 2278 // (pi)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high) 2279 fms.s1 F_S29 = F_S29, f1, F_DS2 2280 nop.i 0;; 2281} 2282 2283 2284{.mfi 2285 nop.m 0 2286 // c7+c9*R^2 2287 fma.s1 F_P79 = F_C9, F_R2, F_C7 2288 nop.i 0 2289} 2290 2291{.mfi 2292 nop.m 0 2293 // c3+c5*R^2 2294 fma.s1 F_P35 = F_C5, F_R2, F_C3 2295 nop.i 0;; 2296} 2297 2298 2299 2300{.mfi 2301 nop.m 0 2302 // R^4 2303 fma.s1 F_R4 = F_R2, F_R2, f0 2304 nop.i 0 2305} 2306 2307{.mfi 2308 nop.m 0 2309 // R^3 2310 fma.s1 F_R3 = F_R2, F_R, f0 2311 nop.i 0;; 2312} 2313 2314 2315{.mfi 2316 nop.m 0 2317 // c11+c13*R^2 2318 fma.s1 F_P1113 = F_C13, F_R2, F_C11 2319 nop.i 0 2320} 2321 2322{.mfi 2323 nop.m 0 2324 // c15+c17*R^2 2325 fma.s1 F_P1517 = F_C17, F_R2, F_C15 2326 nop.i 0;; 2327} 2328 2329 2330{.mfi 2331 nop.m 0 2332 // (pi)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high)+y*(1-s^2)*x 2333 fma.s1 F_S29 = F_Y1S2, F_X, F_S29 2334 nop.i 0;; 2335} 2336 2337 2338{.mfi 2339 nop.m 0 2340 // c11+c13*R^2+c15*R^4+c17*R^6 2341 fma.s1 F_P1117 = F_P1517, F_R4, F_P1113 2342 nop.i 0 2343} 2344 2345{.mfi 2346 nop.m 0 2347 // c3+c5*R^2+c7*R^4+c9*R^6 2348 fma.s1 F_P39 = F_P79, F_R4, F_P35 2349 nop.i 0;; 2350} 2351 2352 2353 2354{.mfi 2355 nop.m 0 2356 // R^8 2357 fma.s1 F_R8 = F_R4, F_R4, f0 2358 nop.i 0;; 2359} 2360 2361 2362{.mfi 2363 nop.m 0 2364 // c3+c5*R^2+c7*R^4+c9*R^6+..+c17*R^14 2365 fma.s1 F_P317 = F_P1117, F_R8, F_P39 2366 nop.i 0;; 2367} 2368 2369 2370{.mfi 2371 nop.m 0 2372 // (pi)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)- 2373 // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17 2374 fnma.s1 F_S29 = F_P317, F_R3, F_S29 2375 nop.i 0;; 2376} 2377 2378.pred.rel "mutex", p6, p11 2379{.mfi 2380 nop.m 0 2381 // Result (if s<0): 2382 // (pi)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)- 2383 // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17 2384 // +(pi)_high-(y*(1-s^2))_high 2385 (p6) fma.s0 f8 = F_S29, f1, F_HI 2386 nop.i 0 2387} 2388 2389{.mfb 2390 nop.m 0 2391 // Result (if s>0): 2392 // (PS29*x^2)*y*(1-s^2)- 2393 // -y*(1-s^2)*x + P3, 17 2394 // +(y*(1-s^2)) 2395 (p11) fms.s0 f8 = F_Y, F_1S2_S, F_S29 2396 br.ret.sptk b0;; 2397} 2398 2399 2400 2401 2402 2403 2404acosl_SPECIAL_CASES: 2405 2406{.mfi 2407 alloc r32 = ar.pfs, 1, 4, 4, 0 2408 // check if the input is a NaN, or unsupported format 2409 // (i.e. not infinity or normal/denormal) 2410 fclass.nm p7, p8 = f8, 0x3f 2411 // pointer to pi/2 2412 add r3 = 96, r3;; 2413} 2414 2415 2416{.mfi 2417 // load pi/2 2418 ldfpd F_PI2_HI, F_PI2_LO = [r3] 2419 // get |s| 2420 fmerge.s F_S = f0, f8 2421 nop.i 0 2422} 2423 2424{.mfb 2425 nop.m 0 2426 // if NaN, quietize it, and return 2427 (p7) fma.s0 f8 = f8, f1, f0 2428 (p7) br.ret.spnt b0;; 2429} 2430 2431 2432{.mfi 2433 nop.m 0 2434 // |s| = 1 ? 2435 fcmp.eq.s0 p9, p10 = F_S, f1 2436 nop.i 0 2437} 2438 2439{.mfi 2440 nop.m 0 2441 // load FR_X 2442 fma.s1 FR_X = f8, f1, f0 2443 // load error tag 2444 mov GR_Parameter_TAG = 57;; 2445} 2446 2447 2448{.mfi 2449 nop.m 0 2450 // if s = 1, result is 0 2451 (p9) fma.s0 f8 = f0, f0, f0 2452 // set p6=0 for |s|>1 2453 (p10) cmp.ne p6, p0 = r0, r0;; 2454} 2455 2456 2457{.mfb 2458 nop.m 0 2459 // if s = -1, result is pi 2460 (p6) fma.s0 f8 = F_PI2_HI, f1, F_PI2_LO 2461 // return if |s| = 1 2462 (p9) br.ret.sptk b0;; 2463} 2464 2465 2466{.mfi 2467 nop.m 0 2468 // get Infinity 2469 frcpa.s1 FR_RESULT, p0 = f1, f0 2470 nop.i 0;; 2471} 2472 2473 2474{.mfb 2475 nop.m 0 2476 // return QNaN indefinite (0*Infinity) 2477 fma.s0 FR_RESULT = f0, FR_RESULT, f0 2478 nop.b 0;; 2479} 2480 2481 2482GLOBAL_LIBM_END(acosl) 2483libm_alias_ldouble_other (acos, acos) 2484 2485 2486LOCAL_LIBM_ENTRY(__libm_error_region) 2487.prologue 2488// (1) 2489{ .mfi 2490 add GR_Parameter_Y=-32,sp // Parameter 2 value 2491 nop.f 0 2492.save ar.pfs,GR_SAVE_PFS 2493 mov GR_SAVE_PFS=ar.pfs // Save ar.pfs 2494} 2495{ .mfi 2496.fframe 64 2497 add sp=-64,sp // Create new stack 2498 nop.f 0 2499 mov GR_SAVE_GP=gp // Save gp 2500};; 2501 2502 2503// (2) 2504{ .mmi 2505 stfe [GR_Parameter_Y] = f1,16 // Store Parameter 2 on stack 2506 add GR_Parameter_X = 16,sp // Parameter 1 address 2507.save b0, GR_SAVE_B0 2508 mov GR_SAVE_B0=b0 // Save b0 2509};; 2510 2511.body 2512// (3) 2513{ .mib 2514 stfe [GR_Parameter_X] = FR_X // Store Parameter 1 on stack 2515 add GR_Parameter_RESULT = 0,GR_Parameter_Y 2516 nop.b 0 // Parameter 3 address 2517} 2518{ .mib 2519 stfe [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack 2520 add GR_Parameter_Y = -16,GR_Parameter_Y 2521 br.call.sptk b0=__libm_error_support# // Call error handling function 2522};; 2523{ .mmi 2524 nop.m 0 2525 nop.m 0 2526 add GR_Parameter_RESULT = 48,sp 2527};; 2528 2529// (4) 2530{ .mmi 2531 ldfe f8 = [GR_Parameter_RESULT] // Get return result off stack 2532.restore sp 2533 add sp = 64,sp // Restore stack pointer 2534 mov b0 = GR_SAVE_B0 // Restore return address 2535};; 2536 2537{ .mib 2538 mov gp = GR_SAVE_GP // Restore gp 2539 mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs 2540 br.ret.sptk b0 // Return 2541};; 2542 2543LOCAL_LIBM_END(__libm_error_region) 2544 2545.type __libm_error_support#,@function 2546.global __libm_error_support# 2547