copysignl.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 "copysignl.c"
  38. .text
  39. ..TXTST0:
  40. # -- Begin copysignl
  41. .text
  42. .align 16,0x90
  43. .globl copysignl
  44. copysignl:
  45. # parameter 1: 8 + %ebp
  46. # parameter 2: 20 + %ebp
  47. ..B1.1:
  48. ..L1:
  49. pushl %ebp
  50. movl %esp, %ebp
  51. andl $-16, %esp
  52. subl $48, %esp
  53. fldt 8(%ebp)
  54. fstpt 24(%esp)
  55. ..B1.2:
  56. fnstcw 38(%esp)
  57. ..B1.3:
  58. movzwl 38(%esp), %edx
  59. movl %edx, %eax
  60. andl $768, %eax
  61. cmpl $768, %eax
  62. je ..B1.10
  63. ..B1.4:
  64. orl $-64768, %edx
  65. movw %dx, 36(%esp)
  66. ..B1.5:
  67. fldcw 36(%esp)
  68. ..B1.6:
  69. movl $1, %eax
  70. ..B1.7:
  71. fldt 20(%ebp)
  72. fldt 24(%esp)
  73. call ..L2
  74. ..L2:
  75. popl %edx
  76. lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx
  77. movzbl 29(%ebp), %ecx
  78. andl $-128, %ecx
  79. fldl _ones@GOTOFF(%edx)
  80. fmul %st, %st(1)
  81. fxch %st(1)
  82. fstpt 12(%esp)
  83. fmulp %st, %st(1)
  84. movzbl 21(%esp), %edx
  85. andl $127, %edx
  86. orl %ecx, %edx
  87. fstpt (%esp)
  88. testl %eax, %eax
  89. movb %dl, 21(%esp)
  90. je ..B1.9
  91. ..B1.8:
  92. fldcw 38(%esp)
  93. ..B1.9:
  94. fldt 12(%esp)
  95. movl %ebp, %esp
  96. popl %ebp
  97. ret
  98. ..B1.10:
  99. xorl %eax, %eax
  100. jmp ..B1.7
  101. .align 16,0x90
  102. .type copysignl,@function
  103. .size copysignl,.-copysignl
  104. .data
  105. # -- End copysignl
  106. .section .rodata, "a"
  107. .align 4
  108. .align 4
  109. _ones:
  110. .long 0
  111. .long 1072693248
  112. .long 0
  113. .long 3220176896
  114. .type _ones,@object
  115. .size _ones,16
  116. .data
  117. .section .note.GNU-stack, ""
  118. # End