nexttowardl.S 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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 "nexttowardl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin nexttowardl
  41. .text
  42. .align 16,0x90
  43. .globl nexttowardl
  44. nexttowardl:
  45. # parameter 1: 48 + %rsp
  46. # parameter 2: 64 + %rsp
  47. ..B1.1:
  48. .cfi_startproc
  49. ..___tag_value_nexttowardl.1:
  50. ..L2:
  51. subq $40, %rsp
  52. .cfi_def_cfa_offset 48
  53. ..B1.2:
  54. fnstcw 34(%rsp)
  55. ..B1.3:
  56. movzwl 56(%rsp), %esi
  57. andl $32767, %esi
  58. cmpl $32767, %esi
  59. je ..B1.53
  60. ..B1.4:
  61. movzwl 72(%rsp), %ecx
  62. andl $32767, %ecx
  63. cmpl $32767, %ecx
  64. je ..B1.45
  65. ..B1.5:
  66. fldt 48(%rsp)
  67. fldt 64(%rsp)
  68. fucomi %st(1), %st
  69. jp ..B1.6
  70. je ..B1.54
  71. ..B1.6:
  72. fstp %st(0)
  73. testl %esi, %esi
  74. jne ..B1.9
  75. ..B1.7:
  76. cmpl $0, 52(%rsp)
  77. jne ..B1.9
  78. ..B1.8:
  79. cmpl $0, 48(%rsp)
  80. je ..B1.44
  81. ..B1.9:
  82. movb 73(%rsp), %al
  83. movb 57(%rsp), %dl
  84. andb $-128, %al
  85. andb $-128, %dl
  86. shrb $7, %al
  87. shrb $7, %dl
  88. fstpt 16(%rsp)
  89. cmpb %dl, %al
  90. jne ..B1.15
  91. ..B1.10:
  92. cmpl %ecx, %esi
  93. jg ..B1.15
  94. ..B1.11:
  95. jne ..B1.29
  96. ..B1.12:
  97. movl 52(%rsp), %eax
  98. movl 68(%rsp), %edx
  99. cmpl %edx, %eax
  100. ja ..B1.15
  101. ..B1.13:
  102. jne ..B1.29
  103. ..B1.14:
  104. movl 48(%rsp), %eax
  105. cmpl 64(%rsp), %eax
  106. jbe ..B1.29
  107. ..B1.15:
  108. movzwl 24(%rsp), %edx
  109. movl %edx, %edi
  110. movl 16(%rsp), %eax
  111. andl $32767, %edi
  112. decl %eax
  113. movl %eax, 16(%rsp)
  114. cmpl $-1, %eax
  115. jne ..B1.34
  116. ..B1.16:
  117. movl 20(%rsp), %eax
  118. decl %eax
  119. testl %edi, %edi
  120. je ..B1.22
  121. ..B1.17:
  122. cmpl $2147483647, %eax
  123. jne ..B1.21
  124. ..B1.18:
  125. decl %edi
  126. andl $-32768, %edx
  127. andl $32767, %edi
  128. orl %edi, %edx
  129. movw %dx, 24(%rsp)
  130. testl %edi, %edi
  131. je ..B1.20
  132. ..B1.19:
  133. movl %edx, %edi
  134. orl $-2147483648, %eax
  135. movl %eax, 20(%rsp)
  136. andl $32767, %edi
  137. jmp ..B1.34
  138. ..B1.20:
  139. movl %edx, %edi
  140. movl %eax, 20(%rsp)
  141. andl $32767, %edi
  142. jmp ..B1.34
  143. ..B1.21:
  144. movl %eax, 20(%rsp)
  145. jmp ..B1.35
  146. ..B1.22:
  147. movl %eax, 20(%rsp)
  148. ..B1.23:
  149. movzwl 34(%rsp), %edx
  150. movl %edx, %eax
  151. andl $768, %eax
  152. cmpl $768, %eax
  153. je ..B1.36
  154. ..B1.24:
  155. orl $-64768, %edx
  156. movw %dx, 32(%rsp)
  157. ..B1.25:
  158. fldcw 32(%rsp)
  159. ..B1.26:
  160. lea _small_value_80(%rip), %rax
  161. fldt (%rax)
  162. fmul %st(0), %st
  163. fstpt (%rsp)
  164. ..B1.27:
  165. fldcw 34(%rsp)
  166. ..B1.28:
  167. fldt 16(%rsp)
  168. addq $40, %rsp
  169. .cfi_def_cfa_offset 8
  170. ret
  171. .cfi_def_cfa_offset 48
  172. ..B1.29:
  173. movzwl 24(%rsp), %ecx
  174. movl %ecx, %edi
  175. movl 16(%rsp), %eax
  176. andl $32767, %edi
  177. incl %eax
  178. movl %eax, 16(%rsp)
  179. jne ..B1.33
  180. ..B1.30:
  181. movl $-2147483648, %eax
  182. xorl %edx, %edx
  183. testl %edi, %edi
  184. movl 20(%rsp), %esi
  185. cmove %eax, %edx
  186. incl %esi
  187. cmpl %edx, %esi
  188. jne ..B1.32
  189. ..B1.31:
  190. incl %edi
  191. andl $-32768, %ecx
  192. andl $32767, %edi
  193. orl $-2147483648, %esi
  194. orl %edi, %ecx
  195. movl %ecx, %edi
  196. movl %esi, 20(%rsp)
  197. andl $32767, %edi
  198. movw %cx, 24(%rsp)
  199. jmp ..B1.33
  200. ..B1.32:
  201. movl %esi, 20(%rsp)
  202. ..B1.33:
  203. cmpl $32767, %edi
  204. je ..B1.37
  205. ..B1.34:
  206. testl %edi, %edi
  207. je ..B1.23
  208. ..B1.35:
  209. fldt 16(%rsp)
  210. addq $40, %rsp
  211. .cfi_def_cfa_offset 8
  212. ret
  213. .cfi_def_cfa_offset 48
  214. ..B1.36:
  215. lea _small_value_80(%rip), %rax
  216. fldt (%rax)
  217. fmul %st(0), %st
  218. fstpt (%rsp)
  219. jmp ..B1.28
  220. ..B1.37:
  221. movzwl 34(%rsp), %edx
  222. movl %edx, %eax
  223. andl $768, %eax
  224. cmpl $768, %eax
  225. je ..B1.43
  226. ..B1.38:
  227. orl $-64768, %edx
  228. movw %dx, 32(%rsp)
  229. ..B1.39:
  230. fldcw 32(%rsp)
  231. ..B1.40:
  232. lea _large_value_80(%rip), %rax
  233. fldt (%rax)
  234. fmul %st(0), %st
  235. fstpt (%rsp)
  236. ..B1.41:
  237. fldcw 34(%rsp)
  238. ..B1.42:
  239. fldt 16(%rsp)
  240. addq $40, %rsp
  241. .cfi_def_cfa_offset 8
  242. ret
  243. .cfi_def_cfa_offset 48
  244. ..B1.43:
  245. lea _large_value_80(%rip), %rax
  246. fldt (%rax)
  247. fmul %st(0), %st
  248. fstpt (%rsp)
  249. jmp ..B1.42
  250. ..B1.44:
  251. fstp %st(0)
  252. movb 73(%rsp), %al
  253. lea _smallest_value_80(%rip), %rdx
  254. andb $-128, %al
  255. shrb $7, %al
  256. movzbl %al, %ecx
  257. shlq $4, %rcx
  258. fldt (%rdx,%rcx)
  259. movzwl 8(%rdx,%rcx), %edi
  260. fstpt 16(%rsp)
  261. andl $32767, %edi
  262. jmp ..B1.34
  263. ..B1.45:
  264. movq $0x8000000000000000, %rax
  265. cmpq 64(%rsp), %rax
  266. je ..B1.5
  267. ..B1.46:
  268. movzwl 34(%rsp), %edx
  269. movl %edx, %eax
  270. andl $768, %eax
  271. cmpl $768, %eax
  272. je ..B1.52
  273. ..B1.47:
  274. orl $-64768, %edx
  275. movw %dx, 32(%rsp)
  276. ..B1.48:
  277. fldcw 32(%rsp)
  278. ..B1.49:
  279. fldt 48(%rsp)
  280. fldt 64(%rsp)
  281. fmulp %st, %st(1)
  282. fstpt 16(%rsp)
  283. ..B1.50:
  284. fldcw 34(%rsp)
  285. ..B1.51:
  286. fldt 16(%rsp)
  287. addq $40, %rsp
  288. .cfi_def_cfa_offset 8
  289. ret
  290. .cfi_def_cfa_offset 48
  291. ..B1.52:
  292. fldt 48(%rsp)
  293. fldt 64(%rsp)
  294. fmulp %st, %st(1)
  295. fstpt 16(%rsp)
  296. jmp ..B1.51
  297. ..B1.53:
  298. movq $0x8000000000000000, %rax
  299. cmpq 48(%rsp), %rax
  300. jne ..B1.46
  301. jmp ..B1.4
  302. ..B1.54:
  303. fstp %st(1)
  304. addq $40, %rsp
  305. .cfi_def_cfa_offset 8
  306. ret
  307. .align 16,0x90
  308. .cfi_endproc
  309. .type nexttowardl,@function
  310. .size nexttowardl,.-nexttowardl
  311. .data
  312. # -- End nexttowardl
  313. .section .rodata, "a"
  314. .align 4
  315. .align 2
  316. _small_value_80:
  317. .word 0
  318. .word 0
  319. .word 0
  320. .word 32768
  321. .word 6383
  322. .word 0
  323. .word 0
  324. .word 0
  325. .word 0
  326. .word 0
  327. .word 0
  328. .word 32768
  329. .word 39151
  330. .word 0
  331. .word 0
  332. .word 0
  333. .type _small_value_80,@object
  334. .size _small_value_80,32
  335. .align 2
  336. _large_value_80:
  337. .word 0
  338. .word 0
  339. .word 0
  340. .word 32768
  341. .word 26383
  342. .word 0
  343. .word 0
  344. .word 0
  345. .word 0
  346. .word 0
  347. .word 0
  348. .word 32768
  349. .word 59151
  350. .word 0
  351. .word 0
  352. .word 0
  353. .type _large_value_80,@object
  354. .size _large_value_80,32
  355. .align 2
  356. _smallest_value_80:
  357. .word 1
  358. .word 0
  359. .word 0
  360. .word 0
  361. .word 0
  362. .word 0
  363. .word 0
  364. .word 0
  365. .word 1
  366. .word 0
  367. .word 0
  368. .word 0
  369. .word 32768
  370. .word 0
  371. .word 0
  372. .word 0
  373. .type _smallest_value_80,@object
  374. .size _smallest_value_80,32
  375. .data
  376. .section .note.GNU-stack, ""
  377. // -- Begin DWARF2 SEGMENT .eh_frame
  378. .section .eh_frame,"a",@progbits
  379. .eh_frame_seg:
  380. .align 1
  381. # End