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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. salq $ZBASE_SHIFT, INCX
  48. FLD 8(%rsp)
  49. FLD 24(%rsp)
  50. testq N, N
  51. jle .L999
  52. fld %st(1)
  53. fabs
  54. fld %st(1)
  55. fabs
  56. faddp %st, %st(1)
  57. fldz
  58. fcomip %st(1), %st
  59. ffreep %st
  60. jne .L30
  61. EMMS
  62. pxor %mm0, %mm0
  63. cmpq $2 * SIZE, INCX
  64. jne .L20
  65. movq N, I
  66. sarq $2, I
  67. jle .L15
  68. ALIGN_4
  69. .L12:
  70. #ifdef PREFETCHW
  71. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  72. #endif
  73. movq %mm0, 0(X)
  74. movq %mm0, 8(X)
  75. movq %mm0, 16(X)
  76. movq %mm0, 24(X)
  77. movq %mm0, 32(X)
  78. movq %mm0, 40(X)
  79. movq %mm0, 48(X)
  80. movq %mm0, 56(X)
  81. movq %mm0, 64(X)
  82. movq %mm0, 72(X)
  83. movq %mm0, 80(X)
  84. movq %mm0, 88(X)
  85. movq %mm0, 96(X)
  86. movq %mm0, 104(X)
  87. movq %mm0, 112(X)
  88. movq %mm0, 120(X)
  89. addq $8 * SIZE, X
  90. decq I
  91. jg .L12
  92. ALIGN_3
  93. .L15:
  94. movq N, I
  95. andq $3, I
  96. jle .L18
  97. ALIGN_2
  98. .L16:
  99. movq %mm0, 0(X)
  100. movq %mm0, 8(X)
  101. movq %mm0, 16(X)
  102. movq %mm0, 24(X)
  103. addq $2 * SIZE, X
  104. decq I
  105. jg .L16
  106. .L18:
  107. EMMS
  108. ret
  109. ALIGN_2
  110. .L20:
  111. movq N, I
  112. sarq $2, I
  113. jle .L25
  114. ALIGN_3
  115. .L22:
  116. movq %mm0, 0(X)
  117. movq %mm0, 8(X)
  118. movq %mm0, 16(X)
  119. movq %mm0, 24(X)
  120. addq INCX, X
  121. movq %mm0, 0(X)
  122. movq %mm0, 8(X)
  123. movq %mm0, 16(X)
  124. movq %mm0, 24(X)
  125. addq INCX, X
  126. movq %mm0, 0(X)
  127. movq %mm0, 8(X)
  128. movq %mm0, 16(X)
  129. movq %mm0, 24(X)
  130. addq INCX, X
  131. movq %mm0, 0(X)
  132. movq %mm0, 8(X)
  133. movq %mm0, 16(X)
  134. movq %mm0, 24(X)
  135. addq INCX, X
  136. decq I
  137. jg .L22
  138. ALIGN_3
  139. .L25:
  140. movq N, I
  141. andq $3, I
  142. jle .L28
  143. ALIGN_3
  144. .L26:
  145. movq %mm0, 0(X)
  146. movq %mm0, 8(X)
  147. movq %mm0, 16(X)
  148. movq %mm0, 24(X)
  149. addq INCX, X
  150. decq I
  151. jg .L26
  152. .L28:
  153. EMMS
  154. ret
  155. ALIGN_3
  156. .L30:
  157. movq N, I
  158. ALIGN_2
  159. .L32:
  160. #ifdef PREFETCHW
  161. PREFETCHW (PREFETCHSIZE + 0) - PREOFFSET(X)
  162. #endif
  163. FLD 0 * SIZE(X)
  164. fmul %st(1),%st
  165. FLD 1 * SIZE(X)
  166. fmul %st(3),%st
  167. faddp %st,%st(1)
  168. FLD 0 * SIZE(X)
  169. fmul %st(3),%st
  170. FLD 1 * SIZE(X)
  171. fmul %st(3),%st
  172. fsubrp %st,%st(1)
  173. FST 0 * SIZE(X)
  174. FST 1 * SIZE(X)
  175. addq INCX, X
  176. decq I
  177. jg .L32
  178. ALIGN_2
  179. .L999:
  180. ffreep %st
  181. ffreep %st
  182. ret
  183. EPILOGUE