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.

zdot_hummer.S 10 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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. #if defined(F_INTERFACE) && defined(F_INTERFACE_F2C)
  41. #define RESULT r3
  42. #define N r4
  43. #define X r5
  44. #define INCX r6
  45. #define Y r7
  46. #define INCY r8
  47. #else
  48. #define N r3
  49. #define X r4
  50. #define INCX r5
  51. #define Y r6
  52. #define INCY r7
  53. #endif
  54. #define INCX2 r9
  55. #define INCY2 r10
  56. #define C1 f1
  57. #define C2 f2
  58. #define C3 f0
  59. #define C4 f3
  60. #define C5 f4
  61. #define C6 f5
  62. #define C7 f6
  63. #define C8 f7
  64. #define A1 f8
  65. #define A2 f9
  66. #define A3 f10
  67. #define A4 f11
  68. #define A5 f12
  69. #define A6 f13
  70. #define A7 f14
  71. #define A8 f15
  72. #define B1 f16
  73. #define B2 f17
  74. #define B3 f18
  75. #define B4 f19
  76. #define B5 f20
  77. #define B6 f21
  78. #define B7 f22
  79. #define B8 f23
  80. #ifndef CONJ
  81. #define FXCXNPMA fxcxnpma
  82. #else
  83. #define FXCXNPMA fxcxnsma
  84. #endif
  85. PROLOGUE
  86. PROFCODE
  87. li r10, -16
  88. stfpdux f14, SP, r10
  89. stfpdux f15, SP, r10
  90. stfpdux f16, SP, r10
  91. stfpdux f17, SP, r10
  92. stfpdux f18, SP, r10
  93. stfpdux f19, SP, r10
  94. stfpdux f20, SP, r10
  95. stfpdux f21, SP, r10
  96. stfpdux f22, SP, r10
  97. stfpdux f23, SP, r10
  98. li r10, 0
  99. stwu r10, -4(SP)
  100. stwu r10, -4(SP)
  101. stwu r10, -4(SP)
  102. stwu r10, -4(SP)
  103. #ifdef F_INTERFACE
  104. LDINT N, 0(N)
  105. LDINT INCX, 0(INCX)
  106. LDINT INCY, 0(INCY)
  107. #endif
  108. lfpdx C1, SP, r10 # Zero clear
  109. slwi INCX, INCX, BASE_SHIFT
  110. add INCX2, INCX, INCX
  111. fpmr C2, C1
  112. slwi INCY, INCY, BASE_SHIFT
  113. fpmr C3, C1
  114. add INCY2, INCY, INCY
  115. fpmr C4, C1
  116. fpmr C5, C1
  117. fpmr C6, C1
  118. fpmr C7, C1
  119. fpmr C8, C1
  120. cmpwi cr0, N, 0
  121. ble LL(99)
  122. #ifdef F_INTERFACE
  123. cmpwi cr0, INCX, 0
  124. bge+ LL(05)
  125. subi r0, N, 1
  126. mullw r0, r0, INCX2
  127. sub X, X, r0
  128. .align 4
  129. LL(05):
  130. cmpwi cr0, INCY, 0
  131. bge+ LL(06)
  132. subi r0, N, 1
  133. mullw r0, r0, INCY2
  134. sub Y, Y, r0
  135. .align 4
  136. LL(06):
  137. #endif
  138. andi. r0, X, 2 * SIZE - 1
  139. bne LL(100)
  140. andi. r0, Y, 2 * SIZE - 1
  141. bne LL(100)
  142. /* X is aligned, Y is aligned */
  143. LL(10):
  144. sub X, X, INCX2
  145. sub Y, Y, INCY2
  146. srawi. r0, N, 3
  147. mtspr CTR, r0
  148. beq- LL(15)
  149. LFPDUX A1, X, INCX2
  150. LFPDUX B1, Y, INCY2
  151. LFPDUX A2, X, INCX2
  152. LFPDUX B2, Y, INCY2
  153. LFPDUX A3, X, INCX2
  154. LFPDUX B3, Y, INCY2
  155. LFPDUX A4, X, INCX2
  156. LFPDUX B4, Y, INCY2
  157. LFPDUX A5, X, INCX2
  158. LFPDUX B5, Y, INCY2
  159. LFPDUX A6, X, INCX2
  160. LFPDUX B6, Y, INCY2
  161. LFPDUX A7, X, INCX2
  162. LFPDUX B7, Y, INCY2
  163. LFPDUX A8, X, INCX2
  164. bdz LL(14)
  165. .align 4
  166. LL(13):
  167. fxcpmadd C1, A1, B1, C1
  168. LFPDUX B8, Y, INCY2
  169. FXCXNPMA C2, A1, B1, C2
  170. LFPDUX A1, X, INCX2
  171. fxcpmadd C3, A2, B2, C3
  172. LFPDUX B1, Y, INCY2
  173. FXCXNPMA C4, A2, B2, C4
  174. LFPDUX A2, X, INCX2
  175. fxcpmadd C5, A3, B3, C5
  176. LFPDUX B2, Y, INCY2
  177. FXCXNPMA C6, A3, B3, C6
  178. LFPDUX A3, X, INCX2
  179. fxcpmadd C7, A4, B4, C7
  180. LFPDUX B3, Y, INCY2
  181. FXCXNPMA C8, A4, B4, C8
  182. LFPDUX A4, X, INCX2
  183. fxcpmadd C1, A5, B5, C1
  184. LFPDUX B4, Y, INCY2
  185. FXCXNPMA C2, A5, B5, C2
  186. LFPDUX A5, X, INCX2
  187. fxcpmadd C3, A6, B6, C3
  188. LFPDUX B5, Y, INCY2
  189. FXCXNPMA C4, A6, B6, C4
  190. LFPDUX A6, X, INCX2
  191. fxcpmadd C5, A7, B7, C5
  192. LFPDUX B6, Y, INCY2
  193. FXCXNPMA C6, A7, B7, C6
  194. LFPDUX A7, X, INCX2
  195. fxcpmadd C7, A8, B8, C7
  196. LFPDUX B7, Y, INCY2
  197. FXCXNPMA C8, A8, B8, C8
  198. LFPDUX A8, X, INCX2
  199. bdnz LL(13)
  200. .align 4
  201. LL(14):
  202. LFPDUX B8, Y, INCY2
  203. fxcpmadd C1, A1, B1, C1
  204. FXCXNPMA C2, A1, B1, C2
  205. fxcpmadd C3, A2, B2, C3
  206. FXCXNPMA C4, A2, B2, C4
  207. fxcpmadd C5, A3, B3, C5
  208. FXCXNPMA C6, A3, B3, C6
  209. fxcpmadd C7, A4, B4, C7
  210. FXCXNPMA C8, A4, B4, C8
  211. fxcpmadd C1, A5, B5, C1
  212. FXCXNPMA C2, A5, B5, C2
  213. fxcpmadd C3, A6, B6, C3
  214. FXCXNPMA C4, A6, B6, C4
  215. fxcpmadd C5, A7, B7, C5
  216. FXCXNPMA C6, A7, B7, C6
  217. fxcpmadd C7, A8, B8, C7
  218. FXCXNPMA C8, A8, B8, C8
  219. .align 4
  220. LL(15):
  221. andi. r0, N, 7
  222. beq LL(99)
  223. andi. r0, N, 4
  224. beq LL(16)
  225. LFPDUX A1, X, INCX2
  226. LFPDUX B1, Y, INCY2
  227. LFPDUX A2, X, INCX2
  228. LFPDUX B2, Y, INCY2
  229. LFPDUX A3, X, INCX2
  230. LFPDUX B3, Y, INCY2
  231. LFPDUX A4, X, INCX2
  232. LFPDUX B4, Y, INCY2
  233. fxcpmadd C1, A1, B1, C1
  234. FXCXNPMA C2, A1, B1, C2
  235. fxcpmadd C3, A2, B2, C3
  236. FXCXNPMA C4, A2, B2, C4
  237. fxcpmadd C5, A3, B3, C5
  238. FXCXNPMA C6, A3, B3, C6
  239. fxcpmadd C7, A4, B4, C7
  240. FXCXNPMA C8, A4, B4, C8
  241. .align 4
  242. LL(16):
  243. andi. r0, N, 2
  244. beq LL(17)
  245. LFPDUX A1, X, INCX2
  246. LFPDUX B1, Y, INCY2
  247. LFPDUX A2, X, INCX2
  248. LFPDUX B2, Y, INCY2
  249. fxcpmadd C1, A1, B1, C1
  250. FXCXNPMA C2, A1, B1, C2
  251. fxcpmadd C3, A2, B2, C3
  252. FXCXNPMA C4, A2, B2, C4
  253. .align 4
  254. LL(17):
  255. andi. r0, N, 1
  256. beq LL(99)
  257. LFPDUX A1, X, INCX2
  258. LFPDUX B1, Y, INCY2
  259. fxcpmadd C1, A1, B1, C1
  260. FXCXNPMA C2, A1, B1, C2
  261. .align 4
  262. LL(99):
  263. li r10, 16
  264. fpadd C1, C1, C5
  265. lfpdux f23, SP, r10
  266. fpadd C2, C2, C6
  267. lfpdux f22, SP, r10
  268. fpadd C3, C3, C7
  269. lfpdux f21, SP, r10
  270. fpadd C4, C4, C8
  271. lfpdux f20, SP, r10
  272. lfpdux f19, SP, r10
  273. lfpdux f18, SP, r10
  274. fpadd C1, C1, C3
  275. lfpdux f17, SP, r10
  276. fpadd C2, C2, C4
  277. lfpdux f16, SP, r10
  278. fpadd C1, C1, C2
  279. lfpdux f15, SP, r10
  280. lfpdux f14, SP, r10
  281. fsmtp C2, C1
  282. #if defined(F_INTERFACE) && defined(F_INTERFACE_F2C)
  283. STFD C1, 0 * SIZE(RESULT)
  284. STFD C2, 1 * SIZE(RESULT)
  285. #endif
  286. addi SP, SP, 16
  287. blr
  288. .align 4
  289. /* X is aligned, Y is NOT aligned */
  290. LL(100):
  291. subi INCX2, INCX2, SIZE
  292. subi INCY2, INCY2, SIZE
  293. li INCX, SIZE
  294. li INCY, SIZE
  295. sub X, X, INCX2
  296. sub Y, Y, INCY2
  297. srawi. r0, N, 2
  298. mtspr CTR, r0
  299. beq- LL(105)
  300. LFDUX A1, X, INCX2
  301. LFDUX B1, Y, INCY2
  302. LFDUX A2, X, INCX
  303. LFDUX B2, Y, INCY
  304. LFDUX A3, X, INCX2
  305. LFDUX B3, Y, INCY2
  306. LFDUX A4, X, INCX
  307. LFDUX B4, Y, INCY
  308. LFDUX A5, X, INCX2
  309. LFDUX B5, Y, INCY2
  310. LFDUX A6, X, INCX
  311. LFDUX B6, Y, INCY
  312. LFDUX A7, X, INCX2
  313. LFDUX B7, Y, INCY2
  314. LFDUX A8, X, INCX
  315. bdz LL(104)
  316. .align 4
  317. LL(103):
  318. fmadd C1, A1, B1, C1
  319. LFDUX B8, Y, INCY
  320. fmadd C2, A1, B2, C2
  321. LFDUX A1, X, INCX2
  322. fmadd C3, A2, B1, C3
  323. LFDUX B1, Y, INCY2
  324. fmadd C4, A2, B2, C4
  325. LFDUX A2, X, INCX
  326. fmadd C5, A3, B3, C5
  327. LFDUX B2, Y, INCY
  328. fmadd C6, A3, B4, C6
  329. LFDUX A3, X, INCX2
  330. fmadd C7, A4, B3, C7
  331. LFDUX B3, Y, INCY2
  332. fmadd C8, A4, B4, C8
  333. LFDUX A4, X, INCX
  334. fmadd C1, A5, B5, C1
  335. LFDUX B4, Y, INCY
  336. fmadd C2, A5, B6, C2
  337. LFDUX A5, X, INCX2
  338. fmadd C3, A6, B5, C3
  339. LFDUX B5, Y, INCY2
  340. fmadd C4, A6, B6, C4
  341. LFDUX A6, X, INCX
  342. fmadd C5, A7, B7, C5
  343. LFDUX B6, Y, INCY
  344. fmadd C6, A7, B8, C6
  345. LFDUX A7, X, INCX2
  346. fmadd C7, A8, B7, C7
  347. LFDUX B7, Y, INCY2
  348. fmadd C8, A8, B8, C8
  349. LFDUX A8, X, INCX
  350. bdnz LL(103)
  351. .align 4
  352. LL(104):
  353. LFDUX B8, Y, INCY
  354. fmadd C1, A1, B1, C1
  355. fmadd C2, A1, B2, C2
  356. fmadd C3, A2, B1, C3
  357. fmadd C4, A2, B2, C4
  358. fmadd C5, A3, B3, C5
  359. fmadd C6, A3, B4, C6
  360. fmadd C7, A4, B3, C7
  361. fmadd C8, A4, B4, C8
  362. fmadd C1, A5, B5, C1
  363. fmadd C2, A5, B6, C2
  364. fmadd C3, A6, B5, C3
  365. fmadd C4, A6, B6, C4
  366. fmadd C5, A7, B7, C5
  367. fmadd C6, A7, B8, C6
  368. fmadd C7, A8, B7, C7
  369. fmadd C8, A8, B8, C8
  370. .align 4
  371. LL(105):
  372. andi. r0, N, 3
  373. beq LL(999)
  374. andi. r0, N, 2
  375. beq LL(107)
  376. LFDUX A1, X, INCX2
  377. LFDUX B1, Y, INCY2
  378. LFDUX A2, X, INCX
  379. LFDUX B2, Y, INCY
  380. LFDUX A3, X, INCX2
  381. LFDUX B3, Y, INCY2
  382. LFDUX A4, X, INCX
  383. LFDUX B4, Y, INCY
  384. fmadd C1, A1, B1, C1
  385. fmadd C2, A1, B2, C2
  386. fmadd C3, A2, B1, C3
  387. fmadd C4, A2, B2, C4
  388. fmadd C5, A3, B3, C5
  389. fmadd C6, A3, B4, C6
  390. fmadd C7, A4, B3, C7
  391. fmadd C8, A4, B4, C8
  392. .align 4
  393. LL(107):
  394. andi. r0, N, 1
  395. beq LL(999)
  396. LFDUX A1, X, INCX2
  397. LFDUX B1, Y, INCY2
  398. LFDUX A2, X, INCX
  399. LFDUX B2, Y, INCY
  400. fmadd C1, A1, B1, C1
  401. fmadd C2, A1, B2, C2
  402. fmadd C3, A2, B1, C3
  403. fmadd C4, A2, B2, C4
  404. .align 4
  405. LL(999):
  406. li r10, 16
  407. fadd C1, C1, C5
  408. lfpdux f23, SP, r10
  409. fadd C2, C2, C6
  410. lfpdux f22, SP, r10
  411. fadd C3, C3, C7
  412. lfpdux f21, SP, r10
  413. fadd C4, C4, C8
  414. lfpdux f20, SP, r10
  415. lfpdux f19, SP, r10
  416. lfpdux f18, SP, r10
  417. lfpdux f17, SP, r10
  418. lfpdux f16, SP, r10
  419. #ifndef CONJ
  420. FSUB C1, C1, C4
  421. FADD C2, C2, C3
  422. #else
  423. FADD C1, C1, C4
  424. FSUB C2, C2, C3
  425. #endif
  426. lfpdux f15, SP, r10
  427. lfpdux f14, SP, r10
  428. #if defined(F_INTERFACE) && defined(F_INTERFACE_F2C)
  429. STFD C1, 0 * SIZE(RESULT)
  430. STFD C2, 1 * SIZE(RESULT)
  431. #endif
  432. addi SP, SP, 16
  433. blr
  434. EPILOGUE