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.

cscal.S 5.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. .set noat
  39. .set noreorder
  40. #define ASSEMBLER
  41. #include "common.h"
  42. #include "version.h"
  43. .globl NAME
  44. .ent NAME
  45. NAME:
  46. #ifdef PROFILE
  47. ldgp $gp, 0($27)
  48. lda $28, _mcount
  49. jsr $28, ($28), _mcount
  50. #endif
  51. #ifndef C_INTERFACE
  52. ldl $16, 0($16) # n
  53. mov $18, $20 # Store Address
  54. ldl $19, 0($19) # incx
  55. nop
  56. LD $f1, 0($17) # alpha
  57. #else
  58. mov $18, $20 # Store Address
  59. fmov $f17, $f1 # alpha
  60. #endif
  61. #ifndef PROFILE
  62. .prologue 0
  63. #else
  64. .prologue 1
  65. #endif
  66. sra $16, 1, $21 # 4-unrolling
  67. ble $16, $End
  68. lda $23, -1($19)
  69. ble $19, $End
  70. bgt $23, $INC_NOT_1
  71. .align 4
  72. ble $21, $Sub
  73. lda $21, -1($21)
  74. LD $f10, 0*SIZE($18)
  75. LD $f11, 1*SIZE($18)
  76. LD $f12, 2*SIZE($18)
  77. LD $f13, 3*SIZE($18)
  78. lda $18, 4*SIZE($18)
  79. ble $21, $MainRemain
  80. .align 4
  81. $MainLoop:
  82. MUL $f10, $f1, $f20
  83. LD $f10, 0*SIZE($18)
  84. MUL $f11, $f1, $f21
  85. LD $f11, 1*SIZE($18)
  86. MUL $f12, $f1, $f22
  87. LD $f12, 2*SIZE($18)
  88. MUL $f13, $f1, $f23
  89. LD $f13, 3*SIZE($18)
  90. lda $18, 4*SIZE($18)
  91. lda $21, -1($21)
  92. ST $f20, 0*SIZE($20)
  93. ST $f21, 1*SIZE($20)
  94. ST $f22, 2*SIZE($20)
  95. ST $f23, 3*SIZE($20)
  96. lda $20, 4*SIZE($20)
  97. bgt $21, $MainLoop
  98. .align 4
  99. $MainRemain:
  100. MUL $f10, $f1, $f20
  101. MUL $f11, $f1, $f21
  102. MUL $f12, $f1, $f22
  103. MUL $f13, $f1, $f23
  104. ST $f20, 0*SIZE($20)
  105. ST $f21, 1*SIZE($20)
  106. ST $f22, 2*SIZE($20)
  107. ST $f23, 3*SIZE($20)
  108. lda $20, 4*SIZE($20)
  109. .align 4
  110. $Sub:
  111. blbc $16, $End
  112. LD $f10, 0*SIZE($18)
  113. LD $f11, 1*SIZE($18)
  114. MUL $f10, $f1, $f20
  115. MUL $f11, $f1, $f21
  116. ST $f20, 0*SIZE($20)
  117. ST $f21, 1*SIZE($20)
  118. .align 4
  119. $End:
  120. ret
  121. .align 4
  122. $INC_NOT_1:
  123. addl $19, $19, $19
  124. ble $21, $INC_Sub
  125. lda $21, -1($21)
  126. LD $f10, 0*SIZE($18)
  127. LD $f11, 1*SIZE($18)
  128. SXADDQ $19, $18, $18
  129. LD $f12, 0*SIZE($18)
  130. LD $f13, 1*SIZE($18)
  131. SXADDQ $19, $18, $18
  132. ble $21, $INC_MainRemain
  133. .align 4
  134. $INC_MainLoop:
  135. MUL $f10, $f1, $f20
  136. LD $f10, 0*SIZE($18)
  137. MUL $f11, $f1, $f21
  138. LD $f11, 1*SIZE($18)
  139. SXADDQ $19, $18, $18
  140. MUL $f12, $f1, $f22
  141. LD $f12, 0*SIZE($18)
  142. MUL $f13, $f1, $f23
  143. LD $f13, 1*SIZE($18)
  144. SXADDQ $19, $18, $18
  145. ST $f20, 0*SIZE($20)
  146. lda $21, -1($21)
  147. ST $f21, 1*SIZE($20)
  148. SXADDQ $19, $20, $20
  149. ST $f22, 0*SIZE($20)
  150. ST $f23, 1*SIZE($20)
  151. SXADDQ $19, $20, $20
  152. unop
  153. bgt $21, $INC_MainLoop
  154. .align 4
  155. $INC_MainRemain:
  156. MUL $f10, $f1, $f20
  157. MUL $f11, $f1, $f21
  158. MUL $f12, $f1, $f22
  159. MUL $f13, $f1, $f23
  160. ST $f20, 0*SIZE($20)
  161. ST $f21, 1*SIZE($20)
  162. SXADDQ $19, $20, $20
  163. ST $f22, 0*SIZE($20)
  164. ST $f23, 1*SIZE($20)
  165. SXADDQ $19, $20, $20
  166. .align 4
  167. $INC_Sub:
  168. blbc $16, $INC_End
  169. LD $f10, 0*SIZE($18)
  170. LD $f11, 1*SIZE($18)
  171. MUL $f10, $f1, $f20
  172. MUL $f11, $f1, $f21
  173. ST $f20, 0*SIZE($20)
  174. ST $f21, 1*SIZE($20)
  175. .align 4
  176. $INC_End:
  177. ret
  178. .end NAME
  179. .ident VERSION