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.

scal.S 8.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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 r3
  41. #define XX r4
  42. #define PREA r5
  43. #if defined(linux) || defined(__FreeBSD__)
  44. #ifndef __64BIT__
  45. #define X r6
  46. #define INCX r7
  47. #else
  48. #define X r7
  49. #define INCX r8
  50. #endif
  51. #endif
  52. #if defined(_AIX) || defined(__APPLE__)
  53. #if !defined(__64BIT__) && defined(DOUBLE)
  54. #define X r8
  55. #define INCX r9
  56. #else
  57. #define X r7
  58. #define INCX r8
  59. #endif
  60. #endif
  61. #define FZERO f0
  62. #define ALPHA f1
  63. PROLOGUE
  64. PROFCODE
  65. addi SP, SP, -8
  66. li r0, 0
  67. stw r0, 0(SP)
  68. lfs FZERO, 0(SP)
  69. addi SP, SP, 8
  70. slwi INCX, INCX, BASE_SHIFT
  71. li PREA, L1_PREFETCHSIZE
  72. cmpwi cr0, N, 0
  73. blelr- cr0
  74. fcmpu cr0, FZERO, ALPHA
  75. bne- cr0, LL(A1I1)
  76. cmpwi cr0, INCX, SIZE
  77. bne- cr0, LL(A0IN)
  78. srawi. r0, N, 4
  79. mtspr CTR, r0
  80. beq- cr0, LL(A0I1_Remain)
  81. .align 4
  82. LL(A0I1_kernel):
  83. STFD FZERO, 0 * SIZE(X)
  84. STFD FZERO, 1 * SIZE(X)
  85. STFD FZERO, 2 * SIZE(X)
  86. STFD FZERO, 3 * SIZE(X)
  87. STFD FZERO, 4 * SIZE(X)
  88. STFD FZERO, 5 * SIZE(X)
  89. STFD FZERO, 6 * SIZE(X)
  90. STFD FZERO, 7 * SIZE(X)
  91. STFD FZERO, 8 * SIZE(X)
  92. STFD FZERO, 9 * SIZE(X)
  93. STFD FZERO, 10 * SIZE(X)
  94. STFD FZERO, 11 * SIZE(X)
  95. STFD FZERO, 12 * SIZE(X)
  96. STFD FZERO, 13 * SIZE(X)
  97. STFD FZERO, 14 * SIZE(X)
  98. STFD FZERO, 15 * SIZE(X)
  99. addi X, X, 16 * SIZE
  100. bdnz LL(A0I1_kernel)
  101. .align 4
  102. LL(A0I1_Remain):
  103. andi. r0, N, 15
  104. mtspr CTR, r0
  105. beqlr+
  106. .align 4
  107. LL(A0I1_RemainKernel):
  108. STFD FZERO, 0 * SIZE(X)
  109. addi X, X, 1 * SIZE
  110. bdnz LL(A0I1_RemainKernel)
  111. blr
  112. .align 4
  113. LL(A0IN):
  114. srawi. r0, N, 3
  115. mtspr CTR, r0
  116. beq- LL(A0IN_Remain)
  117. .align 4
  118. LL(A0IN_Kernel):
  119. dcbtst X, PREA
  120. STFD FZERO, 0 * SIZE(X)
  121. add X, X, INCX
  122. STFD FZERO, 0 * SIZE(X)
  123. add X, X, INCX
  124. STFD FZERO, 0 * SIZE(X)
  125. add X, X, INCX
  126. STFD FZERO, 0 * SIZE(X)
  127. add X, X, INCX
  128. STFD FZERO, 0 * SIZE(X)
  129. add X, X, INCX
  130. STFD FZERO, 0 * SIZE(X)
  131. add X, X, INCX
  132. STFD FZERO, 0 * SIZE(X)
  133. add X, X, INCX
  134. STFD FZERO, 0 * SIZE(X)
  135. add X, X, INCX
  136. bdnz LL(A0IN_Kernel)
  137. .align 4
  138. LL(A0IN_Remain):
  139. andi. r0, N, 7
  140. mtspr CTR, r0
  141. beqlr+
  142. .align 4
  143. LL(A0IN_RemainKernel):
  144. STFD FZERO, 0 * SIZE(X)
  145. add X, X, INCX
  146. bdnz LL(A0IN_RemainKernel)
  147. blr
  148. .align 4
  149. LL(A1I1):
  150. cmpwi cr0, INCX, SIZE
  151. bne- LL(A1IN)
  152. mr XX, X
  153. srawi. r0, N, 4
  154. mtspr CTR, r0
  155. beq+ LL(A1I1_Remain)
  156. LFD f2, 0 * SIZE(X)
  157. LFD f3, 1 * SIZE(X)
  158. LFD f4, 2 * SIZE(X)
  159. LFD f5, 3 * SIZE(X)
  160. LFD f6, 4 * SIZE(X)
  161. LFD f7, 5 * SIZE(X)
  162. LFD f8, 6 * SIZE(X)
  163. LFD f9, 7 * SIZE(X)
  164. bdz LL(13)
  165. .align 4
  166. LL(A1I1_kernel):
  167. FMUL f10, ALPHA, f2
  168. FMUL f11, ALPHA, f3
  169. FMUL f12, ALPHA, f4
  170. FMUL f13, ALPHA, f5
  171. LFD f2, 8 * SIZE(X)
  172. LFD f3, 9 * SIZE(X)
  173. LFD f4, 10 * SIZE(X)
  174. LFD f5, 11 * SIZE(X)
  175. STFD f10, 0 * SIZE(X)
  176. STFD f11, 1 * SIZE(X)
  177. STFD f12, 2 * SIZE(X)
  178. STFD f13, 3 * SIZE(X)
  179. FMUL f10, ALPHA, f6
  180. FMUL f11, ALPHA, f7
  181. FMUL f12, ALPHA, f8
  182. FMUL f13, ALPHA, f9
  183. LFD f6, 12 * SIZE(X)
  184. LFD f7, 13 * SIZE(X)
  185. LFD f8, 14 * SIZE(X)
  186. LFD f9, 15 * SIZE(X)
  187. STFD f10, 4 * SIZE(X)
  188. STFD f11, 5 * SIZE(X)
  189. STFD f12, 6 * SIZE(X)
  190. STFD f13, 7 * SIZE(X)
  191. FMUL f10, ALPHA, f2
  192. FMUL f11, ALPHA, f3
  193. FMUL f12, ALPHA, f4
  194. FMUL f13, ALPHA, f5
  195. LFD f2, 16 * SIZE(X)
  196. LFD f3, 17 * SIZE(X)
  197. LFD f4, 18 * SIZE(X)
  198. LFD f5, 19 * SIZE(X)
  199. STFD f10, 8 * SIZE(X)
  200. STFD f11, 9 * SIZE(X)
  201. STFD f12, 10 * SIZE(X)
  202. STFD f13, 11 * SIZE(X)
  203. FMUL f10, ALPHA, f6
  204. FMUL f11, ALPHA, f7
  205. FMUL f12, ALPHA, f8
  206. FMUL f13, ALPHA, f9
  207. LFD f6, 20 * SIZE(X)
  208. LFD f7, 21 * SIZE(X)
  209. LFD f8, 22 * SIZE(X)
  210. LFD f9, 23 * SIZE(X)
  211. STFD f10, 12 * SIZE(X)
  212. STFD f11, 13 * SIZE(X)
  213. STFD f12, 14 * SIZE(X)
  214. STFD f13, 15 * SIZE(X)
  215. addi X, X, 16 * SIZE
  216. dcbtst X, PREA
  217. bdnz LL(A1I1_kernel)
  218. .align 4
  219. LL(13):
  220. FMUL f10, ALPHA, f2
  221. FMUL f11, ALPHA, f3
  222. FMUL f12, ALPHA, f4
  223. FMUL f13, ALPHA, f5
  224. LFD f2, 8 * SIZE(X)
  225. LFD f3, 9 * SIZE(X)
  226. LFD f4, 10 * SIZE(X)
  227. LFD f5, 11 * SIZE(X)
  228. STFD f10, 0 * SIZE(X)
  229. STFD f11, 1 * SIZE(X)
  230. STFD f12, 2 * SIZE(X)
  231. STFD f13, 3 * SIZE(X)
  232. FMUL f10, ALPHA, f6
  233. FMUL f11, ALPHA, f7
  234. FMUL f12, ALPHA, f8
  235. FMUL f13, ALPHA, f9
  236. LFD f6, 12 * SIZE(X)
  237. LFD f7, 13 * SIZE(X)
  238. LFD f8, 14 * SIZE(X)
  239. LFD f9, 15 * SIZE(X)
  240. STFD f10, 4 * SIZE(X)
  241. STFD f11, 5 * SIZE(X)
  242. STFD f12, 6 * SIZE(X)
  243. STFD f13, 7 * SIZE(X)
  244. FMUL f10, ALPHA, f2
  245. FMUL f11, ALPHA, f3
  246. FMUL f12, ALPHA, f4
  247. FMUL f13, ALPHA, f5
  248. STFD f10, 8 * SIZE(X)
  249. STFD f11, 9 * SIZE(X)
  250. STFD f12, 10 * SIZE(X)
  251. STFD f13, 11 * SIZE(X)
  252. FMUL f10, ALPHA, f6
  253. FMUL f11, ALPHA, f7
  254. FMUL f12, ALPHA, f8
  255. FMUL f13, ALPHA, f9
  256. STFD f10, 12 * SIZE(X)
  257. STFD f11, 13 * SIZE(X)
  258. STFD f12, 14 * SIZE(X)
  259. STFD f13, 15 * SIZE(X)
  260. addi X, X, 16 * SIZE
  261. .align 4
  262. LL(A1I1_Remain):
  263. andi. r0, N, 15
  264. mtspr CTR, r0
  265. beqlr+
  266. .align 4
  267. LL(A1I1_RemainKernel):
  268. LFD f2, 0 * SIZE(X)
  269. FMUL f2, ALPHA, f2
  270. STFD f2, 0 * SIZE(X)
  271. addi X, X, 1 * SIZE
  272. bdnz LL(A1I1_RemainKernel)
  273. blr
  274. .align 4
  275. LL(A1IN):
  276. mr XX, X
  277. srawi. r0, N, 3
  278. mtspr CTR, r0
  279. beq- LL(A1IN_Remain)
  280. .align 4
  281. LL(A1IN_Kernel):
  282. LFD f2, 0 * SIZE(XX)
  283. add XX, XX, INCX
  284. LFD f3, 0 * SIZE(XX)
  285. add XX, XX, INCX
  286. LFD f4, 0 * SIZE(XX)
  287. add XX, XX, INCX
  288. LFD f5, 0 * SIZE(XX)
  289. add XX, XX, INCX
  290. FMUL f2, ALPHA, f2
  291. FMUL f3, ALPHA, f3
  292. FMUL f4, ALPHA, f4
  293. FMUL f5, ALPHA, f5
  294. LFD f6, 0 * SIZE(XX)
  295. add XX, XX, INCX
  296. LFD f7, 0 * SIZE(XX)
  297. add XX, XX, INCX
  298. LFD f8, 0 * SIZE(XX)
  299. add XX, XX, INCX
  300. LFD f9, 0 * SIZE(XX)
  301. add XX, XX, INCX
  302. FMUL f6, ALPHA, f6
  303. FMUL f7, ALPHA, f7
  304. FMUL f8, ALPHA, f8
  305. FMUL f9, ALPHA, f9
  306. STFD f2, 0 * SIZE(X)
  307. add X, X, INCX
  308. STFD f3, 0 * SIZE(X)
  309. add X, X, INCX
  310. STFD f4, 0 * SIZE(X)
  311. add X, X, INCX
  312. STFD f5, 0 * SIZE(X)
  313. add X, X, INCX
  314. STFD f6, 0 * SIZE(X)
  315. add X, X, INCX
  316. STFD f7, 0 * SIZE(X)
  317. add X, X, INCX
  318. STFD f8, 0 * SIZE(X)
  319. add X, X, INCX
  320. STFD f9, 0 * SIZE(X)
  321. add X, X, INCX
  322. bdnz LL(A1IN_Kernel)
  323. .align 4
  324. LL(A1IN_Remain):
  325. andi. r0, N, 7
  326. mtspr CTR, r0
  327. beqlr+
  328. .align 4
  329. LL(A1IN_RemainKernel):
  330. LFD f2, 0 * SIZE(XX)
  331. add XX, XX, INCX
  332. FMUL f2, ALPHA, f2
  333. STFD f2, 0 * SIZE(X)
  334. add X, X, INCX
  335. bdnz LL(A1IN_RemainKernel)
  336. blr
  337. EPILOGUE