xor.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * arch/sparc64/lib/xor.S
  4. *
  5. * High speed xor_block operation for RAID4/5 utilizing the
  6. * UltraSparc Visual Instruction Set and Niagara store-init/twin-load.
  7. *
  8. * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  9. * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  10. */
  11. #include <linux/linkage.h>
  12. #include <asm/visasm.h>
  13. #include <asm/asi.h>
  14. #include <asm/dcu.h>
  15. #include <asm/spitfire.h>
  16. #include <asm/export.h>
  17. /*
  18. * Requirements:
  19. * !(((long)dest | (long)sourceN) & (64 - 1)) &&
  20. * !(len & 127) && len >= 256
  21. */
  22. .text
  23. /* VIS versions. */
  24. ENTRY(xor_vis_2)
  25. rd %fprs, %o5
  26. andcc %o5, FPRS_FEF|FPRS_DU, %g0
  27. be,pt %icc, 0f
  28. sethi %hi(VISenter), %g1
  29. jmpl %g1 + %lo(VISenter), %g7
  30. add %g7, 8, %g7
  31. 0: wr %g0, FPRS_FEF, %fprs
  32. rd %asi, %g1
  33. wr %g0, ASI_BLK_P, %asi
  34. membar #LoadStore|#StoreLoad|#StoreStore
  35. sub %o0, 128, %o0
  36. ldda [%o1] %asi, %f0
  37. ldda [%o2] %asi, %f16
  38. 2: ldda [%o1 + 64] %asi, %f32
  39. fxor %f0, %f16, %f16
  40. fxor %f2, %f18, %f18
  41. fxor %f4, %f20, %f20
  42. fxor %f6, %f22, %f22
  43. fxor %f8, %f24, %f24
  44. fxor %f10, %f26, %f26
  45. fxor %f12, %f28, %f28
  46. fxor %f14, %f30, %f30
  47. stda %f16, [%o1] %asi
  48. ldda [%o2 + 64] %asi, %f48
  49. ldda [%o1 + 128] %asi, %f0
  50. fxor %f32, %f48, %f48
  51. fxor %f34, %f50, %f50
  52. add %o1, 128, %o1
  53. fxor %f36, %f52, %f52
  54. add %o2, 128, %o2
  55. fxor %f38, %f54, %f54
  56. subcc %o0, 128, %o0
  57. fxor %f40, %f56, %f56
  58. fxor %f42, %f58, %f58
  59. fxor %f44, %f60, %f60
  60. fxor %f46, %f62, %f62
  61. stda %f48, [%o1 - 64] %asi
  62. bne,pt %xcc, 2b
  63. ldda [%o2] %asi, %f16
  64. ldda [%o1 + 64] %asi, %f32
  65. fxor %f0, %f16, %f16
  66. fxor %f2, %f18, %f18
  67. fxor %f4, %f20, %f20
  68. fxor %f6, %f22, %f22
  69. fxor %f8, %f24, %f24
  70. fxor %f10, %f26, %f26
  71. fxor %f12, %f28, %f28
  72. fxor %f14, %f30, %f30
  73. stda %f16, [%o1] %asi
  74. ldda [%o2 + 64] %asi, %f48
  75. membar #Sync
  76. fxor %f32, %f48, %f48
  77. fxor %f34, %f50, %f50
  78. fxor %f36, %f52, %f52
  79. fxor %f38, %f54, %f54
  80. fxor %f40, %f56, %f56
  81. fxor %f42, %f58, %f58
  82. fxor %f44, %f60, %f60
  83. fxor %f46, %f62, %f62
  84. stda %f48, [%o1 + 64] %asi
  85. membar #Sync|#StoreStore|#StoreLoad
  86. wr %g1, %g0, %asi
  87. retl
  88. wr %g0, 0, %fprs
  89. ENDPROC(xor_vis_2)
  90. EXPORT_SYMBOL(xor_vis_2)
  91. ENTRY(xor_vis_3)
  92. rd %fprs, %o5
  93. andcc %o5, FPRS_FEF|FPRS_DU, %g0
  94. be,pt %icc, 0f
  95. sethi %hi(VISenter), %g1
  96. jmpl %g1 + %lo(VISenter), %g7
  97. add %g7, 8, %g7
  98. 0: wr %g0, FPRS_FEF, %fprs
  99. rd %asi, %g1
  100. wr %g0, ASI_BLK_P, %asi
  101. membar #LoadStore|#StoreLoad|#StoreStore
  102. sub %o0, 64, %o0
  103. ldda [%o1] %asi, %f0
  104. ldda [%o2] %asi, %f16
  105. 3: ldda [%o3] %asi, %f32
  106. fxor %f0, %f16, %f48
  107. fxor %f2, %f18, %f50
  108. add %o1, 64, %o1
  109. fxor %f4, %f20, %f52
  110. fxor %f6, %f22, %f54
  111. add %o2, 64, %o2
  112. fxor %f8, %f24, %f56
  113. fxor %f10, %f26, %f58
  114. fxor %f12, %f28, %f60
  115. fxor %f14, %f30, %f62
  116. ldda [%o1] %asi, %f0
  117. fxor %f48, %f32, %f48
  118. fxor %f50, %f34, %f50
  119. fxor %f52, %f36, %f52
  120. fxor %f54, %f38, %f54
  121. add %o3, 64, %o3
  122. fxor %f56, %f40, %f56
  123. fxor %f58, %f42, %f58
  124. subcc %o0, 64, %o0
  125. fxor %f60, %f44, %f60
  126. fxor %f62, %f46, %f62
  127. stda %f48, [%o1 - 64] %asi
  128. bne,pt %xcc, 3b
  129. ldda [%o2] %asi, %f16
  130. ldda [%o3] %asi, %f32
  131. fxor %f0, %f16, %f48
  132. fxor %f2, %f18, %f50
  133. fxor %f4, %f20, %f52
  134. fxor %f6, %f22, %f54
  135. fxor %f8, %f24, %f56
  136. fxor %f10, %f26, %f58
  137. fxor %f12, %f28, %f60
  138. fxor %f14, %f30, %f62
  139. membar #Sync
  140. fxor %f48, %f32, %f48
  141. fxor %f50, %f34, %f50
  142. fxor %f52, %f36, %f52
  143. fxor %f54, %f38, %f54
  144. fxor %f56, %f40, %f56
  145. fxor %f58, %f42, %f58
  146. fxor %f60, %f44, %f60
  147. fxor %f62, %f46, %f62
  148. stda %f48, [%o1] %asi
  149. membar #Sync|#StoreStore|#StoreLoad
  150. wr %g1, %g0, %asi
  151. retl
  152. wr %g0, 0, %fprs
  153. ENDPROC(xor_vis_3)
  154. EXPORT_SYMBOL(xor_vis_3)
  155. ENTRY(xor_vis_4)
  156. rd %fprs, %o5
  157. andcc %o5, FPRS_FEF|FPRS_DU, %g0
  158. be,pt %icc, 0f
  159. sethi %hi(VISenter), %g1
  160. jmpl %g1 + %lo(VISenter), %g7
  161. add %g7, 8, %g7
  162. 0: wr %g0, FPRS_FEF, %fprs
  163. rd %asi, %g1
  164. wr %g0, ASI_BLK_P, %asi
  165. membar #LoadStore|#StoreLoad|#StoreStore
  166. sub %o0, 64, %o0
  167. ldda [%o1] %asi, %f0
  168. ldda [%o2] %asi, %f16
  169. 4: ldda [%o3] %asi, %f32
  170. fxor %f0, %f16, %f16
  171. fxor %f2, %f18, %f18
  172. add %o1, 64, %o1
  173. fxor %f4, %f20, %f20
  174. fxor %f6, %f22, %f22
  175. add %o2, 64, %o2
  176. fxor %f8, %f24, %f24
  177. fxor %f10, %f26, %f26
  178. fxor %f12, %f28, %f28
  179. fxor %f14, %f30, %f30
  180. ldda [%o4] %asi, %f48
  181. fxor %f16, %f32, %f32
  182. fxor %f18, %f34, %f34
  183. fxor %f20, %f36, %f36
  184. fxor %f22, %f38, %f38
  185. add %o3, 64, %o3
  186. fxor %f24, %f40, %f40
  187. fxor %f26, %f42, %f42
  188. fxor %f28, %f44, %f44
  189. fxor %f30, %f46, %f46
  190. ldda [%o1] %asi, %f0
  191. fxor %f32, %f48, %f48
  192. fxor %f34, %f50, %f50
  193. fxor %f36, %f52, %f52
  194. add %o4, 64, %o4
  195. fxor %f38, %f54, %f54
  196. fxor %f40, %f56, %f56
  197. fxor %f42, %f58, %f58
  198. subcc %o0, 64, %o0
  199. fxor %f44, %f60, %f60
  200. fxor %f46, %f62, %f62
  201. stda %f48, [%o1 - 64] %asi
  202. bne,pt %xcc, 4b
  203. ldda [%o2] %asi, %f16
  204. ldda [%o3] %asi, %f32
  205. fxor %f0, %f16, %f16
  206. fxor %f2, %f18, %f18
  207. fxor %f4, %f20, %f20
  208. fxor %f6, %f22, %f22
  209. fxor %f8, %f24, %f24
  210. fxor %f10, %f26, %f26
  211. fxor %f12, %f28, %f28
  212. fxor %f14, %f30, %f30
  213. ldda [%o4] %asi, %f48
  214. fxor %f16, %f32, %f32
  215. fxor %f18, %f34, %f34
  216. fxor %f20, %f36, %f36
  217. fxor %f22, %f38, %f38
  218. fxor %f24, %f40, %f40
  219. fxor %f26, %f42, %f42
  220. fxor %f28, %f44, %f44
  221. fxor %f30, %f46, %f46
  222. membar #Sync
  223. fxor %f32, %f48, %f48
  224. fxor %f34, %f50, %f50
  225. fxor %f36, %f52, %f52
  226. fxor %f38, %f54, %f54
  227. fxor %f40, %f56, %f56
  228. fxor %f42, %f58, %f58
  229. fxor %f44, %f60, %f60
  230. fxor %f46, %f62, %f62
  231. stda %f48, [%o1] %asi
  232. membar #Sync|#StoreStore|#StoreLoad
  233. wr %g1, %g0, %asi
  234. retl
  235. wr %g0, 0, %fprs
  236. ENDPROC(xor_vis_4)
  237. EXPORT_SYMBOL(xor_vis_4)
  238. ENTRY(xor_vis_5)
  239. save %sp, -192, %sp
  240. rd %fprs, %o5
  241. andcc %o5, FPRS_FEF|FPRS_DU, %g0
  242. be,pt %icc, 0f
  243. sethi %hi(VISenter), %g1
  244. jmpl %g1 + %lo(VISenter), %g7
  245. add %g7, 8, %g7
  246. 0: wr %g0, FPRS_FEF, %fprs
  247. rd %asi, %g1
  248. wr %g0, ASI_BLK_P, %asi
  249. membar #LoadStore|#StoreLoad|#StoreStore
  250. sub %i0, 64, %i0
  251. ldda [%i1] %asi, %f0
  252. ldda [%i2] %asi, %f16
  253. 5: ldda [%i3] %asi, %f32
  254. fxor %f0, %f16, %f48
  255. fxor %f2, %f18, %f50
  256. add %i1, 64, %i1
  257. fxor %f4, %f20, %f52
  258. fxor %f6, %f22, %f54
  259. add %i2, 64, %i2
  260. fxor %f8, %f24, %f56
  261. fxor %f10, %f26, %f58
  262. fxor %f12, %f28, %f60
  263. fxor %f14, %f30, %f62
  264. ldda [%i4] %asi, %f16
  265. fxor %f48, %f32, %f48
  266. fxor %f50, %f34, %f50
  267. fxor %f52, %f36, %f52
  268. fxor %f54, %f38, %f54
  269. add %i3, 64, %i3
  270. fxor %f56, %f40, %f56
  271. fxor %f58, %f42, %f58
  272. fxor %f60, %f44, %f60
  273. fxor %f62, %f46, %f62
  274. ldda [%i5] %asi, %f32
  275. fxor %f48, %f16, %f48
  276. fxor %f50, %f18, %f50
  277. add %i4, 64, %i4
  278. fxor %f52, %f20, %f52
  279. fxor %f54, %f22, %f54
  280. add %i5, 64, %i5
  281. fxor %f56, %f24, %f56
  282. fxor %f58, %f26, %f58
  283. fxor %f60, %f28, %f60
  284. fxor %f62, %f30, %f62
  285. ldda [%i1] %asi, %f0
  286. fxor %f48, %f32, %f48
  287. fxor %f50, %f34, %f50
  288. fxor %f52, %f36, %f52
  289. fxor %f54, %f38, %f54
  290. fxor %f56, %f40, %f56
  291. fxor %f58, %f42, %f58
  292. subcc %i0, 64, %i0
  293. fxor %f60, %f44, %f60
  294. fxor %f62, %f46, %f62
  295. stda %f48, [%i1 - 64] %asi
  296. bne,pt %xcc, 5b
  297. ldda [%i2] %asi, %f16
  298. ldda [%i3] %asi, %f32
  299. fxor %f0, %f16, %f48
  300. fxor %f2, %f18, %f50
  301. fxor %f4, %f20, %f52
  302. fxor %f6, %f22, %f54
  303. fxor %f8, %f24, %f56
  304. fxor %f10, %f26, %f58
  305. fxor %f12, %f28, %f60
  306. fxor %f14, %f30, %f62
  307. ldda [%i4] %asi, %f16
  308. fxor %f48, %f32, %f48
  309. fxor %f50, %f34, %f50
  310. fxor %f52, %f36, %f52
  311. fxor %f54, %f38, %f54
  312. fxor %f56, %f40, %f56
  313. fxor %f58, %f42, %f58
  314. fxor %f60, %f44, %f60
  315. fxor %f62, %f46, %f62
  316. ldda [%i5] %asi, %f32
  317. fxor %f48, %f16, %f48
  318. fxor %f50, %f18, %f50
  319. fxor %f52, %f20, %f52
  320. fxor %f54, %f22, %f54
  321. fxor %f56, %f24, %f56
  322. fxor %f58, %f26, %f58
  323. fxor %f60, %f28, %f60
  324. fxor %f62, %f30, %f62
  325. membar #Sync
  326. fxor %f48, %f32, %f48
  327. fxor %f50, %f34, %f50
  328. fxor %f52, %f36, %f52
  329. fxor %f54, %f38, %f54
  330. fxor %f56, %f40, %f56
  331. fxor %f58, %f42, %f58
  332. fxor %f60, %f44, %f60
  333. fxor %f62, %f46, %f62
  334. stda %f48, [%i1] %asi
  335. membar #Sync|#StoreStore|#StoreLoad
  336. wr %g1, %g0, %asi
  337. wr %g0, 0, %fprs
  338. ret
  339. restore
  340. ENDPROC(xor_vis_5)
  341. EXPORT_SYMBOL(xor_vis_5)
  342. /* Niagara versions. */
  343. ENTRY(xor_niagara_2) /* %o0=bytes, %o1=dest, %o2=src */
  344. save %sp, -192, %sp
  345. prefetch [%i1], #n_writes
  346. prefetch [%i2], #one_read
  347. rd %asi, %g7
  348. wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
  349. srlx %i0, 6, %g1
  350. mov %i1, %i0
  351. mov %i2, %i1
  352. 1: ldda [%i1 + 0x00] %asi, %i2 /* %i2/%i3 = src + 0x00 */
  353. ldda [%i1 + 0x10] %asi, %i4 /* %i4/%i5 = src + 0x10 */
  354. ldda [%i1 + 0x20] %asi, %g2 /* %g2/%g3 = src + 0x20 */
  355. ldda [%i1 + 0x30] %asi, %l0 /* %l0/%l1 = src + 0x30 */
  356. prefetch [%i1 + 0x40], #one_read
  357. ldda [%i0 + 0x00] %asi, %o0 /* %o0/%o1 = dest + 0x00 */
  358. ldda [%i0 + 0x10] %asi, %o2 /* %o2/%o3 = dest + 0x10 */
  359. ldda [%i0 + 0x20] %asi, %o4 /* %o4/%o5 = dest + 0x20 */
  360. ldda [%i0 + 0x30] %asi, %l2 /* %l2/%l3 = dest + 0x30 */
  361. prefetch [%i0 + 0x40], #n_writes
  362. xor %o0, %i2, %o0
  363. xor %o1, %i3, %o1
  364. stxa %o0, [%i0 + 0x00] %asi
  365. stxa %o1, [%i0 + 0x08] %asi
  366. xor %o2, %i4, %o2
  367. xor %o3, %i5, %o3
  368. stxa %o2, [%i0 + 0x10] %asi
  369. stxa %o3, [%i0 + 0x18] %asi
  370. xor %o4, %g2, %o4
  371. xor %o5, %g3, %o5
  372. stxa %o4, [%i0 + 0x20] %asi
  373. stxa %o5, [%i0 + 0x28] %asi
  374. xor %l2, %l0, %l2
  375. xor %l3, %l1, %l3
  376. stxa %l2, [%i0 + 0x30] %asi
  377. stxa %l3, [%i0 + 0x38] %asi
  378. add %i0, 0x40, %i0
  379. subcc %g1, 1, %g1
  380. bne,pt %xcc, 1b
  381. add %i1, 0x40, %i1
  382. membar #Sync
  383. wr %g7, 0x0, %asi
  384. ret
  385. restore
  386. ENDPROC(xor_niagara_2)
  387. EXPORT_SYMBOL(xor_niagara_2)
  388. ENTRY(xor_niagara_3) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
  389. save %sp, -192, %sp
  390. prefetch [%i1], #n_writes
  391. prefetch [%i2], #one_read
  392. prefetch [%i3], #one_read
  393. rd %asi, %g7
  394. wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
  395. srlx %i0, 6, %g1
  396. mov %i1, %i0
  397. mov %i2, %i1
  398. mov %i3, %l7
  399. 1: ldda [%i1 + 0x00] %asi, %i2 /* %i2/%i3 = src1 + 0x00 */
  400. ldda [%i1 + 0x10] %asi, %i4 /* %i4/%i5 = src1 + 0x10 */
  401. ldda [%l7 + 0x00] %asi, %g2 /* %g2/%g3 = src2 + 0x00 */
  402. ldda [%l7 + 0x10] %asi, %l0 /* %l0/%l1 = src2 + 0x10 */
  403. ldda [%i0 + 0x00] %asi, %o0 /* %o0/%o1 = dest + 0x00 */
  404. ldda [%i0 + 0x10] %asi, %o2 /* %o2/%o3 = dest + 0x10 */
  405. xor %g2, %i2, %g2
  406. xor %g3, %i3, %g3
  407. xor %o0, %g2, %o0
  408. xor %o1, %g3, %o1
  409. stxa %o0, [%i0 + 0x00] %asi
  410. stxa %o1, [%i0 + 0x08] %asi
  411. ldda [%i1 + 0x20] %asi, %i2 /* %i2/%i3 = src1 + 0x20 */
  412. ldda [%l7 + 0x20] %asi, %g2 /* %g2/%g3 = src2 + 0x20 */
  413. ldda [%i0 + 0x20] %asi, %o0 /* %o0/%o1 = dest + 0x20 */
  414. xor %l0, %i4, %l0
  415. xor %l1, %i5, %l1
  416. xor %o2, %l0, %o2
  417. xor %o3, %l1, %o3
  418. stxa %o2, [%i0 + 0x10] %asi
  419. stxa %o3, [%i0 + 0x18] %asi
  420. ldda [%i1 + 0x30] %asi, %i4 /* %i4/%i5 = src1 + 0x30 */
  421. ldda [%l7 + 0x30] %asi, %l0 /* %l0/%l1 = src2 + 0x30 */
  422. ldda [%i0 + 0x30] %asi, %o2 /* %o2/%o3 = dest + 0x30 */
  423. prefetch [%i1 + 0x40], #one_read
  424. prefetch [%l7 + 0x40], #one_read
  425. prefetch [%i0 + 0x40], #n_writes
  426. xor %g2, %i2, %g2
  427. xor %g3, %i3, %g3
  428. xor %o0, %g2, %o0
  429. xor %o1, %g3, %o1
  430. stxa %o0, [%i0 + 0x20] %asi
  431. stxa %o1, [%i0 + 0x28] %asi
  432. xor %l0, %i4, %l0
  433. xor %l1, %i5, %l1
  434. xor %o2, %l0, %o2
  435. xor %o3, %l1, %o3
  436. stxa %o2, [%i0 + 0x30] %asi
  437. stxa %o3, [%i0 + 0x38] %asi
  438. add %i0, 0x40, %i0
  439. add %i1, 0x40, %i1
  440. subcc %g1, 1, %g1
  441. bne,pt %xcc, 1b
  442. add %l7, 0x40, %l7
  443. membar #Sync
  444. wr %g7, 0x0, %asi
  445. ret
  446. restore
  447. ENDPROC(xor_niagara_3)
  448. EXPORT_SYMBOL(xor_niagara_3)
  449. ENTRY(xor_niagara_4) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
  450. save %sp, -192, %sp
  451. prefetch [%i1], #n_writes
  452. prefetch [%i2], #one_read
  453. prefetch [%i3], #one_read
  454. prefetch [%i4], #one_read
  455. rd %asi, %g7
  456. wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
  457. srlx %i0, 6, %g1
  458. mov %i1, %i0
  459. mov %i2, %i1
  460. mov %i3, %l7
  461. mov %i4, %l6
  462. 1: ldda [%i1 + 0x00] %asi, %i2 /* %i2/%i3 = src1 + 0x00 */
  463. ldda [%l7 + 0x00] %asi, %i4 /* %i4/%i5 = src2 + 0x00 */
  464. ldda [%l6 + 0x00] %asi, %g2 /* %g2/%g3 = src3 + 0x00 */
  465. ldda [%i0 + 0x00] %asi, %l0 /* %l0/%l1 = dest + 0x00 */
  466. xor %i4, %i2, %i4
  467. xor %i5, %i3, %i5
  468. ldda [%i1 + 0x10] %asi, %i2 /* %i2/%i3 = src1 + 0x10 */
  469. xor %g2, %i4, %g2
  470. xor %g3, %i5, %g3
  471. ldda [%l7 + 0x10] %asi, %i4 /* %i4/%i5 = src2 + 0x10 */
  472. xor %l0, %g2, %l0
  473. xor %l1, %g3, %l1
  474. stxa %l0, [%i0 + 0x00] %asi
  475. stxa %l1, [%i0 + 0x08] %asi
  476. ldda [%l6 + 0x10] %asi, %g2 /* %g2/%g3 = src3 + 0x10 */
  477. ldda [%i0 + 0x10] %asi, %l0 /* %l0/%l1 = dest + 0x10 */
  478. xor %i4, %i2, %i4
  479. xor %i5, %i3, %i5
  480. ldda [%i1 + 0x20] %asi, %i2 /* %i2/%i3 = src1 + 0x20 */
  481. xor %g2, %i4, %g2
  482. xor %g3, %i5, %g3
  483. ldda [%l7 + 0x20] %asi, %i4 /* %i4/%i5 = src2 + 0x20 */
  484. xor %l0, %g2, %l0
  485. xor %l1, %g3, %l1
  486. stxa %l0, [%i0 + 0x10] %asi
  487. stxa %l1, [%i0 + 0x18] %asi
  488. ldda [%l6 + 0x20] %asi, %g2 /* %g2/%g3 = src3 + 0x20 */
  489. ldda [%i0 + 0x20] %asi, %l0 /* %l0/%l1 = dest + 0x20 */
  490. xor %i4, %i2, %i4
  491. xor %i5, %i3, %i5
  492. ldda [%i1 + 0x30] %asi, %i2 /* %i2/%i3 = src1 + 0x30 */
  493. xor %g2, %i4, %g2
  494. xor %g3, %i5, %g3
  495. ldda [%l7 + 0x30] %asi, %i4 /* %i4/%i5 = src2 + 0x30 */
  496. xor %l0, %g2, %l0
  497. xor %l1, %g3, %l1
  498. stxa %l0, [%i0 + 0x20] %asi
  499. stxa %l1, [%i0 + 0x28] %asi
  500. ldda [%l6 + 0x30] %asi, %g2 /* %g2/%g3 = src3 + 0x30 */
  501. ldda [%i0 + 0x30] %asi, %l0 /* %l0/%l1 = dest + 0x30 */
  502. prefetch [%i1 + 0x40], #one_read
  503. prefetch [%l7 + 0x40], #one_read
  504. prefetch [%l6 + 0x40], #one_read
  505. prefetch [%i0 + 0x40], #n_writes
  506. xor %i4, %i2, %i4
  507. xor %i5, %i3, %i5
  508. xor %g2, %i4, %g2
  509. xor %g3, %i5, %g3
  510. xor %l0, %g2, %l0
  511. xor %l1, %g3, %l1
  512. stxa %l0, [%i0 + 0x30] %asi
  513. stxa %l1, [%i0 + 0x38] %asi
  514. add %i0, 0x40, %i0
  515. add %i1, 0x40, %i1
  516. add %l7, 0x40, %l7
  517. subcc %g1, 1, %g1
  518. bne,pt %xcc, 1b
  519. add %l6, 0x40, %l6
  520. membar #Sync
  521. wr %g7, 0x0, %asi
  522. ret
  523. restore
  524. ENDPROC(xor_niagara_4)
  525. EXPORT_SYMBOL(xor_niagara_4)
  526. ENTRY(xor_niagara_5) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 */
  527. save %sp, -192, %sp
  528. prefetch [%i1], #n_writes
  529. prefetch [%i2], #one_read
  530. prefetch [%i3], #one_read
  531. prefetch [%i4], #one_read
  532. prefetch [%i5], #one_read
  533. rd %asi, %g7
  534. wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
  535. srlx %i0, 6, %g1
  536. mov %i1, %i0
  537. mov %i2, %i1
  538. mov %i3, %l7
  539. mov %i4, %l6
  540. mov %i5, %l5
  541. 1: ldda [%i1 + 0x00] %asi, %i2 /* %i2/%i3 = src1 + 0x00 */
  542. ldda [%l7 + 0x00] %asi, %i4 /* %i4/%i5 = src2 + 0x00 */
  543. ldda [%l6 + 0x00] %asi, %g2 /* %g2/%g3 = src3 + 0x00 */
  544. ldda [%l5 + 0x00] %asi, %l0 /* %l0/%l1 = src4 + 0x00 */
  545. ldda [%i0 + 0x00] %asi, %l2 /* %l2/%l3 = dest + 0x00 */
  546. xor %i4, %i2, %i4
  547. xor %i5, %i3, %i5
  548. ldda [%i1 + 0x10] %asi, %i2 /* %i2/%i3 = src1 + 0x10 */
  549. xor %g2, %i4, %g2
  550. xor %g3, %i5, %g3
  551. ldda [%l7 + 0x10] %asi, %i4 /* %i4/%i5 = src2 + 0x10 */
  552. xor %l0, %g2, %l0
  553. xor %l1, %g3, %l1
  554. ldda [%l6 + 0x10] %asi, %g2 /* %g2/%g3 = src3 + 0x10 */
  555. xor %l2, %l0, %l2
  556. xor %l3, %l1, %l3
  557. stxa %l2, [%i0 + 0x00] %asi
  558. stxa %l3, [%i0 + 0x08] %asi
  559. ldda [%l5 + 0x10] %asi, %l0 /* %l0/%l1 = src4 + 0x10 */
  560. ldda [%i0 + 0x10] %asi, %l2 /* %l2/%l3 = dest + 0x10 */
  561. xor %i4, %i2, %i4
  562. xor %i5, %i3, %i5
  563. ldda [%i1 + 0x20] %asi, %i2 /* %i2/%i3 = src1 + 0x20 */
  564. xor %g2, %i4, %g2
  565. xor %g3, %i5, %g3
  566. ldda [%l7 + 0x20] %asi, %i4 /* %i4/%i5 = src2 + 0x20 */
  567. xor %l0, %g2, %l0
  568. xor %l1, %g3, %l1
  569. ldda [%l6 + 0x20] %asi, %g2 /* %g2/%g3 = src3 + 0x20 */
  570. xor %l2, %l0, %l2
  571. xor %l3, %l1, %l3
  572. stxa %l2, [%i0 + 0x10] %asi
  573. stxa %l3, [%i0 + 0x18] %asi
  574. ldda [%l5 + 0x20] %asi, %l0 /* %l0/%l1 = src4 + 0x20 */
  575. ldda [%i0 + 0x20] %asi, %l2 /* %l2/%l3 = dest + 0x20 */
  576. xor %i4, %i2, %i4
  577. xor %i5, %i3, %i5
  578. ldda [%i1 + 0x30] %asi, %i2 /* %i2/%i3 = src1 + 0x30 */
  579. xor %g2, %i4, %g2
  580. xor %g3, %i5, %g3
  581. ldda [%l7 + 0x30] %asi, %i4 /* %i4/%i5 = src2 + 0x30 */
  582. xor %l0, %g2, %l0
  583. xor %l1, %g3, %l1
  584. ldda [%l6 + 0x30] %asi, %g2 /* %g2/%g3 = src3 + 0x30 */
  585. xor %l2, %l0, %l2
  586. xor %l3, %l1, %l3
  587. stxa %l2, [%i0 + 0x20] %asi
  588. stxa %l3, [%i0 + 0x28] %asi
  589. ldda [%l5 + 0x30] %asi, %l0 /* %l0/%l1 = src4 + 0x30 */
  590. ldda [%i0 + 0x30] %asi, %l2 /* %l2/%l3 = dest + 0x30 */
  591. prefetch [%i1 + 0x40], #one_read
  592. prefetch [%l7 + 0x40], #one_read
  593. prefetch [%l6 + 0x40], #one_read
  594. prefetch [%l5 + 0x40], #one_read
  595. prefetch [%i0 + 0x40], #n_writes
  596. xor %i4, %i2, %i4
  597. xor %i5, %i3, %i5
  598. xor %g2, %i4, %g2
  599. xor %g3, %i5, %g3
  600. xor %l0, %g2, %l0
  601. xor %l1, %g3, %l1
  602. xor %l2, %l0, %l2
  603. xor %l3, %l1, %l3
  604. stxa %l2, [%i0 + 0x30] %asi
  605. stxa %l3, [%i0 + 0x38] %asi
  606. add %i0, 0x40, %i0
  607. add %i1, 0x40, %i1
  608. add %l7, 0x40, %l7
  609. add %l6, 0x40, %l6
  610. subcc %g1, 1, %g1
  611. bne,pt %xcc, 1b
  612. add %l5, 0x40, %l5
  613. membar #Sync
  614. wr %g7, 0x0, %asi
  615. ret
  616. restore
  617. ENDPROC(xor_niagara_5)
  618. EXPORT_SYMBOL(xor_niagara_5)