remainder.S 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 "remainder.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin remainder
  41. .text
  42. .align 16,0x90
  43. .globl remainder
  44. remainder:
  45. # parameter 1: 8 + %ebp
  46. # parameter 2: 16 + %ebp
  47. ..B1.1:
  48. ..L1:
  49. pushl %ebp
  50. movl %esp, %ebp
  51. andl $-16, %esp
  52. subl $16, %esp
  53. movzwl 22(%ebp), %ecx
  54. andl $32752, %ecx
  55. shrl $4, %ecx
  56. call ..L2
  57. ..L2:
  58. popl %eax
  59. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
  60. testl %ecx, %ecx
  61. jne ..B1.4
  62. ..B1.2:
  63. testl $1048575, 20(%ebp)
  64. jne ..B1.4
  65. ..B1.3:
  66. cmpl $0, 16(%ebp)
  67. je ..B1.9
  68. ..B1.4:
  69. movzwl 14(%ebp), %edx
  70. andl $32752, %edx
  71. shrl $4, %edx
  72. cmpl $2047, %edx
  73. je ..B1.28
  74. ..B1.5:
  75. cmpl $2047, %ecx
  76. je ..B1.14
  77. ..B1.7:
  78. fldl 16(%ebp)
  79. fldl 8(%ebp)
  80. .L_2TAG_PACKET_0.0.2:
  81. fprem1
  82. fstsw %ax
  83. sahf
  84. jp .L_2TAG_PACKET_0.0.2
  85. fstp %st(1)
  86. fstpl (%esp)
  87. ..B1.8:
  88. fldl (%esp)
  89. movl %ebp, %esp
  90. popl %ebp
  91. ret
  92. ..B1.9:
  93. movzwl 14(%ebp), %edx
  94. andl $32752, %edx
  95. cmpl $32752, %edx
  96. je ..B1.11
  97. ..B1.10:
  98. fldl _infs@GOTOFF(%eax)
  99. fmull _zeros@GOTOFF(%eax)
  100. fstl (%esp)
  101. movl %ebp, %esp
  102. popl %ebp
  103. ret
  104. ..B1.11:
  105. testl $1048575, 12(%ebp)
  106. jne ..B1.13
  107. ..B1.12:
  108. cmpl $0, 8(%ebp)
  109. je ..B1.10
  110. ..B1.13:
  111. fldl 8(%ebp)
  112. faddl 16(%ebp)
  113. fstl (%esp)
  114. movl %ebp, %esp
  115. popl %ebp
  116. ret
  117. ..B1.14:
  118. testl $1048575, 20(%ebp)
  119. jne ..B1.19
  120. ..B1.15:
  121. cmpl $0, 16(%ebp)
  122. jne ..B1.19
  123. ..B1.16:
  124. cmpl $2047, %edx
  125. je ..B1.25
  126. ..B1.17:
  127. cmpl $2047, %ecx
  128. je ..B1.20
  129. jmp ..B1.7
  130. ..B1.19:
  131. fldl 8(%ebp)
  132. faddl 16(%ebp)
  133. movl %ebp, %esp
  134. popl %ebp
  135. ret
  136. ..B1.20:
  137. testl $1048575, 20(%ebp)
  138. jne ..B1.7
  139. ..B1.21:
  140. cmpl $0, 16(%ebp)
  141. jne ..B1.7
  142. ..B1.22:
  143. fldl 8(%ebp)
  144. movl %ebp, %esp
  145. popl %ebp
  146. ret
  147. ..B1.25:
  148. testl $1048575, 12(%ebp)
  149. jne ..B1.17
  150. ..B1.26:
  151. cmpl $0, 8(%ebp)
  152. jne ..B1.17
  153. ..B1.27:
  154. fldl _infs@GOTOFF(%eax)
  155. fmull _zeros@GOTOFF(%eax)
  156. movl %ebp, %esp
  157. popl %ebp
  158. ret
  159. ..B1.28:
  160. testl $1048575, 12(%ebp)
  161. jne ..B1.19
  162. ..B1.29:
  163. cmpl $0, 8(%ebp)
  164. jne ..B1.19
  165. ..B1.30:
  166. cmpl $2047, %ecx
  167. je ..B1.14
  168. jmp ..B1.16
  169. .align 16,0x90
  170. .type remainder,@function
  171. .size remainder,.-remainder
  172. .data
  173. # -- End remainder
  174. .section .rodata, "a"
  175. .align 4
  176. .align 4
  177. _infs:
  178. .long 0
  179. .long 2146435072
  180. .long 0
  181. .long 4293918720
  182. .type _infs,@object
  183. .size _infs,16
  184. .align 4
  185. _zeros:
  186. .long 0
  187. .long 0
  188. .long 0
  189. .long 2147483648
  190. .type _zeros,@object
  191. .size _zeros,16
  192. .data
  193. .section .note.GNU-stack, ""
  194. # End
  195. .globl drem
  196. .equ drem, remainder