scalbf.S 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /*
  2. * Math library
  3. *
  4. * Copyright (C) 2016 Intel Corporation. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the name of Intel Corporation nor the names of its
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. *
  33. * Author Name <jingwei.zhang@intel.com>
  34. * History:
  35. * 03-14-2016 Initial version. numerics svn rev. 12864
  36. */
  37. .file "scalbf.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin scalbf
  41. .text
  42. .align 16,0x90
  43. .globl scalbf
  44. scalbf:
  45. # parameter 1: 32 + %esp
  46. # parameter 2: 36 + %esp
  47. ..B1.1:
  48. ..L1:
  49. pushl %esi
  50. pushl %edi
  51. pushl %ebx
  52. pushl %ebp
  53. subl $12, %esp
  54. movzwl 34(%esp), %ebx
  55. movl %ebx, %edx
  56. andl $32640, %edx
  57. movzwl 38(%esp), %edi
  58. andl $32640, %edi
  59. shrl $7, %edx
  60. shrl $7, %edi
  61. call ..L2
  62. ..L2:
  63. popl %ebp
  64. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp
  65. cmpl $255, %edx
  66. je ..B1.48
  67. ..B1.2:
  68. cmpl $255, %edi
  69. je ..B1.31
  70. ..B1.3:
  71. cmpl $127, %edi
  72. jl ..B1.16
  73. ..B1.4:
  74. cmpl $150, %edi
  75. jge ..B1.7
  76. ..B1.5:
  77. movl 36(%esp), %esi
  78. movl %edi, %ecx
  79. andl $8388607, %esi
  80. negl %ecx
  81. movl %esi, %eax
  82. addl $22, %ecx
  83. orl $8388608, %eax
  84. addl $10, %edi
  85. shrl %cl, %eax
  86. movl %edi, %ecx
  87. shll %cl, %esi
  88. testl %esi, %esi
  89. je ..B1.8
  90. ..B1.6:
  91. fldz
  92. fmuls .L_2il0floatpacket.0@GOTOFF(%ebp)
  93. addl $12, %esp
  94. popl %ebp
  95. popl %ebx
  96. popl %edi
  97. popl %esi
  98. ret
  99. ..B1.7:
  100. movl $65536, %eax
  101. ..B1.8:
  102. testl %edx, %edx
  103. jne ..B1.11
  104. ..B1.9:
  105. testl $8388607, 32(%esp)
  106. je ..B1.15
  107. ..B1.10:
  108. flds 32(%esp)
  109. fmuls .L_2il0floatpacket.1@GOTOFF(%ebp)
  110. fstps 32(%esp)
  111. movzwl 34(%esp), %ebx
  112. movl %ebx, %edx
  113. andl $32640, %edx
  114. shrl $7, %edx
  115. addl $-25, %edx
  116. ..B1.11:
  117. cmpl $65536, %eax
  118. movzbl 39(%esp), %esi
  119. jle ..L3
  120. movl $65536, %eax
  121. ..L3:
  122. movl %eax, %ecx
  123. negl %ecx
  124. testl $128, %esi
  125. jne ..L4
  126. movl %eax, %ecx
  127. ..L4:
  128. lea (%edx,%ecx), %eax
  129. testl %eax, %eax
  130. jle ..B1.26
  131. ..B1.12:
  132. cmpl $255, %eax
  133. jge ..B1.25
  134. ..B1.13:
  135. movzbl %al, %eax
  136. andl $-32641, %ebx
  137. shll $7, %eax
  138. orl %eax, %ebx
  139. movw %bx, 34(%esp)
  140. flds 32(%esp)
  141. ..B1.14:
  142. addl $12, %esp
  143. popl %ebp
  144. popl %ebx
  145. popl %edi
  146. popl %esi
  147. ret
  148. ..B1.15:
  149. flds 32(%esp)
  150. addl $12, %esp
  151. popl %ebp
  152. popl %ebx
  153. popl %edi
  154. popl %esi
  155. ret
  156. ..B1.16:
  157. testl %edi, %edi
  158. jne ..B1.19
  159. ..B1.17:
  160. testl $8388607, 36(%esp)
  161. jne ..B1.19
  162. ..B1.18:
  163. flds 32(%esp)
  164. addl $12, %esp
  165. popl %ebp
  166. popl %ebx
  167. popl %edi
  168. popl %esi
  169. ret
  170. ..B1.19:
  171. cmpl $255, %edx
  172. jne ..B1.24
  173. ..B1.20:
  174. testl %edi, %edi
  175. jg ..B1.22
  176. ..B1.21:
  177. fldz
  178. fmuls .L_2il0floatpacket.0@GOTOFF(%ebp)
  179. addl $12, %esp
  180. popl %ebp
  181. popl %ebx
  182. popl %edi
  183. popl %esi
  184. ret
  185. ..B1.22:
  186. cmpl $1, %edi
  187. je ..B1.30
  188. ..B1.23:
  189. movzbl 35(%esp), %eax
  190. andl $128, %eax
  191. shrl $7, %eax
  192. flds _infs@GOTOFF(%ebp,%eax,4)
  193. addl $12, %esp
  194. popl %ebp
  195. popl %ebx
  196. popl %edi
  197. popl %esi
  198. ret
  199. ..B1.24:
  200. fldz
  201. fmuls .L_2il0floatpacket.0@GOTOFF(%ebp)
  202. addl $12, %esp
  203. popl %ebp
  204. popl %ebx
  205. popl %edi
  206. popl %esi
  207. ret
  208. ..B1.25:
  209. movzbl 35(%esp), %eax
  210. andl $128, %eax
  211. shrl $7, %eax
  212. flds _large_value_32@GOTOFF(%ebp,%eax,4)
  213. fmuls .L_2il0floatpacket.2@GOTOFF(%ebp)
  214. fsts (%esp)
  215. addl $12, %esp
  216. popl %ebp
  217. popl %ebx
  218. popl %edi
  219. popl %esi
  220. ret
  221. ..B1.26:
  222. cmpl $-23, %eax
  223. jge ..B1.28
  224. ..B1.27:
  225. movzbl 35(%esp), %eax
  226. andl $128, %eax
  227. shrl $7, %eax
  228. flds _small_value_32@GOTOFF(%ebp,%eax,4)
  229. fmuls .L_2il0floatpacket.3@GOTOFF(%ebp)
  230. jmp ..B1.29
  231. ..B1.28:
  232. movl 32(%esp), %eax
  233. lea 25(%edx,%ecx), %edx
  234. movl %eax, (%esp)
  235. shrl $16, %eax
  236. movzbl %dl, %edx
  237. andl $-32641, %eax
  238. shll $7, %edx
  239. orl %edx, %eax
  240. movw %ax, 2(%esp)
  241. flds (%esp)
  242. fmuls .L_2il0floatpacket.4@GOTOFF(%ebp)
  243. ..B1.29:
  244. fsts (%esp)
  245. addl $12, %esp
  246. popl %ebp
  247. popl %ebx
  248. popl %edi
  249. popl %esi
  250. ret
  251. ..B1.30:
  252. testl $8388607, 36(%esp)
  253. jle ..B1.21
  254. jmp ..B1.23
  255. ..B1.31:
  256. testl $8388607, 36(%esp)
  257. jne ..B1.43
  258. ..B1.32:
  259. testl %edx, %edx
  260. jne ..B1.38
  261. ..B1.33:
  262. testl $8388607, 32(%esp)
  263. jne ..B1.39
  264. ..B1.34:
  265. movzbl 39(%esp), %eax
  266. testl $128, %eax
  267. je ..B1.36
  268. ..B1.35:
  269. flds 32(%esp)
  270. addl $12, %esp
  271. popl %ebp
  272. popl %ebx
  273. popl %edi
  274. popl %esi
  275. ret
  276. ..B1.36:
  277. fldz
  278. fmuls .L_2il0floatpacket.0@GOTOFF(%ebp)
  279. ..B1.37:
  280. addl $12, %esp
  281. popl %ebp
  282. popl %ebx
  283. popl %edi
  284. popl %esi
  285. ret
  286. ..B1.38:
  287. cmpl $255, %edx
  288. je ..B1.44
  289. ..B1.39:
  290. movzbl 35(%esp), %edx
  291. andl $128, %edx
  292. movzbl 39(%esp), %eax
  293. shrl $7, %edx
  294. testl $128, %eax
  295. je ..B1.41
  296. ..B1.40:
  297. flds _zeros@GOTOFF(%ebp,%edx,4)
  298. addl $12, %esp
  299. popl %ebp
  300. popl %ebx
  301. popl %edi
  302. popl %esi
  303. ret
  304. ..B1.41:
  305. flds _infs@GOTOFF(%ebp,%edx,4)
  306. ..B1.42:
  307. addl $12, %esp
  308. popl %ebp
  309. popl %ebx
  310. popl %edi
  311. popl %esi
  312. ret
  313. ..B1.43:
  314. flds 32(%esp)
  315. fadds 36(%esp)
  316. addl $12, %esp
  317. popl %ebp
  318. popl %ebx
  319. popl %edi
  320. popl %esi
  321. ret
  322. ..B1.44:
  323. movzbl 39(%esp), %eax
  324. testl $128, %eax
  325. jne ..B1.46
  326. ..B1.45:
  327. flds 32(%esp)
  328. addl $12, %esp
  329. popl %ebp
  330. popl %ebx
  331. popl %edi
  332. popl %esi
  333. ret
  334. ..B1.46:
  335. fldz
  336. fmuls .L_2il0floatpacket.0@GOTOFF(%ebp)
  337. ..B1.47:
  338. addl $12, %esp
  339. popl %ebp
  340. popl %ebx
  341. popl %edi
  342. popl %esi
  343. ret
  344. ..B1.48:
  345. testl $8388607, 32(%esp)
  346. jne ..B1.43
  347. ..B1.49:
  348. cmpl $255, %edi
  349. je ..B1.31
  350. jmp ..B1.16
  351. .align 16,0x90
  352. .type scalbf,@function
  353. .size scalbf,.-scalbf
  354. .data
  355. # -- End scalbf
  356. .section .rodata, "a"
  357. .align 4
  358. .align 4
  359. .L_2il0floatpacket.0:
  360. .long 0x7f800000
  361. .type .L_2il0floatpacket.0,@object
  362. .size .L_2il0floatpacket.0,4
  363. .align 4
  364. .L_2il0floatpacket.1:
  365. .long 0x4c000000
  366. .type .L_2il0floatpacket.1,@object
  367. .size .L_2il0floatpacket.1,4
  368. .align 4
  369. .L_2il0floatpacket.2:
  370. .long 0x71800000
  371. .type .L_2il0floatpacket.2,@object
  372. .size .L_2il0floatpacket.2,4
  373. .align 4
  374. .L_2il0floatpacket.3:
  375. .long 0x0d800000
  376. .type .L_2il0floatpacket.3,@object
  377. .size .L_2il0floatpacket.3,4
  378. .align 4
  379. .L_2il0floatpacket.4:
  380. .long 0x33000000
  381. .type .L_2il0floatpacket.4,@object
  382. .size .L_2il0floatpacket.4,4
  383. .align 4
  384. _infs:
  385. .long 2139095040
  386. .long 4286578688
  387. .type _infs,@object
  388. .size _infs,8
  389. .align 4
  390. _large_value_32:
  391. .long 1904214016
  392. .long 4051697664
  393. .type _large_value_32,@object
  394. .size _large_value_32,8
  395. .align 4
  396. _small_value_32:
  397. .long 226492416
  398. .long 2373976064
  399. .type _small_value_32,@object
  400. .size _small_value_32,8
  401. .align 4
  402. _zeros:
  403. .long 0
  404. .long 2147483648
  405. .type _zeros,@object
  406. .size _zeros,8
  407. .data
  408. .section .note.GNU-stack, ""
  409. # End