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