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.

cnrm2.S 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 $4
  41. #define X $5
  42. #define INCX $6
  43. #define I $2
  44. #define TEMP $3
  45. #define a1 $f6
  46. #define a2 $f7
  47. #define a3 $f8
  48. #define a4 $f9
  49. #define a5 $f10
  50. #define a6 $f11
  51. #define a7 $f12
  52. #define a8 $f13
  53. #define s1 $f0
  54. #define s2 $f1
  55. #define t1 $f2
  56. #define t2 $f3
  57. #define t3 $f4
  58. #define t4 $f5
  59. PROLOGUE
  60. #ifdef F_INTERFACE
  61. LDINT N, 0(N)
  62. LDINT INCX, 0(INCX)
  63. #endif
  64. dmtc1 $0, s1
  65. li TEMP, 2 * SIZE
  66. blez N, .L999
  67. mov.d s2, s1
  68. beqz INCX, .L999
  69. dsll INCX, INCX, ZBASE_SHIFT
  70. dsra I, N, 2
  71. blez I, .L25
  72. NOP
  73. LD a1, 0 * SIZE(X)
  74. LD a2, 1 * SIZE(X)
  75. daddu X, X, INCX
  76. LD a3, 0 * SIZE(X)
  77. LD a4, 1 * SIZE(X)
  78. daddu X, X, INCX
  79. LD a5, 0 * SIZE(X)
  80. LD a6, 1 * SIZE(X)
  81. daddu X, X, INCX
  82. cvt.d.s t1, a1
  83. LD a7, 0 * SIZE(X)
  84. cvt.d.s t2, a2
  85. LD a8, 1 * SIZE(X)
  86. cvt.d.s t3, a3
  87. daddiu I, I, -1
  88. cvt.d.s t4, a4
  89. blez I, .L24
  90. daddu X, X, INCX
  91. .align 3
  92. .L23:
  93. madd.d s1, s1, t1, t1
  94. LD a1, 0 * SIZE(X)
  95. cvt.d.s t1, a5
  96. NOP
  97. madd.d s2, s2, t2, t2
  98. LD a2, 1 * SIZE(X)
  99. cvt.d.s t2, a6
  100. daddu X, X, INCX
  101. madd.d s1, s1, t3, t3
  102. LD a3, 0 * SIZE(X)
  103. cvt.d.s t3, a7
  104. NOP
  105. madd.d s2, s2, t4, t4
  106. LD a4, 1 * SIZE(X)
  107. cvt.d.s t4, a8
  108. daddu X, X, INCX
  109. madd.d s1, s1, t1, t1
  110. LD a5, 0 * SIZE(X)
  111. cvt.d.s t1, a1
  112. daddiu I, I, -1
  113. madd.d s2, s2, t2, t2
  114. LD a6, 1 * SIZE(X)
  115. cvt.d.s t2, a2
  116. daddu X, X, INCX
  117. madd.d s1, s1, t3, t3
  118. LD a7, 0 * SIZE(X)
  119. cvt.d.s t3, a3
  120. LD a8, 1 * SIZE(X)
  121. madd.d s2, s2, t4, t4
  122. daddu X, X, INCX
  123. bgtz I, .L23
  124. cvt.d.s t4, a4
  125. .align 3
  126. .L24:
  127. madd.d s1, s1, t1, t1
  128. cvt.d.s t1, a5
  129. madd.d s2, s2, t2, t2
  130. cvt.d.s t2, a6
  131. madd.d s1, s1, t3, t3
  132. cvt.d.s t3, a7
  133. madd.d s2, s2, t4, t4
  134. cvt.d.s t4, a8
  135. madd.d s1, s1, t1, t1
  136. madd.d s2, s2, t2, t2
  137. madd.d s1, s1, t3, t3
  138. madd.d s2, s2, t4, t4
  139. .align 3
  140. .L25:
  141. andi I, N, 3
  142. blez I, .L999
  143. NOP
  144. .align 3
  145. .L26:
  146. LD a1, 0 * SIZE(X)
  147. LD a2, 1 * SIZE(X)
  148. daddiu I, I, -1
  149. cvt.d.s t1, a1
  150. cvt.d.s t2, a2
  151. madd.d s1, s1, t1, t1
  152. daddu X, X, INCX
  153. bgtz I, .L26
  154. madd.d s2, s2, t2, t2
  155. .align 3
  156. .L999:
  157. add.d s1, s1, s2
  158. sqrt.d s1, s1
  159. j $31
  160. cvt.s.d s1, s1
  161. EPILOGUE