You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

zscal.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #define ASSEMBLER
  39. #include "common.h"
  40. #define N ARG1
  41. #define X ARG4
  42. #define INCX ARG5
  43. #define I %rax
  44. #include "l1param.h"
  45. PROLOGUE
  46. PROFCODE
  47. #ifdef WINDOWS_ABI
  48. emms
  49. #endif
  50. salq $ZBASE_SHIFT, INCX
  51. FLD 8(%rsp)
  52. FLD 24(%rsp)
  53. testq N, N
  54. jle .L999
  55. fld %st(1)
  56. fabs
  57. fld %st(1)
  58. fabs
  59. faddp %st, %st(1)
  60. fldz
  61. fcomip %st(1), %st
  62. ffreep %st
  63. jne .L30
  64. EMMS
  65. pxor %mm0, %mm0
  66. cmpq $2 * SIZE, INCX
  67. jne .L20
  68. movq N, I
  69. sarq $2, I
  70. jle .L15
  71. ALIGN_4
  72. .L12:
  73. #ifdef PREFETCHW
  74. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  75. #endif
  76. movq %mm0, 0(X)
  77. movq %mm0, 8(X)
  78. movq %mm0, 16(X)
  79. movq %mm0, 24(X)
  80. movq %mm0, 32(X)
  81. movq %mm0, 40(X)
  82. movq %mm0, 48(X)
  83. movq %mm0, 56(X)
  84. movq %mm0, 64(X)
  85. movq %mm0, 72(X)
  86. movq %mm0, 80(X)
  87. movq %mm0, 88(X)
  88. movq %mm0, 96(X)
  89. movq %mm0, 104(X)
  90. movq %mm0, 112(X)
  91. movq %mm0, 120(X)
  92. addq $8 * SIZE, X
  93. decq I
  94. jg .L12
  95. ALIGN_3
  96. .L15:
  97. movq N, I
  98. andq $3, I
  99. jle .L18
  100. ALIGN_2
  101. .L16:
  102. movq %mm0, 0(X)
  103. movq %mm0, 8(X)
  104. movq %mm0, 16(X)
  105. movq %mm0, 24(X)
  106. addq $2 * SIZE, X
  107. decq I
  108. jg .L16
  109. .L18:
  110. EMMS
  111. ret
  112. ALIGN_2
  113. .L20:
  114. movq N, I
  115. sarq $2, I
  116. jle .L25
  117. ALIGN_3
  118. .L22:
  119. movq %mm0, 0(X)
  120. movq %mm0, 8(X)
  121. movq %mm0, 16(X)
  122. movq %mm0, 24(X)
  123. addq INCX, X
  124. movq %mm0, 0(X)
  125. movq %mm0, 8(X)
  126. movq %mm0, 16(X)
  127. movq %mm0, 24(X)
  128. addq INCX, X
  129. movq %mm0, 0(X)
  130. movq %mm0, 8(X)
  131. movq %mm0, 16(X)
  132. movq %mm0, 24(X)
  133. addq INCX, X
  134. movq %mm0, 0(X)
  135. movq %mm0, 8(X)
  136. movq %mm0, 16(X)
  137. movq %mm0, 24(X)
  138. addq INCX, X
  139. decq I
  140. jg .L22
  141. ALIGN_3
  142. .L25:
  143. movq N, I
  144. andq $3, I
  145. jle .L28
  146. ALIGN_3
  147. .L26:
  148. movq %mm0, 0(X)
  149. movq %mm0, 8(X)
  150. movq %mm0, 16(X)
  151. movq %mm0, 24(X)
  152. addq INCX, X
  153. decq I
  154. jg .L26
  155. .L28:
  156. EMMS
  157. ret
  158. ALIGN_3
  159. .L30:
  160. movq N, I
  161. ALIGN_2
  162. .L32:
  163. #ifdef PREFETCHW
  164. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  165. #endif
  166. FLD 0 * SIZE(X)
  167. fmul %st(1),%st
  168. FLD 1 * SIZE(X)
  169. fmul %st(3),%st
  170. faddp %st,%st(1)
  171. FLD 0 * SIZE(X)
  172. fmul %st(3),%st
  173. FLD 1 * SIZE(X)
  174. fmul %st(3),%st
  175. fsubrp %st,%st(1)
  176. FST 0 * SIZE(X)
  177. FST 1 * SIZE(X)
  178. addq INCX, X
  179. decq I
  180. jg .L32
  181. ALIGN_2
  182. .L999:
  183. ffreep %st
  184. ffreep %st
  185. ret
  186. EPILOGUE